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


Generated: Thu Sep 24 01:02:16 2020 Cross-referenced by PHPXref 0.7.1