|
1 this["wp"] = this["wp"] || {}; this["wp"]["nux"] = |
|
2 /******/ (function(modules) { // webpackBootstrap |
|
3 /******/ // The module cache |
|
4 /******/ var installedModules = {}; |
|
5 /******/ |
|
6 /******/ // The require function |
|
7 /******/ function __webpack_require__(moduleId) { |
|
8 /******/ |
|
9 /******/ // Check if module is in cache |
|
10 /******/ if(installedModules[moduleId]) { |
|
11 /******/ return installedModules[moduleId].exports; |
|
12 /******/ } |
|
13 /******/ // Create a new module (and put it into the cache) |
|
14 /******/ var module = installedModules[moduleId] = { |
|
15 /******/ i: moduleId, |
|
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
|
19 /******/ |
|
20 /******/ // Execute the module function |
|
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 /******/ |
|
23 /******/ // Flag the module as loaded |
|
24 /******/ module.l = true; |
|
25 /******/ |
|
26 /******/ // Return the exports of the module |
|
27 /******/ return module.exports; |
|
28 /******/ } |
|
29 /******/ |
|
30 /******/ |
|
31 /******/ // expose the modules object (__webpack_modules__) |
|
32 /******/ __webpack_require__.m = modules; |
|
33 /******/ |
|
34 /******/ // expose the module cache |
|
35 /******/ __webpack_require__.c = installedModules; |
|
36 /******/ |
|
37 /******/ // define getter function for harmony exports |
|
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 /******/ if(!__webpack_require__.o(exports, name)) { |
|
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 /******/ } |
|
42 /******/ }; |
|
43 /******/ |
|
44 /******/ // define __esModule on exports |
|
45 /******/ __webpack_require__.r = function(exports) { |
|
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 /******/ } |
|
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = 375); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
|
88 /******/ ({ |
|
89 |
|
90 /***/ 0: |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = this["wp"]["element"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ 1: |
|
98 /***/ (function(module, exports) { |
|
99 |
|
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
|
101 |
|
102 /***/ }), |
|
103 |
|
104 /***/ 15: |
|
105 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
106 |
|
107 "use strict"; |
|
108 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
109 function _defineProperty(obj, key, value) { |
|
110 if (key in obj) { |
|
111 Object.defineProperty(obj, key, { |
|
112 value: value, |
|
113 enumerable: true, |
|
114 configurable: true, |
|
115 writable: true |
|
116 }); |
|
117 } else { |
|
118 obj[key] = value; |
|
119 } |
|
120 |
|
121 return obj; |
|
122 } |
|
123 |
|
124 /***/ }), |
|
125 |
|
126 /***/ 17: |
|
127 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
128 |
|
129 "use strict"; |
|
130 |
|
131 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
132 function _arrayWithoutHoles(arr) { |
|
133 if (Array.isArray(arr)) { |
|
134 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { |
|
135 arr2[i] = arr[i]; |
|
136 } |
|
137 |
|
138 return arr2; |
|
139 } |
|
140 } |
|
141 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
142 var iterableToArray = __webpack_require__(34); |
|
143 |
|
144 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
145 function _nonIterableSpread() { |
|
146 throw new TypeError("Invalid attempt to spread non-iterable instance"); |
|
147 } |
|
148 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
149 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); |
|
150 |
|
151 |
|
152 |
|
153 function _toConsumableArray(arr) { |
|
154 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
155 } |
|
156 |
|
157 /***/ }), |
|
158 |
|
159 /***/ 2: |
|
160 /***/ (function(module, exports) { |
|
161 |
|
162 (function() { module.exports = this["lodash"]; }()); |
|
163 |
|
164 /***/ }), |
|
165 |
|
166 /***/ 28: |
|
167 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
168 |
|
169 "use strict"; |
|
170 |
|
171 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
172 var arrayWithHoles = __webpack_require__(37); |
|
173 |
|
174 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
175 function _iterableToArrayLimit(arr, i) { |
|
176 var _arr = []; |
|
177 var _n = true; |
|
178 var _d = false; |
|
179 var _e = undefined; |
|
180 |
|
181 try { |
|
182 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
183 _arr.push(_s.value); |
|
184 |
|
185 if (i && _arr.length === i) break; |
|
186 } |
|
187 } catch (err) { |
|
188 _d = true; |
|
189 _e = err; |
|
190 } finally { |
|
191 try { |
|
192 if (!_n && _i["return"] != null) _i["return"](); |
|
193 } finally { |
|
194 if (_d) throw _e; |
|
195 } |
|
196 } |
|
197 |
|
198 return _arr; |
|
199 } |
|
200 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
201 var nonIterableRest = __webpack_require__(38); |
|
202 |
|
203 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
204 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); |
|
205 |
|
206 |
|
207 |
|
208 function _slicedToArray(arr, i) { |
|
209 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
210 } |
|
211 |
|
212 /***/ }), |
|
213 |
|
214 /***/ 30: |
|
215 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
216 |
|
217 "use strict"; |
|
218 |
|
219 |
|
220 var LEAF_KEY, hasWeakMap; |
|
221 |
|
222 /** |
|
223 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
224 * |
|
225 * @type {Object} |
|
226 */ |
|
227 LEAF_KEY = {}; |
|
228 |
|
229 /** |
|
230 * Whether environment supports WeakMap. |
|
231 * |
|
232 * @type {boolean} |
|
233 */ |
|
234 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
235 |
|
236 /** |
|
237 * Returns the first argument as the sole entry in an array. |
|
238 * |
|
239 * @param {*} value Value to return. |
|
240 * |
|
241 * @return {Array} Value returned as entry in array. |
|
242 */ |
|
243 function arrayOf( value ) { |
|
244 return [ value ]; |
|
245 } |
|
246 |
|
247 /** |
|
248 * Returns true if the value passed is object-like, or false otherwise. A value |
|
249 * is object-like if it can support property assignment, e.g. object or array. |
|
250 * |
|
251 * @param {*} value Value to test. |
|
252 * |
|
253 * @return {boolean} Whether value is object-like. |
|
254 */ |
|
255 function isObjectLike( value ) { |
|
256 return !! value && 'object' === typeof value; |
|
257 } |
|
258 |
|
259 /** |
|
260 * Creates and returns a new cache object. |
|
261 * |
|
262 * @return {Object} Cache object. |
|
263 */ |
|
264 function createCache() { |
|
265 var cache = { |
|
266 clear: function() { |
|
267 cache.head = null; |
|
268 }, |
|
269 }; |
|
270 |
|
271 return cache; |
|
272 } |
|
273 |
|
274 /** |
|
275 * Returns true if entries within the two arrays are strictly equal by |
|
276 * reference from a starting index. |
|
277 * |
|
278 * @param {Array} a First array. |
|
279 * @param {Array} b Second array. |
|
280 * @param {number} fromIndex Index from which to start comparison. |
|
281 * |
|
282 * @return {boolean} Whether arrays are shallowly equal. |
|
283 */ |
|
284 function isShallowEqual( a, b, fromIndex ) { |
|
285 var i; |
|
286 |
|
287 if ( a.length !== b.length ) { |
|
288 return false; |
|
289 } |
|
290 |
|
291 for ( i = fromIndex; i < a.length; i++ ) { |
|
292 if ( a[ i ] !== b[ i ] ) { |
|
293 return false; |
|
294 } |
|
295 } |
|
296 |
|
297 return true; |
|
298 } |
|
299 |
|
300 /** |
|
301 * Returns a memoized selector function. The getDependants function argument is |
|
302 * called before the memoized selector and is expected to return an immutable |
|
303 * reference or array of references on which the selector depends for computing |
|
304 * its own return value. The memoize cache is preserved only as long as those |
|
305 * dependant references remain the same. If getDependants returns a different |
|
306 * reference(s), the cache is cleared and the selector value regenerated. |
|
307 * |
|
308 * @param {Function} selector Selector function. |
|
309 * @param {Function} getDependants Dependant getter returning an immutable |
|
310 * reference or array of reference used in |
|
311 * cache bust consideration. |
|
312 * |
|
313 * @return {Function} Memoized selector. |
|
314 */ |
|
315 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { |
|
316 var rootCache, getCache; |
|
317 |
|
318 // Use object source as dependant if getter not provided |
|
319 if ( ! getDependants ) { |
|
320 getDependants = arrayOf; |
|
321 } |
|
322 |
|
323 /** |
|
324 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
325 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
326 * cache object. |
|
327 * |
|
328 * @return {(WeakMap|Object)} Root cache object. |
|
329 */ |
|
330 function getRootCache() { |
|
331 return rootCache; |
|
332 } |
|
333 |
|
334 /** |
|
335 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
336 * will be used to create a unique cache for each set of dependants. This |
|
337 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
338 * to occur on entries where the key object is no longer referenced. Since |
|
339 * WeakMap requires the key to be an object, this is only possible when the |
|
340 * dependant is object-like. The root cache is created as a hierarchy where |
|
341 * each top-level key is the first entry in a dependants set, the value a |
|
342 * WeakMap where each key is the next dependant, and so on. This continues |
|
343 * so long as the dependants are object-like. If no dependants are object- |
|
344 * like, then the cache is shared across all invocations. |
|
345 * |
|
346 * @see isObjectLike |
|
347 * |
|
348 * @param {Array} dependants Selector dependants. |
|
349 * |
|
350 * @return {Object} Cache object. |
|
351 */ |
|
352 function getWeakMapCache( dependants ) { |
|
353 var caches = rootCache, |
|
354 isUniqueByDependants = true, |
|
355 i, dependant, map, cache; |
|
356 |
|
357 for ( i = 0; i < dependants.length; i++ ) { |
|
358 dependant = dependants[ i ]; |
|
359 |
|
360 // Can only compose WeakMap from object-like key. |
|
361 if ( ! isObjectLike( dependant ) ) { |
|
362 isUniqueByDependants = false; |
|
363 break; |
|
364 } |
|
365 |
|
366 // Does current segment of cache already have a WeakMap? |
|
367 if ( caches.has( dependant ) ) { |
|
368 // Traverse into nested WeakMap. |
|
369 caches = caches.get( dependant ); |
|
370 } else { |
|
371 // Create, set, and traverse into a new one. |
|
372 map = new WeakMap(); |
|
373 caches.set( dependant, map ); |
|
374 caches = map; |
|
375 } |
|
376 } |
|
377 |
|
378 // We use an arbitrary (but consistent) object as key for the last item |
|
379 // in the WeakMap to serve as our running cache. |
|
380 if ( ! caches.has( LEAF_KEY ) ) { |
|
381 cache = createCache(); |
|
382 cache.isUniqueByDependants = isUniqueByDependants; |
|
383 caches.set( LEAF_KEY, cache ); |
|
384 } |
|
385 |
|
386 return caches.get( LEAF_KEY ); |
|
387 } |
|
388 |
|
389 // Assign cache handler by availability of WeakMap |
|
390 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
391 |
|
392 /** |
|
393 * Resets root memoization cache. |
|
394 */ |
|
395 function clear() { |
|
396 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
397 } |
|
398 |
|
399 // eslint-disable-next-line jsdoc/check-param-names |
|
400 /** |
|
401 * The augmented selector call, considering first whether dependants have |
|
402 * changed before passing it to underlying memoize function. |
|
403 * |
|
404 * @param {Object} source Source object for derivation. |
|
405 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
406 * |
|
407 * @return {*} Selector result. |
|
408 */ |
|
409 function callSelector( /* source, ...extraArgs */ ) { |
|
410 var len = arguments.length, |
|
411 cache, node, i, args, dependants; |
|
412 |
|
413 // Create copy of arguments (avoid leaking deoptimization). |
|
414 args = new Array( len ); |
|
415 for ( i = 0; i < len; i++ ) { |
|
416 args[ i ] = arguments[ i ]; |
|
417 } |
|
418 |
|
419 dependants = getDependants.apply( null, args ); |
|
420 cache = getCache( dependants ); |
|
421 |
|
422 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
423 // of WeakMap support), shallow compare against last dependants and, if |
|
424 // references have changed, destroy cache to recalculate result. |
|
425 if ( ! cache.isUniqueByDependants ) { |
|
426 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
427 cache.clear(); |
|
428 } |
|
429 |
|
430 cache.lastDependants = dependants; |
|
431 } |
|
432 |
|
433 node = cache.head; |
|
434 while ( node ) { |
|
435 // Check whether node arguments match arguments |
|
436 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
437 node = node.next; |
|
438 continue; |
|
439 } |
|
440 |
|
441 // At this point we can assume we've found a match |
|
442 |
|
443 // Surface matched node to head if not already |
|
444 if ( node !== cache.head ) { |
|
445 // Adjust siblings to point to each other. |
|
446 node.prev.next = node.next; |
|
447 if ( node.next ) { |
|
448 node.next.prev = node.prev; |
|
449 } |
|
450 |
|
451 node.next = cache.head; |
|
452 node.prev = null; |
|
453 cache.head.prev = node; |
|
454 cache.head = node; |
|
455 } |
|
456 |
|
457 // Return immediately |
|
458 return node.val; |
|
459 } |
|
460 |
|
461 // No cached value found. Continue to insertion phase: |
|
462 |
|
463 node = { |
|
464 // Generate the result from original function |
|
465 val: selector.apply( null, args ), |
|
466 }; |
|
467 |
|
468 // Avoid including the source object in the cache. |
|
469 args[ 0 ] = null; |
|
470 node.args = args; |
|
471 |
|
472 // Don't need to check whether node is already head, since it would |
|
473 // have been returned above already if it was |
|
474 |
|
475 // Shift existing head down list |
|
476 if ( cache.head ) { |
|
477 cache.head.prev = node; |
|
478 node.next = cache.head; |
|
479 } |
|
480 |
|
481 cache.head = node; |
|
482 |
|
483 return node.val; |
|
484 } |
|
485 |
|
486 callSelector.getDependants = getDependants; |
|
487 callSelector.clear = clear; |
|
488 clear(); |
|
489 |
|
490 return callSelector; |
|
491 }); |
|
492 |
|
493 |
|
494 /***/ }), |
|
495 |
|
496 /***/ 34: |
|
497 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
498 |
|
499 "use strict"; |
|
500 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
501 function _iterableToArray(iter) { |
|
502 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
|
503 } |
|
504 |
|
505 /***/ }), |
|
506 |
|
507 /***/ 37: |
|
508 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
509 |
|
510 "use strict"; |
|
511 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
|
512 function _arrayWithHoles(arr) { |
|
513 if (Array.isArray(arr)) return arr; |
|
514 } |
|
515 |
|
516 /***/ }), |
|
517 |
|
518 /***/ 375: |
|
519 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
520 |
|
521 "use strict"; |
|
522 __webpack_require__.r(__webpack_exports__); |
|
523 var actions_namespaceObject = {}; |
|
524 __webpack_require__.r(actions_namespaceObject); |
|
525 __webpack_require__.d(actions_namespaceObject, "triggerGuide", function() { return triggerGuide; }); |
|
526 __webpack_require__.d(actions_namespaceObject, "dismissTip", function() { return dismissTip; }); |
|
527 __webpack_require__.d(actions_namespaceObject, "disableTips", function() { return disableTips; }); |
|
528 __webpack_require__.d(actions_namespaceObject, "enableTips", function() { return enableTips; }); |
|
529 var selectors_namespaceObject = {}; |
|
530 __webpack_require__.r(selectors_namespaceObject); |
|
531 __webpack_require__.d(selectors_namespaceObject, "getAssociatedGuide", function() { return getAssociatedGuide; }); |
|
532 __webpack_require__.d(selectors_namespaceObject, "isTipVisible", function() { return isTipVisible; }); |
|
533 __webpack_require__.d(selectors_namespaceObject, "areTipsEnabled", function() { return selectors_areTipsEnabled; }); |
|
534 |
|
535 // EXTERNAL MODULE: external {"this":["wp","data"]} |
|
536 var external_this_wp_data_ = __webpack_require__(5); |
|
537 |
|
538 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
539 var defineProperty = __webpack_require__(15); |
|
540 |
|
541 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
542 var objectSpread = __webpack_require__(7); |
|
543 |
|
544 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
545 var toConsumableArray = __webpack_require__(17); |
|
546 |
|
547 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/reducer.js |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 /** |
|
553 * WordPress dependencies |
|
554 */ |
|
555 |
|
556 /** |
|
557 * Reducer that tracks which tips are in a guide. Each guide is represented by |
|
558 * an array which contains the tip identifiers contained within that guide. |
|
559 * |
|
560 * @param {Array} state Current state. |
|
561 * @param {Object} action Dispatched action. |
|
562 * |
|
563 * @return {Array} Updated state. |
|
564 */ |
|
565 |
|
566 function guides() { |
|
567 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
568 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
569 |
|
570 switch (action.type) { |
|
571 case 'TRIGGER_GUIDE': |
|
572 return [].concat(Object(toConsumableArray["a" /* default */])(state), [action.tipIds]); |
|
573 } |
|
574 |
|
575 return state; |
|
576 } |
|
577 /** |
|
578 * Reducer that tracks whether or not tips are globally enabled. |
|
579 * |
|
580 * @param {boolean} state Current state. |
|
581 * @param {Object} action Dispatched action. |
|
582 * |
|
583 * @return {boolean} Updated state. |
|
584 */ |
|
585 |
|
586 function areTipsEnabled() { |
|
587 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; |
|
588 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
589 |
|
590 switch (action.type) { |
|
591 case 'DISABLE_TIPS': |
|
592 return false; |
|
593 |
|
594 case 'ENABLE_TIPS': |
|
595 return true; |
|
596 } |
|
597 |
|
598 return state; |
|
599 } |
|
600 /** |
|
601 * Reducer that tracks which tips have been dismissed. If the state object |
|
602 * contains a tip identifier, then that tip is dismissed. |
|
603 * |
|
604 * @param {Object} state Current state. |
|
605 * @param {Object} action Dispatched action. |
|
606 * |
|
607 * @return {Object} Updated state. |
|
608 */ |
|
609 |
|
610 function dismissedTips() { |
|
611 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
612 var action = arguments.length > 1 ? arguments[1] : undefined; |
|
613 |
|
614 switch (action.type) { |
|
615 case 'DISMISS_TIP': |
|
616 return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.id, true)); |
|
617 |
|
618 case 'ENABLE_TIPS': |
|
619 return {}; |
|
620 } |
|
621 |
|
622 return state; |
|
623 } |
|
624 var preferences = Object(external_this_wp_data_["combineReducers"])({ |
|
625 areTipsEnabled: areTipsEnabled, |
|
626 dismissedTips: dismissedTips |
|
627 }); |
|
628 /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({ |
|
629 guides: guides, |
|
630 preferences: preferences |
|
631 })); |
|
632 |
|
633 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/actions.js |
|
634 /** |
|
635 * Returns an action object that, when dispatched, presents a guide that takes |
|
636 * the user through a series of tips step by step. |
|
637 * |
|
638 * @param {string[]} tipIds Which tips to show in the guide. |
|
639 * |
|
640 * @return {Object} Action object. |
|
641 */ |
|
642 function triggerGuide(tipIds) { |
|
643 return { |
|
644 type: 'TRIGGER_GUIDE', |
|
645 tipIds: tipIds |
|
646 }; |
|
647 } |
|
648 /** |
|
649 * Returns an action object that, when dispatched, dismisses the given tip. A |
|
650 * dismissed tip will not show again. |
|
651 * |
|
652 * @param {string} id The tip to dismiss. |
|
653 * |
|
654 * @return {Object} Action object. |
|
655 */ |
|
656 |
|
657 function dismissTip(id) { |
|
658 return { |
|
659 type: 'DISMISS_TIP', |
|
660 id: id |
|
661 }; |
|
662 } |
|
663 /** |
|
664 * Returns an action object that, when dispatched, prevents all tips from |
|
665 * showing again. |
|
666 * |
|
667 * @return {Object} Action object. |
|
668 */ |
|
669 |
|
670 function disableTips() { |
|
671 return { |
|
672 type: 'DISABLE_TIPS' |
|
673 }; |
|
674 } |
|
675 /** |
|
676 * Returns an action object that, when dispatched, makes all tips show again. |
|
677 * |
|
678 * @return {Object} Action object. |
|
679 */ |
|
680 |
|
681 function enableTips() { |
|
682 return { |
|
683 type: 'ENABLE_TIPS' |
|
684 }; |
|
685 } |
|
686 |
|
687 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
|
688 var slicedToArray = __webpack_require__(28); |
|
689 |
|
690 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
|
691 var rememo = __webpack_require__(30); |
|
692 |
|
693 // EXTERNAL MODULE: external "lodash" |
|
694 var external_lodash_ = __webpack_require__(2); |
|
695 |
|
696 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/selectors.js |
|
697 |
|
698 |
|
699 /** |
|
700 * External dependencies |
|
701 */ |
|
702 |
|
703 |
|
704 /** |
|
705 * An object containing information about a guide. |
|
706 * |
|
707 * @typedef {Object} NUX.GuideInfo |
|
708 * @property {string[]} tipIds Which tips the guide contains. |
|
709 * @property {?string} currentTipId The guide's currently showing tip. |
|
710 * @property {?string} nextTipId The guide's next tip to show. |
|
711 */ |
|
712 |
|
713 /** |
|
714 * Returns an object describing the guide, if any, that the given tip is a part |
|
715 * of. |
|
716 * |
|
717 * @param {Object} state Global application state. |
|
718 * @param {string} tipId The tip to query. |
|
719 * |
|
720 * @return {?NUX.GuideInfo} Information about the associated guide. |
|
721 */ |
|
722 |
|
723 var getAssociatedGuide = Object(rememo["a" /* default */])(function (state, tipId) { |
|
724 var _iteratorNormalCompletion = true; |
|
725 var _didIteratorError = false; |
|
726 var _iteratorError = undefined; |
|
727 |
|
728 try { |
|
729 for (var _iterator = state.guides[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { |
|
730 var tipIds = _step.value; |
|
731 |
|
732 if (Object(external_lodash_["includes"])(tipIds, tipId)) { |
|
733 var nonDismissedTips = Object(external_lodash_["difference"])(tipIds, Object(external_lodash_["keys"])(state.preferences.dismissedTips)); |
|
734 |
|
735 var _nonDismissedTips = Object(slicedToArray["a" /* default */])(nonDismissedTips, 2), |
|
736 _nonDismissedTips$ = _nonDismissedTips[0], |
|
737 currentTipId = _nonDismissedTips$ === void 0 ? null : _nonDismissedTips$, |
|
738 _nonDismissedTips$2 = _nonDismissedTips[1], |
|
739 nextTipId = _nonDismissedTips$2 === void 0 ? null : _nonDismissedTips$2; |
|
740 |
|
741 return { |
|
742 tipIds: tipIds, |
|
743 currentTipId: currentTipId, |
|
744 nextTipId: nextTipId |
|
745 }; |
|
746 } |
|
747 } |
|
748 } catch (err) { |
|
749 _didIteratorError = true; |
|
750 _iteratorError = err; |
|
751 } finally { |
|
752 try { |
|
753 if (!_iteratorNormalCompletion && _iterator.return != null) { |
|
754 _iterator.return(); |
|
755 } |
|
756 } finally { |
|
757 if (_didIteratorError) { |
|
758 throw _iteratorError; |
|
759 } |
|
760 } |
|
761 } |
|
762 |
|
763 return null; |
|
764 }, function (state) { |
|
765 return [state.guides, state.preferences.dismissedTips]; |
|
766 }); |
|
767 /** |
|
768 * Determines whether or not the given tip is showing. Tips are hidden if they |
|
769 * are disabled, have been dismissed, or are not the current tip in any |
|
770 * guide that they have been added to. |
|
771 * |
|
772 * @param {Object} state Global application state. |
|
773 * @param {string} tipId The tip to query. |
|
774 * |
|
775 * @return {boolean} Whether or not the given tip is showing. |
|
776 */ |
|
777 |
|
778 function isTipVisible(state, tipId) { |
|
779 if (!state.preferences.areTipsEnabled) { |
|
780 return false; |
|
781 } |
|
782 |
|
783 if (state.preferences.dismissedTips[tipId]) { |
|
784 return false; |
|
785 } |
|
786 |
|
787 var associatedGuide = getAssociatedGuide(state, tipId); |
|
788 |
|
789 if (associatedGuide && associatedGuide.currentTipId !== tipId) { |
|
790 return false; |
|
791 } |
|
792 |
|
793 return true; |
|
794 } |
|
795 /** |
|
796 * Returns whether or not tips are globally enabled. |
|
797 * |
|
798 * @param {Object} state Global application state. |
|
799 * |
|
800 * @return {boolean} Whether tips are globally enabled. |
|
801 */ |
|
802 |
|
803 function selectors_areTipsEnabled(state) { |
|
804 return state.preferences.areTipsEnabled; |
|
805 } |
|
806 |
|
807 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/store/index.js |
|
808 /** |
|
809 * WordPress dependencies |
|
810 */ |
|
811 |
|
812 /** |
|
813 * Internal dependencies |
|
814 */ |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 var store = Object(external_this_wp_data_["registerStore"])('core/nux', { |
|
820 reducer: reducer, |
|
821 actions: actions_namespaceObject, |
|
822 selectors: selectors_namespaceObject, |
|
823 persist: ['preferences'] |
|
824 }); |
|
825 /* harmony default export */ var build_module_store = (store); |
|
826 |
|
827 // EXTERNAL MODULE: external {"this":["wp","element"]} |
|
828 var external_this_wp_element_ = __webpack_require__(0); |
|
829 |
|
830 // EXTERNAL MODULE: external {"this":["wp","compose"]} |
|
831 var external_this_wp_compose_ = __webpack_require__(6); |
|
832 |
|
833 // EXTERNAL MODULE: external {"this":["wp","components"]} |
|
834 var external_this_wp_components_ = __webpack_require__(4); |
|
835 |
|
836 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
837 var external_this_wp_i18n_ = __webpack_require__(1); |
|
838 |
|
839 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/components/dot-tip/index.js |
|
840 |
|
841 |
|
842 /** |
|
843 * WordPress dependencies |
|
844 */ |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 function getAnchorRect(anchor) { |
|
851 // The default getAnchorRect() excludes an element's top and bottom padding |
|
852 // from its calculation. We want tips to point to the outer margin of an |
|
853 // element, so we override getAnchorRect() to include all padding. |
|
854 return anchor.parentNode.getBoundingClientRect(); |
|
855 } |
|
856 |
|
857 function onClick(event) { |
|
858 // Tips are often nested within buttons. We stop propagation so that clicking |
|
859 // on a tip doesn't result in the button being clicked. |
|
860 event.stopPropagation(); |
|
861 } |
|
862 |
|
863 function DotTip(_ref) { |
|
864 var children = _ref.children, |
|
865 isVisible = _ref.isVisible, |
|
866 hasNextTip = _ref.hasNextTip, |
|
867 onDismiss = _ref.onDismiss, |
|
868 onDisable = _ref.onDisable; |
|
869 |
|
870 if (!isVisible) { |
|
871 return null; |
|
872 } |
|
873 |
|
874 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { |
|
875 className: "nux-dot-tip", |
|
876 position: "middle right", |
|
877 noArrow: true, |
|
878 focusOnMount: "container", |
|
879 getAnchorRect: getAnchorRect, |
|
880 role: "dialog", |
|
881 "aria-label": Object(external_this_wp_i18n_["__"])('Editor tips'), |
|
882 onClick: onClick |
|
883 }, Object(external_this_wp_element_["createElement"])("p", null, children), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { |
|
884 isLink: true, |
|
885 onClick: onDismiss |
|
886 }, hasNextTip ? Object(external_this_wp_i18n_["__"])('See next tip') : Object(external_this_wp_i18n_["__"])('Got it'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
|
887 className: "nux-dot-tip__disable", |
|
888 icon: "no-alt", |
|
889 label: Object(external_this_wp_i18n_["__"])('Disable tips'), |
|
890 onClick: onDisable |
|
891 })); |
|
892 } |
|
893 /* harmony default export */ var dot_tip = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { |
|
894 var tipId = _ref2.tipId; |
|
895 |
|
896 var _select = select('core/nux'), |
|
897 isTipVisible = _select.isTipVisible, |
|
898 getAssociatedGuide = _select.getAssociatedGuide; |
|
899 |
|
900 var associatedGuide = getAssociatedGuide(tipId); |
|
901 return { |
|
902 isVisible: isTipVisible(tipId), |
|
903 hasNextTip: !!(associatedGuide && associatedGuide.nextTipId) |
|
904 }; |
|
905 }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { |
|
906 var tipId = _ref3.tipId; |
|
907 |
|
908 var _dispatch = dispatch('core/nux'), |
|
909 dismissTip = _dispatch.dismissTip, |
|
910 disableTips = _dispatch.disableTips; |
|
911 |
|
912 return { |
|
913 onDismiss: function onDismiss() { |
|
914 dismissTip(tipId); |
|
915 }, |
|
916 onDisable: function onDisable() { |
|
917 disableTips(); |
|
918 } |
|
919 }; |
|
920 }))(DotTip)); |
|
921 |
|
922 // CONCATENATED MODULE: ./node_modules/@wordpress/nux/build-module/index.js |
|
923 /* concated harmony reexport DotTip */__webpack_require__.d(__webpack_exports__, "DotTip", function() { return dot_tip; }); |
|
924 /** |
|
925 * Internal dependencies |
|
926 */ |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 /***/ }), |
|
932 |
|
933 /***/ 38: |
|
934 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
935 |
|
936 "use strict"; |
|
937 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
938 function _nonIterableRest() { |
|
939 throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
|
940 } |
|
941 |
|
942 /***/ }), |
|
943 |
|
944 /***/ 4: |
|
945 /***/ (function(module, exports) { |
|
946 |
|
947 (function() { module.exports = this["wp"]["components"]; }()); |
|
948 |
|
949 /***/ }), |
|
950 |
|
951 /***/ 5: |
|
952 /***/ (function(module, exports) { |
|
953 |
|
954 (function() { module.exports = this["wp"]["data"]; }()); |
|
955 |
|
956 /***/ }), |
|
957 |
|
958 /***/ 6: |
|
959 /***/ (function(module, exports) { |
|
960 |
|
961 (function() { module.exports = this["wp"]["compose"]; }()); |
|
962 |
|
963 /***/ }), |
|
964 |
|
965 /***/ 7: |
|
966 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
967 |
|
968 "use strict"; |
|
969 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
970 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
971 |
|
972 function _objectSpread(target) { |
|
973 for (var i = 1; i < arguments.length; i++) { |
|
974 var source = arguments[i] != null ? arguments[i] : {}; |
|
975 var ownKeys = Object.keys(source); |
|
976 |
|
977 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
978 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
979 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
980 })); |
|
981 } |
|
982 |
|
983 ownKeys.forEach(function (key) { |
|
984 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
985 }); |
|
986 } |
|
987 |
|
988 return target; |
|
989 } |
|
990 |
|
991 /***/ }) |
|
992 |
|
993 /******/ }); |