[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> server-side-render.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["serverSideRender"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 452);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 1:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = this["wp"]["i18n"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 12:
 105  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 106  
 107  "use strict";
 108  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
 109  function _extends() {
 110    _extends = Object.assign || function (target) {
 111      for (var i = 1; i < arguments.length; i++) {
 112        var source = arguments[i];
 113  
 114        for (var key in source) {
 115          if (Object.prototype.hasOwnProperty.call(source, key)) {
 116            target[key] = source[key];
 117          }
 118        }
 119      }
 120  
 121      return target;
 122    };
 123  
 124    return _extends.apply(this, arguments);
 125  }
 126  
 127  /***/ }),
 128  
 129  /***/ 13:
 130  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 131  
 132  "use strict";
 133  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
 134  function _defineProperties(target, props) {
 135    for (var i = 0; i < props.length; i++) {
 136      var descriptor = props[i];
 137      descriptor.enumerable = descriptor.enumerable || false;
 138      descriptor.configurable = true;
 139      if ("value" in descriptor) descriptor.writable = true;
 140      Object.defineProperty(target, descriptor.key, descriptor);
 141    }
 142  }
 143  
 144  function _createClass(Constructor, protoProps, staticProps) {
 145    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 146    if (staticProps) _defineProperties(Constructor, staticProps);
 147    return Constructor;
 148  }
 149  
 150  /***/ }),
 151  
 152  /***/ 14:
 153  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 154  
 155  "use strict";
 156  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 157  function _classCallCheck(instance, Constructor) {
 158    if (!(instance instanceof Constructor)) {
 159      throw new TypeError("Cannot call a class as a function");
 160    }
 161  }
 162  
 163  /***/ }),
 164  
 165  /***/ 15:
 166  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 167  
 168  "use strict";
 169  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
 170  /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
 171  /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
 172  
 173  
 174  function _possibleConstructorReturn(self, call) {
 175    if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
 176      return call;
 177    }
 178  
 179    return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
 180  }
 181  
 182  /***/ }),
 183  
 184  /***/ 16:
 185  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 186  
 187  "use strict";
 188  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
 189  function _getPrototypeOf(o) {
 190    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
 191      return o.__proto__ || Object.getPrototypeOf(o);
 192    };
 193    return _getPrototypeOf(o);
 194  }
 195  
 196  /***/ }),
 197  
 198  /***/ 17:
 199  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 200  
 201  "use strict";
 202  
 203  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
 204  function _setPrototypeOf(o, p) {
 205    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
 206      o.__proto__ = p;
 207      return o;
 208    };
 209  
 210    return _setPrototypeOf(o, p);
 211  }
 212  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
 213  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
 214  
 215  function _inherits(subClass, superClass) {
 216    if (typeof superClass !== "function" && superClass !== null) {
 217      throw new TypeError("Super expression must either be null or a function");
 218    }
 219  
 220    subClass.prototype = Object.create(superClass && superClass.prototype, {
 221      constructor: {
 222        value: subClass,
 223        writable: true,
 224        configurable: true
 225      }
 226    });
 227    if (superClass) _setPrototypeOf(subClass, superClass);
 228  }
 229  
 230  /***/ }),
 231  
 232  /***/ 19:
 233  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 234  
 235  "use strict";
 236  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
 237  /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43);
 238  
 239  function _objectWithoutProperties(source, excluded) {
 240    if (source == null) return {};
 241    var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded);
 242    var key, i;
 243  
 244    if (Object.getOwnPropertySymbols) {
 245      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
 246  
 247      for (i = 0; i < sourceSymbolKeys.length; i++) {
 248        key = sourceSymbolKeys[i];
 249        if (excluded.indexOf(key) >= 0) continue;
 250        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
 251        target[key] = source[key];
 252      }
 253    }
 254  
 255    return target;
 256  }
 257  
 258  /***/ }),
 259  
 260  /***/ 2:
 261  /***/ (function(module, exports) {
 262  
 263  (function() { module.exports = this["lodash"]; }());
 264  
 265  /***/ }),
 266  
 267  /***/ 3:
 268  /***/ (function(module, exports) {
 269  
 270  (function() { module.exports = this["wp"]["components"]; }());
 271  
 272  /***/ }),
 273  
 274  /***/ 30:
 275  /***/ (function(module, exports) {
 276  
 277  (function() { module.exports = this["wp"]["url"]; }());
 278  
 279  /***/ }),
 280  
 281  /***/ 34:
 282  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 283  
 284  "use strict";
 285  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
 286  function _typeof(obj) {
 287    "@babel/helpers - typeof";
 288  
 289    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 290      _typeof = function _typeof(obj) {
 291        return typeof obj;
 292      };
 293    } else {
 294      _typeof = function _typeof(obj) {
 295        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
 296      };
 297    }
 298  
 299    return _typeof(obj);
 300  }
 301  
 302  /***/ }),
 303  
 304  /***/ 37:
 305  /***/ (function(module, exports) {
 306  
 307  (function() { module.exports = this["wp"]["deprecated"]; }());
 308  
 309  /***/ }),
 310  
 311  /***/ 4:
 312  /***/ (function(module, exports) {
 313  
 314  (function() { module.exports = this["wp"]["data"]; }());
 315  
 316  /***/ }),
 317  
 318  /***/ 42:
 319  /***/ (function(module, exports) {
 320  
 321  (function() { module.exports = this["wp"]["apiFetch"]; }());
 322  
 323  /***/ }),
 324  
 325  /***/ 43:
 326  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 327  
 328  "use strict";
 329  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
 330  function _objectWithoutPropertiesLoose(source, excluded) {
 331    if (source == null) return {};
 332    var target = {};
 333    var sourceKeys = Object.keys(source);
 334    var key, i;
 335  
 336    for (i = 0; i < sourceKeys.length; i++) {
 337      key = sourceKeys[i];
 338      if (excluded.indexOf(key) >= 0) continue;
 339      target[key] = source[key];
 340    }
 341  
 342    return target;
 343  }
 344  
 345  /***/ }),
 346  
 347  /***/ 452:
 348  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 349  
 350  "use strict";
 351  __webpack_require__.r(__webpack_exports__);
 352  
 353  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
 354  var esm_extends = __webpack_require__(12);
 355  
 356  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 357  var defineProperty = __webpack_require__(5);
 358  
 359  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
 360  var objectWithoutProperties = __webpack_require__(19);
 361  
 362  // EXTERNAL MODULE: external {"this":["wp","element"]}
 363  var external_this_wp_element_ = __webpack_require__(0);
 364  
 365  // EXTERNAL MODULE: external {"this":["wp","data"]}
 366  var external_this_wp_data_ = __webpack_require__(4);
 367  
 368  // EXTERNAL MODULE: external {"this":["wp","deprecated"]}
 369  var external_this_wp_deprecated_ = __webpack_require__(37);
 370  var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_);
 371  
 372  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
 373  var classCallCheck = __webpack_require__(14);
 374  
 375  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
 376  var createClass = __webpack_require__(13);
 377  
 378  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
 379  var possibleConstructorReturn = __webpack_require__(15);
 380  
 381  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
 382  var getPrototypeOf = __webpack_require__(16);
 383  
 384  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
 385  var inherits = __webpack_require__(17);
 386  
 387  // EXTERNAL MODULE: external {"this":"lodash"}
 388  var external_this_lodash_ = __webpack_require__(2);
 389  
 390  // EXTERNAL MODULE: external {"this":["wp","i18n"]}
 391  var external_this_wp_i18n_ = __webpack_require__(1);
 392  
 393  // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
 394  var external_this_wp_apiFetch_ = __webpack_require__(42);
 395  var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
 396  
 397  // EXTERNAL MODULE: external {"this":["wp","url"]}
 398  var external_this_wp_url_ = __webpack_require__(30);
 399  
 400  // EXTERNAL MODULE: external {"this":["wp","components"]}
 401  var external_this_wp_components_ = __webpack_require__(3);
 402  
 403  // CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/server-side-render.js
 404  
 405  
 406  
 407  
 408  
 409  
 410  
 411  
 412  
 413  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 414  
 415  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 416  
 417  /**
 418   * External dependencies
 419   */
 420  
 421  /**
 422   * WordPress dependencies
 423   */
 424  
 425  
 426  
 427  
 428  
 429  
 430  function rendererPath(block) {
 431    var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
 432    var urlQueryArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
 433    return Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/block-renderer/".concat(block), _objectSpread({
 434      context: 'edit'
 435    }, null !== attributes ? {
 436      attributes: attributes
 437    } : {}, {}, urlQueryArgs));
 438  }
 439  var server_side_render_ServerSideRender =
 440  /*#__PURE__*/
 441  function (_Component) {
 442    Object(inherits["a" /* default */])(ServerSideRender, _Component);
 443  
 444    function ServerSideRender(props) {
 445      var _this;
 446  
 447      Object(classCallCheck["a" /* default */])(this, ServerSideRender);
 448  
 449      _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ServerSideRender).call(this, props));
 450      _this.state = {
 451        response: null
 452      };
 453      return _this;
 454    }
 455  
 456    Object(createClass["a" /* default */])(ServerSideRender, [{
 457      key: "componentDidMount",
 458      value: function componentDidMount() {
 459        this.isStillMounted = true;
 460        this.fetch(this.props); // Only debounce once the initial fetch occurs to ensure that the first
 461        // renders show data as soon as possible.
 462  
 463        this.fetch = Object(external_this_lodash_["debounce"])(this.fetch, 500);
 464      }
 465    }, {
 466      key: "componentWillUnmount",
 467      value: function componentWillUnmount() {
 468        this.isStillMounted = false;
 469      }
 470    }, {
 471      key: "componentDidUpdate",
 472      value: function componentDidUpdate(prevProps) {
 473        if (!Object(external_this_lodash_["isEqual"])(prevProps, this.props)) {
 474          this.fetch(this.props);
 475        }
 476      }
 477    }, {
 478      key: "fetch",
 479      value: function fetch(props) {
 480        var _this2 = this;
 481  
 482        if (!this.isStillMounted) {
 483          return;
 484        }
 485  
 486        if (null !== this.state.response) {
 487          this.setState({
 488            response: null
 489          });
 490        }
 491  
 492        var block = props.block,
 493            _props$attributes = props.attributes,
 494            attributes = _props$attributes === void 0 ? null : _props$attributes,
 495            _props$urlQueryArgs = props.urlQueryArgs,
 496            urlQueryArgs = _props$urlQueryArgs === void 0 ? {} : _props$urlQueryArgs;
 497        var path = rendererPath(block, attributes, urlQueryArgs); // Store the latest fetch request so that when we process it, we can
 498        // check if it is the current request, to avoid race conditions on slow networks.
 499  
 500        var fetchRequest = this.currentFetchRequest = external_this_wp_apiFetch_default()({
 501          path: path
 502        }).then(function (response) {
 503          if (_this2.isStillMounted && fetchRequest === _this2.currentFetchRequest && response) {
 504            _this2.setState({
 505              response: response.rendered
 506            });
 507          }
 508        }).catch(function (error) {
 509          if (_this2.isStillMounted && fetchRequest === _this2.currentFetchRequest) {
 510            _this2.setState({
 511              response: {
 512                error: true,
 513                errorMsg: error.message
 514              }
 515            });
 516          }
 517        });
 518        return fetchRequest;
 519      }
 520    }, {
 521      key: "render",
 522      value: function render() {
 523        var response = this.state.response;
 524        var _this$props = this.props,
 525            className = _this$props.className,
 526            EmptyResponsePlaceholder = _this$props.EmptyResponsePlaceholder,
 527            ErrorResponsePlaceholder = _this$props.ErrorResponsePlaceholder,
 528            LoadingResponsePlaceholder = _this$props.LoadingResponsePlaceholder;
 529  
 530        if (response === '') {
 531          return Object(external_this_wp_element_["createElement"])(EmptyResponsePlaceholder, Object(esm_extends["a" /* default */])({
 532            response: response
 533          }, this.props));
 534        } else if (!response) {
 535          return Object(external_this_wp_element_["createElement"])(LoadingResponsePlaceholder, Object(esm_extends["a" /* default */])({
 536            response: response
 537          }, this.props));
 538        } else if (response.error) {
 539          return Object(external_this_wp_element_["createElement"])(ErrorResponsePlaceholder, Object(esm_extends["a" /* default */])({
 540            response: response
 541          }, this.props));
 542        }
 543  
 544        return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], {
 545          key: "html",
 546          className: className
 547        }, response);
 548      }
 549    }]);
 550  
 551    return ServerSideRender;
 552  }(external_this_wp_element_["Component"]);
 553  server_side_render_ServerSideRender.defaultProps = {
 554    EmptyResponsePlaceholder: function EmptyResponsePlaceholder(_ref) {
 555      var className = _ref.className;
 556      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], {
 557        className: className
 558      }, Object(external_this_wp_i18n_["__"])('Block rendered as empty.'));
 559    },
 560    ErrorResponsePlaceholder: function ErrorResponsePlaceholder(_ref2) {
 561      var response = _ref2.response,
 562          className = _ref2.className;
 563      // translators: %s: error message describing the problem
 564      var errorMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Error loading block: %s'), response.errorMsg);
 565      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], {
 566        className: className
 567      }, errorMessage);
 568    },
 569    LoadingResponsePlaceholder: function LoadingResponsePlaceholder(_ref3) {
 570      var className = _ref3.className;
 571      return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], {
 572        className: className
 573      }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null));
 574    }
 575  };
 576  /* harmony default export */ var server_side_render = (server_side_render_ServerSideRender);
 577  
 578  // CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/index.js
 579  
 580  
 581  
 582  
 583  
 584  function build_module_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 585  
 586  function build_module_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { build_module_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { build_module_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 587  
 588  /**
 589   * WordPress dependencies
 590   */
 591  
 592  
 593  
 594  /**
 595   * Internal dependencies
 596   */
 597  
 598  
 599  /**
 600   * Constants
 601   */
 602  
 603  var EMPTY_OBJECT = {};
 604  var ExportedServerSideRender = Object(external_this_wp_data_["withSelect"])(function (select) {
 605    var coreEditorSelect = select('core/editor');
 606  
 607    if (coreEditorSelect) {
 608      var currentPostId = coreEditorSelect.getCurrentPostId();
 609  
 610      if (currentPostId) {
 611        return {
 612          currentPostId: currentPostId
 613        };
 614      }
 615    }
 616  
 617    return EMPTY_OBJECT;
 618  })(function (_ref) {
 619    var _ref$urlQueryArgs = _ref.urlQueryArgs,
 620        urlQueryArgs = _ref$urlQueryArgs === void 0 ? EMPTY_OBJECT : _ref$urlQueryArgs,
 621        currentPostId = _ref.currentPostId,
 622        props = Object(objectWithoutProperties["a" /* default */])(_ref, ["urlQueryArgs", "currentPostId"]);
 623  
 624    var newUrlQueryArgs = Object(external_this_wp_element_["useMemo"])(function () {
 625      if (!currentPostId) {
 626        return urlQueryArgs;
 627      }
 628  
 629      return build_module_objectSpread({
 630        post_id: currentPostId
 631      }, urlQueryArgs);
 632    }, [currentPostId, urlQueryArgs]);
 633    return Object(external_this_wp_element_["createElement"])(server_side_render, Object(esm_extends["a" /* default */])({
 634      urlQueryArgs: newUrlQueryArgs
 635    }, props));
 636  });
 637  
 638  if (window && window.wp && window.wp.components) {
 639    window.wp.components.ServerSideRender = Object(external_this_wp_element_["forwardRef"])(function (props, ref) {
 640      external_this_wp_deprecated_default()('wp.components.ServerSideRender', {
 641        alternative: 'wp.serverSideRender'
 642      });
 643      return Object(external_this_wp_element_["createElement"])(ExportedServerSideRender, Object(esm_extends["a" /* default */])({}, props, {
 644        ref: ref
 645      }));
 646    });
 647  }
 648  
 649  /* harmony default export */ var build_module = __webpack_exports__["default"] = (ExportedServerSideRender);
 650  
 651  
 652  /***/ }),
 653  
 654  /***/ 5:
 655  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 656  
 657  "use strict";
 658  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 659  function _defineProperty(obj, key, value) {
 660    if (key in obj) {
 661      Object.defineProperty(obj, key, {
 662        value: value,
 663        enumerable: true,
 664        configurable: true,
 665        writable: true
 666      });
 667    } else {
 668      obj[key] = value;
 669    }
 670  
 671    return obj;
 672  }
 673  
 674  /***/ }),
 675  
 676  /***/ 7:
 677  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 678  
 679  "use strict";
 680  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
 681  function _assertThisInitialized(self) {
 682    if (self === void 0) {
 683      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
 684    }
 685  
 686    return self;
 687  }
 688  
 689  /***/ })
 690  
 691  /******/ })["default"];


Generated: Tue Apr 7 01:00:07 2020 Cross-referenced by PHPXref 0.7.1