19
|
1 |
/******/ (function() { // webpackBootstrap |
|
2 |
/******/ "use strict"; |
|
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/compat get default export */ |
|
8 |
/******/ !function() { |
|
9 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
|
10 |
/******/ __webpack_require__.n = function(module) { |
|
11 |
/******/ var getter = module && module.__esModule ? |
|
12 |
/******/ function() { return module['default']; } : |
|
13 |
/******/ function() { return module; }; |
|
14 |
/******/ __webpack_require__.d(getter, { a: getter }); |
|
15 |
/******/ return getter; |
|
16 |
/******/ }; |
|
17 |
/******/ }(); |
|
18 |
/******/ |
|
19 |
/******/ /* webpack/runtime/define property getters */ |
|
20 |
/******/ !function() { |
|
21 |
/******/ // define getter functions for harmony exports |
|
22 |
/******/ __webpack_require__.d = function(exports, definition) { |
|
23 |
/******/ for(var key in definition) { |
|
24 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
25 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
26 |
/******/ } |
|
27 |
/******/ } |
16
|
28 |
/******/ }; |
19
|
29 |
/******/ }(); |
|
30 |
/******/ |
|
31 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
32 |
/******/ !function() { |
|
33 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
34 |
/******/ }(); |
|
35 |
/******/ |
|
36 |
/******/ /* webpack/runtime/make namespace object */ |
|
37 |
/******/ !function() { |
|
38 |
/******/ // define __esModule on exports |
|
39 |
/******/ __webpack_require__.r = function(exports) { |
|
40 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
41 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
42 |
/******/ } |
|
43 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
44 |
/******/ }; |
|
45 |
/******/ }(); |
|
46 |
/******/ |
16
|
47 |
/************************************************************************/ |
19
|
48 |
var __webpack_exports__ = {}; |
|
49 |
// ESM COMPAT FLAG |
|
50 |
__webpack_require__.r(__webpack_exports__); |
16
|
51 |
|
19
|
52 |
// EXPORTS |
|
53 |
__webpack_require__.d(__webpack_exports__, { |
|
54 |
"__unstableAwaitPromise": function() { return /* binding */ __unstableAwaitPromise; }, |
|
55 |
"apiFetch": function() { return /* binding */ apiFetch; }, |
|
56 |
"controls": function() { return /* binding */ controls; }, |
|
57 |
"dispatch": function() { return /* binding */ dispatch; }, |
|
58 |
"select": function() { return /* binding */ build_module_select; }, |
|
59 |
"syncSelect": function() { return /* binding */ syncSelect; } |
|
60 |
}); |
|
61 |
|
|
62 |
;// CONCATENATED MODULE: external ["wp","apiFetch"] |
|
63 |
var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
|
64 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
|
65 |
;// CONCATENATED MODULE: external ["wp","data"] |
|
66 |
var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
67 |
;// CONCATENATED MODULE: external ["wp","deprecated"] |
|
68 |
var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
|
69 |
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
|
70 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/data-controls/build-module/index.js |
16
|
71 |
/** |
|
72 |
* WordPress dependencies |
|
73 |
*/ |
|
74 |
|
|
75 |
|
18
|
76 |
|
16
|
77 |
/** |
|
78 |
* Dispatches a control action for triggering an api fetch call. |
|
79 |
* |
|
80 |
* @param {Object} request Arguments for the fetch request. |
|
81 |
* |
|
82 |
* @example |
|
83 |
* ```js |
|
84 |
* import { apiFetch } from '@wordpress/data-controls'; |
|
85 |
* |
|
86 |
* // Action generator using apiFetch |
|
87 |
* export function* myAction() { |
|
88 |
* const path = '/v2/my-api/items'; |
|
89 |
* const items = yield apiFetch( { path } ); |
|
90 |
* // do something with the items. |
|
91 |
* } |
|
92 |
* ``` |
|
93 |
* |
|
94 |
* @return {Object} The control descriptor. |
|
95 |
*/ |
|
96 |
|
18
|
97 |
function apiFetch(request) { |
16
|
98 |
return { |
|
99 |
type: 'API_FETCH', |
18
|
100 |
request |
16
|
101 |
}; |
18
|
102 |
} |
16
|
103 |
/** |
18
|
104 |
* Control for resolving a selector in a registered data store. |
|
105 |
* Alias for the `resolveSelect` built-in control in the `@wordpress/data` package. |
|
106 |
* |
|
107 |
* @param {Array} args Arguments passed without change to the `@wordpress/data` control. |
|
108 |
*/ |
|
109 |
|
19
|
110 |
function build_module_select() { |
|
111 |
external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', { |
18
|
112 |
since: '5.7', |
|
113 |
alternative: 'built-in `resolveSelect` control in `@wordpress/data`' |
|
114 |
}); |
19
|
115 |
return external_wp_data_namespaceObject.controls.resolveSelect(...arguments); |
18
|
116 |
} |
|
117 |
/** |
|
118 |
* Control for calling a selector in a registered data store. |
|
119 |
* Alias for the `select` built-in control in the `@wordpress/data` package. |
16
|
120 |
* |
18
|
121 |
* @param {Array} args Arguments passed without change to the `@wordpress/data` control. |
|
122 |
*/ |
|
123 |
|
19
|
124 |
function syncSelect() { |
|
125 |
external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', { |
18
|
126 |
since: '5.7', |
|
127 |
alternative: 'built-in `select` control in `@wordpress/data`' |
|
128 |
}); |
19
|
129 |
return external_wp_data_namespaceObject.controls.select(...arguments); |
18
|
130 |
} |
|
131 |
/** |
|
132 |
* Control for dispatching an action in a registered data store. |
|
133 |
* Alias for the `dispatch` control in the `@wordpress/data` package. |
16
|
134 |
* |
18
|
135 |
* @param {Array} args Arguments passed without change to the `@wordpress/data` control. |
|
136 |
*/ |
|
137 |
|
19
|
138 |
function dispatch() { |
|
139 |
external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', { |
18
|
140 |
since: '5.7', |
|
141 |
alternative: 'built-in `dispatch` control in `@wordpress/data`' |
|
142 |
}); |
19
|
143 |
return external_wp_data_namespaceObject.controls.dispatch(...arguments); |
18
|
144 |
} |
|
145 |
/** |
|
146 |
* Dispatches a control action for awaiting on a promise to be resolved. |
|
147 |
* |
|
148 |
* @param {Object} promise Promise to wait for. |
16
|
149 |
* |
|
150 |
* @example |
|
151 |
* ```js |
18
|
152 |
* import { __unstableAwaitPromise } from '@wordpress/data-controls'; |
16
|
153 |
* |
18
|
154 |
* // Action generator using apiFetch |
16
|
155 |
* export function* myAction() { |
18
|
156 |
* const promise = getItemsAsync(); |
|
157 |
* const items = yield __unstableAwaitPromise( promise ); |
|
158 |
* // do something with the items. |
16
|
159 |
* } |
|
160 |
* ``` |
|
161 |
* |
|
162 |
* @return {Object} The control descriptor. |
|
163 |
*/ |
|
164 |
|
18
|
165 |
const __unstableAwaitPromise = function (promise) { |
16
|
166 |
return { |
18
|
167 |
type: 'AWAIT_PROMISE', |
|
168 |
promise |
16
|
169 |
}; |
18
|
170 |
}; |
16
|
171 |
/** |
|
172 |
* The default export is what you use to register the controls with your custom |
|
173 |
* store. |
|
174 |
* |
|
175 |
* @example |
|
176 |
* ```js |
|
177 |
* // WordPress dependencies |
|
178 |
* import { controls } from '@wordpress/data-controls'; |
|
179 |
* import { registerStore } from '@wordpress/data'; |
|
180 |
* |
|
181 |
* // Internal dependencies |
|
182 |
* import reducer from './reducer'; |
|
183 |
* import * as selectors from './selectors'; |
|
184 |
* import * as actions from './actions'; |
|
185 |
* import * as resolvers from './resolvers'; |
|
186 |
* |
|
187 |
* registerStore( 'my-custom-store', { |
18
|
188 |
* reducer, |
|
189 |
* controls, |
|
190 |
* actions, |
|
191 |
* selectors, |
|
192 |
* resolvers, |
16
|
193 |
* } ); |
|
194 |
* ``` |
|
195 |
* @return {Object} An object for registering the default controls with the |
18
|
196 |
* store. |
16
|
197 |
*/ |
|
198 |
|
18
|
199 |
const controls = { |
19
|
200 |
AWAIT_PROMISE: _ref => { |
|
201 |
let { |
|
202 |
promise |
|
203 |
} = _ref; |
|
204 |
return promise; |
|
205 |
}, |
16
|
206 |
|
19
|
207 |
API_FETCH(_ref2) { |
|
208 |
let { |
|
209 |
request |
|
210 |
} = _ref2; |
|
211 |
return external_wp_apiFetch_default()(request); |
18
|
212 |
} |
16
|
213 |
|
|
214 |
}; |
|
215 |
|
19
|
216 |
(window.wp = window.wp || {}).dataControls = __webpack_exports__; |
|
217 |
/******/ })() |
|
218 |
; |