| @@ -1,237 +1,130 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ var __webpack_modules__ = ({ | |
| 1 | +(function(react) { | |
| 4 | 2 | |
| 5 | -/***/ "./packages/packages/libs/session/src/session-storage-context.tsx": | |
| 6 | -/*!************************************************************************!*\ | |
| 7 | - !*** ./packages/packages/libs/session/src/session-storage-context.tsx ***! | |
| 8 | - \************************************************************************/ | |
| 9 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 3 | +//#region \0rolldown/runtime.js | |
| 4 | + var __create = Object.create; | |
| 5 | + var __defProp = Object.defineProperty; | |
| 6 | + var __name = (target, value) => __defProp(target, "name", { | |
| 7 | + value, | |
| 8 | + configurable: true | |
| 9 | + }); | |
| 10 | + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | |
| 11 | + var __getOwnPropNames = Object.getOwnPropertyNames; | |
| 12 | + var __getProtoOf = Object.getPrototypeOf; | |
| 13 | + var __hasOwnProp = Object.prototype.hasOwnProperty; | |
| 14 | + var __exportAll = (all, no_symbols) => { | |
| 15 | + let target = {}; | |
| 16 | + for (var name in all) { | |
| 17 | + __defProp(target, name, { | |
| 18 | + get: all[name], | |
| 19 | + enumerable: true | |
| 20 | + }); | |
| 21 | + } | |
| 22 | + if (!no_symbols) { | |
| 23 | + __defProp(target, Symbol.toStringTag, { value: "Module" }); | |
| 24 | + } | |
| 25 | + return target; | |
| 26 | + }; | |
| 27 | + var __copyProps = (to, from, except, desc) => { | |
| 28 | + if (from && typeof from === "object" || typeof from === "function") { | |
| 29 | + for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | |
| 30 | + key = keys[i]; | |
| 31 | + if (!__hasOwnProp.call(to, key) && key !== except) { | |
| 32 | + __defProp(to, key, { | |
| 33 | + get: ((k) => from[k]).bind(null, key), | |
| 34 | + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | |
| 35 | + }); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return to; | |
| 40 | + }; | |
| 41 | + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | |
| 42 | + value: mod, | |
| 43 | + enumerable: true | |
| 44 | + }) : target, mod)); | |
| 10 | 45 | |
| 11 | -__webpack_require__.r(__webpack_exports__); | |
| 12 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | -/* harmony export */ Context: function() { return /* binding */ Context; }, | |
| 14 | -/* harmony export */ SessionStorageProvider: function() { return /* binding */ SessionStorageProvider; } | |
| 15 | -/* harmony export */ }); | |
| 16 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 17 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 46 | +//#endregion | |
| 47 | +react = __toESM(react); | |
| 18 | 48 | |
| 49 | +//#region packages/packages/libs/session/src/session-storage.ts | |
| 50 | + var getSessionStorageItem = (key) => { | |
| 51 | + return JSON.parse(sessionStorage.getItem(key) || "{}")?.item; | |
| 52 | + }; | |
| 53 | + var setSessionStorageItem = (key, item) => { | |
| 54 | + sessionStorage.setItem(key, JSON.stringify({ item })); | |
| 55 | + window.dispatchEvent(new StorageEvent("storage", { | |
| 56 | + key, | |
| 57 | + storageArea: sessionStorage | |
| 58 | + })); | |
| 59 | + }; | |
| 60 | + var removeSessionStorageItem = (key) => { | |
| 61 | + sessionStorage.removeItem(key); | |
| 62 | + window.dispatchEvent(new StorageEvent("storage", { | |
| 63 | + key, | |
| 64 | + storageArea: sessionStorage | |
| 65 | + })); | |
| 66 | + }; | |
| 19 | 67 | |
| 20 | -const Context = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); | |
| 21 | -function SessionStorageProvider({ | |
| 22 | - children, | |
| 23 | - prefix | |
| 24 | -}) { | |
| 25 | - const contextPrefix = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(Context)?.prefix ?? ''; | |
| 26 | - const chainedPrefix = contextPrefix ? `${contextPrefix}/${prefix}` : prefix; | |
| 27 | - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Context.Provider, { | |
| 28 | - value: { | |
| 29 | - prefix: chainedPrefix | |
| 30 | - } | |
| 31 | - }, children); | |
| 32 | -} | |
| 68 | +//#endregion | |
| 69 | +//#region packages/packages/libs/session/src/session-storage-context.tsx | |
| 70 | + var Context = (0, react.createContext)(null); | |
| 71 | + function SessionStorageProvider({ children, prefix }) { | |
| 72 | + const contextPrefix = (0, react.useContext)(Context)?.prefix ?? ""; | |
| 73 | + const chainedPrefix = contextPrefix ? `${contextPrefix}/${prefix}` : prefix; | |
| 74 | + return /* @__PURE__ */ react.createElement(Context.Provider, { value: { prefix: chainedPrefix } }, children); | |
| 75 | + } | |
| 33 | 76 | |
| 34 | -/***/ }), | |
| 77 | +//#endregion | |
| 78 | +//#region packages/packages/libs/session/src/use-session-storage.ts | |
| 79 | + var useSessionStorage = (key, customPrefix) => { | |
| 80 | + const contextPrefix = (0, react.useContext)(Context)?.prefix ?? ""; | |
| 81 | + const prefixedKey = `${customPrefix ? customPrefix : contextPrefix}/${key}`; | |
| 82 | + const [value, setValue] = (0, react.useState)(); | |
| 83 | + (0, react.useEffect)(() => { | |
| 84 | + return subscribeToSessionStorage(prefixedKey, (newValue) => { | |
| 85 | + setValue(newValue ?? null); | |
| 86 | + }); | |
| 87 | + }, [prefixedKey]); | |
| 88 | + const saveValue = (newValue) => { | |
| 89 | + setSessionStorageItem(prefixedKey, newValue); | |
| 90 | + }; | |
| 91 | + const removeValue = () => { | |
| 92 | + removeSessionStorageItem(prefixedKey); | |
| 93 | + }; | |
| 94 | + return [ | |
| 95 | + value, | |
| 96 | + saveValue, | |
| 97 | + removeValue | |
| 98 | + ]; | |
| 99 | + }; | |
| 100 | + var subscribeToSessionStorage = (key, subscriber) => { | |
| 101 | + subscriber(getSessionStorageItem(key)); | |
| 102 | + const abortController = new AbortController(); | |
| 103 | + window.addEventListener("storage", (e) => { | |
| 104 | + if (e.key !== key || e.storageArea !== sessionStorage) return; | |
| 105 | + subscriber(getSessionStorageItem(key)); | |
| 106 | + }, { signal: abortController.signal }); | |
| 107 | + return () => { | |
| 108 | + abortController.abort(); | |
| 109 | + }; | |
| 110 | + }; | |
| 35 | 111 | |
| 36 | -/***/ "./packages/packages/libs/session/src/session-storage.ts": | |
| 37 | -/*!***************************************************************!*\ | |
| 38 | - !*** ./packages/packages/libs/session/src/session-storage.ts ***! | |
| 39 | - \***************************************************************/ | |
| 40 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 112 | +//#endregion | |
| 113 | +//#region packages/packages/libs/session/src/index.ts | |
| 114 | + var src_exports = /* @__PURE__ */ __exportAll({ | |
| 115 | + Context: () => Context, | |
| 116 | + SessionStorageProvider: () => SessionStorageProvider, | |
| 117 | + getSessionStorageItem: () => getSessionStorageItem, | |
| 118 | + removeSessionStorageItem: () => removeSessionStorageItem, | |
| 119 | + setSessionStorageItem: () => setSessionStorageItem, | |
| 120 | + useSessionStorage: () => useSessionStorage | |
| 121 | + }); | |
| 41 | 122 | |
| 42 | -__webpack_require__.r(__webpack_exports__); | |
| 43 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 44 | -/* harmony export */ getSessionStorageItem: function() { return /* binding */ getSessionStorageItem; }, | |
| 45 | -/* harmony export */ removeSessionStorageItem: function() { return /* binding */ removeSessionStorageItem; }, | |
| 46 | -/* harmony export */ setSessionStorageItem: function() { return /* binding */ setSessionStorageItem; } | |
| 47 | -/* harmony export */ }); | |
| 48 | -const getSessionStorageItem = key => { | |
| 49 | - return JSON.parse(sessionStorage.getItem(key) || '{}')?.item; | |
| 50 | -}; | |
| 51 | -const setSessionStorageItem = (key, item) => { | |
| 52 | - sessionStorage.setItem(key, JSON.stringify({ | |
| 53 | - item | |
| 54 | - })); | |
| 123 | +//#endregion | |
| 124 | +//#region \0elementor-package-library-entry | |
| 125 | + (window.elementorV2 = window.elementorV2 || {}).session = src_exports; | |
| 55 | 126 | |
| 56 | - // The browser doesn't dispatch the `storage` event for the current tab, | |
| 57 | - // so we need to dispatch it manually. | |
| 58 | - // | |
| 59 | - // https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event | |
| 60 | - window.dispatchEvent(new StorageEvent('storage', { | |
| 61 | - key, | |
| 62 | - storageArea: sessionStorage | |
| 63 | - })); | |
| 64 | -}; | |
| 65 | -const removeSessionStorageItem = key => { | |
| 66 | - sessionStorage.removeItem(key); | |
| 67 | - | |
| 68 | - // The browser doesn't dispatch the `storage` event for the current tab, | |
| 69 | - // so we need to dispatch it manually. | |
| 70 | - // | |
| 71 | - // https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event | |
| 72 | - window.dispatchEvent(new StorageEvent('storage', { | |
| 73 | - key, | |
| 74 | - storageArea: sessionStorage | |
| 75 | - })); | |
| 76 | -}; | |
| 77 | - | |
| 78 | -/***/ }), | |
| 79 | - | |
| 80 | -/***/ "./packages/packages/libs/session/src/use-session-storage.ts": | |
| 81 | -/*!*******************************************************************!*\ | |
| 82 | - !*** ./packages/packages/libs/session/src/use-session-storage.ts ***! | |
| 83 | - \*******************************************************************/ | |
| 84 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 85 | - | |
| 86 | -__webpack_require__.r(__webpack_exports__); | |
| 87 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 88 | -/* harmony export */ useSessionStorage: function() { return /* binding */ useSessionStorage; } | |
| 89 | -/* harmony export */ }); | |
| 90 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 91 | -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 92 | -/* harmony import */ var _session_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./session-storage */ "./packages/packages/libs/session/src/session-storage.ts"); | |
| 93 | -/* harmony import */ var _session_storage_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./session-storage-context */ "./packages/packages/libs/session/src/session-storage-context.tsx"); | |
| 94 | - | |
| 95 | - | |
| 96 | - | |
| 97 | -const useSessionStorage = (key, customPrefix) => { | |
| 98 | - const contextPrefix = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_session_storage_context__WEBPACK_IMPORTED_MODULE_2__.Context)?.prefix ?? ''; | |
| 99 | - const prefix = customPrefix ? customPrefix : contextPrefix; | |
| 100 | - const prefixedKey = `${prefix}/${key}`; | |
| 101 | - const [value, setValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(); | |
| 102 | - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { | |
| 103 | - return subscribeToSessionStorage(prefixedKey, newValue => { | |
| 104 | - setValue(newValue ?? null); | |
| 105 | - }); | |
| 106 | - }, [prefixedKey]); | |
| 107 | - const saveValue = newValue => { | |
| 108 | - (0,_session_storage__WEBPACK_IMPORTED_MODULE_1__.setSessionStorageItem)(prefixedKey, newValue); | |
| 109 | - }; | |
| 110 | - const removeValue = () => { | |
| 111 | - (0,_session_storage__WEBPACK_IMPORTED_MODULE_1__.removeSessionStorageItem)(prefixedKey); | |
| 112 | - }; | |
| 113 | - return [value, saveValue, removeValue]; | |
| 114 | -}; | |
| 115 | -const subscribeToSessionStorage = (key, subscriber) => { | |
| 116 | - subscriber((0,_session_storage__WEBPACK_IMPORTED_MODULE_1__.getSessionStorageItem)(key)); | |
| 117 | - const abortController = new AbortController(); | |
| 118 | - window.addEventListener('storage', e => { | |
| 119 | - if (e.key !== key || e.storageArea !== sessionStorage) { | |
| 120 | - return; | |
| 121 | - } | |
| 122 | - subscriber((0,_session_storage__WEBPACK_IMPORTED_MODULE_1__.getSessionStorageItem)(key)); | |
| 123 | - }, { | |
| 124 | - signal: abortController.signal | |
| 125 | - }); | |
| 126 | - return () => { | |
| 127 | - abortController.abort(); | |
| 128 | - }; | |
| 129 | -}; | |
| 130 | - | |
| 131 | -/***/ }), | |
| 132 | - | |
| 133 | -/***/ "react": | |
| 134 | -/*!**************************!*\ | |
| 135 | - !*** external ["React"] ***! | |
| 136 | - \**************************/ | |
| 137 | -/***/ (function(module) { | |
| 138 | - | |
| 139 | -module.exports = window["React"]; | |
| 140 | - | |
| 141 | -/***/ }) | |
| 142 | - | |
| 143 | -/******/ }); | |
| 144 | -/************************************************************************/ | |
| 145 | -/******/ // The module cache | |
| 146 | -/******/ var __webpack_module_cache__ = {}; | |
| 147 | -/******/ | |
| 148 | -/******/ // The require function | |
| 149 | -/******/ function __webpack_require__(moduleId) { | |
| 150 | -/******/ // Check if module is in cache | |
| 151 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 152 | -/******/ if (cachedModule !== undefined) { | |
| 153 | -/******/ return cachedModule.exports; | |
| 154 | -/******/ } | |
| 155 | -/******/ // Create a new module (and put it into the cache) | |
| 156 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 157 | -/******/ // no module.id needed | |
| 158 | -/******/ // no module.loaded needed | |
| 159 | -/******/ exports: {} | |
| 160 | -/******/ }; | |
| 161 | -/******/ | |
| 162 | -/******/ // Execute the module function | |
| 163 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 164 | -/******/ | |
| 165 | -/******/ // Return the exports of the module | |
| 166 | -/******/ return module.exports; | |
| 167 | -/******/ } | |
| 168 | -/******/ | |
| 169 | -/************************************************************************/ | |
| 170 | -/******/ /* webpack/runtime/compat get default export */ | |
| 171 | -/******/ !function() { | |
| 172 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 173 | -/******/ __webpack_require__.n = function(module) { | |
| 174 | -/******/ var getter = module && module.__esModule ? | |
| 175 | -/******/ function() { return module['default']; } : | |
| 176 | -/******/ function() { return module; }; | |
| 177 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 178 | -/******/ return getter; | |
| 179 | -/******/ }; | |
| 180 | -/******/ }(); | |
| 181 | -/******/ | |
| 182 | -/******/ /* webpack/runtime/define property getters */ | |
| 183 | -/******/ !function() { | |
| 184 | -/******/ // define getter functions for harmony exports | |
| 185 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 186 | -/******/ for(var key in definition) { | |
| 187 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 188 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 189 | -/******/ } | |
| 190 | -/******/ } | |
| 191 | -/******/ }; | |
| 192 | -/******/ }(); | |
| 193 | -/******/ | |
| 194 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 195 | -/******/ !function() { | |
| 196 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 197 | -/******/ }(); | |
| 198 | -/******/ | |
| 199 | -/******/ /* webpack/runtime/make namespace object */ | |
| 200 | -/******/ !function() { | |
| 201 | -/******/ // define __esModule on exports | |
| 202 | -/******/ __webpack_require__.r = function(exports) { | |
| 203 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 204 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 205 | -/******/ } | |
| 206 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 207 | -/******/ }; | |
| 208 | -/******/ }(); | |
| 209 | -/******/ | |
| 210 | -/************************************************************************/ | |
| 211 | -var __webpack_exports__ = {}; | |
| 212 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 213 | -!function() { | |
| 214 | -/*!*****************************************************!*\ | |
| 215 | - !*** ./packages/packages/libs/session/src/index.ts ***! | |
| 216 | - \*****************************************************/ | |
| 217 | -__webpack_require__.r(__webpack_exports__); | |
| 218 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 219 | -/* harmony export */ Context: function() { return /* reexport safe */ _session_storage_context__WEBPACK_IMPORTED_MODULE_2__.Context; }, | |
| 220 | -/* harmony export */ SessionStorageProvider: function() { return /* reexport safe */ _session_storage_context__WEBPACK_IMPORTED_MODULE_2__.SessionStorageProvider; }, | |
| 221 | -/* harmony export */ getSessionStorageItem: function() { return /* reexport safe */ _session_storage__WEBPACK_IMPORTED_MODULE_0__.getSessionStorageItem; }, | |
| 222 | -/* harmony export */ removeSessionStorageItem: function() { return /* reexport safe */ _session_storage__WEBPACK_IMPORTED_MODULE_0__.removeSessionStorageItem; }, | |
| 223 | -/* harmony export */ setSessionStorageItem: function() { return /* reexport safe */ _session_storage__WEBPACK_IMPORTED_MODULE_0__.setSessionStorageItem; }, | |
| 224 | -/* harmony export */ useSessionStorage: function() { return /* reexport safe */ _use_session_storage__WEBPACK_IMPORTED_MODULE_1__.useSessionStorage; } | |
| 225 | -/* harmony export */ }); | |
| 226 | -/* harmony import */ var _session_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./session-storage */ "./packages/packages/libs/session/src/session-storage.ts"); | |
| 227 | -/* harmony import */ var _use_session_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./use-session-storage */ "./packages/packages/libs/session/src/use-session-storage.ts"); | |
| 228 | -/* harmony import */ var _session_storage_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./session-storage-context */ "./packages/packages/libs/session/src/session-storage-context.tsx"); | |
| 229 | - | |
| 230 | - | |
| 231 | - | |
| 232 | -}(); | |
| 233 | -(window.elementorV2 = window.elementorV2 || {}).session = __webpack_exports__; | |
| 234 | -/******/ })() | |
| 235 | -; | |
| 127 | +//#endregion | |
| 128 | +})(React); | |
| 236 | 129 | window.elementorV2.session?.init?.(); |
| 237 | 130 | //# sourceMappingURL=session.js.map |