2023-09-21 15:26:32 +02:00
|
|
|
/******/ (function() { // webpackBootstrap
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ "use strict";
|
|
|
|
/******/ // The require scope
|
|
|
|
/******/ var __webpack_require__ = {};
|
|
|
|
/******/
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ /* webpack/runtime/compat get default export */
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ !function() {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ __webpack_require__.n = function(module) {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ var getter = module && module.__esModule ?
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ function() { return module['default']; } :
|
|
|
|
/******/ function() { return module; };
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ __webpack_require__.d(getter, { a: getter });
|
|
|
|
/******/ return getter;
|
|
|
|
/******/ };
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ }();
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/define property getters */
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ !function() {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ // define getter functions for harmony exports
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ __webpack_require__.d = function(exports, definition) {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ for(var key in definition) {
|
|
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
|
|
/******/ }
|
|
|
|
/******/ }
|
|
|
|
/******/ };
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ }();
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ !function() {
|
|
|
|
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
|
|
|
/******/ }();
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/
|
|
|
|
/******/ /* webpack/runtime/make namespace object */
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ !function() {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ // define __esModule on exports
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
2019-09-19 17:19:18 +02:00
|
|
|
/******/ };
|
2023-09-21 15:26:32 +02:00
|
|
|
/******/ }();
|
2022-04-11 14:04:30 +02:00
|
|
|
/******/
|
2019-09-19 17:19:18 +02:00
|
|
|
/************************************************************************/
|
2022-04-11 14:04:30 +02:00
|
|
|
var __webpack_exports__ = {};
|
|
|
|
// ESM COMPAT FLAG
|
2019-09-19 17:19:18 +02:00
|
|
|
__webpack_require__.r(__webpack_exports__);
|
2022-04-11 14:04:30 +02:00
|
|
|
|
|
|
|
// EXPORTS
|
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
2023-09-21 15:26:32 +02:00
|
|
|
__unstableAwaitPromise: function() { return /* binding */ __unstableAwaitPromise; },
|
|
|
|
apiFetch: function() { return /* binding */ apiFetch; },
|
|
|
|
controls: function() { return /* binding */ controls; },
|
|
|
|
dispatch: function() { return /* binding */ dispatch; },
|
|
|
|
select: function() { return /* binding */ build_module_select; },
|
|
|
|
syncSelect: function() { return /* binding */ syncSelect; }
|
2022-04-11 14:04:30 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: external ["wp","apiFetch"]
|
2023-09-21 15:26:32 +02:00
|
|
|
var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
|
2022-04-11 14:04:30 +02:00
|
|
|
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
|
|
|
|
;// CONCATENATED MODULE: external ["wp","data"]
|
2023-09-21 15:26:32 +02:00
|
|
|
var external_wp_data_namespaceObject = window["wp"]["data"];
|
2022-04-11 14:04:30 +02:00
|
|
|
;// CONCATENATED MODULE: external ["wp","deprecated"]
|
2023-09-21 15:26:32 +02:00
|
|
|
var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
|
2022-04-11 14:04:30 +02:00
|
|
|
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/@wordpress/data-controls/build-module/index.js
|
2019-09-19 17:19:18 +02:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
2021-01-28 03:04:13 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatches a control action for triggering an api fetch call.
|
|
|
|
*
|
|
|
|
* @param {Object} request Arguments for the fetch request.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* import { apiFetch } from '@wordpress/data-controls';
|
|
|
|
*
|
|
|
|
* // Action generator using apiFetch
|
2020-01-08 12:57:23 +01:00
|
|
|
* export function* myAction() {
|
|
|
|
* const path = '/v2/my-api/items';
|
|
|
|
* const items = yield apiFetch( { path } );
|
|
|
|
* // do something with the items.
|
2019-09-19 17:19:18 +02:00
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @return {Object} The control descriptor.
|
|
|
|
*/
|
2020-10-20 15:36:16 +02:00
|
|
|
function apiFetch(request) {
|
2019-09-19 17:19:18 +02:00
|
|
|
return {
|
|
|
|
type: 'API_FETCH',
|
2021-05-19 17:09:27 +02:00
|
|
|
request
|
2019-09-19 17:19:18 +02:00
|
|
|
};
|
2020-10-20 15:36:16 +02:00
|
|
|
}
|
2023-09-26 16:23:26 +02:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/**
|
2020-10-20 15:36:16 +02:00
|
|
|
* Control for resolving a selector in a registered data store.
|
|
|
|
* Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.
|
2019-09-19 17:19:18 +02:00
|
|
|
*
|
2023-06-27 16:24:19 +02:00
|
|
|
* @param storeNameOrDescriptor The store object or identifier.
|
|
|
|
* @param selectorName The selector name.
|
|
|
|
* @param args Arguments passed without change to the `@wordpress/data` control.
|
2019-09-19 17:19:18 +02:00
|
|
|
*/
|
2023-06-27 16:24:19 +02:00
|
|
|
function build_module_select(storeNameOrDescriptor, selectorName, ...args) {
|
2022-04-11 14:04:30 +02:00
|
|
|
external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', {
|
2021-04-15 17:19:43 +02:00
|
|
|
since: '5.7',
|
2021-01-28 03:04:13 +01:00
|
|
|
alternative: 'built-in `resolveSelect` control in `@wordpress/data`'
|
|
|
|
});
|
2023-06-27 16:24:19 +02:00
|
|
|
return external_wp_data_namespaceObject.controls.resolveSelect(storeNameOrDescriptor, selectorName, ...args);
|
2019-09-19 17:19:18 +02:00
|
|
|
}
|
2023-09-26 16:23:26 +02:00
|
|
|
|
2020-06-26 15:33:47 +02:00
|
|
|
/**
|
2020-10-20 15:36:16 +02:00
|
|
|
* Control for calling a selector in a registered data store.
|
|
|
|
* Alias for the `select` built-in control in the `@wordpress/data` package.
|
2020-06-26 15:33:47 +02:00
|
|
|
*
|
2023-06-27 16:24:19 +02:00
|
|
|
* @param storeNameOrDescriptor The store object or identifier.
|
|
|
|
* @param selectorName The selector name.
|
|
|
|
* @param args Arguments passed without change to the `@wordpress/data` control.
|
2020-06-26 15:33:47 +02:00
|
|
|
*/
|
2023-06-27 16:24:19 +02:00
|
|
|
function syncSelect(storeNameOrDescriptor, selectorName, ...args) {
|
2022-04-11 14:04:30 +02:00
|
|
|
external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', {
|
2021-04-15 17:19:43 +02:00
|
|
|
since: '5.7',
|
2021-01-28 03:04:13 +01:00
|
|
|
alternative: 'built-in `select` control in `@wordpress/data`'
|
|
|
|
});
|
2023-06-27 16:24:19 +02:00
|
|
|
return external_wp_data_namespaceObject.controls.select(storeNameOrDescriptor, selectorName, ...args);
|
2020-06-26 15:33:47 +02:00
|
|
|
}
|
2023-09-26 16:23:26 +02:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/**
|
2020-10-20 15:36:16 +02:00
|
|
|
* Control for dispatching an action in a registered data store.
|
|
|
|
* Alias for the `dispatch` control in the `@wordpress/data` package.
|
2019-09-19 17:19:18 +02:00
|
|
|
*
|
2023-06-27 16:24:19 +02:00
|
|
|
* @param storeNameOrDescriptor The store object or identifier.
|
|
|
|
* @param actionName The action name.
|
|
|
|
* @param args Arguments passed without change to the `@wordpress/data` control.
|
2019-09-19 17:19:18 +02:00
|
|
|
*/
|
2023-06-27 16:24:19 +02:00
|
|
|
function dispatch(storeNameOrDescriptor, actionName, ...args) {
|
2022-04-11 14:04:30 +02:00
|
|
|
external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', {
|
2021-04-15 17:19:43 +02:00
|
|
|
since: '5.7',
|
2021-01-28 03:04:13 +01:00
|
|
|
alternative: 'built-in `dispatch` control in `@wordpress/data`'
|
|
|
|
});
|
2023-06-27 16:24:19 +02:00
|
|
|
return external_wp_data_namespaceObject.controls.dispatch(storeNameOrDescriptor, actionName, ...args);
|
2019-09-19 17:19:18 +02:00
|
|
|
}
|
2023-09-26 16:23:26 +02:00
|
|
|
|
2021-01-28 03:04:13 +01:00
|
|
|
/**
|
|
|
|
* Dispatches a control action for awaiting on a promise to be resolved.
|
|
|
|
*
|
|
|
|
* @param {Object} promise Promise to wait for.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* import { __unstableAwaitPromise } from '@wordpress/data-controls';
|
|
|
|
*
|
|
|
|
* // Action generator using apiFetch
|
|
|
|
* export function* myAction() {
|
|
|
|
* const promise = getItemsAsync();
|
|
|
|
* const items = yield __unstableAwaitPromise( promise );
|
|
|
|
* // do something with the items.
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @return {Object} The control descriptor.
|
|
|
|
*/
|
2021-05-19 17:09:27 +02:00
|
|
|
const __unstableAwaitPromise = function (promise) {
|
2021-01-28 03:04:13 +01:00
|
|
|
return {
|
|
|
|
type: 'AWAIT_PROMISE',
|
2021-05-19 17:09:27 +02:00
|
|
|
promise
|
2021-01-28 03:04:13 +01:00
|
|
|
};
|
|
|
|
};
|
2023-09-26 16:23:26 +02:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/**
|
|
|
|
* The default export is what you use to register the controls with your custom
|
|
|
|
* store.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
|
|
|
* // WordPress dependencies
|
|
|
|
* import { controls } from '@wordpress/data-controls';
|
|
|
|
* import { registerStore } from '@wordpress/data';
|
|
|
|
*
|
|
|
|
* // Internal dependencies
|
|
|
|
* import reducer from './reducer';
|
|
|
|
* import * as selectors from './selectors';
|
|
|
|
* import * as actions from './actions';
|
|
|
|
* import * as resolvers from './resolvers';
|
|
|
|
*
|
2020-01-08 12:57:23 +01:00
|
|
|
* registerStore( 'my-custom-store', {
|
2021-01-28 03:04:13 +01:00
|
|
|
* reducer,
|
|
|
|
* controls,
|
|
|
|
* actions,
|
|
|
|
* selectors,
|
|
|
|
* resolvers,
|
2019-09-19 17:19:18 +02:00
|
|
|
* } );
|
|
|
|
* ```
|
|
|
|
* @return {Object} An object for registering the default controls with the
|
2021-01-28 03:04:13 +01:00
|
|
|
* store.
|
2019-09-19 17:19:18 +02:00
|
|
|
*/
|
2021-05-19 17:09:27 +02:00
|
|
|
const controls = {
|
2023-06-27 16:24:19 +02:00
|
|
|
AWAIT_PROMISE: ({
|
|
|
|
promise
|
|
|
|
}) => promise,
|
|
|
|
API_FETCH({
|
|
|
|
request
|
|
|
|
}) {
|
2022-04-11 14:04:30 +02:00
|
|
|
return external_wp_apiFetch_default()(request);
|
2020-10-20 15:36:16 +02:00
|
|
|
}
|
2021-05-19 17:09:27 +02:00
|
|
|
};
|
2019-09-19 17:19:18 +02:00
|
|
|
|
2022-04-11 14:04:30 +02:00
|
|
|
(window.wp = window.wp || {}).dataControls = __webpack_exports__;
|
|
|
|
/******/ })()
|
|
|
|
;
|