19
|
1 |
/******/ (function() { // webpackBootstrap |
|
2 |
/******/ "use strict"; |
|
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
8 |
/******/ !function() { |
|
9 |
/******/ // define getter functions for harmony exports |
|
10 |
/******/ __webpack_require__.d = function(exports, definition) { |
|
11 |
/******/ for(var key in definition) { |
|
12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
14 |
/******/ } |
|
15 |
/******/ } |
9
|
16 |
/******/ }; |
19
|
17 |
/******/ }(); |
|
18 |
/******/ |
|
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
20 |
/******/ !function() { |
|
21 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
22 |
/******/ }(); |
|
23 |
/******/ |
|
24 |
/******/ /* webpack/runtime/make namespace object */ |
|
25 |
/******/ !function() { |
|
26 |
/******/ // define __esModule on exports |
|
27 |
/******/ __webpack_require__.r = function(exports) { |
|
28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
30 |
/******/ } |
|
31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
32 |
/******/ }; |
|
33 |
/******/ }(); |
|
34 |
/******/ |
9
|
35 |
/************************************************************************/ |
19
|
36 |
var __webpack_exports__ = {}; |
16
|
37 |
// ESM COMPAT FLAG |
9
|
38 |
__webpack_require__.r(__webpack_exports__); |
16
|
39 |
|
18
|
40 |
// EXPORTS |
19
|
41 |
__webpack_require__.d(__webpack_exports__, { |
|
42 |
"store": function() { return /* reexport */ store; } |
|
43 |
}); |
18
|
44 |
|
16
|
45 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/actions.js |
9
|
46 |
var actions_namespaceObject = {}; |
|
47 |
__webpack_require__.r(actions_namespaceObject); |
19
|
48 |
__webpack_require__.d(actions_namespaceObject, { |
|
49 |
"createErrorNotice": function() { return createErrorNotice; }, |
|
50 |
"createInfoNotice": function() { return createInfoNotice; }, |
|
51 |
"createNotice": function() { return createNotice; }, |
|
52 |
"createSuccessNotice": function() { return createSuccessNotice; }, |
|
53 |
"createWarningNotice": function() { return createWarningNotice; }, |
|
54 |
"removeNotice": function() { return removeNotice; } |
|
55 |
}); |
16
|
56 |
|
|
57 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js |
9
|
58 |
var selectors_namespaceObject = {}; |
|
59 |
__webpack_require__.r(selectors_namespaceObject); |
19
|
60 |
__webpack_require__.d(selectors_namespaceObject, { |
|
61 |
"getNotices": function() { return getNotices; } |
|
62 |
}); |
9
|
63 |
|
19
|
64 |
;// CONCATENATED MODULE: external ["wp","data"] |
|
65 |
var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
66 |
;// CONCATENATED MODULE: external "lodash" |
|
67 |
var external_lodash_namespaceObject = window["lodash"]; |
|
68 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js |
9
|
69 |
/** |
|
70 |
* Higher-order reducer creator which creates a combined reducer object, keyed |
|
71 |
* by a property on the action object. |
|
72 |
* |
|
73 |
* @param {string} actionProperty Action property by which to key object. |
|
74 |
* |
|
75 |
* @return {Function} Higher-order reducer. |
|
76 |
*/ |
19
|
77 |
const onSubKey = actionProperty => reducer => function () { |
|
78 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
79 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
18
|
80 |
// Retrieve subkey from action. Do not track if undefined; useful for cases |
|
81 |
// where reducer is scoped by action shape. |
|
82 |
const key = action[actionProperty]; |
9
|
83 |
|
18
|
84 |
if (key === undefined) { |
|
85 |
return state; |
|
86 |
} // Avoid updating state if unchanged. Note that this also accounts for a |
|
87 |
// reducer which returns undefined on a key which is not yet tracked. |
9
|
88 |
|
|
89 |
|
18
|
90 |
const nextKeyState = reducer(state[key], action); |
9
|
91 |
|
18
|
92 |
if (nextKeyState === state[key]) { |
|
93 |
return state; |
|
94 |
} |
9
|
95 |
|
18
|
96 |
return { ...state, |
|
97 |
[key]: nextKeyState |
9
|
98 |
}; |
|
99 |
}; |
18
|
100 |
/* harmony default export */ var on_sub_key = (onSubKey); |
9
|
101 |
|
19
|
102 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/reducer.js |
9
|
103 |
/** |
|
104 |
* External dependencies |
|
105 |
*/ |
|
106 |
|
|
107 |
/** |
|
108 |
* Internal dependencies |
|
109 |
*/ |
|
110 |
|
|
111 |
|
|
112 |
/** |
|
113 |
* Reducer returning the next notices state. The notices state is an object |
|
114 |
* where each key is a context, its value an array of notice objects. |
|
115 |
* |
|
116 |
* @param {Object} state Current state. |
|
117 |
* @param {Object} action Dispatched action. |
|
118 |
* |
|
119 |
* @return {Object} Updated state. |
|
120 |
*/ |
|
121 |
|
19
|
122 |
const notices = on_sub_key('context')(function () { |
|
123 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
124 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
|
125 |
|
9
|
126 |
switch (action.type) { |
|
127 |
case 'CREATE_NOTICE': |
|
128 |
// Avoid duplicates on ID. |
19
|
129 |
return [...(0,external_lodash_namespaceObject.reject)(state, { |
9
|
130 |
id: action.notice.id |
18
|
131 |
}), action.notice]; |
9
|
132 |
|
|
133 |
case 'REMOVE_NOTICE': |
19
|
134 |
return (0,external_lodash_namespaceObject.reject)(state, { |
9
|
135 |
id: action.id |
|
136 |
}); |
|
137 |
} |
|
138 |
|
|
139 |
return state; |
|
140 |
}); |
18
|
141 |
/* harmony default export */ var reducer = (notices); |
9
|
142 |
|
19
|
143 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/constants.js |
9
|
144 |
/** |
|
145 |
* Default context to use for notice grouping when not otherwise specified. Its |
|
146 |
* specific value doesn't hold much meaning, but it must be reasonably unique |
|
147 |
* and, more importantly, referenced consistently in the store implementation. |
|
148 |
* |
|
149 |
* @type {string} |
|
150 |
*/ |
18
|
151 |
const DEFAULT_CONTEXT = 'global'; |
9
|
152 |
/** |
|
153 |
* Default notice status. |
|
154 |
* |
|
155 |
* @type {string} |
|
156 |
*/ |
|
157 |
|
18
|
158 |
const DEFAULT_STATUS = 'info'; |
9
|
159 |
|
19
|
160 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/actions.js |
9
|
161 |
/** |
|
162 |
* External dependencies |
|
163 |
*/ |
|
164 |
|
|
165 |
/** |
|
166 |
* Internal dependencies |
|
167 |
*/ |
|
168 |
|
|
169 |
|
|
170 |
/** |
16
|
171 |
* @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice. |
|
172 |
* |
19
|
173 |
* @property {string} label Message to use as action label. |
|
174 |
* @property {?string} url Optional URL of resource if action incurs |
|
175 |
* browser navigation. |
|
176 |
* @property {?Function} onClick Optional function to invoke when action is |
|
177 |
* triggered by user. |
16
|
178 |
* |
|
179 |
*/ |
|
180 |
|
|
181 |
/** |
|
182 |
* Returns an action object used in signalling that a notice is to be created. |
9
|
183 |
* |
16
|
184 |
* @param {string} [status='info'] Notice status. |
|
185 |
* @param {string} content Notice message. |
|
186 |
* @param {Object} [options] Notice options. |
|
187 |
* @param {string} [options.context='global'] Context under which to |
|
188 |
* group notice. |
|
189 |
* @param {string} [options.id] Identifier for notice. |
|
190 |
* Automatically assigned |
|
191 |
* if not specified. |
|
192 |
* @param {boolean} [options.isDismissible=true] Whether the notice can |
|
193 |
* be dismissed by user. |
|
194 |
* @param {string} [options.type='default'] Type of notice, one of |
|
195 |
* `default`, or `snackbar`. |
|
196 |
* @param {boolean} [options.speak=true] Whether the notice |
|
197 |
* content should be |
|
198 |
* announced to screen |
|
199 |
* readers. |
|
200 |
* @param {Array<WPNoticeAction>} [options.actions] User actions to be |
|
201 |
* presented with notice. |
18
|
202 |
* @param {Object} [options.icon] An icon displayed with the notice. |
|
203 |
* @param {boolean} [options.explicitDismiss] Whether the notice includes |
|
204 |
* an explict dismiss button and |
|
205 |
* can't be dismissed by clicking |
|
206 |
* the body of the notice. |
|
207 |
* @param {Function} [options.onDismiss] Called when the notice is dismissed. |
16
|
208 |
* |
|
209 |
* @return {Object} Action object. |
9
|
210 |
*/ |
|
211 |
|
19
|
212 |
function createNotice() { |
|
213 |
let status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATUS; |
|
214 |
let content = arguments.length > 1 ? arguments[1] : undefined; |
|
215 |
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
18
|
216 |
const { |
|
217 |
speak = true, |
|
218 |
isDismissible = true, |
|
219 |
context = DEFAULT_CONTEXT, |
19
|
220 |
id = (0,external_lodash_namespaceObject.uniqueId)(context), |
18
|
221 |
actions = [], |
|
222 |
type = 'default', |
|
223 |
__unstableHTML, |
|
224 |
icon = null, |
|
225 |
explicitDismiss = false, |
19
|
226 |
onDismiss |
18
|
227 |
} = options; // The supported value shape of content is currently limited to plain text |
16
|
228 |
// strings. To avoid setting expectation that e.g. a WPElement could be |
|
229 |
// supported, cast to a string. |
9
|
230 |
|
16
|
231 |
content = String(content); |
|
232 |
return { |
|
233 |
type: 'CREATE_NOTICE', |
18
|
234 |
context, |
16
|
235 |
notice: { |
18
|
236 |
id, |
|
237 |
status, |
|
238 |
content, |
16
|
239 |
spokenMessage: speak ? content : null, |
18
|
240 |
__unstableHTML, |
|
241 |
isDismissible, |
|
242 |
actions, |
|
243 |
type, |
|
244 |
icon, |
|
245 |
explicitDismiss, |
|
246 |
onDismiss |
9
|
247 |
} |
16
|
248 |
}; |
9
|
249 |
} |
|
250 |
/** |
|
251 |
* Returns an action object used in signalling that a success notice is to be |
|
252 |
* created. Refer to `createNotice` for options documentation. |
|
253 |
* |
|
254 |
* @see createNotice |
|
255 |
* |
16
|
256 |
* @param {string} content Notice message. |
|
257 |
* @param {Object} [options] Optional notice options. |
9
|
258 |
* |
|
259 |
* @return {Object} Action object. |
|
260 |
*/ |
|
261 |
|
|
262 |
function createSuccessNotice(content, options) { |
|
263 |
return createNotice('success', content, options); |
|
264 |
} |
|
265 |
/** |
|
266 |
* Returns an action object used in signalling that an info notice is to be |
|
267 |
* created. Refer to `createNotice` for options documentation. |
|
268 |
* |
|
269 |
* @see createNotice |
|
270 |
* |
16
|
271 |
* @param {string} content Notice message. |
|
272 |
* @param {Object} [options] Optional notice options. |
9
|
273 |
* |
|
274 |
* @return {Object} Action object. |
|
275 |
*/ |
|
276 |
|
|
277 |
function createInfoNotice(content, options) { |
|
278 |
return createNotice('info', content, options); |
|
279 |
} |
|
280 |
/** |
|
281 |
* Returns an action object used in signalling that an error notice is to be |
|
282 |
* created. Refer to `createNotice` for options documentation. |
|
283 |
* |
|
284 |
* @see createNotice |
|
285 |
* |
16
|
286 |
* @param {string} content Notice message. |
|
287 |
* @param {Object} [options] Optional notice options. |
9
|
288 |
* |
|
289 |
* @return {Object} Action object. |
|
290 |
*/ |
|
291 |
|
|
292 |
function createErrorNotice(content, options) { |
|
293 |
return createNotice('error', content, options); |
|
294 |
} |
|
295 |
/** |
|
296 |
* Returns an action object used in signalling that a warning notice is to be |
|
297 |
* created. Refer to `createNotice` for options documentation. |
|
298 |
* |
|
299 |
* @see createNotice |
|
300 |
* |
16
|
301 |
* @param {string} content Notice message. |
|
302 |
* @param {Object} [options] Optional notice options. |
9
|
303 |
* |
|
304 |
* @return {Object} Action object. |
|
305 |
*/ |
|
306 |
|
|
307 |
function createWarningNotice(content, options) { |
|
308 |
return createNotice('warning', content, options); |
|
309 |
} |
|
310 |
/** |
|
311 |
* Returns an action object used in signalling that a notice is to be removed. |
|
312 |
* |
16
|
313 |
* @param {string} id Notice unique identifier. |
|
314 |
* @param {string} [context='global'] Optional context (grouping) in which the notice is |
|
315 |
* intended to appear. Defaults to default context. |
9
|
316 |
* |
|
317 |
* @return {Object} Action object. |
|
318 |
*/ |
|
319 |
|
19
|
320 |
function removeNotice(id) { |
|
321 |
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT; |
9
|
322 |
return { |
|
323 |
type: 'REMOVE_NOTICE', |
18
|
324 |
id, |
|
325 |
context |
9
|
326 |
}; |
|
327 |
} |
|
328 |
|
19
|
329 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/selectors.js |
9
|
330 |
/** |
|
331 |
* Internal dependencies |
|
332 |
*/ |
|
333 |
|
16
|
334 |
/** @typedef {import('./actions').WPNoticeAction} WPNoticeAction */ |
|
335 |
|
9
|
336 |
/** |
|
337 |
* The default empty set of notices to return when there are no notices |
|
338 |
* assigned for a given notices context. This can occur if the getNotices |
|
339 |
* selector is called without a notice ever having been created for the |
|
340 |
* context. A shared value is used to ensure referential equality between |
|
341 |
* sequential selector calls, since otherwise `[] !== []`. |
|
342 |
* |
|
343 |
* @type {Array} |
|
344 |
*/ |
|
345 |
|
18
|
346 |
const DEFAULT_NOTICES = []; |
9
|
347 |
/** |
16
|
348 |
* @typedef {Object} WPNotice Notice object. |
9
|
349 |
* |
19
|
350 |
* @property {string} id Unique identifier of notice. |
|
351 |
* @property {string} status Status of notice, one of `success`, |
|
352 |
* `info`, `error`, or `warning`. Defaults |
|
353 |
* to `info`. |
|
354 |
* @property {string} content Notice message. |
|
355 |
* @property {string} spokenMessage Audibly announced message text used by |
|
356 |
* assistive technologies. |
|
357 |
* @property {string} __unstableHTML Notice message as raw HTML. Intended to |
|
358 |
* serve primarily for compatibility of |
|
359 |
* server-rendered notices, and SHOULD NOT |
|
360 |
* be used for notices. It is subject to |
|
361 |
* removal without notice. |
|
362 |
* @property {boolean} isDismissible Whether the notice can be dismissed by |
|
363 |
* user. Defaults to `true`. |
|
364 |
* @property {string} type Type of notice, one of `default`, |
|
365 |
* or `snackbar`. Defaults to `default`. |
|
366 |
* @property {boolean} speak Whether the notice content should be |
|
367 |
* announced to screen readers. Defaults to |
|
368 |
* `true`. |
|
369 |
* @property {WPNoticeAction[]} actions User actions to present with notice. |
9
|
370 |
* |
|
371 |
*/ |
|
372 |
|
|
373 |
/** |
|
374 |
* Returns all notices as an array, optionally for a given context. Defaults to |
|
375 |
* the global context. |
|
376 |
* |
|
377 |
* @param {Object} state Notices state. |
|
378 |
* @param {?string} context Optional grouping context. |
|
379 |
* |
|
380 |
* @return {WPNotice[]} Array of notices. |
|
381 |
*/ |
|
382 |
|
19
|
383 |
function getNotices(state) { |
|
384 |
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT; |
9
|
385 |
return state[context] || DEFAULT_NOTICES; |
|
386 |
} |
|
387 |
|
19
|
388 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/index.js |
9
|
389 |
/** |
|
390 |
* WordPress dependencies |
|
391 |
*/ |
|
392 |
|
|
393 |
/** |
|
394 |
* Internal dependencies |
|
395 |
*/ |
|
396 |
|
|
397 |
|
|
398 |
|
|
399 |
|
18
|
400 |
/** |
|
401 |
* Store definition for the notices namespace. |
|
402 |
* |
|
403 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
404 |
* |
|
405 |
* @type {Object} |
|
406 |
*/ |
|
407 |
|
19
|
408 |
const store = (0,external_wp_data_namespaceObject.createReduxStore)('core/notices', { |
18
|
409 |
reducer: reducer, |
9
|
410 |
actions: actions_namespaceObject, |
16
|
411 |
selectors: selectors_namespaceObject |
18
|
412 |
}); |
19
|
413 |
(0,external_wp_data_namespaceObject.register)(store); |
9
|
414 |
|
19
|
415 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/index.js |
9
|
416 |
|
|
417 |
|
19
|
418 |
(window.wp = window.wp || {}).notices = __webpack_exports__; |
|
419 |
/******/ })() |
|
420 |
; |