| @@ -1,58 +1,59 @@ | ||
| 1 | 1 | /******/ (() => { // webpackBootstrap |
| 2 | -/******/ "use strict"; | |
| 3 | 2 | /******/ var __webpack_modules__ = ({ |
| 4 | 3 | |
| 5 | -/***/ "./assets/src/js/api.js" | |
| 6 | -/*!******************************!*\ | |
| 7 | - !*** ./assets/src/js/api.js ***! | |
| 8 | - \******************************/ | |
| 4 | +/***/ "./assets/src/js/lpToastify.js" | |
| 5 | +/*!*************************************!*\ | |
| 6 | + !*** ./assets/src/js/lpToastify.js ***! | |
| 7 | + \*************************************/ | |
| 9 | 8 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 10 | 9 | |
| 10 | +"use strict"; | |
| 11 | 11 | __webpack_require__.r(__webpack_exports__); |
| 12 | 12 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 | -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 13 | +/* harmony export */ show: () => (/* binding */ show) | |
| 14 | 14 | /* harmony export */ }); |
| 15 | -/** | |
| 16 | - * List API on backend | |
| 17 | - * | |
| 18 | - * @since 4.2.6 | |
| 19 | - * @version 1.0.2 | |
| 15 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js"); | |
| 16 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 17 | +/* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css"); | |
| 18 | +/** | |
| 19 | + * Utils functions | |
| 20 | + * | |
| 21 | + * @param url | |
| 22 | + * @param data | |
| 23 | + * @param functions | |
| 24 | + * @since 4.3.0 | |
| 25 | + * @version 1.0.0 | |
| 20 | 26 | */ |
| 21 | 27 | |
| 22 | -const lplistAPI = {}; | |
| 23 | -let lp_rest_url; | |
| 24 | -if ('undefined' !== typeof lpDataAdmin) { | |
| 25 | - lp_rest_url = lpDataAdmin.lp_rest_url; | |
| 26 | - lplistAPI.admin = { | |
| 27 | - apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 28 | - apiAddons: lp_rest_url + 'lp/v1/addon/all', | |
| 29 | - apiAddonAction: lp_rest_url + 'lp/v1/addon/action-n', | |
| 30 | - apiAddonsPurchase: lp_rest_url + 'lp/v1/addon/info-addons-purchase', | |
| 31 | - apiSearchCourses: lp_rest_url + 'lp/v1/admin/tools/search-course', | |
| 32 | - apiSearchUsers: lp_rest_url + 'lp/v1/admin/tools/search-user', | |
| 33 | - apiAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/assign-user-course', | |
| 34 | - apiUnAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/unassign-user-course' | |
| 35 | - }; | |
| 36 | -} | |
| 37 | -if ('undefined' !== typeof lpData) { | |
| 38 | - lp_rest_url = lpData.lp_rest_url; | |
| 39 | - lplistAPI.frontend = { | |
| 40 | - apiWidgets: lp_rest_url + 'lp/v1/widgets/api', | |
| 41 | - apiCourses: lp_rest_url + 'lp/v1/courses/archive-course', | |
| 42 | - // Deprecated API, don't load from v4.3.7 | |
| 43 | - apiAJAX: lp_rest_url + 'lp/v1/load_content_via_ajax/', | |
| 44 | - // Deprecated since 4.3.0 | |
| 45 | - apiProfileCoverImage: lp_rest_url + 'lp/v1/profile/cover-image' | |
| 46 | - }; | |
| 47 | -} | |
| 48 | -if (lp_rest_url) { | |
| 49 | - lplistAPI.apiCourses = lp_rest_url + 'lp/v1/courses/'; | |
| 50 | - lplistAPI.apiEditCoursesArchiveBlock = lp_rest_url + 'lp/v1/courses/edit-archive-block'; | |
| 51 | - lplistAPI.apiCoursesSuggest = lp_rest_url + 'lp/v1/courses/courses-suggest'; | |
| 52 | -} | |
| 53 | -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lplistAPI); | |
| 54 | 28 | |
| 29 | +const argsToastify = { | |
| 30 | + text: '', | |
| 31 | + gravity: lpData.toast.gravity, | |
| 32 | + // `top` or `bottom` | |
| 33 | + position: lpData.toast.position, | |
| 34 | + // `left`, `center` or `right` | |
| 35 | + className: `${lpData.toast.classPrefix}`, | |
| 36 | + close: lpData.toast.close == 1, | |
| 37 | + stopOnFocus: lpData.toast.stopOnFocus == 1, | |
| 38 | + duration: lpData.toast.duration | |
| 39 | +}; | |
| 40 | +const show = (message, status = 'success', argsCustom) => { | |
| 41 | + let args = argsToastify; | |
| 42 | + if (argsCustom) { | |
| 43 | + args = { | |
| 44 | + ...args, | |
| 45 | + ...argsCustom | |
| 46 | + }; | |
| 47 | + } | |
| 48 | + const toastify = new (toastify_js__WEBPACK_IMPORTED_MODULE_0___default())({ | |
| 49 | + ...args, | |
| 50 | + text: message, | |
| 51 | + className: `${lpData.toast.classPrefix} ${status}` | |
| 52 | + }); | |
| 53 | + toastify.showToast(); | |
| 54 | +}; | |
| 55 | + | |
| 55 | 56 | /***/ }, |
| 56 | 57 | |
| 57 | 58 | /***/ "./assets/src/js/utils.js" |
| 58 | 59 | /*!********************************!*\ |
| @@ -59,12 +60,14 @@ | ||
| 59 | 60 | !*** ./assets/src/js/utils.js ***! |
| 60 | 61 | \********************************/ |
| 61 | 62 | (__unused_webpack_module, __webpack_exports__, __webpack_require__) { |
| 62 | 63 | |
| 64 | +"use strict"; | |
| 63 | 65 | __webpack_require__.r(__webpack_exports__); |
| 64 | 66 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 65 | 67 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 66 | 68 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 69 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 67 | 70 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 68 | 71 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 69 | 72 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 70 | 73 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -76,18 +79,19 @@ | ||
| 76 | 79 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 77 | 80 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 78 | 81 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 79 | 82 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 80 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 83 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 84 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 81 | 85 | /* harmony export */ }); |
| 82 | -/** | |
| 83 | - * Utils functions | |
| 84 | - * | |
| 85 | - * @param url | |
| 86 | - * @param data | |
| 87 | - * @param functions | |
| 88 | - * @since 4.2.5.1 | |
| 89 | - * @version 1.0.6 | |
| 86 | +/** | |
| 87 | + * Utils functions | |
| 88 | + * | |
| 89 | + * @param url | |
| 90 | + * @param data | |
| 91 | + * @param functions | |
| 92 | + * @since 4.2.5.1 | |
| 93 | + * @version 1.0.7 | |
| 90 | 94 | */ |
| 91 | 95 | const lpClassName = { |
| 92 | 96 | hidden: 'lp-hidden', |
| 93 | 97 | loading: 'loading', |
| @@ -92,9 +96,12 @@ | ||
| 92 | 96 | hidden: 'lp-hidden', |
| 93 | 97 | loading: 'loading', |
| 94 | 98 | elCollapse: 'lp-collapse', |
| 95 | 99 | elSectionToggle: '.lp-section-toggle', |
| 96 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 100 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 101 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 102 | + elFullScreen: 'lp-full-screen-view', | |
| 103 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 97 | 104 | }; |
| 98 | 105 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 99 | 106 | if ('function' === typeof functions.before) { |
| 100 | 107 | functions.before(); |
| @@ -116,12 +123,12 @@ | ||
| 116 | 123 | } |
| 117 | 124 | }); |
| 118 | 125 | }; |
| 119 | 126 | |
| 120 | -/** | |
| 121 | - * Get current URL without params. | |
| 122 | - * | |
| 123 | - * @since 4.2.5.1 | |
| 127 | +/** | |
| 128 | + * Get current URL without params. | |
| 129 | + * | |
| 130 | + * @since 4.2.5.1 | |
| 124 | 131 | */ |
| 125 | 132 | const lpGetCurrentURLNoParam = () => { |
| 126 | 133 | let currentUrl = window.location.href; |
| 127 | 134 | const hasParams = currentUrl.includes('?'); |
| @@ -137,14 +144,14 @@ | ||
| 137 | 144 | }); |
| 138 | 145 | return url; |
| 139 | 146 | }; |
| 140 | 147 | |
| 141 | -/** | |
| 142 | - * Listen element viewed. | |
| 143 | - * | |
| 144 | - * @param el | |
| 145 | - * @param callback | |
| 146 | - * @since 4.2.5.8 | |
| 148 | +/** | |
| 149 | + * Listen element viewed. | |
| 150 | + * | |
| 151 | + * @param el | |
| 152 | + * @param callback | |
| 153 | + * @since 4.2.5.8 | |
| 147 | 154 | */ |
| 148 | 155 | const listenElementViewed = (el, callback) => { |
| 149 | 156 | const observerSeeItem = new IntersectionObserver(function (entries) { |
| 150 | 157 | for (const entry of entries) { |
| @@ -155,13 +162,13 @@ | ||
| 155 | 162 | }); |
| 156 | 163 | observerSeeItem.observe(el); |
| 157 | 164 | }; |
| 158 | 165 | |
| 159 | -/** | |
| 160 | - * Listen element created. | |
| 161 | - * | |
| 162 | - * @param callback | |
| 163 | - * @since 4.2.5.8 | |
| 166 | +/** | |
| 167 | + * Listen element created. | |
| 168 | + * | |
| 169 | + * @param callback | |
| 170 | + * @since 4.2.5.8 | |
| 164 | 171 | */ |
| 165 | 172 | const listenElementCreated = callback => { |
| 166 | 173 | const observerCreateItem = new MutationObserver(function (mutations) { |
| 167 | 174 | mutations.forEach(function (mutation) { |
| @@ -180,14 +187,14 @@ | ||
| 180 | 187 | }); |
| 181 | 188 | // End. |
| 182 | 189 | }; |
| 183 | 190 | |
| 184 | -/** | |
| 185 | - * Listen element created. | |
| 186 | - * | |
| 187 | - * @param selector | |
| 188 | - * @param callback | |
| 189 | - * @since 4.2.7.1 | |
| 191 | +/** | |
| 192 | + * Listen element created. | |
| 193 | + * | |
| 194 | + * @param selector | |
| 195 | + * @param callback | |
| 196 | + * @since 4.2.7.1 | |
| 190 | 197 | */ |
| 191 | 198 | const lpOnElementReady = (selector, callback) => { |
| 192 | 199 | const element = document.querySelector(selector); |
| 193 | 200 | if (element) { |
| @@ -328,17 +335,17 @@ | ||
| 328 | 335 | }; |
| 329 | 336 | return dataHandle; |
| 330 | 337 | }; |
| 331 | 338 | |
| 332 | -/** | |
| 333 | - * Event trigger | |
| 334 | - * For each list of event handlers, listen event on document. | |
| 335 | - * | |
| 336 | - * eventName: 'click', 'change', ... | |
| 337 | - * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ] | |
| 338 | - * | |
| 339 | - * @param eventName | |
| 340 | - * @param eventHandlers | |
| 339 | +/** | |
| 340 | + * Event trigger | |
| 341 | + * For each list of event handlers, listen event on document. | |
| 342 | + * | |
| 343 | + * eventName: 'click', 'change', ... | |
| 344 | + * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ] | |
| 345 | + * | |
| 346 | + * @param eventName | |
| 347 | + * @param eventHandlers | |
| 341 | 348 | */ |
| 342 | 349 | const eventHandlers = (eventName, eventHandlers) => { |
| 343 | 350 | document.addEventListener(eventName, e => { |
| 344 | 351 | const target = e.target; |
| @@ -379,32 +386,32 @@ | ||
| 379 | 386 | }); |
| 380 | 387 | }); |
| 381 | 388 | }; |
| 382 | 389 | |
| 383 | -/** | |
| 384 | - * Debounce - delays function execution until after `wait` ms of inactivity. | |
| 385 | - * | |
| 386 | - * Each call resets the timer. Only the last call in a burst executes. | |
| 387 | - * | |
| 388 | - * USE CASES: | |
| 389 | - * - Search inputs, form validation, window resize | |
| 390 | - * - Multiple elements need independent timers | |
| 391 | - * - When you need to call with different arguments | |
| 392 | - * | |
| 393 | - * EXAMPLES: | |
| 394 | - * const debouncedSearch = debounce( (query) => fetchResults(query), 300 ); | |
| 395 | - * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value)); | |
| 396 | - * | |
| 397 | - * const debouncedResize = debounce( recalculateLayout, 250 ); | |
| 398 | - * window.addEventListener('resize', debouncedResize); | |
| 399 | - * | |
| 400 | - * ⚠️ Create ONCE outside event handlers, not inside. | |
| 401 | - * | |
| 402 | - * @param {Function} func - Function to debounce (can be anonymous) | |
| 403 | - * @param {number} wait - Milliseconds to wait (default: 500) | |
| 404 | - * @return {Function} Debounced wrapper function | |
| 405 | - * @since 4.3.7 | |
| 406 | - * @version 1.0.0 | |
| 390 | +/** | |
| 391 | + * Debounce - delays function execution until after `wait` ms of inactivity. | |
| 392 | + * | |
| 393 | + * Each call resets the timer. Only the last call in a burst executes. | |
| 394 | + * | |
| 395 | + * USE CASES: | |
| 396 | + * - Search inputs, form validation, window resize | |
| 397 | + * - Multiple elements need independent timers | |
| 398 | + * - When you need to call with different arguments | |
| 399 | + * | |
| 400 | + * EXAMPLES: | |
| 401 | + * const debouncedSearch = debounce( (query) => fetchResults(query), 300 ); | |
| 402 | + * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value)); | |
| 403 | + * | |
| 404 | + * const debouncedResize = debounce( recalculateLayout, 250 ); | |
| 405 | + * window.addEventListener('resize', debouncedResize); | |
| 406 | + * | |
| 407 | + * ⚠️ Create ONCE outside event handlers, not inside. | |
| 408 | + * | |
| 409 | + * @param {Function} func - Function to debounce (can be anonymous) | |
| 410 | + * @param {number} wait - Milliseconds to wait (default: 500) | |
| 411 | + * @return {Function} Debounced wrapper function | |
| 412 | + * @since 4.3.7 | |
| 413 | + * @version 1.0.0 | |
| 407 | 414 | */ |
| 408 | 415 | const debounce = (func, wait = 500) => { |
| 409 | 416 | let timer; |
| 410 | 417 | return args => { |
| @@ -412,8 +419,1157 @@ | ||
| 412 | 419 | timer = setTimeout(() => func(args), wait); |
| 413 | 420 | }; |
| 414 | 421 | }; |
| 415 | 422 | |
| 423 | +/** | |
| 424 | + * Initialize lp-toggle-enable components. | |
| 425 | + * | |
| 426 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 427 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 428 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 429 | + * | |
| 430 | + * HTML structure: | |
| 431 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 432 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 433 | + * <span class="lp-toggle-enable__track"></span> | |
| 434 | + * </label> | |
| 435 | + * | |
| 436 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 437 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 438 | + * @since 4.4.5 | |
| 439 | + * @version 1.0.0 | |
| 440 | + */ | |
| 441 | +window.lpToggleEnableInit = 0; | |
| 442 | +const toggleEnable = (onToggle = null) => { | |
| 443 | + if (window.lpToggleEnableInit) { | |
| 444 | + return; | |
| 445 | + } | |
| 446 | + window.lpToggleEnableInit = 1; | |
| 447 | + const selector = '.lp-toggle-enable'; | |
| 448 | + const updateUI = (toggle, isEnabled) => { | |
| 449 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 450 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 451 | + if (input) { | |
| 452 | + input.checked = isEnabled; | |
| 453 | + input.value = isEnabled ? '1' : '0'; | |
| 454 | + } | |
| 455 | + }; | |
| 456 | + | |
| 457 | + // Delegate click handling via eventHandlers. | |
| 458 | + eventHandlers('click', [{ | |
| 459 | + selector, | |
| 460 | + callBack: args => { | |
| 461 | + const { | |
| 462 | + e, | |
| 463 | + target | |
| 464 | + } = args; | |
| 465 | + const toggle = target.closest(selector); | |
| 466 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 467 | + return; | |
| 468 | + } | |
| 469 | + e.preventDefault(); | |
| 470 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 471 | + updateUI(toggle, isEnabled); | |
| 472 | + if ('function' === typeof onToggle) { | |
| 473 | + onToggle(toggle, isEnabled); | |
| 474 | + } | |
| 475 | + } | |
| 476 | + }]); | |
| 477 | +}; | |
| 478 | + | |
| 479 | +/** | |
| 480 | + * Initialize custom fullscreen view buttons. | |
| 481 | + * | |
| 482 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 483 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 484 | + * target element. Falls back to the button's parent element when | |
| 485 | + * `data-target` is not provided. | |
| 486 | + * | |
| 487 | + * @since 4.4.5 | |
| 488 | + * @version 1.0.0 | |
| 489 | + */ | |
| 490 | +window.lpFullScreenViewInit = 0; | |
| 491 | +const fullScreenView = () => { | |
| 492 | + if (window.lpFullScreenViewInit) { | |
| 493 | + return; | |
| 494 | + } | |
| 495 | + window.lpFullScreenViewInit = 1; | |
| 496 | + let lastScrollY = 0; | |
| 497 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 498 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 499 | + if (isFullscreen) { | |
| 500 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 501 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 502 | + window.scrollTo(0, lastScrollY); | |
| 503 | + } else { | |
| 504 | + lastScrollY = window.scrollY; | |
| 505 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 506 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 507 | + } | |
| 508 | + if (!isFullscreen) { | |
| 509 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 510 | + const closeButton = document.createElement('button'); | |
| 511 | + closeButton.type = 'button'; | |
| 512 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 513 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 514 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 515 | + closeButton.addEventListener('click', e => { | |
| 516 | + e.preventDefault(); | |
| 517 | + lpToggleFullscreenView(elTarget); | |
| 518 | + }); | |
| 519 | + elTarget.appendChild(closeButton); | |
| 520 | + } | |
| 521 | + } else { | |
| 522 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 523 | + if (closeButton) { | |
| 524 | + closeButton.remove(); | |
| 525 | + } | |
| 526 | + } | |
| 527 | + }; | |
| 528 | + eventHandlers('click', [{ | |
| 529 | + selector: lpClassName.elBtnFullScreen, | |
| 530 | + callBack: args => { | |
| 531 | + const { | |
| 532 | + e, | |
| 533 | + target | |
| 534 | + } = args; | |
| 535 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 536 | + if (!elBtnFullScreen) { | |
| 537 | + console.log('No full screen button found'); | |
| 538 | + return; | |
| 539 | + } | |
| 540 | + e.preventDefault(); | |
| 541 | + let elTarget = null; | |
| 542 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 543 | + console.log(targetSelector); | |
| 544 | + if (targetSelector) { | |
| 545 | + elTarget = document.querySelector(targetSelector); | |
| 546 | + } | |
| 547 | + if (!elTarget) { | |
| 548 | + console.log('No target element found'); | |
| 549 | + return; | |
| 550 | + } | |
| 551 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 552 | + } | |
| 553 | + }]); | |
| 554 | +}; | |
| 555 | + | |
| 556 | +/***/ }, | |
| 557 | + | |
| 558 | +/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css" | |
| 559 | +/*!*****************************************************************************************!*\ | |
| 560 | + !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***! | |
| 561 | + \*****************************************************************************************/ | |
| 562 | +(module, __webpack_exports__, __webpack_require__) { | |
| 563 | + | |
| 564 | +"use strict"; | |
| 565 | +__webpack_require__.r(__webpack_exports__); | |
| 566 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 567 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 568 | +/* harmony export */ }); | |
| 569 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js"); | |
| 570 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 571 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); | |
| 572 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 573 | +// Imports | |
| 574 | + | |
| 575 | + | |
| 576 | +var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); | |
| 577 | +// Module | |
| 578 | +___CSS_LOADER_EXPORT___.push([module.id, `/*! | |
| 579 | + * Toastify js 1.12.0 | |
| 580 | + * https://github.com/apvarun/toastify-js | |
| 581 | + * @license MIT licensed | |
| 582 | + * | |
| 583 | + * Copyright (C) 2018 Varun A P | |
| 584 | + */ | |
| 585 | + | |
| 586 | +.toastify { | |
| 587 | + padding: 12px 20px; | |
| 588 | + color: #ffffff; | |
| 589 | + display: inline-block; | |
| 590 | + box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3); | |
| 591 | + background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5); | |
| 592 | + background: linear-gradient(135deg, #73a5ff, #5477f5); | |
| 593 | + position: fixed; | |
| 594 | + opacity: 0; | |
| 595 | + transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); | |
| 596 | + border-radius: 2px; | |
| 597 | + cursor: pointer; | |
| 598 | + text-decoration: none; | |
| 599 | + max-width: calc(50% - 20px); | |
| 600 | + z-index: 2147483647; | |
| 601 | +} | |
| 602 | + | |
| 603 | +.toastify.on { | |
| 604 | + opacity: 1; | |
| 605 | +} | |
| 606 | + | |
| 607 | +.toast-close { | |
| 608 | + background: transparent; | |
| 609 | + border: 0; | |
| 610 | + color: white; | |
| 611 | + cursor: pointer; | |
| 612 | + font-family: inherit; | |
| 613 | + font-size: 1em; | |
| 614 | + opacity: 0.4; | |
| 615 | + padding: 0 5px; | |
| 616 | +} | |
| 617 | + | |
| 618 | +.toastify-right { | |
| 619 | + right: 15px; | |
| 620 | +} | |
| 621 | + | |
| 622 | +.toastify-left { | |
| 623 | + left: 15px; | |
| 624 | +} | |
| 625 | + | |
| 626 | +.toastify-top { | |
| 627 | + top: -150px; | |
| 628 | +} | |
| 629 | + | |
| 630 | +.toastify-bottom { | |
| 631 | + bottom: -150px; | |
| 632 | +} | |
| 633 | + | |
| 634 | +.toastify-rounded { | |
| 635 | + border-radius: 25px; | |
| 636 | +} | |
| 637 | + | |
| 638 | +.toastify-avatar { | |
| 639 | + width: 1.5em; | |
| 640 | + height: 1.5em; | |
| 641 | + margin: -7px 5px; | |
| 642 | + border-radius: 2px; | |
| 643 | +} | |
| 644 | + | |
| 645 | +.toastify-center { | |
| 646 | + margin-left: auto; | |
| 647 | + margin-right: auto; | |
| 648 | + left: 0; | |
| 649 | + right: 0; | |
| 650 | + max-width: fit-content; | |
| 651 | + max-width: -moz-fit-content; | |
| 652 | +} | |
| 653 | + | |
| 654 | +@media only screen and (max-width: 360px) { | |
| 655 | + .toastify-right, .toastify-left { | |
| 656 | + margin-left: auto; | |
| 657 | + margin-right: auto; | |
| 658 | + left: 0; | |
| 659 | + right: 0; | |
| 660 | + max-width: fit-content; | |
| 661 | + } | |
| 662 | +} | |
| 663 | +`, "",{"version":3,"sources":["webpack://./node_modules/toastify-js/src/toastify.css"],"names":[],"mappings":"AAAA;;;;;;EAME;;AAEF;IACI,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,uFAAuF;IACvF,6DAA6D;IAC7D,qDAAqD;IACrD,eAAe;IACf,UAAU;IACV,wDAAwD;IACxD,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,mBAAmB;AACvB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,SAAS;IACT,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,YAAY;IACZ,cAAc;AAClB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,sBAAsB;IACtB,2BAA2B;AAC/B;;AAEA;IACI;QACI,iBAAiB;QACjB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,sBAAsB;IAC1B;AACJ","sourcesContent":["/*!\n * Toastify js 1.12.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n.toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n}\n\n.toastify.on {\n opacity: 1;\n}\n\n.toast-close {\n background: transparent;\n border: 0;\n color: white;\n cursor: pointer;\n font-family: inherit;\n font-size: 1em;\n opacity: 0.4;\n padding: 0 5px;\n}\n\n.toastify-right {\n right: 15px;\n}\n\n.toastify-left {\n left: 15px;\n}\n\n.toastify-top {\n top: -150px;\n}\n\n.toastify-bottom {\n bottom: -150px;\n}\n\n.toastify-rounded {\n border-radius: 25px;\n}\n\n.toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: -7px 5px;\n border-radius: 2px;\n}\n\n.toastify-center {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n max-width: -moz-fit-content;\n}\n\n@media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n}\n"],"sourceRoot":""}]); | |
| 664 | +// Exports | |
| 665 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); | |
| 666 | + | |
| 667 | + | |
| 668 | +/***/ }, | |
| 669 | + | |
| 670 | +/***/ "./node_modules/css-loader/dist/runtime/api.js" | |
| 671 | +/*!*****************************************************!*\ | |
| 672 | + !*** ./node_modules/css-loader/dist/runtime/api.js ***! | |
| 673 | + \*****************************************************/ | |
| 674 | +(module) { | |
| 675 | + | |
| 676 | +"use strict"; | |
| 677 | + | |
| 678 | + | |
| 679 | +/* | |
| 680 | + MIT License http://www.opensource.org/licenses/mit-license.php | |
| 681 | + Author Tobias Koppers @sokra | |
| 682 | +*/ | |
| 683 | +module.exports = function (cssWithMappingToString) { | |
| 684 | + var list = []; | |
| 685 | + | |
| 686 | + // return the list of modules as css string | |
| 687 | + list.toString = function toString() { | |
| 688 | + return this.map(function (item) { | |
| 689 | + var content = ""; | |
| 690 | + var needLayer = typeof item[5] !== "undefined"; | |
| 691 | + if (item[4]) { | |
| 692 | + content += "@supports (".concat(item[4], ") {"); | |
| 693 | + } | |
| 694 | + if (item[2]) { | |
| 695 | + content += "@media ".concat(item[2], " {"); | |
| 696 | + } | |
| 697 | + if (needLayer) { | |
| 698 | + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); | |
| 699 | + } | |
| 700 | + content += cssWithMappingToString(item); | |
| 701 | + if (needLayer) { | |
| 702 | + content += "}"; | |
| 703 | + } | |
| 704 | + if (item[2]) { | |
| 705 | + content += "}"; | |
| 706 | + } | |
| 707 | + if (item[4]) { | |
| 708 | + content += "}"; | |
| 709 | + } | |
| 710 | + return content; | |
| 711 | + }).join(""); | |
| 712 | + }; | |
| 713 | + | |
| 714 | + // import a list of modules into the list | |
| 715 | + list.i = function i(modules, media, dedupe, supports, layer) { | |
| 716 | + if (typeof modules === "string") { | |
| 717 | + modules = [[null, modules, undefined]]; | |
| 718 | + } | |
| 719 | + var alreadyImportedModules = {}; | |
| 720 | + if (dedupe) { | |
| 721 | + for (var k = 0; k < this.length; k++) { | |
| 722 | + var id = this[k][0]; | |
| 723 | + if (id != null) { | |
| 724 | + alreadyImportedModules[id] = true; | |
| 725 | + } | |
| 726 | + } | |
| 727 | + } | |
| 728 | + for (var _k = 0; _k < modules.length; _k++) { | |
| 729 | + var item = [].concat(modules[_k]); | |
| 730 | + if (dedupe && alreadyImportedModules[item[0]]) { | |
| 731 | + continue; | |
| 732 | + } | |
| 733 | + if (typeof layer !== "undefined") { | |
| 734 | + if (typeof item[5] === "undefined") { | |
| 735 | + item[5] = layer; | |
| 736 | + } else { | |
| 737 | + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); | |
| 738 | + item[5] = layer; | |
| 739 | + } | |
| 740 | + } | |
| 741 | + if (media) { | |
| 742 | + if (!item[2]) { | |
| 743 | + item[2] = media; | |
| 744 | + } else { | |
| 745 | + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); | |
| 746 | + item[2] = media; | |
| 747 | + } | |
| 748 | + } | |
| 749 | + if (supports) { | |
| 750 | + if (!item[4]) { | |
| 751 | + item[4] = "".concat(supports); | |
| 752 | + } else { | |
| 753 | + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); | |
| 754 | + item[4] = supports; | |
| 755 | + } | |
| 756 | + } | |
| 757 | + list.push(item); | |
| 758 | + } | |
| 759 | + }; | |
| 760 | + return list; | |
| 761 | +}; | |
| 762 | + | |
| 763 | +/***/ }, | |
| 764 | + | |
| 765 | +/***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js" | |
| 766 | +/*!************************************************************!*\ | |
| 767 | + !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***! | |
| 768 | + \************************************************************/ | |
| 769 | +(module) { | |
| 770 | + | |
| 771 | +"use strict"; | |
| 772 | + | |
| 773 | + | |
| 774 | +module.exports = function (item) { | |
| 775 | + var content = item[1]; | |
| 776 | + var cssMapping = item[3]; | |
| 777 | + if (!cssMapping) { | |
| 778 | + return content; | |
| 779 | + } | |
| 780 | + if (typeof btoa === "function") { | |
| 781 | + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); | |
| 782 | + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); | |
| 783 | + var sourceMapping = "/*# ".concat(data, " */"); | |
| 784 | + return [content].concat([sourceMapping]).join("\n"); | |
| 785 | + } | |
| 786 | + return [content].join("\n"); | |
| 787 | +}; | |
| 788 | + | |
| 789 | +/***/ }, | |
| 790 | + | |
| 791 | +/***/ "./node_modules/toastify-js/src/toastify.css" | |
| 792 | +/*!***************************************************!*\ | |
| 793 | + !*** ./node_modules/toastify-js/src/toastify.css ***! | |
| 794 | + \***************************************************/ | |
| 795 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 796 | + | |
| 797 | +"use strict"; | |
| 798 | +__webpack_require__.r(__webpack_exports__); | |
| 799 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 800 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 801 | +/* harmony export */ }); | |
| 802 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); | |
| 803 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 804 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"); | |
| 805 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 806 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js"); | |
| 807 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__); | |
| 808 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); | |
| 809 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__); | |
| 810 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"); | |
| 811 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__); | |
| 812 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"); | |
| 813 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__); | |
| 814 | +/* harmony import */ var _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js!./toastify.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"); | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | +var options = {}; | |
| 827 | + | |
| 828 | +options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default()); | |
| 829 | +options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default()); | |
| 830 | + | |
| 831 | + options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head"); | |
| 832 | + | |
| 833 | +options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default()); | |
| 834 | +options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default()); | |
| 835 | + | |
| 836 | +var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"], options); | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined); | |
| 842 | + | |
| 843 | + | |
| 844 | +/***/ }, | |
| 845 | + | |
| 846 | +/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js" | |
| 847 | +/*!****************************************************************************!*\ | |
| 848 | + !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! | |
| 849 | + \****************************************************************************/ | |
| 850 | +(module) { | |
| 851 | + | |
| 852 | +"use strict"; | |
| 853 | + | |
| 854 | + | |
| 855 | +var stylesInDOM = []; | |
| 856 | +function getIndexByIdentifier(identifier) { | |
| 857 | + var result = -1; | |
| 858 | + for (var i = 0; i < stylesInDOM.length; i++) { | |
| 859 | + if (stylesInDOM[i].identifier === identifier) { | |
| 860 | + result = i; | |
| 861 | + break; | |
| 862 | + } | |
| 863 | + } | |
| 864 | + return result; | |
| 865 | +} | |
| 866 | +function modulesToDom(list, options) { | |
| 867 | + var idCountMap = {}; | |
| 868 | + var identifiers = []; | |
| 869 | + for (var i = 0; i < list.length; i++) { | |
| 870 | + var item = list[i]; | |
| 871 | + var id = options.base ? item[0] + options.base : item[0]; | |
| 872 | + var count = idCountMap[id] || 0; | |
| 873 | + var identifier = "".concat(id, " ").concat(count); | |
| 874 | + idCountMap[id] = count + 1; | |
| 875 | + var indexByIdentifier = getIndexByIdentifier(identifier); | |
| 876 | + var obj = { | |
| 877 | + css: item[1], | |
| 878 | + media: item[2], | |
| 879 | + sourceMap: item[3], | |
| 880 | + supports: item[4], | |
| 881 | + layer: item[5] | |
| 882 | + }; | |
| 883 | + if (indexByIdentifier !== -1) { | |
| 884 | + stylesInDOM[indexByIdentifier].references++; | |
| 885 | + stylesInDOM[indexByIdentifier].updater(obj); | |
| 886 | + } else { | |
| 887 | + var updater = addElementStyle(obj, options); | |
| 888 | + options.byIndex = i; | |
| 889 | + stylesInDOM.splice(i, 0, { | |
| 890 | + identifier: identifier, | |
| 891 | + updater: updater, | |
| 892 | + references: 1 | |
| 893 | + }); | |
| 894 | + } | |
| 895 | + identifiers.push(identifier); | |
| 896 | + } | |
| 897 | + return identifiers; | |
| 898 | +} | |
| 899 | +function addElementStyle(obj, options) { | |
| 900 | + var api = options.domAPI(options); | |
| 901 | + api.update(obj); | |
| 902 | + var updater = function updater(newObj) { | |
| 903 | + if (newObj) { | |
| 904 | + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { | |
| 905 | + return; | |
| 906 | + } | |
| 907 | + api.update(obj = newObj); | |
| 908 | + } else { | |
| 909 | + api.remove(); | |
| 910 | + } | |
| 911 | + }; | |
| 912 | + return updater; | |
| 913 | +} | |
| 914 | +module.exports = function (list, options) { | |
| 915 | + options = options || {}; | |
| 916 | + list = list || []; | |
| 917 | + var lastIdentifiers = modulesToDom(list, options); | |
| 918 | + return function update(newList) { | |
| 919 | + newList = newList || []; | |
| 920 | + for (var i = 0; i < lastIdentifiers.length; i++) { | |
| 921 | + var identifier = lastIdentifiers[i]; | |
| 922 | + var index = getIndexByIdentifier(identifier); | |
| 923 | + stylesInDOM[index].references--; | |
| 924 | + } | |
| 925 | + var newLastIdentifiers = modulesToDom(newList, options); | |
| 926 | + for (var _i = 0; _i < lastIdentifiers.length; _i++) { | |
| 927 | + var _identifier = lastIdentifiers[_i]; | |
| 928 | + var _index = getIndexByIdentifier(_identifier); | |
| 929 | + if (stylesInDOM[_index].references === 0) { | |
| 930 | + stylesInDOM[_index].updater(); | |
| 931 | + stylesInDOM.splice(_index, 1); | |
| 932 | + } | |
| 933 | + } | |
| 934 | + lastIdentifiers = newLastIdentifiers; | |
| 935 | + }; | |
| 936 | +}; | |
| 937 | + | |
| 938 | +/***/ }, | |
| 939 | + | |
| 940 | +/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js" | |
| 941 | +/*!********************************************************************!*\ | |
| 942 | + !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***! | |
| 943 | + \********************************************************************/ | |
| 944 | +(module) { | |
| 945 | + | |
| 946 | +"use strict"; | |
| 947 | + | |
| 948 | + | |
| 949 | +var memo = {}; | |
| 950 | + | |
| 951 | +/* istanbul ignore next */ | |
| 952 | +function getTarget(target) { | |
| 953 | + if (typeof memo[target] === "undefined") { | |
| 954 | + var styleTarget = document.querySelector(target); | |
| 955 | + | |
| 956 | + // Special case to return head of iframe instead of iframe itself | |
| 957 | + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { | |
| 958 | + try { | |
| 959 | + // This will throw an exception if access to iframe is blocked | |
| 960 | + // due to cross-origin restrictions | |
| 961 | + styleTarget = styleTarget.contentDocument.head; | |
| 962 | + } catch (e) { | |
| 963 | + // istanbul ignore next | |
| 964 | + styleTarget = null; | |
| 965 | + } | |
| 966 | + } | |
| 967 | + memo[target] = styleTarget; | |
| 968 | + } | |
| 969 | + return memo[target]; | |
| 970 | +} | |
| 971 | + | |
| 972 | +/* istanbul ignore next */ | |
| 973 | +function insertBySelector(insert, style) { | |
| 974 | + var target = getTarget(insert); | |
| 975 | + if (!target) { | |
| 976 | + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); | |
| 977 | + } | |
| 978 | + target.appendChild(style); | |
| 979 | +} | |
| 980 | +module.exports = insertBySelector; | |
| 981 | + | |
| 982 | +/***/ }, | |
| 983 | + | |
| 984 | +/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js" | |
| 985 | +/*!**********************************************************************!*\ | |
| 986 | + !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***! | |
| 987 | + \**********************************************************************/ | |
| 988 | +(module) { | |
| 989 | + | |
| 990 | +"use strict"; | |
| 991 | + | |
| 992 | + | |
| 993 | +/* istanbul ignore next */ | |
| 994 | +function insertStyleElement(options) { | |
| 995 | + var element = document.createElement("style"); | |
| 996 | + options.setAttributes(element, options.attributes); | |
| 997 | + options.insert(element, options.options); | |
| 998 | + return element; | |
| 999 | +} | |
| 1000 | +module.exports = insertStyleElement; | |
| 1001 | + | |
| 1002 | +/***/ }, | |
| 1003 | + | |
| 1004 | +/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js" | |
| 1005 | +/*!**********************************************************************************!*\ | |
| 1006 | + !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! | |
| 1007 | + \**********************************************************************************/ | |
| 1008 | +(module, __unused_webpack_exports, __webpack_require__) { | |
| 1009 | + | |
| 1010 | +"use strict"; | |
| 1011 | + | |
| 1012 | + | |
| 1013 | +/* istanbul ignore next */ | |
| 1014 | +function setAttributesWithoutAttributes(styleElement) { | |
| 1015 | + var nonce = true ? __webpack_require__.nc : 0; | |
| 1016 | + if (nonce) { | |
| 1017 | + styleElement.setAttribute("nonce", nonce); | |
| 1018 | + } | |
| 1019 | +} | |
| 1020 | +module.exports = setAttributesWithoutAttributes; | |
| 1021 | + | |
| 1022 | +/***/ }, | |
| 1023 | + | |
| 1024 | +/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js" | |
| 1025 | +/*!***************************************************************!*\ | |
| 1026 | + !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***! | |
| 1027 | + \***************************************************************/ | |
| 1028 | +(module) { | |
| 1029 | + | |
| 1030 | +"use strict"; | |
| 1031 | + | |
| 1032 | + | |
| 1033 | +/* istanbul ignore next */ | |
| 1034 | +function apply(styleElement, options, obj) { | |
| 1035 | + var css = ""; | |
| 1036 | + if (obj.supports) { | |
| 1037 | + css += "@supports (".concat(obj.supports, ") {"); | |
| 1038 | + } | |
| 1039 | + if (obj.media) { | |
| 1040 | + css += "@media ".concat(obj.media, " {"); | |
| 1041 | + } | |
| 1042 | + var needLayer = typeof obj.layer !== "undefined"; | |
| 1043 | + if (needLayer) { | |
| 1044 | + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); | |
| 1045 | + } | |
| 1046 | + css += obj.css; | |
| 1047 | + if (needLayer) { | |
| 1048 | + css += "}"; | |
| 1049 | + } | |
| 1050 | + if (obj.media) { | |
| 1051 | + css += "}"; | |
| 1052 | + } | |
| 1053 | + if (obj.supports) { | |
| 1054 | + css += "}"; | |
| 1055 | + } | |
| 1056 | + var sourceMap = obj.sourceMap; | |
| 1057 | + if (sourceMap && typeof btoa !== "undefined") { | |
| 1058 | + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); | |
| 1059 | + } | |
| 1060 | + | |
| 1061 | + // For old IE | |
| 1062 | + /* istanbul ignore if */ | |
| 1063 | + options.styleTagTransform(css, styleElement, options.options); | |
| 1064 | +} | |
| 1065 | +function removeStyleElement(styleElement) { | |
| 1066 | + // istanbul ignore if | |
| 1067 | + if (styleElement.parentNode === null) { | |
| 1068 | + return false; | |
| 1069 | + } | |
| 1070 | + styleElement.parentNode.removeChild(styleElement); | |
| 1071 | +} | |
| 1072 | + | |
| 1073 | +/* istanbul ignore next */ | |
| 1074 | +function domAPI(options) { | |
| 1075 | + if (typeof document === "undefined") { | |
| 1076 | + return { | |
| 1077 | + update: function update() {}, | |
| 1078 | + remove: function remove() {} | |
| 1079 | + }; | |
| 1080 | + } | |
| 1081 | + var styleElement = options.insertStyleElement(options); | |
| 1082 | + return { | |
| 1083 | + update: function update(obj) { | |
| 1084 | + apply(styleElement, options, obj); | |
| 1085 | + }, | |
| 1086 | + remove: function remove() { | |
| 1087 | + removeStyleElement(styleElement); | |
| 1088 | + } | |
| 1089 | + }; | |
| 1090 | +} | |
| 1091 | +module.exports = domAPI; | |
| 1092 | + | |
| 1093 | +/***/ }, | |
| 1094 | + | |
| 1095 | +/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js" | |
| 1096 | +/*!*********************************************************************!*\ | |
| 1097 | + !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***! | |
| 1098 | + \*********************************************************************/ | |
| 1099 | +(module) { | |
| 1100 | + | |
| 1101 | +"use strict"; | |
| 1102 | + | |
| 1103 | + | |
| 1104 | +/* istanbul ignore next */ | |
| 1105 | +function styleTagTransform(css, styleElement) { | |
| 1106 | + if (styleElement.styleSheet) { | |
| 1107 | + styleElement.styleSheet.cssText = css; | |
| 1108 | + } else { | |
| 1109 | + while (styleElement.firstChild) { | |
| 1110 | + styleElement.removeChild(styleElement.firstChild); | |
| 1111 | + } | |
| 1112 | + styleElement.appendChild(document.createTextNode(css)); | |
| 1113 | + } | |
| 1114 | +} | |
| 1115 | +module.exports = styleTagTransform; | |
| 1116 | + | |
| 1117 | +/***/ }, | |
| 1118 | + | |
| 1119 | +/***/ "./node_modules/toastify-js/src/toastify.js" | |
| 1120 | +/*!**************************************************!*\ | |
| 1121 | + !*** ./node_modules/toastify-js/src/toastify.js ***! | |
| 1122 | + \**************************************************/ | |
| 1123 | +(module) { | |
| 1124 | + | |
| 1125 | +/*! | |
| 1126 | + * Toastify js 1.12.0 | |
| 1127 | + * https://github.com/apvarun/toastify-js | |
| 1128 | + * @license MIT licensed | |
| 1129 | + * | |
| 1130 | + * Copyright (C) 2018 Varun A P | |
| 1131 | + */ | |
| 1132 | +(function(root, factory) { | |
| 1133 | + if ( true && module.exports) { | |
| 1134 | + module.exports = factory(); | |
| 1135 | + } else { | |
| 1136 | + root.Toastify = factory(); | |
| 1137 | + } | |
| 1138 | +})(this, function(global) { | |
| 1139 | + // Object initialization | |
| 1140 | + var Toastify = function(options) { | |
| 1141 | + // Returning a new init object | |
| 1142 | + return new Toastify.lib.init(options); | |
| 1143 | + }, | |
| 1144 | + // Library version | |
| 1145 | + version = "1.12.0"; | |
| 1146 | + | |
| 1147 | + // Set the default global options | |
| 1148 | + Toastify.defaults = { | |
| 1149 | + oldestFirst: true, | |
| 1150 | + text: "Toastify is awesome!", | |
| 1151 | + node: undefined, | |
| 1152 | + duration: 3000, | |
| 1153 | + selector: undefined, | |
| 1154 | + callback: function () { | |
| 1155 | + }, | |
| 1156 | + destination: undefined, | |
| 1157 | + newWindow: false, | |
| 1158 | + close: false, | |
| 1159 | + gravity: "toastify-top", | |
| 1160 | + positionLeft: false, | |
| 1161 | + position: '', | |
| 1162 | + backgroundColor: '', | |
| 1163 | + avatar: "", | |
| 1164 | + className: "", | |
| 1165 | + stopOnFocus: true, | |
| 1166 | + onClick: function () { | |
| 1167 | + }, | |
| 1168 | + offset: {x: 0, y: 0}, | |
| 1169 | + escapeMarkup: true, | |
| 1170 | + ariaLive: 'polite', | |
| 1171 | + style: {background: ''} | |
| 1172 | + }; | |
| 1173 | + | |
| 1174 | + // Defining the prototype of the object | |
| 1175 | + Toastify.lib = Toastify.prototype = { | |
| 1176 | + toastify: version, | |
| 1177 | + | |
| 1178 | + constructor: Toastify, | |
| 1179 | + | |
| 1180 | + // Initializing the object with required parameters | |
| 1181 | + init: function(options) { | |
| 1182 | + // Verifying and validating the input object | |
| 1183 | + if (!options) { | |
| 1184 | + options = {}; | |
| 1185 | + } | |
| 1186 | + | |
| 1187 | + // Creating the options object | |
| 1188 | + this.options = {}; | |
| 1189 | + | |
| 1190 | + this.toastElement = null; | |
| 1191 | + | |
| 1192 | + // Validating the options | |
| 1193 | + this.options.text = options.text || Toastify.defaults.text; // Display message | |
| 1194 | + this.options.node = options.node || Toastify.defaults.node; // Display content as node | |
| 1195 | + this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration | |
| 1196 | + this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector | |
| 1197 | + this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display | |
| 1198 | + this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination | |
| 1199 | + this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window | |
| 1200 | + this.options.close = options.close || Toastify.defaults.close; // Show toast close icon | |
| 1201 | + this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom | |
| 1202 | + this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right | |
| 1203 | + this.options.position = options.position || Toastify.defaults.position; // toast position - left or right | |
| 1204 | + this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color | |
| 1205 | + this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path | |
| 1206 | + this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast | |
| 1207 | + this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus | |
| 1208 | + this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click | |
| 1209 | + this.options.offset = options.offset || Toastify.defaults.offset; // toast offset | |
| 1210 | + this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup; | |
| 1211 | + this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive; | |
| 1212 | + this.options.style = options.style || Toastify.defaults.style; | |
| 1213 | + if(options.backgroundColor) { | |
| 1214 | + this.options.style.background = options.backgroundColor; | |
| 1215 | + } | |
| 1216 | + | |
| 1217 | + // Returning the current object for chaining functions | |
| 1218 | + return this; | |
| 1219 | + }, | |
| 1220 | + | |
| 1221 | + // Building the DOM element | |
| 1222 | + buildToast: function() { | |
| 1223 | + // Validating if the options are defined | |
| 1224 | + if (!this.options) { | |
| 1225 | + throw "Toastify is not initialized"; | |
| 1226 | + } | |
| 1227 | + | |
| 1228 | + // Creating the DOM object | |
| 1229 | + var divElement = document.createElement("div"); | |
| 1230 | + divElement.className = "toastify on " + this.options.className; | |
| 1231 | + | |
| 1232 | + // Positioning toast to left or right or center | |
| 1233 | + if (!!this.options.position) { | |
| 1234 | + divElement.className += " toastify-" + this.options.position; | |
| 1235 | + } else { | |
| 1236 | + // To be depreciated in further versions | |
| 1237 | + if (this.options.positionLeft === true) { | |
| 1238 | + divElement.className += " toastify-left"; | |
| 1239 | + console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.') | |
| 1240 | + } else { | |
| 1241 | + // Default position | |
| 1242 | + divElement.className += " toastify-right"; | |
| 1243 | + } | |
| 1244 | + } | |
| 1245 | + | |
| 1246 | + // Assigning gravity of element | |
| 1247 | + divElement.className += " " + this.options.gravity; | |
| 1248 | + | |
| 1249 | + if (this.options.backgroundColor) { | |
| 1250 | + // This is being deprecated in favor of using the style HTML DOM property | |
| 1251 | + console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.'); | |
| 1252 | + } | |
| 1253 | + | |
| 1254 | + // Loop through our style object and apply styles to divElement | |
| 1255 | + for (var property in this.options.style) { | |
| 1256 | + divElement.style[property] = this.options.style[property]; | |
| 1257 | + } | |
| 1258 | + | |
| 1259 | + // Announce the toast to screen readers | |
| 1260 | + if (this.options.ariaLive) { | |
| 1261 | + divElement.setAttribute('aria-live', this.options.ariaLive) | |
| 1262 | + } | |
| 1263 | + | |
| 1264 | + // Adding the toast message/node | |
| 1265 | + if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) { | |
| 1266 | + // If we have a valid node, we insert it | |
| 1267 | + divElement.appendChild(this.options.node) | |
| 1268 | + } else { | |
| 1269 | + if (this.options.escapeMarkup) { | |
| 1270 | + divElement.innerText = this.options.text; | |
| 1271 | + } else { | |
| 1272 | + divElement.innerHTML = this.options.text; | |
| 1273 | + } | |
| 1274 | + | |
| 1275 | + if (this.options.avatar !== "") { | |
| 1276 | + var avatarElement = document.createElement("img"); | |
| 1277 | + avatarElement.src = this.options.avatar; | |
| 1278 | + | |
| 1279 | + avatarElement.className = "toastify-avatar"; | |
| 1280 | + | |
| 1281 | + if (this.options.position == "left" || this.options.positionLeft === true) { | |
| 1282 | + // Adding close icon on the left of content | |
| 1283 | + divElement.appendChild(avatarElement); | |
| 1284 | + } else { | |
| 1285 | + // Adding close icon on the right of content | |
| 1286 | + divElement.insertAdjacentElement("afterbegin", avatarElement); | |
| 1287 | + } | |
| 1288 | + } | |
| 1289 | + } | |
| 1290 | + | |
| 1291 | + // Adding a close icon to the toast | |
| 1292 | + if (this.options.close === true) { | |
| 1293 | + // Create a span for close element | |
| 1294 | + var closeElement = document.createElement("button"); | |
| 1295 | + closeElement.type = "button"; | |
| 1296 | + closeElement.setAttribute("aria-label", "Close"); | |
| 1297 | + closeElement.className = "toast-close"; | |
| 1298 | + closeElement.innerHTML = "✖"; | |
| 1299 | + | |
| 1300 | + // Triggering the removal of toast from DOM on close click | |
| 1301 | + closeElement.addEventListener( | |
| 1302 | + "click", | |
| 1303 | + function(event) { | |
| 1304 | + event.stopPropagation(); | |
| 1305 | + this.removeElement(this.toastElement); | |
| 1306 | + window.clearTimeout(this.toastElement.timeOutValue); | |
| 1307 | + }.bind(this) | |
| 1308 | + ); | |
| 1309 | + | |
| 1310 | + //Calculating screen width | |
| 1311 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 1312 | + | |
| 1313 | + // Adding the close icon to the toast element | |
| 1314 | + // Display on the right if screen width is less than or equal to 360px | |
| 1315 | + if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) { | |
| 1316 | + // Adding close icon on the left of content | |
| 1317 | + divElement.insertAdjacentElement("afterbegin", closeElement); | |
| 1318 | + } else { | |
| 1319 | + // Adding close icon on the right of content | |
| 1320 | + divElement.appendChild(closeElement); | |
| 1321 | + } | |
| 1322 | + } | |
| 1323 | + | |
| 1324 | + // Clear timeout while toast is focused | |
| 1325 | + if (this.options.stopOnFocus && this.options.duration > 0) { | |
| 1326 | + var self = this; | |
| 1327 | + // stop countdown | |
| 1328 | + divElement.addEventListener( | |
| 1329 | + "mouseover", | |
| 1330 | + function(event) { | |
| 1331 | + window.clearTimeout(divElement.timeOutValue); | |
| 1332 | + } | |
| 1333 | + ) | |
| 1334 | + // add back the timeout | |
| 1335 | + divElement.addEventListener( | |
| 1336 | + "mouseleave", | |
| 1337 | + function() { | |
| 1338 | + divElement.timeOutValue = window.setTimeout( | |
| 1339 | + function() { | |
| 1340 | + // Remove the toast from DOM | |
| 1341 | + self.removeElement(divElement); | |
| 1342 | + }, | |
| 1343 | + self.options.duration | |
| 1344 | + ) | |
| 1345 | + } | |
| 1346 | + ) | |
| 1347 | + } | |
| 1348 | + | |
| 1349 | + // Adding an on-click destination path | |
| 1350 | + if (typeof this.options.destination !== "undefined") { | |
| 1351 | + divElement.addEventListener( | |
| 1352 | + "click", | |
| 1353 | + function(event) { | |
| 1354 | + event.stopPropagation(); | |
| 1355 | + if (this.options.newWindow === true) { | |
| 1356 | + window.open(this.options.destination, "_blank"); | |
| 1357 | + } else { | |
| 1358 | + window.location = this.options.destination; | |
| 1359 | + } | |
| 1360 | + }.bind(this) | |
| 1361 | + ); | |
| 1362 | + } | |
| 1363 | + | |
| 1364 | + if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") { | |
| 1365 | + divElement.addEventListener( | |
| 1366 | + "click", | |
| 1367 | + function(event) { | |
| 1368 | + event.stopPropagation(); | |
| 1369 | + this.options.onClick(); | |
| 1370 | + }.bind(this) | |
| 1371 | + ); | |
| 1372 | + } | |
| 1373 | + | |
| 1374 | + // Adding offset | |
| 1375 | + if(typeof this.options.offset === "object") { | |
| 1376 | + | |
| 1377 | + var x = getAxisOffsetAValue("x", this.options); | |
| 1378 | + var y = getAxisOffsetAValue("y", this.options); | |
| 1379 | + | |
| 1380 | + var xOffset = this.options.position == "left" ? x : "-" + x; | |
| 1381 | + var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y; | |
| 1382 | + | |
| 1383 | + divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")"; | |
| 1384 | + | |
| 1385 | + } | |
| 1386 | + | |
| 1387 | + // Returning the generated element | |
| 1388 | + return divElement; | |
| 1389 | + }, | |
| 1390 | + | |
| 1391 | + // Displaying the toast | |
| 1392 | + showToast: function() { | |
| 1393 | + // Creating the DOM object for the toast | |
| 1394 | + this.toastElement = this.buildToast(); | |
| 1395 | + | |
| 1396 | + // Getting the root element to with the toast needs to be added | |
| 1397 | + var rootElement; | |
| 1398 | + if (typeof this.options.selector === "string") { | |
| 1399 | + rootElement = document.getElementById(this.options.selector); | |
| 1400 | + } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) { | |
| 1401 | + rootElement = this.options.selector; | |
| 1402 | + } else { | |
| 1403 | + rootElement = document.body; | |
| 1404 | + } | |
| 1405 | + | |
| 1406 | + // Validating if root element is present in DOM | |
| 1407 | + if (!rootElement) { | |
| 1408 | + throw "Root element is not defined"; | |
| 1409 | + } | |
| 1410 | + | |
| 1411 | + // Adding the DOM element | |
| 1412 | + var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild; | |
| 1413 | + rootElement.insertBefore(this.toastElement, elementToInsert); | |
| 1414 | + | |
| 1415 | + // Repositioning the toasts in case multiple toasts are present | |
| 1416 | + Toastify.reposition(); | |
| 1417 | + | |
| 1418 | + if (this.options.duration > 0) { | |
| 1419 | + this.toastElement.timeOutValue = window.setTimeout( | |
| 1420 | + function() { | |
| 1421 | + // Remove the toast from DOM | |
| 1422 | + this.removeElement(this.toastElement); | |
| 1423 | + }.bind(this), | |
| 1424 | + this.options.duration | |
| 1425 | + ); // Binding `this` for function invocation | |
| 1426 | + } | |
| 1427 | + | |
| 1428 | + // Supporting function chaining | |
| 1429 | + return this; | |
| 1430 | + }, | |
| 1431 | + | |
| 1432 | + hideToast: function() { | |
| 1433 | + if (this.toastElement.timeOutValue) { | |
| 1434 | + clearTimeout(this.toastElement.timeOutValue); | |
| 1435 | + } | |
| 1436 | + this.removeElement(this.toastElement); | |
| 1437 | + }, | |
| 1438 | + | |
| 1439 | + // Removing the element from the DOM | |
| 1440 | + removeElement: function(toastElement) { | |
| 1441 | + // Hiding the element | |
| 1442 | + // toastElement.classList.remove("on"); | |
| 1443 | + toastElement.className = toastElement.className.replace(" on", ""); | |
| 1444 | + | |
| 1445 | + // Removing the element from DOM after transition end | |
| 1446 | + window.setTimeout( | |
| 1447 | + function() { | |
| 1448 | + // remove options node if any | |
| 1449 | + if (this.options.node && this.options.node.parentNode) { | |
| 1450 | + this.options.node.parentNode.removeChild(this.options.node); | |
| 1451 | + } | |
| 1452 | + | |
| 1453 | + // Remove the element from the DOM, only when the parent node was not removed before. | |
| 1454 | + if (toastElement.parentNode) { | |
| 1455 | + toastElement.parentNode.removeChild(toastElement); | |
| 1456 | + } | |
| 1457 | + | |
| 1458 | + // Calling the callback function | |
| 1459 | + this.options.callback.call(toastElement); | |
| 1460 | + | |
| 1461 | + // Repositioning the toasts again | |
| 1462 | + Toastify.reposition(); | |
| 1463 | + }.bind(this), | |
| 1464 | + 400 | |
| 1465 | + ); // Binding `this` for function invocation | |
| 1466 | + }, | |
| 1467 | + }; | |
| 1468 | + | |
| 1469 | + // Positioning the toasts on the DOM | |
| 1470 | + Toastify.reposition = function() { | |
| 1471 | + | |
| 1472 | + // Top margins with gravity | |
| 1473 | + var topLeftOffsetSize = { | |
| 1474 | + top: 15, | |
| 1475 | + bottom: 15, | |
| 1476 | + }; | |
| 1477 | + var topRightOffsetSize = { | |
| 1478 | + top: 15, | |
| 1479 | + bottom: 15, | |
| 1480 | + }; | |
| 1481 | + var offsetSize = { | |
| 1482 | + top: 15, | |
| 1483 | + bottom: 15, | |
| 1484 | + }; | |
| 1485 | + | |
| 1486 | + // Get all toast messages on the DOM | |
| 1487 | + var allToasts = document.getElementsByClassName("toastify"); | |
| 1488 | + | |
| 1489 | + var classUsed; | |
| 1490 | + | |
| 1491 | + // Modifying the position of each toast element | |
| 1492 | + for (var i = 0; i < allToasts.length; i++) { | |
| 1493 | + // Getting the applied gravity | |
| 1494 | + if (containsClass(allToasts[i], "toastify-top") === true) { | |
| 1495 | + classUsed = "toastify-top"; | |
| 1496 | + } else { | |
| 1497 | + classUsed = "toastify-bottom"; | |
| 1498 | + } | |
| 1499 | + | |
| 1500 | + var height = allToasts[i].offsetHeight; | |
| 1501 | + classUsed = classUsed.substr(9, classUsed.length-1) | |
| 1502 | + // Spacing between toasts | |
| 1503 | + var offset = 15; | |
| 1504 | + | |
| 1505 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 1506 | + | |
| 1507 | + // Show toast in center if screen with less than or equal to 360px | |
| 1508 | + if (width <= 360) { | |
| 1509 | + // Setting the position | |
| 1510 | + allToasts[i].style[classUsed] = offsetSize[classUsed] + "px"; | |
| 1511 | + | |
| 1512 | + offsetSize[classUsed] += height + offset; | |
| 1513 | + } else { | |
| 1514 | + if (containsClass(allToasts[i], "toastify-left") === true) { | |
| 1515 | + // Setting the position | |
| 1516 | + allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px"; | |
| 1517 | + | |
| 1518 | + topLeftOffsetSize[classUsed] += height + offset; | |
| 1519 | + } else { | |
| 1520 | + // Setting the position | |
| 1521 | + allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px"; | |
| 1522 | + | |
| 1523 | + topRightOffsetSize[classUsed] += height + offset; | |
| 1524 | + } | |
| 1525 | + } | |
| 1526 | + } | |
| 1527 | + | |
| 1528 | + // Supporting function chaining | |
| 1529 | + return this; | |
| 1530 | + }; | |
| 1531 | + | |
| 1532 | + // Helper function to get offset. | |
| 1533 | + function getAxisOffsetAValue(axis, options) { | |
| 1534 | + | |
| 1535 | + if(options.offset[axis]) { | |
| 1536 | + if(isNaN(options.offset[axis])) { | |
| 1537 | + return options.offset[axis]; | |
| 1538 | + } | |
| 1539 | + else { | |
| 1540 | + return options.offset[axis] + 'px'; | |
| 1541 | + } | |
| 1542 | + } | |
| 1543 | + | |
| 1544 | + return '0px'; | |
| 1545 | + | |
| 1546 | + } | |
| 1547 | + | |
| 1548 | + function containsClass(elem, yourClass) { | |
| 1549 | + if (!elem || typeof yourClass !== "string") { | |
| 1550 | + return false; | |
| 1551 | + } else if ( | |
| 1552 | + elem.className && | |
| 1553 | + elem.className | |
| 1554 | + .trim() | |
| 1555 | + .split(/\s+/gi) | |
| 1556 | + .indexOf(yourClass) > -1 | |
| 1557 | + ) { | |
| 1558 | + return true; | |
| 1559 | + } else { | |
| 1560 | + return false; | |
| 1561 | + } | |
| 1562 | + } | |
| 1563 | + | |
| 1564 | + // Setting up the prototype for the init object | |
| 1565 | + Toastify.lib.init.prototype = Toastify.lib; | |
| 1566 | + | |
| 1567 | + // Returning the Toastify function to be assigned to the window object/module | |
| 1568 | + return Toastify; | |
| 1569 | +}); | |
| 1570 | + | |
| 1571 | + | |
| 416 | 1572 | /***/ } |
| 417 | 1573 | |
| 418 | 1574 | /******/ }); |
| 419 | 1575 | /************************************************************************/ |
| @@ -428,9 +1584,9 @@ | ||
| 428 | 1584 | /******/ return cachedModule.exports; |
| 429 | 1585 | /******/ } |
| 430 | 1586 | /******/ // Create a new module (and put it into the cache) |
| 431 | 1587 | /******/ var module = __webpack_module_cache__[moduleId] = { |
| 432 | -/******/ // no module.id needed | |
| 1588 | +/******/ id: moduleId, | |
| 433 | 1589 | /******/ // no module.loaded needed |
| 434 | 1590 | /******/ exports: {} |
| 435 | 1591 | /******/ }; |
| 436 | 1592 | /******/ |
| @@ -440,9 +1596,9 @@ | ||
| 440 | 1596 | /******/ var e = new Error("Cannot find module '" + moduleId + "'"); |
| 441 | 1597 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 442 | 1598 | /******/ throw e; |
| 443 | 1599 | /******/ } |
| 444 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 1600 | +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
| 445 | 1601 | /******/ |
| 446 | 1602 | /******/ // Return the exports of the module |
| 447 | 1603 | /******/ return module.exports; |
| 448 | 1604 | /******/ } |
| @@ -447,8 +1603,20 @@ | ||
| 447 | 1603 | /******/ return module.exports; |
| 448 | 1604 | /******/ } |
| 449 | 1605 | /******/ |
| 450 | 1606 | /************************************************************************/ |
| 1607 | +/******/ /* webpack/runtime/compat get default export */ | |
| 1608 | +/******/ (() => { | |
| 1609 | +/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 1610 | +/******/ __webpack_require__.n = (module) => { | |
| 1611 | +/******/ var getter = module && module.__esModule ? | |
| 1612 | +/******/ () => (module['default']) : | |
| 1613 | +/******/ () => (module); | |
| 1614 | +/******/ __webpack_require__.d(getter, { a: getter }); | |
| 1615 | +/******/ return getter; | |
| 1616 | +/******/ }; | |
| 1617 | +/******/ })(); | |
| 1618 | +/******/ | |
| 451 | 1619 | /******/ /* webpack/runtime/define property getters */ |
| 452 | 1620 | /******/ (() => { |
| 453 | 1621 | /******/ // define getter functions for harmony exports |
| 454 | 1622 | /******/ __webpack_require__.d = (exports, definition) => { |
| @@ -475,126 +1643,138 @@ | ||
| 475 | 1643 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 476 | 1644 | /******/ }; |
| 477 | 1645 | /******/ })(); |
| 478 | 1646 | /******/ |
| 1647 | +/******/ /* webpack/runtime/nonce */ | |
| 1648 | +/******/ (() => { | |
| 1649 | +/******/ __webpack_require__.nc = undefined; | |
| 1650 | +/******/ })(); | |
| 1651 | +/******/ | |
| 479 | 1652 | /************************************************************************/ |
| 480 | 1653 | var __webpack_exports__ = {}; |
| 481 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 1654 | +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. | |
| 482 | 1655 | (() => { |
| 1656 | +"use strict"; | |
| 483 | 1657 | /*!**********************************************!*\ |
| 484 | 1658 | !*** ./assets/src/js/admin/admin-notices.js ***! |
| 485 | 1659 | \**********************************************/ |
| 486 | 1660 | __webpack_require__.r(__webpack_exports__); |
| 487 | -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ "./assets/src/js/utils.js"); | |
| 488 | -/* harmony import */ var _api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api.js */ "./assets/src/js/api.js"); | |
| 489 | -/** | |
| 490 | - * Script handle admin notices. | |
| 491 | - * | |
| 492 | - * @since 4.1.7.3.2 | |
| 493 | - * @version 1.0.2 | |
| 1661 | +/* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js"); | |
| 1662 | +/* harmony import */ var lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lpAssetsJsPath/lpToastify.js */ "./assets/src/js/lpToastify.js"); | |
| 1663 | +/** | |
| 1664 | + * Script handle admin notices. | |
| 1665 | + * | |
| 1666 | + * @since 4.1.7.3.2 | |
| 1667 | + * @version 1.0.3 | |
| 494 | 1668 | */ |
| 495 | 1669 | |
| 496 | 1670 | |
| 497 | -let elLPAdminNotices = null; | |
| 498 | -let dataHtml = null; | |
| 499 | -const queryString = window.location.search; | |
| 500 | -const urlParams = new URLSearchParams(queryString); | |
| 501 | -const tab = urlParams.get('tab'); | |
| 502 | -const notifyAddonsNewVersion = () => { | |
| 503 | - try { | |
| 504 | - const elAdminMenu = document.querySelector('#adminmenu'); | |
| 505 | - if (!elAdminMenu) { | |
| 506 | - return; | |
| 1671 | +class AdminNotices { | |
| 1672 | + static selectors = { | |
| 1673 | + elAddonsNewVersionTotals: '.lp-addons-new-version-totals', | |
| 1674 | + elBtnDismiss: '.btn-lp-notice-dismiss', | |
| 1675 | + elAdminMenu: '#adminmenu', | |
| 1676 | + elTabLP: '#toplevel_page_learn_press', | |
| 1677 | + elTabLPName: '.wp-menu-name', | |
| 1678 | + elTabLPNotice: '.tab-lp-admin-notice', | |
| 1679 | + elTabLPAddons: 'a[href="admin.php?page=learn-press-addons"]', | |
| 1680 | + elMenuAddons: '.lp-menu-addons', | |
| 1681 | + elUpdatePlugins: '.update-plugins', | |
| 1682 | + elMessage: '.learn-press-message' | |
| 1683 | + }; | |
| 1684 | + init() { | |
| 1685 | + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady(AdminNotices.selectors.elAddonsNewVersionTotals, () => { | |
| 1686 | + this.notifyAddonsNewVersion(); | |
| 1687 | + }); | |
| 1688 | + this.events(); | |
| 1689 | + } | |
| 1690 | + notifyAddonsNewVersion() { | |
| 1691 | + try { | |
| 1692 | + const elAdminMenu = document.querySelector(AdminNotices.selectors.elAdminMenu); | |
| 1693 | + if (!elAdminMenu) { | |
| 1694 | + return; | |
| 1695 | + } | |
| 1696 | + const elTabLP = elAdminMenu.querySelector(AdminNotices.selectors.elTabLP); | |
| 1697 | + if (!elTabLP) { | |
| 1698 | + return; | |
| 1699 | + } | |
| 1700 | + const elTabLPName = elTabLP.querySelector(AdminNotices.selectors.elTabLPName); | |
| 1701 | + if (!elTabLPName) { | |
| 1702 | + return; | |
| 1703 | + } | |
| 1704 | + const elAddonsNewVerTotal = document.querySelector(AdminNotices.selectors.elAddonsNewVersionTotals); | |
| 1705 | + if (!elAddonsNewVerTotal) { | |
| 1706 | + return; | |
| 1707 | + } | |
| 1708 | + const htmlNotifyLP = `<span class="tab-lp-admin-notice"></span>`; | |
| 1709 | + if (!elTabLPName.querySelector(AdminNotices.selectors.elTabLPNotice)) { | |
| 1710 | + elTabLPName.insertAdjacentHTML('beforeend', htmlNotifyLP); | |
| 1711 | + } | |
| 1712 | + const elTabLPAddons = elTabLP.querySelector(AdminNotices.selectors.elTabLPAddons); | |
| 1713 | + if (!elTabLPAddons) { | |
| 1714 | + return; | |
| 1715 | + } | |
| 1716 | + const total = elAddonsNewVerTotal.dataset.total; | |
| 1717 | + const elMenuAddons = elTabLPAddons.querySelector(AdminNotices.selectors.elMenuAddons); | |
| 1718 | + if (!elMenuAddons) { | |
| 1719 | + return; | |
| 1720 | + } | |
| 1721 | + elTabLPAddons.setAttribute('href', 'admin.php?page=learn-press-addons&tab=update'); | |
| 1722 | + elMenuAddons.textContent = total; | |
| 1723 | + elMenuAddons.classList.remove(lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpClassName.hidden); | |
| 1724 | + } catch (e) { | |
| 1725 | + console.log(e); | |
| 507 | 1726 | } |
| 508 | - const elTabLP = elAdminMenu.querySelector('#toplevel_page_learn_press'); | |
| 509 | - if (!elTabLP) { | |
| 1727 | + } | |
| 1728 | + | |
| 1729 | + /*** Events ***/ | |
| 1730 | + events() { | |
| 1731 | + if (AdminNotices._loadedEvents) { | |
| 510 | 1732 | return; |
| 511 | 1733 | } |
| 512 | - const elTabLPName = elTabLP.querySelector('.wp-menu-name'); | |
| 513 | - if (!elTabLPName) { | |
| 514 | - return; | |
| 515 | - } | |
| 516 | - const elAddonsNewVerTotal = document.querySelector('input[name=lp-addons-new-version-totals]'); | |
| 517 | - if (!elAddonsNewVerTotal) { | |
| 518 | - return; | |
| 519 | - } | |
| 520 | - const htmlNotifyLP = `<span class="tab-lp-admin-notice"></span>`; | |
| 521 | - elTabLPName.insertAdjacentHTML('beforeend', htmlNotifyLP); | |
| 522 | - const elTabLPAddons = elTabLP.querySelector('a[href="admin.php?page=learn-press-addons"]'); | |
| 523 | - if (!elTabLPAddons) { | |
| 524 | - return; | |
| 525 | - } | |
| 526 | - const total = elAddonsNewVerTotal.value; | |
| 527 | - const html = `<span style="margin-left: 5px" class="update-plugins">${total}</span>`; | |
| 528 | - elTabLPAddons.setAttribute('href', 'admin.php?page=learn-press-addons&tab=update'); | |
| 529 | - elTabLPAddons.insertAdjacentHTML('beforeend', html); | |
| 530 | - } catch (e) { | |
| 531 | - console.log(e); | |
| 1734 | + AdminNotices._loadedEvents = true; | |
| 1735 | + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{ | |
| 1736 | + selector: AdminNotices.selectors.elBtnDismiss, | |
| 1737 | + class: this, | |
| 1738 | + callBack: this.dismissNotice.name | |
| 1739 | + }]); | |
| 532 | 1740 | } |
| 533 | -}; | |
| 534 | -const callAdminNotices = (set = '') => { | |
| 535 | - if (!lpGlobalSettings.is_admin) { | |
| 536 | - return; | |
| 537 | - } | |
| 538 | - let params = tab ? `?tab=${tab}` : ''; | |
| 539 | - params += set ? (tab ? '&' : '?') + `${set}` : ''; | |
| 540 | - fetch(_api_js__WEBPACK_IMPORTED_MODULE_1__["default"].admin.apiAdminNotice + params, { | |
| 541 | - method: 'POST', | |
| 542 | - headers: { | |
| 543 | - 'X-WP-Nonce': lpGlobalSettings.nonce | |
| 544 | - } | |
| 545 | - }).then(res => res.json()).then(res => { | |
| 546 | - // console.log(data); | |
| 547 | - | |
| 1741 | + dismissNotice(args) { | |
| 548 | 1742 | const { |
| 549 | - status, | |
| 550 | - message, | |
| 551 | - data | |
| 552 | - } = res; | |
| 553 | - if (status === 'success') { | |
| 554 | - if ('Dismissed!' !== message) { | |
| 555 | - dataHtml = data.content; | |
| 556 | - if (dataHtml.length === 0) { | |
| 557 | - elLPAdminNotices.style.display = 'none'; | |
| 558 | - } else { | |
| 559 | - elLPAdminNotices.innerHTML = dataHtml; | |
| 560 | - elLPAdminNotices.style.display = 'block'; | |
| 561 | - // Handle notify addons new version. | |
| 562 | - notifyAddonsNewVersion(); | |
| 563 | - } | |
| 564 | - } | |
| 565 | - } else { | |
| 566 | - dataHtml = message; | |
| 1743 | + e, | |
| 1744 | + target | |
| 1745 | + } = args; | |
| 1746 | + const el = target.closest(AdminNotices.selectors.elBtnDismiss); | |
| 1747 | + if (!el) { | |
| 1748 | + return; | |
| 567 | 1749 | } |
| 568 | - }).catch(err => { | |
| 569 | - console.log(err); | |
| 570 | - }); | |
| 571 | -}; | |
| 572 | - | |
| 573 | -// Listen element ready | |
| 574 | -(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady)('.lp-admin-notices', () => { | |
| 575 | - elLPAdminNotices = document.querySelector('.lp-admin-notices'); | |
| 576 | - callAdminNotices(); | |
| 577 | -}); | |
| 578 | - | |
| 579 | -/*** Events ***/ | |
| 580 | -document.addEventListener('click', e => { | |
| 581 | - const el = e.target; | |
| 582 | - if (el.classList.contains('btn-lp-notice-dismiss')) { | |
| 583 | 1750 | e.preventDefault(); |
| 584 | 1751 | |
| 585 | 1752 | // eslint-disable-next-line no-alert |
| 586 | - if (confirm('Are you sure you want to dismiss this notice?')) { | |
| 587 | - const parent = el.closest('.lp-notice'); | |
| 588 | - callAdminNotices(`dismiss=${el.getAttribute('data-dismiss')}`); | |
| 589 | - parent.remove(); | |
| 590 | - if (elLPAdminNotices.querySelectorAll('.lp-notice').length === 0) { | |
| 591 | - elLPAdminNotices.style.display = 'none'; | |
| 592 | - } | |
| 1753 | + if (confirm(el.dataset.message)) { | |
| 1754 | + const parent = el.closest(AdminNotices.selectors.elMessage); | |
| 1755 | + const dataSend = JSON.parse(el.dataset.send); | |
| 1756 | + window.lpAJAXG.fetchAJAX(dataSend, { | |
| 1757 | + success: response => { | |
| 1758 | + const { | |
| 1759 | + message, | |
| 1760 | + status | |
| 1761 | + } = response; | |
| 1762 | + lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__.show(message, status); | |
| 1763 | + if (status === 'success') { | |
| 1764 | + parent?.remove(); | |
| 1765 | + } | |
| 1766 | + }, | |
| 1767 | + error: error => { | |
| 1768 | + lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_1__.show(error, 'error'); | |
| 1769 | + } | |
| 1770 | + }); | |
| 593 | 1771 | } |
| 594 | 1772 | } |
| 595 | -}); | |
| 1773 | +} | |
| 1774 | +const adminNotices = new AdminNotices(); | |
| 1775 | +adminNotices.init(); | |
| 596 | 1776 | })(); |
| 597 | 1777 | |
| 598 | 1778 | /******/ })() |
| 599 | 1779 | ; |
| 600 | 1780 | //# sourceMappingURL=admin-notices.js.map |