| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "@wordpress/api-fetch": |
| 6 |
/*!**********************************!*\ |
| 7 |
!*** external ["wp","apiFetch"] ***! |
| 8 |
\**********************************/ |
| 9 |
/***/ (function(module) { |
| 10 |
|
| 11 |
module.exports = window["wp"]["apiFetch"]; |
| 12 |
|
| 13 |
/***/ }) |
| 14 |
|
| 15 |
/******/ }); |
| 16 |
/************************************************************************/ |
| 17 |
/******/ // The module cache |
| 18 |
/******/ var __webpack_module_cache__ = {}; |
| 19 |
/******/ |
| 20 |
/******/ // The require function |
| 21 |
/******/ function __webpack_require__(moduleId) { |
| 22 |
/******/ // Check if module is in cache |
| 23 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 24 |
/******/ if (cachedModule !== undefined) { |
| 25 |
/******/ return cachedModule.exports; |
| 26 |
/******/ } |
| 27 |
/******/ // Create a new module (and put it into the cache) |
| 28 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 29 |
/******/ // no module.id needed |
| 30 |
/******/ // no module.loaded needed |
| 31 |
/******/ exports: {} |
| 32 |
/******/ }; |
| 33 |
/******/ |
| 34 |
/******/ // Execute the module function |
| 35 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 36 |
/******/ |
| 37 |
/******/ // Return the exports of the module |
| 38 |
/******/ return module.exports; |
| 39 |
/******/ } |
| 40 |
/******/ |
| 41 |
/************************************************************************/ |
| 42 |
/******/ /* webpack/runtime/compat get default export */ |
| 43 |
/******/ !function() { |
| 44 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 45 |
/******/ __webpack_require__.n = function(module) { |
| 46 |
/******/ var getter = module && module.__esModule ? |
| 47 |
/******/ function() { return module['default']; } : |
| 48 |
/******/ function() { return module; }; |
| 49 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 50 |
/******/ return getter; |
| 51 |
/******/ }; |
| 52 |
/******/ }(); |
| 53 |
/******/ |
| 54 |
/******/ /* webpack/runtime/define property getters */ |
| 55 |
/******/ !function() { |
| 56 |
/******/ // define getter functions for harmony exports |
| 57 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 58 |
/******/ for(var key in definition) { |
| 59 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 60 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 61 |
/******/ } |
| 62 |
/******/ } |
| 63 |
/******/ }; |
| 64 |
/******/ }(); |
| 65 |
/******/ |
| 66 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 67 |
/******/ !function() { |
| 68 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 69 |
/******/ }(); |
| 70 |
/******/ |
| 71 |
/******/ /* webpack/runtime/make namespace object */ |
| 72 |
/******/ !function() { |
| 73 |
/******/ // define __esModule on exports |
| 74 |
/******/ __webpack_require__.r = function(exports) { |
| 75 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 76 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 77 |
/******/ } |
| 78 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 79 |
/******/ }; |
| 80 |
/******/ }(); |
| 81 |
/******/ |
| 82 |
/************************************************************************/ |
| 83 |
var __webpack_exports__ = {}; |
| 84 |
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. |
| 85 |
!function() { |
| 86 |
/*!*********************************************!*\ |
| 87 |
!*** ./assets/src/apps/js/data-controls.js ***! |
| 88 |
\*********************************************/ |
| 89 |
__webpack_require__.r(__webpack_exports__); |
| 90 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 91 |
/* harmony export */ "apiFetch": function() { return /* binding */ apiFetch; }, |
| 92 |
/* harmony export */ "controls": function() { return /* binding */ controls; }, |
| 93 |
/* harmony export */ "dispatch": function() { return /* binding */ dispatch; }, |
| 94 |
/* harmony export */ "select": function() { return /* binding */ select; } |
| 95 |
/* harmony export */ }); |
| 96 |
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); |
| 97 |
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0__); |
| 98 |
|
| 99 |
|
| 100 |
const createRegistryControl = function createRegistryControl(registryControl) { |
| 101 |
registryControl.isRegistryControl = true; |
| 102 |
return registryControl; |
| 103 |
}; |
| 104 |
|
| 105 |
const apiFetch = request => { |
| 106 |
return { |
| 107 |
type: 'API_FETCH', |
| 108 |
request |
| 109 |
}; |
| 110 |
}; |
| 111 |
function select(storeKey, selectorName) { |
| 112 |
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { |
| 113 |
args[_key - 2] = arguments[_key]; |
| 114 |
} |
| 115 |
|
| 116 |
return { |
| 117 |
type: 'SELECT', |
| 118 |
storeKey, |
| 119 |
selectorName, |
| 120 |
args |
| 121 |
}; |
| 122 |
} |
| 123 |
function dispatch(storeKey, actionName) { |
| 124 |
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { |
| 125 |
args[_key2 - 2] = arguments[_key2]; |
| 126 |
} |
| 127 |
|
| 128 |
return { |
| 129 |
type: 'DISPATCH', |
| 130 |
storeKey, |
| 131 |
actionName, |
| 132 |
args |
| 133 |
}; |
| 134 |
} |
| 135 |
|
| 136 |
const resolveSelect = (registry, _ref) => { |
| 137 |
let { |
| 138 |
storeKey, |
| 139 |
selectorName, |
| 140 |
args |
| 141 |
} = _ref; |
| 142 |
return new Promise(resolve => { |
| 143 |
const hasFinished = () => registry.select('').hasFinishedResolution(storeKey, selectorName, args); |
| 144 |
|
| 145 |
const getResult = () => registry.select(storeKey)[selectorName].apply(null, args); |
| 146 |
|
| 147 |
const result = getResult(); |
| 148 |
|
| 149 |
if (hasFinished()) { |
| 150 |
return resolve(result); |
| 151 |
} |
| 152 |
|
| 153 |
const unsubscribe = registry.subscribe(() => { |
| 154 |
if (hasFinished()) { |
| 155 |
unsubscribe(); |
| 156 |
resolve(getResult()); |
| 157 |
} |
| 158 |
}); |
| 159 |
}); |
| 160 |
}; |
| 161 |
|
| 162 |
const controls = { |
| 163 |
API_FETCH(_ref2) { |
| 164 |
let { |
| 165 |
request |
| 166 |
} = _ref2; |
| 167 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_0___default()(request); |
| 168 |
}, |
| 169 |
|
| 170 |
SELECT: createRegistryControl(registry => _ref3 => { |
| 171 |
let { |
| 172 |
storeKey, |
| 173 |
selectorName, |
| 174 |
args |
| 175 |
} = _ref3; |
| 176 |
return registry.select(storeKey)[selectorName].hasResolver ? resolveSelect(registry, { |
| 177 |
storeKey, |
| 178 |
selectorName, |
| 179 |
args |
| 180 |
}) : registry.select(storeKey)[selectorName](...args); |
| 181 |
}), |
| 182 |
DISPATCH: createRegistryControl(registry => _ref4 => { |
| 183 |
let { |
| 184 |
storeKey, |
| 185 |
actionName, |
| 186 |
args |
| 187 |
} = _ref4; |
| 188 |
return registry.dispatch(storeKey)[actionName](...args); |
| 189 |
}) |
| 190 |
}; |
| 191 |
}(); |
| 192 |
(window.LP = window.LP || {}).dataControls = __webpack_exports__; |
| 193 |
/******/ })() |
| 194 |
; |
| 195 |
//# sourceMappingURL=data-controls.js.map |