2019-09-19 11:19:18 -04:00
this [ "wp" ] = this [ "wp" ] || { } ; this [ "wp" ] [ "serverSideRender" ] =
/******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/
/******/ // Load entry module and return exports
2020-10-20 09:36:16 -04:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 487 ) ;
2019-09-19 11:19:18 -04:00
/******/ } )
/************************************************************************/
/******/ ( {
/***/ 0 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "element" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 1 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "i18n" ] ; } ( ) ) ;
/***/ } ) ,
2020-10-13 09:10:30 -04:00
/***/ 14 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _objectWithoutProperties ; } ) ;
2020-10-20 09:36:16 -04:00
/* harmony import */ var _objectWithoutPropertiesLoose _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 43 ) ;
2020-06-26 09:33:47 -04:00
function _objectWithoutProperties ( source , excluded ) {
if ( source == null ) return { } ;
var target = Object ( _objectWithoutPropertiesLoose _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( source , excluded ) ;
var key , i ;
if ( Object . getOwnPropertySymbols ) {
var sourceSymbolKeys = Object . getOwnPropertySymbols ( source ) ;
for ( i = 0 ; i < sourceSymbolKeys . length ; i ++ ) {
key = sourceSymbolKeys [ i ] ;
if ( excluded . indexOf ( key ) >= 0 ) continue ;
if ( ! Object . prototype . propertyIsEnumerable . call ( source , key ) ) continue ;
target [ key ] = source [ key ] ;
}
}
return target ;
2020-01-22 17:06:21 -05:00
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 16 :
2020-10-13 09:10:30 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _assertThisInitialized ; } ) ;
function _assertThisInitialized ( self ) {
if ( self === void 0 ) {
throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ;
}
return self ;
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 19 :
2020-07-07 10:43:35 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _getPrototypeOf ; } ) ;
function _getPrototypeOf ( o ) {
_getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) {
return o . _ _proto _ _ || Object . getPrototypeOf ( o ) ;
} ;
return _getPrototypeOf ( o ) ;
}
/***/ } ) ,
2020-10-13 09:10:30 -04:00
/***/ 2 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "lodash" ] ; } ( ) ) ;
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 21 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _classCallCheck ; } ) ;
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) {
throw new TypeError ( "Cannot call a class as a function" ) ;
}
}
/***/ } ) ,
/***/ 22 :
2020-01-22 17:06:21 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2019-09-19 11:19:18 -04:00
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _createClass ; } ) ;
function _defineProperties ( target , props ) {
for ( var i = 0 ; i < props . length ; i ++ ) {
var descriptor = props [ i ] ;
descriptor . enumerable = descriptor . enumerable || false ;
descriptor . configurable = true ;
if ( "value" in descriptor ) descriptor . writable = true ;
Object . defineProperty ( target , descriptor . key , descriptor ) ;
}
}
function _createClass ( Constructor , protoProps , staticProps ) {
if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ;
if ( staticProps ) _defineProperties ( Constructor , staticProps ) ;
return Constructor ;
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 23 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 07:50:29 -04:00
// EXPORTS
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return /* binding */ _inherits ; } ) ;
2019-09-19 11:19:18 -04:00
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
function _setPrototypeOf ( o , p ) {
_setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) {
o . _ _proto _ _ = p ;
return o ;
} ;
return _setPrototypeOf ( o , p ) ;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
function _inherits ( subClass , superClass ) {
if ( typeof superClass !== "function" && superClass !== null ) {
throw new TypeError ( "Super expression must either be null or a function" ) ;
}
subClass . prototype = Object . create ( superClass && superClass . prototype , {
constructor : {
value : subClass ,
writable : true ,
configurable : true
}
} ) ;
if ( superClass ) _setPrototypeOf ( subClass , superClass ) ;
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 24 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-26 09:33:47 -04:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _possibleConstructorReturn ; } ) ;
/* harmony import */ var _helpers _esm _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 40 ) ;
2020-10-20 09:36:16 -04:00
/* harmony import */ var _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( 16 ) ;
2019-09-19 11:19:18 -04:00
2020-06-26 09:33:47 -04:00
function _possibleConstructorReturn ( self , call ) {
if ( call && ( Object ( _helpers _esm _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ /* default */ "a" ] ) ( call ) === "object" || typeof call === "function" ) ) {
return call ;
2019-09-19 11:19:18 -04:00
}
2020-06-26 09:33:47 -04:00
return Object ( _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ /* default */ "a" ] ) ( self ) ;
2019-09-19 11:19:18 -04:00
}
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 3 :
2020-02-06 16:03:31 -05:00
/***/ ( function ( module , exports ) {
2020-06-26 09:33:47 -04:00
( function ( ) { module . exports = this [ "wp" ] [ "components" ] ; } ( ) ) ;
2020-02-06 16:03:31 -05:00
/***/ } ) ,
2020-07-27 16:10:36 -04:00
/***/ 31 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , exports ) {
2020-06-26 09:33:47 -04:00
( function ( ) { module . exports = this [ "wp" ] [ "url" ] ; } ( ) ) ;
2019-09-19 11:19:18 -04:00
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 36 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , exports ) {
2020-06-26 09:33:47 -04:00
( function ( ) { module . exports = this [ "wp" ] [ "deprecated" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 4 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "data" ] ; } ( ) ) ;
2019-09-19 11:19:18 -04:00
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 40 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _typeof ; } ) ;
function _typeof ( obj ) {
2020-02-06 16:03:31 -05:00
"@babel/helpers - typeof" ;
2020-01-08 06:57:23 -05:00
if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) {
2019-09-19 11:19:18 -04:00
_typeof = function _typeof ( obj ) {
2020-01-08 06:57:23 -05:00
return typeof obj ;
2019-09-19 11:19:18 -04:00
} ;
} else {
_typeof = function _typeof ( obj ) {
2020-01-08 06:57:23 -05:00
return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ;
2019-09-19 11:19:18 -04:00
} ;
}
return _typeof ( obj ) ;
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 43 :
2020-02-06 16:03:31 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _objectWithoutPropertiesLoose ; } ) ;
function _objectWithoutPropertiesLoose ( source , excluded ) {
if ( source == null ) return { } ;
var target = { } ;
var sourceKeys = Object . keys ( source ) ;
var key , i ;
for ( i = 0 ; i < sourceKeys . length ; i ++ ) {
key = sourceKeys [ i ] ;
if ( excluded . indexOf ( key ) >= 0 ) continue ;
target [ key ] = source [ key ] ;
}
return target ;
}
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 47 :
2020-06-26 09:33:47 -04:00
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = this [ "wp" ] [ "apiFetch" ] ; } ( ) ) ;
/***/ } ) ,
2020-10-20 09:36:16 -04:00
/***/ 487 :
2019-09-19 11:19:18 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-29 07:50:29 -04:00
// ESM COMPAT FLAG
2019-09-19 11:19:18 -04:00
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
2020-06-26 09:33:47 -04:00
var esm _extends = _ _webpack _require _ _ ( 8 ) ;
2019-09-19 11:19:18 -04:00
2020-02-06 16:03:31 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = _ _webpack _require _ _ ( 5 ) ;
2019-09-19 11:19:18 -04:00
2020-01-08 06:57:23 -05:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
2020-10-13 09:10:30 -04:00
var objectWithoutProperties = _ _webpack _require _ _ ( 14 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external _this _wp _element _ = _ _webpack _require _ _ ( 0 ) ;
// EXTERNAL MODULE: external {"this":["wp","data"]}
var external _this _wp _data _ = _ _webpack _require _ _ ( 4 ) ;
// EXTERNAL MODULE: external {"this":["wp","deprecated"]}
2020-10-20 09:36:16 -04:00
var external _this _wp _deprecated _ = _ _webpack _require _ _ ( 36 ) ;
2019-09-19 11:19:18 -04:00
var external _this _wp _deprecated _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _wp _deprecated _ ) ;
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
2020-10-13 09:10:30 -04:00
var classCallCheck = _ _webpack _require _ _ ( 21 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
2020-10-20 09:36:16 -04:00
var createClass = _ _webpack _require _ _ ( 22 ) ;
2020-10-13 09:10:30 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
2020-10-20 09:36:16 -04:00
var inherits = _ _webpack _require _ _ ( 23 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
2020-10-20 09:36:16 -04:00
var possibleConstructorReturn = _ _webpack _require _ _ ( 24 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
2020-10-20 09:36:16 -04:00
var getPrototypeOf = _ _webpack _require _ _ ( 19 ) ;
2019-09-19 11:19:18 -04:00
2020-01-03 08:17:24 -05:00
// EXTERNAL MODULE: external {"this":"lodash"}
var external _this _lodash _ = _ _webpack _require _ _ ( 2 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external _this _wp _i18n _ = _ _webpack _require _ _ ( 1 ) ;
// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
2020-10-20 09:36:16 -04:00
var external _this _wp _apiFetch _ = _ _webpack _require _ _ ( 47 ) ;
2019-09-19 11:19:18 -04:00
var external _this _wp _apiFetch _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _this _wp _apiFetch _ ) ;
// EXTERNAL MODULE: external {"this":["wp","url"]}
2020-07-27 16:10:36 -04:00
var external _this _wp _url _ = _ _webpack _require _ _ ( 31 ) ;
2019-09-19 11:19:18 -04:00
// EXTERNAL MODULE: external {"this":["wp","components"]}
var external _this _wp _components _ = _ _webpack _require _ _ ( 3 ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/server-side-render.js
2020-10-13 09:10:30 -04:00
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 ) ; } ; }
2020-06-26 09:33:47 -04:00
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 ; } }
2020-02-06 16:03:31 -05:00
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 ; }
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 ; }
2019-09-19 11:19:18 -04:00
/ * *
* External dependencies
* /
/ * *
* WordPress dependencies
* /
function rendererPath ( block ) {
var attributes = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ;
var urlQueryArgs = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
2020-10-13 09:10:30 -04:00
return Object ( external _this _wp _url _ [ "addQueryArgs" ] ) ( "/wp/v2/block-renderer/" . concat ( block ) , _objectSpread ( _objectSpread ( {
2019-09-19 11:19:18 -04:00
context : 'edit'
} , null !== attributes ? {
attributes : attributes
2020-10-13 09:10:30 -04:00
} : { } ) , urlQueryArgs ) ) ;
2019-09-19 11:19:18 -04:00
}
2020-06-26 09:33:47 -04:00
var server _side _render _ServerSideRender = /*#__PURE__*/ function ( _Component ) {
2019-09-19 11:19:18 -04:00
Object ( inherits [ "a" /* default */ ] ) ( ServerSideRender , _Component ) ;
2020-06-26 09:33:47 -04:00
var _super = _createSuper ( ServerSideRender ) ;
2019-09-19 11:19:18 -04:00
function ServerSideRender ( props ) {
var _this ;
Object ( classCallCheck [ "a" /* default */ ] ) ( this , ServerSideRender ) ;
2020-06-26 09:33:47 -04:00
_this = _super . call ( this , props ) ;
2019-09-19 11:19:18 -04:00
_this . state = {
response : null
} ;
return _this ;
}
Object ( createClass [ "a" /* default */ ] ) ( ServerSideRender , [ {
key : "componentDidMount" ,
value : function componentDidMount ( ) {
this . isStillMounted = true ;
this . fetch ( this . props ) ; // Only debounce once the initial fetch occurs to ensure that the first
// renders show data as soon as possible.
2020-01-03 08:17:24 -05:00
this . fetch = Object ( external _this _lodash _ [ "debounce" ] ) ( this . fetch , 500 ) ;
2019-09-19 11:19:18 -04:00
}
} , {
key : "componentWillUnmount" ,
value : function componentWillUnmount ( ) {
this . isStillMounted = false ;
}
} , {
key : "componentDidUpdate" ,
value : function componentDidUpdate ( prevProps ) {
2020-01-03 08:17:24 -05:00
if ( ! Object ( external _this _lodash _ [ "isEqual" ] ) ( prevProps , this . props ) ) {
2019-09-19 11:19:18 -04:00
this . fetch ( this . props ) ;
}
}
} , {
key : "fetch" ,
value : function fetch ( props ) {
var _this2 = this ;
if ( ! this . isStillMounted ) {
return ;
}
if ( null !== this . state . response ) {
this . setState ( {
response : null
} ) ;
}
var block = props . block ,
_props$attributes = props . attributes ,
attributes = _props$attributes === void 0 ? null : _props$attributes ,
2020-10-13 09:10:30 -04:00
_props$httpMethod = props . httpMethod ,
httpMethod = _props$httpMethod === void 0 ? 'GET' : _props$httpMethod ,
2019-09-19 11:19:18 -04:00
_props$urlQueryArgs = props . urlQueryArgs ,
2020-10-13 09:10:30 -04:00
urlQueryArgs = _props$urlQueryArgs === void 0 ? { } : _props$urlQueryArgs ; // If httpMethod is 'POST', send the attributes in the request body instead of the URL.
// This allows sending a larger attributes object than in a GET request, where the attributes are in the URL.
var isPostRequest = 'POST' === httpMethod ;
var urlAttributes = isPostRequest ? null : attributes ;
var path = rendererPath ( block , urlAttributes , urlQueryArgs ) ;
var data = isPostRequest ? {
attributes : attributes
} : null ; // Store the latest fetch request so that when we process it, we can
2019-09-19 11:19:18 -04:00
// check if it is the current request, to avoid race conditions on slow networks.
var fetchRequest = this . currentFetchRequest = external _this _wp _apiFetch _default ( ) ( {
2020-10-13 09:10:30 -04:00
path : path ,
data : data ,
method : isPostRequest ? 'POST' : 'GET'
2019-09-19 11:19:18 -04:00
} ) . then ( function ( response ) {
if ( _this2 . isStillMounted && fetchRequest === _this2 . currentFetchRequest && response ) {
_this2 . setState ( {
response : response . rendered
} ) ;
}
} ) . catch ( function ( error ) {
if ( _this2 . isStillMounted && fetchRequest === _this2 . currentFetchRequest ) {
_this2 . setState ( {
response : {
error : true ,
errorMsg : error . message
}
} ) ;
}
} ) ;
return fetchRequest ;
}
} , {
key : "render" ,
value : function render ( ) {
var response = this . state . response ;
var _this$props = this . props ,
className = _this$props . className ,
EmptyResponsePlaceholder = _this$props . EmptyResponsePlaceholder ,
ErrorResponsePlaceholder = _this$props . ErrorResponsePlaceholder ,
LoadingResponsePlaceholder = _this$props . LoadingResponsePlaceholder ;
if ( response === '' ) {
return Object ( external _this _wp _element _ [ "createElement" ] ) ( EmptyResponsePlaceholder , Object ( esm _extends [ "a" /* default */ ] ) ( {
response : response
} , this . props ) ) ;
} else if ( ! response ) {
return Object ( external _this _wp _element _ [ "createElement" ] ) ( LoadingResponsePlaceholder , Object ( esm _extends [ "a" /* default */ ] ) ( {
response : response
} , this . props ) ) ;
} else if ( response . error ) {
return Object ( external _this _wp _element _ [ "createElement" ] ) ( ErrorResponsePlaceholder , Object ( esm _extends [ "a" /* default */ ] ) ( {
response : response
} , this . props ) ) ;
}
return Object ( external _this _wp _element _ [ "createElement" ] ) ( external _this _wp _element _ [ "RawHTML" ] , {
key : "html" ,
className : className
} , response ) ;
}
} ] ) ;
return ServerSideRender ;
} ( external _this _wp _element _ [ "Component" ] ) ;
server _side _render _ServerSideRender . defaultProps = {
EmptyResponsePlaceholder : function EmptyResponsePlaceholder ( _ref ) {
var className = _ref . className ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( external _this _wp _components _ [ "Placeholder" ] , {
className : className
2020-02-06 16:03:31 -05:00
} , Object ( external _this _wp _i18n _ [ "__" ] ) ( 'Block rendered as empty.' ) ) ;
2019-09-19 11:19:18 -04:00
} ,
ErrorResponsePlaceholder : function ErrorResponsePlaceholder ( _ref2 ) {
var response = _ref2 . response ,
className = _ref2 . className ;
2020-06-26 09:33:47 -04:00
var errorMessage = Object ( external _this _wp _i18n _ [ "sprintf" ] ) ( // translators: %s: error message describing the problem
Object ( external _this _wp _i18n _ [ "__" ] ) ( 'Error loading block: %s' ) , response . errorMsg ) ;
2019-09-19 11:19:18 -04:00
return Object ( external _this _wp _element _ [ "createElement" ] ) ( external _this _wp _components _ [ "Placeholder" ] , {
className : className
} , errorMessage ) ;
} ,
LoadingResponsePlaceholder : function LoadingResponsePlaceholder ( _ref3 ) {
var className = _ref3 . className ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( external _this _wp _components _ [ "Placeholder" ] , {
className : className
} , Object ( external _this _wp _element _ [ "createElement" ] ) ( external _this _wp _components _ [ "Spinner" ] , null ) ) ;
}
} ;
/* harmony default export */ var server _side _render = ( server _side _render _ServerSideRender ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/server-side-render/build-module/index.js
2020-02-06 16:03:31 -05:00
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 ; }
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 ; }
2019-09-19 11:19:18 -04:00
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
/ * *
* Constants
* /
var EMPTY _OBJECT = { } ;
var ExportedServerSideRender = Object ( external _this _wp _data _ [ "withSelect" ] ) ( function ( select ) {
var coreEditorSelect = select ( 'core/editor' ) ;
if ( coreEditorSelect ) {
var currentPostId = coreEditorSelect . getCurrentPostId ( ) ;
if ( currentPostId ) {
return {
currentPostId : currentPostId
} ;
}
}
return EMPTY _OBJECT ;
} ) ( function ( _ref ) {
var _ref$urlQueryArgs = _ref . urlQueryArgs ,
urlQueryArgs = _ref$urlQueryArgs === void 0 ? EMPTY _OBJECT : _ref$urlQueryArgs ,
currentPostId = _ref . currentPostId ,
props = Object ( objectWithoutProperties [ "a" /* default */ ] ) ( _ref , [ "urlQueryArgs" , "currentPostId" ] ) ;
var newUrlQueryArgs = Object ( external _this _wp _element _ [ "useMemo" ] ) ( function ( ) {
if ( ! currentPostId ) {
return urlQueryArgs ;
}
2020-02-06 16:03:31 -05:00
return build _module _objectSpread ( {
2019-09-19 11:19:18 -04:00
post _id : currentPostId
} , urlQueryArgs ) ;
} , [ currentPostId , urlQueryArgs ] ) ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( server _side _render , Object ( esm _extends [ "a" /* default */ ] ) ( {
urlQueryArgs : newUrlQueryArgs
} , props ) ) ;
} ) ;
if ( window && window . wp && window . wp . components ) {
window . wp . components . ServerSideRender = Object ( external _this _wp _element _ [ "forwardRef" ] ) ( function ( props , ref ) {
external _this _wp _deprecated _default ( ) ( 'wp.components.ServerSideRender' , {
alternative : 'wp.serverSideRender'
} ) ;
return Object ( external _this _wp _element _ [ "createElement" ] ) ( ExportedServerSideRender , Object ( esm _extends [ "a" /* default */ ] ) ( { } , props , {
ref : ref
} ) ) ;
} ) ;
}
/* harmony default export */ var build _module = _ _webpack _exports _ _ [ "default" ] = ( ExportedServerSideRender ) ;
2019-10-15 11:37:08 -04:00
/***/ } ) ,
2020-02-06 16:03:31 -05:00
/***/ 5 :
2020-01-08 06:57:23 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
2019-10-15 11:37:08 -04:00
2020-01-08 06:57:23 -05:00
"use strict" ;
2020-02-06 16:03:31 -05:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _defineProperty ; } ) ;
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
2019-09-19 11:19:18 -04:00
} ) ;
2020-02-06 16:03:31 -05:00
} else {
obj [ key ] = value ;
2019-09-19 11:19:18 -04:00
}
2020-02-06 16:03:31 -05:00
return obj ;
2019-09-19 11:19:18 -04:00
}
2020-01-08 06:57:23 -05:00
/***/ } ) ,
2020-06-26 09:33:47 -04:00
/***/ 8 :
2020-01-22 17:06:21 -05:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-26 09:33:47 -04:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _extends ; } ) ;
function _extends ( ) {
_extends = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
2020-01-22 17:06:21 -05:00
2020-06-26 09:33:47 -04:00
for ( var key in source ) {
if ( Object . prototype . hasOwnProperty . call ( source , key ) ) {
target [ key ] = source [ key ] ;
}
}
}
return target ;
} ;
return _extends . apply ( this , arguments ) ;
2020-01-22 17:06:21 -05:00
}
2019-09-19 11:19:18 -04:00
/***/ } )
/******/ } ) [ "default" ] ;