| @@ -1,275 +1,74 @@ | ||
| 1 | -(function(_wordpress_i18n) { | |
| 1 | +/*! elementor - v3.8.1 - 13-11-2022 */ | |
| 2 | +/******/ (() => { // webpackBootstrap | |
| 3 | +/******/ "use strict"; | |
| 4 | +/******/ var __webpack_modules__ = ({ | |
| 2 | 5 | |
| 3 | -//#region \0rolldown/runtime.js | |
| 4 | - var __defProp = Object.defineProperty; | |
| 5 | - var __name = (target, value) => __defProp(target, "name", { | |
| 6 | - value, | |
| 7 | - configurable: true | |
| 8 | - }); | |
| 6 | +/***/ "@wordpress/i18n": | |
| 7 | +/*!**************************!*\ | |
| 8 | + !*** external "wp.i18n" ***! | |
| 9 | + \**************************/ | |
| 10 | +/***/ ((module) => { | |
| 9 | 11 | |
| 10 | -//#endregion | |
| 12 | +module.exports = wp.i18n; | |
| 11 | 13 | |
| 12 | -//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js | |
| 13 | - function _classCallCheck(a, n) { | |
| 14 | - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); | |
| 15 | - } | |
| 14 | +/***/ }) | |
| 16 | 15 | |
| 17 | -//#endregion | |
| 18 | -//#region node_modules/@babel/runtime/helpers/esm/typeof.js | |
| 19 | - function _typeof(o) { | |
| 20 | - "@babel/helpers - typeof"; | |
| 21 | - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { | |
| 22 | - return typeof o; | |
| 23 | - } : function(o) { | |
| 24 | - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; | |
| 25 | - }, _typeof(o); | |
| 26 | - } | |
| 16 | +/******/ }); | |
| 17 | +/************************************************************************/ | |
| 18 | +/******/ // The module cache | |
| 19 | +/******/ var __webpack_module_cache__ = {}; | |
| 20 | +/******/ | |
| 21 | +/******/ // The require function | |
| 22 | +/******/ function __webpack_require__(moduleId) { | |
| 23 | +/******/ // Check if module is in cache | |
| 24 | +/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 25 | +/******/ if (cachedModule !== undefined) { | |
| 26 | +/******/ return cachedModule.exports; | |
| 27 | +/******/ } | |
| 28 | +/******/ // Create a new module (and put it into the cache) | |
| 29 | +/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 30 | +/******/ // no module.id needed | |
| 31 | +/******/ // no module.loaded needed | |
| 32 | +/******/ exports: {} | |
| 33 | +/******/ }; | |
| 34 | +/******/ | |
| 35 | +/******/ // Execute the module function | |
| 36 | +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 37 | +/******/ | |
| 38 | +/******/ // Return the exports of the module | |
| 39 | +/******/ return module.exports; | |
| 40 | +/******/ } | |
| 41 | +/******/ | |
| 42 | +/************************************************************************/ | |
| 43 | +var __webpack_exports__ = {}; | |
| 44 | +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | |
| 45 | +(() => { | |
| 46 | +/*!*******************************************************!*\ | |
| 47 | + !*** ../app/modules/import-export/assets/js/admin.js ***! | |
| 48 | + \*******************************************************/ | |
| 49 | +/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"]; | |
| 27 | 50 | |
| 28 | -//#endregion | |
| 29 | -//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js | |
| 30 | - function toPrimitive(t, r) { | |
| 31 | - if ("object" != _typeof(t) || !t) return t; | |
| 32 | - var e = t[Symbol.toPrimitive]; | |
| 33 | - if (void 0 !== e) { | |
| 34 | - var i = e.call(t, r || "default"); | |
| 35 | - if ("object" != _typeof(i)) return i; | |
| 36 | - throw new TypeError("@@toPrimitive must return a primitive value."); | |
| 37 | - } | |
| 38 | - return ("string" === r ? String : Number)(t); | |
| 39 | - } | |
| 40 | 51 | |
| 41 | -//#endregion | |
| 42 | -//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js | |
| 43 | - function toPropertyKey(t) { | |
| 44 | - var i = toPrimitive(t, "string"); | |
| 45 | - return "symbol" == _typeof(i) ? i : i + ""; | |
| 46 | - } | |
| 52 | +var revertButton = document.getElementById('elementor-import-export__revert_kit'); | |
| 47 | 53 | |
| 48 | -//#endregion | |
| 49 | -//#region node_modules/@babel/runtime/helpers/esm/createClass.js | |
| 50 | - function _defineProperties(e, r) { | |
| 51 | - for (var t = 0; t < r.length; t++) { | |
| 52 | - var o = r[t]; | |
| 53 | - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); | |
| 54 | - } | |
| 55 | - } | |
| 56 | - function _createClass(e, r, t) { | |
| 57 | - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; | |
| 58 | - } | |
| 54 | +if (revertButton) { | |
| 55 | + revertButton.addEventListener('click', function (event) { | |
| 56 | + event.preventDefault(); | |
| 57 | + elementorCommon.dialogsManager.createWidget('confirm', { | |
| 58 | + headerMessage: __('Sure you want to make these changes?', 'elementor'), | |
| 59 | + message: __('Removing assets or changing your site settings can drastically change the look of your website.', 'elementor'), | |
| 60 | + strings: { | |
| 61 | + confirm: __('Yes', 'elementor'), | |
| 62 | + cancel: __('No, go back', 'elementor') | |
| 63 | + }, | |
| 64 | + onConfirm: function onConfirm() { | |
| 65 | + location.href = revertButton.href; | |
| 66 | + } | |
| 67 | + }).show(); | |
| 68 | + }); | |
| 69 | +} | |
| 70 | +})(); | |
| 59 | 71 | |
| 60 | -//#endregion | |
| 61 | -//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js | |
| 62 | - function _defineProperty(e, r, t) { | |
| 63 | - return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { | |
| 64 | - value: t, | |
| 65 | - enumerable: !0, | |
| 66 | - configurable: !0, | |
| 67 | - writable: !0 | |
| 68 | - }) : e[r] = t, e; | |
| 69 | - } | |
| 70 | - | |
| 71 | -//#endregion | |
| 72 | -//#region app/modules/import-export/assets/js/admin.js | |
| 73 | - var Admin = /*#__PURE__*/ function() { | |
| 74 | - function Admin() { | |
| 75 | - _classCallCheck(this, Admin); | |
| 76 | - /** | |
| 77 | - * Session Storage Key | |
| 78 | - * | |
| 79 | - * @type {string} | |
| 80 | - */ | |
| 81 | - _defineProperty(this, "KIT_DATA_KEY", "elementor-kit-data"); | |
| 82 | - /** | |
| 83 | - * Contains the ID of the referrer Kit and the name of the Kit to remove. Stored in session storage. | |
| 84 | - * | |
| 85 | - * @type {Object} | |
| 86 | - */ | |
| 87 | - _defineProperty(this, "cachedKitData", void 0); | |
| 88 | - /** | |
| 89 | - * The 'Remove Kit' revert button | |
| 90 | - * | |
| 91 | - * @type {Element} | |
| 92 | - */ | |
| 93 | - _defineProperty(this, "revertButton", void 0); | |
| 94 | - /** | |
| 95 | - * Name of the kit currently active (last imported) | |
| 96 | - * | |
| 97 | - * @type {string} | |
| 98 | - */ | |
| 99 | - _defineProperty(this, "activeKitName", void 0); | |
| 100 | - this.activeKitName = this.getActiveKitName(); | |
| 101 | - this.revertButton = document.getElementById("elementor-import-export__revert_kit"); | |
| 102 | - if (this.revertButton) { | |
| 103 | - this.revertButton.addEventListener("click", this.onRevertButtonClick.bind(this)); | |
| 104 | - this.maybeAddRevertBtnMargin(); | |
| 105 | - this.maybeScrollToRevertButton(); | |
| 106 | - } | |
| 107 | - this.maybeShowReferrerKitDialog(); | |
| 108 | - } | |
| 109 | - return _createClass(Admin, [ | |
| 110 | - { | |
| 111 | - key: "shouldScrollToRevert", | |
| 112 | - value: function shouldScrollToRevert() { | |
| 113 | - return !!new URLSearchParams(window.location.search).get("scroll_to_revert"); | |
| 114 | - } | |
| 115 | - }, | |
| 116 | - { | |
| 117 | - key: "maybeAddRevertBtnMargin", | |
| 118 | - value: function maybeAddRevertBtnMargin() { | |
| 119 | - if (!this.shouldScrollToRevert()) return; | |
| 120 | - this.revertButton.style.marginBottom = this.calculateMargin(); | |
| 121 | - } | |
| 122 | - }, | |
| 123 | - { | |
| 124 | - key: "maybeScrollToRevertButton", | |
| 125 | - value: function maybeScrollToRevertButton() { | |
| 126 | - if (!this.shouldScrollToRevert()) return; | |
| 127 | - this.scrollToBottom(); | |
| 128 | - } | |
| 129 | - }, | |
| 130 | - { | |
| 131 | - key: "calculateMargin", | |
| 132 | - value: function calculateMargin() { | |
| 133 | - var adminBar = document.getElementById("wpadminbar"); | |
| 134 | - var adminBarHeight = adminBar ? adminBar.offsetHeight : 0; | |
| 135 | - var revertKitHeight = this.revertButton.parentElement.offsetHeight; | |
| 136 | - return document.body.clientHeight - adminBarHeight - revertKitHeight - document.getElementById("wpfooter").offsetHeight - 15 + "px"; | |
| 137 | - } | |
| 138 | - }, | |
| 139 | - { | |
| 140 | - key: "scrollToBottom", | |
| 141 | - value: function scrollToBottom() { | |
| 142 | - setTimeout(function() { | |
| 143 | - window.scrollTo(0, document.body.scrollHeight); | |
| 144 | - }); | |
| 145 | - } | |
| 146 | - }, | |
| 147 | - { | |
| 148 | - key: "onRevertButtonClick", | |
| 149 | - value: function onRevertButtonClick(event) { | |
| 150 | - var _this = this; | |
| 151 | - event.preventDefault(); | |
| 152 | - elementorCommon.dialogsManager.createWidget("confirm", { | |
| 153 | - headerMessage: (0, _wordpress_i18n.__)("Are you sure?", "elementor"), | |
| 154 | - message: (0, _wordpress_i18n.__)("Removing %s will permanently delete changes made to the Websites Template's content and site settings", "elementor").replace("%s", this.activeKitName), | |
| 155 | - strings: { | |
| 156 | - confirm: (0, _wordpress_i18n.__)("Delete", "elementor"), | |
| 157 | - cancel: (0, _wordpress_i18n.__)("Cancel", "elementor") | |
| 158 | - }, | |
| 159 | - onConfirm: function onConfirm() { | |
| 160 | - return _this.onRevertConfirm(); | |
| 161 | - } | |
| 162 | - }).show(); | |
| 163 | - } | |
| 164 | - }, | |
| 165 | - { | |
| 166 | - key: "onRevertConfirm", | |
| 167 | - value: function onRevertConfirm() { | |
| 168 | - var referrerKitId = new URLSearchParams(this.revertButton.href).get("referrer_kit"); | |
| 169 | - this.saveToCache(referrerKitId !== null && referrerKitId !== void 0 ? referrerKitId : ""); | |
| 170 | - location.href = this.revertButton.href; | |
| 171 | - } | |
| 172 | - }, | |
| 173 | - { | |
| 174 | - key: "maybeShowReferrerKitDialog", | |
| 175 | - value: function maybeShowReferrerKitDialog() { | |
| 176 | - var referrerKitId = this.getDataFromCache().referrerKitId; | |
| 177 | - if (void 0 === referrerKitId) return; | |
| 178 | - if (0 === referrerKitId.length) { | |
| 179 | - this.createKitDeletedWidget({ | |
| 180 | - message: (0, _wordpress_i18n.__)("Try a different Website Template or build your site from scratch.", "elementor"), | |
| 181 | - strings: { | |
| 182 | - confirm: (0, _wordpress_i18n.__)("OK", "elementor"), | |
| 183 | - cancel: (0, _wordpress_i18n.__)("Library", "elementor") | |
| 184 | - }, | |
| 185 | - onCancel: function onCancel() { | |
| 186 | - location.href = elementorImportExport.appUrl; | |
| 187 | - } | |
| 188 | - }); | |
| 189 | - this.clearCache(); | |
| 190 | - return; | |
| 191 | - } | |
| 192 | - this.createKitDeletedWidget({ | |
| 193 | - message: (0, _wordpress_i18n.__)("You're ready to apply a new Kit!", "elementor"), | |
| 194 | - strings: { | |
| 195 | - confirm: (0, _wordpress_i18n.__)("Continue to new Kit", "elementor"), | |
| 196 | - cancel: (0, _wordpress_i18n.__)("Close", "elementor") | |
| 197 | - }, | |
| 198 | - onConfirm: function onConfirm() { | |
| 199 | - location.href = elementorImportExport.appUrl + "/preview/" + referrerKitId; | |
| 200 | - } | |
| 201 | - }); | |
| 202 | - this.clearCache(); | |
| 203 | - } | |
| 204 | - }, | |
| 205 | - { | |
| 206 | - key: "createKitDeletedWidget", | |
| 207 | - value: function createKitDeletedWidget(options) { | |
| 208 | - var activeKitName = this.getDataFromCache().activeKitName; | |
| 209 | - elementorCommon.dialogsManager.createWidget("confirm", { | |
| 210 | - id: "e-revert-kit-deleted-dialog", | |
| 211 | - headerMessage: (0, _wordpress_i18n.__)("%s was successfully deleted", "elementor").replace("%s", activeKitName), | |
| 212 | - message: options.message, | |
| 213 | - strings: { | |
| 214 | - confirm: options.strings.confirm, | |
| 215 | - cancel: options.strings.cancel | |
| 216 | - }, | |
| 217 | - onConfirm: options.onConfirm, | |
| 218 | - onCancel: options.onCancel | |
| 219 | - }).show(); | |
| 220 | - } | |
| 221 | - }, | |
| 222 | - { | |
| 223 | - key: "getActiveKitName", | |
| 224 | - value: function getActiveKitName() { | |
| 225 | - var lastKit = elementorImportExport.lastImportedSession; | |
| 226 | - if (lastKit.kit_title) return lastKit.kit_title; | |
| 227 | - if (lastKit.kit_name) return this.convertNameToTitle(lastKit.kit_name); | |
| 228 | - return (0, _wordpress_i18n.__)("Your Kit", "elementor"); | |
| 229 | - } | |
| 230 | - }, | |
| 231 | - { | |
| 232 | - key: "convertNameToTitle", | |
| 233 | - value: function convertNameToTitle(name) { | |
| 234 | - return name.split(/[-_]+/).map(function(word) { | |
| 235 | - return word[0].toUpperCase() + word.substring(1); | |
| 236 | - }).join(" "); | |
| 237 | - } | |
| 238 | - }, | |
| 239 | - { | |
| 240 | - key: "saveToCache", | |
| 241 | - value: function saveToCache(referrerKitId) { | |
| 242 | - sessionStorage.setItem(this.KIT_DATA_KEY, JSON.stringify({ | |
| 243 | - referrerKitId, | |
| 244 | - activeKitName: this.activeKitName | |
| 245 | - })); | |
| 246 | - } | |
| 247 | - }, | |
| 248 | - { | |
| 249 | - key: "getDataFromCache", | |
| 250 | - value: function getDataFromCache() { | |
| 251 | - var _this$cachedKitData; | |
| 252 | - if (this.cachedKitData) return this.cachedKitData; | |
| 253 | - try { | |
| 254 | - this.cachedKitData = JSON.parse(sessionStorage.getItem(this.KIT_DATA_KEY)); | |
| 255 | - } catch (e) { | |
| 256 | - return {}; | |
| 257 | - } | |
| 258 | - return (_this$cachedKitData = this.cachedKitData) !== null && _this$cachedKitData !== void 0 ? _this$cachedKitData : {}; | |
| 259 | - } | |
| 260 | - }, | |
| 261 | - { | |
| 262 | - key: "clearCache", | |
| 263 | - value: function clearCache() { | |
| 264 | - sessionStorage.removeItem(this.KIT_DATA_KEY); | |
| 265 | - } | |
| 266 | - } | |
| 267 | - ]); | |
| 268 | - }(); | |
| 269 | - window.addEventListener("load", function() { | |
| 270 | - new Admin(); | |
| 271 | - }); | |
| 272 | - | |
| 273 | -//#endregion | |
| 274 | -})(wp.i18n); | |
| 72 | +/******/ })() | |
| 73 | +; | |
| 275 | 74 | //# sourceMappingURL=import-export-admin.js.map |