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


Generated: Sun Feb 28 01:00:03 2021 Cross-referenced by PHPXref 0.7.1