PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.1
Elementor Website Builder – more than just a page builder v4.3.1
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | assets/js/import-export-admin.js +264 -411 4.1.0 → 4.3.1 View file →
@@ -1,422 +1,275 @@
1 -/******/ (() => { // webpackBootstrap
2 -/******/ var __webpack_modules__ = ({
1 +(function(_wordpress_i18n) {
3 2
4 -/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js":
5 -/*!****************************************************************!*\
6 - !*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
7 - \****************************************************************/
8 -/***/ ((module) => {
3 +//#region \0rolldown/runtime.js
4 + var __defProp = Object.defineProperty;
5 + var __name = (target, value) => __defProp(target, "name", {
6 + value,
7 + configurable: true
8 + });
9 9
10 -function _classCallCheck(a, n) {
11 - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
12 -}
13 -module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
10 +//#endregion
14 11
15 -/***/ }),
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 + }
16 16
17 -/***/ "../node_modules/@babel/runtime/helpers/createClass.js":
18 -/*!*************************************************************!*\
19 - !*** ../node_modules/@babel/runtime/helpers/createClass.js ***!
20 - \*************************************************************/
21 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
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 + }
22 27
23 -var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
24 -function _defineProperties(e, r) {
25 - for (var t = 0; t < r.length; t++) {
26 - var o = r[t];
27 - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
28 - }
29 -}
30 -function _createClass(e, r, t) {
31 - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
32 - writable: !1
33 - }), e;
34 -}
35 -module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
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 + }
36 40
37 -/***/ }),
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 + }
38 47
39 -/***/ "../node_modules/@babel/runtime/helpers/defineProperty.js":
40 -/*!****************************************************************!*\
41 - !*** ../node_modules/@babel/runtime/helpers/defineProperty.js ***!
42 - \****************************************************************/
43 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
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 + }
44 59
45 -var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
46 -function _defineProperty(e, r, t) {
47 - return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
48 - value: t,
49 - enumerable: !0,
50 - configurable: !0,
51 - writable: !0
52 - }) : e[r] = t, e;
53 -}
54 -module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
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 + }
55 70
56 -/***/ }),
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 + });
57 272
58 -/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
59 -/*!***********************************************************************!*\
60 - !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
61 - \***********************************************************************/
62 -/***/ ((module) => {
63 -
64 -function _interopRequireDefault(e) {
65 - return e && e.__esModule ? e : {
66 - "default": e
67 - };
68 -}
69 -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
70 -
71 -/***/ }),
72 -
73 -/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
74 -/*!*************************************************************!*\
75 - !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
76 - \*************************************************************/
77 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
78 -
79 -var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
80 -function toPrimitive(t, r) {
81 - if ("object" != _typeof(t) || !t) return t;
82 - var e = t[Symbol.toPrimitive];
83 - if (void 0 !== e) {
84 - var i = e.call(t, r || "default");
85 - if ("object" != _typeof(i)) return i;
86 - throw new TypeError("@@toPrimitive must return a primitive value.");
87 - }
88 - return ("string" === r ? String : Number)(t);
89 -}
90 -module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
91 -
92 -/***/ }),
93 -
94 -/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
95 -/*!***************************************************************!*\
96 - !*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
97 - \***************************************************************/
98 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
99 -
100 -var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
101 -var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
102 -function toPropertyKey(t) {
103 - var i = toPrimitive(t, "string");
104 - return "symbol" == _typeof(i) ? i : i + "";
105 -}
106 -module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
107 -
108 -/***/ }),
109 -
110 -/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
111 -/*!********************************************************!*\
112 - !*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
113 - \********************************************************/
114 -/***/ ((module) => {
115 -
116 -function _typeof(o) {
117 - "@babel/helpers - typeof";
118 -
119 - return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
120 - return typeof o;
121 - } : function (o) {
122 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
123 - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
124 -}
125 -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
126 -
127 -/***/ }),
128 -
129 -/***/ "@wordpress/i18n":
130 -/*!**************************!*\
131 - !*** external "wp.i18n" ***!
132 - \**************************/
133 -/***/ ((module) => {
134 -
135 -"use strict";
136 -module.exports = wp.i18n;
137 -
138 -/***/ })
139 -
140 -/******/ });
141 -/************************************************************************/
142 -/******/ // The module cache
143 -/******/ var __webpack_module_cache__ = {};
144 -/******/
145 -/******/ // The require function
146 -/******/ function __webpack_require__(moduleId) {
147 -/******/ // Check if module is in cache
148 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
149 -/******/ if (cachedModule !== undefined) {
150 -/******/ return cachedModule.exports;
151 -/******/ }
152 -/******/ // Create a new module (and put it into the cache)
153 -/******/ var module = __webpack_module_cache__[moduleId] = {
154 -/******/ // no module.id needed
155 -/******/ // no module.loaded needed
156 -/******/ exports: {}
157 -/******/ };
158 -/******/
159 -/******/ // Execute the module function
160 -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
161 -/******/
162 -/******/ // Return the exports of the module
163 -/******/ return module.exports;
164 -/******/ }
165 -/******/
166 -/************************************************************************/
167 -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
168 -(() => {
169 -"use strict";
170 -/*!*******************************************************!*\
171 - !*** ../app/modules/import-export/assets/js/admin.js ***!
172 - \*******************************************************/
173 -/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"];
174 -
175 -
176 -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
177 -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
178 -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
179 -var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js"));
180 -var Admin = /*#__PURE__*/function () {
181 - function Admin() {
182 - (0, _classCallCheck2.default)(this, Admin);
183 - /**
184 - * Session Storage Key
185 - *
186 - * @type {string}
187 - */
188 - (0, _defineProperty2.default)(this, "KIT_DATA_KEY", 'elementor-kit-data');
189 - /**
190 - * Contains the ID of the referrer Kit and the name of the Kit to remove. Stored in session storage.
191 - *
192 - * @type {Object}
193 - */
194 - (0, _defineProperty2.default)(this, "cachedKitData", void 0);
195 - /**
196 - * The 'Remove Kit' revert button
197 - *
198 - * @type {Element}
199 - */
200 - (0, _defineProperty2.default)(this, "revertButton", void 0);
201 - /**
202 - * Name of the kit currently active (last imported)
203 - *
204 - * @type {string}
205 - */
206 - (0, _defineProperty2.default)(this, "activeKitName", void 0);
207 - this.activeKitName = this.getActiveKitName();
208 - this.revertButton = document.getElementById('elementor-import-export__revert_kit');
209 - if (this.revertButton) {
210 - this.revertButton.addEventListener('click', this.onRevertButtonClick.bind(this));
211 - this.maybeAddRevertBtnMargin();
212 - this.maybeScrollToRevertButton();
213 - }
214 - this.maybeShowReferrerKitDialog();
215 - }
216 - return (0, _createClass2.default)(Admin, [{
217 - key: "shouldScrollToRevert",
218 - value: function shouldScrollToRevert() {
219 - var urlParams = new URLSearchParams(window.location.search);
220 - return !!urlParams.get('scroll_to_revert');
221 - }
222 - }, {
223 - key: "maybeAddRevertBtnMargin",
224 - value: function maybeAddRevertBtnMargin() {
225 - if (!this.shouldScrollToRevert()) {
226 - return;
227 - }
228 - this.revertButton.style.marginBottom = this.calculateMargin();
229 - }
230 - }, {
231 - key: "maybeScrollToRevertButton",
232 - value: function maybeScrollToRevertButton() {
233 - if (!this.shouldScrollToRevert()) {
234 - return;
235 - }
236 - this.scrollToBottom();
237 - }
238 -
239 - /**
240 - * CalculateMargin
241 - *
242 - * @return {string}
243 - */
244 - }, {
245 - key: "calculateMargin",
246 - value: function calculateMargin() {
247 - var adminBar = document.getElementById('wpadminbar');
248 - var adminBarHeight = adminBar ? adminBar.offsetHeight : 0;
249 - var revertKitHeight = this.revertButton.parentElement.offsetHeight;
250 - return document.body.clientHeight - adminBarHeight - revertKitHeight - document.getElementById('wpfooter').offsetHeight - 15 // Extra margin at the top
251 - + 'px';
252 - }
253 -
254 - /**
255 - * Scroll to the bottom of the page
256 - */
257 - }, {
258 - key: "scrollToBottom",
259 - value: function scrollToBottom() {
260 - setTimeout(function () {
261 - window.scrollTo(0, document.body.scrollHeight);
262 - });
263 - }
264 -
265 - /**
266 - * RevertBtnOnClick
267 - *
268 - * @param {Event} event
269 - */
270 - }, {
271 - key: "onRevertButtonClick",
272 - value: function onRevertButtonClick(event) {
273 - var _this = this;
274 - event.preventDefault();
275 - elementorCommon.dialogsManager.createWidget('confirm', {
276 - headerMessage: __('Are you sure?', 'elementor'),
277 - // Translators: %s is the name of the active Kit
278 - message: __('Removing %s will permanently delete changes made to the Websites Template\'s content and site settings', 'elementor').replace('%s', this.activeKitName),
279 - strings: {
280 - confirm: __('Delete', 'elementor'),
281 - cancel: __('Cancel', 'elementor')
282 - },
283 - onConfirm: function onConfirm() {
284 - return _this.onRevertConfirm();
285 - }
286 - }).show();
287 - }
288 - }, {
289 - key: "onRevertConfirm",
290 - value: function onRevertConfirm() {
291 - var referrerKitId = new URLSearchParams(this.revertButton.href).get('referrer_kit');
292 - this.saveToCache(referrerKitId !== null && referrerKitId !== void 0 ? referrerKitId : '');
293 - location.href = this.revertButton.href;
294 - }
295 - }, {
296 - key: "maybeShowReferrerKitDialog",
297 - value: function maybeShowReferrerKitDialog() {
298 - var _this$getDataFromCach = this.getDataFromCache(),
299 - referrerKitId = _this$getDataFromCach.referrerKitId;
300 - if (undefined === referrerKitId) {
301 - return;
302 - }
303 - if (0 === referrerKitId.length) {
304 - this.createKitDeletedWidget({
305 - message: __('Try a different Website Template or build your site from scratch.', 'elementor'),
306 - strings: {
307 - confirm: __('OK', 'elementor'),
308 - cancel: __('Library', 'elementor')
309 - },
310 - onCancel: function onCancel() {
311 - location.href = elementorImportExport.appUrl;
312 - }
313 - });
314 - this.clearCache();
315 - return;
316 - }
317 - this.createKitDeletedWidget({
318 - message: __('You\'re ready to apply a new Kit!', 'elementor'),
319 - strings: {
320 - confirm: __('Continue to new Kit', 'elementor'),
321 - cancel: __('Close', 'elementor')
322 - },
323 - onConfirm: function onConfirm() {
324 - location.href = elementorImportExport.appUrl + '/preview/' + referrerKitId;
325 - }
326 - });
327 - this.clearCache();
328 - }
329 -
330 - /**
331 - * CreateKitDeletedWidget
332 - *
333 - * @param {Object} options
334 - */
335 - }, {
336 - key: "createKitDeletedWidget",
337 - value: function createKitDeletedWidget(options) {
338 - var _this$getDataFromCach2 = this.getDataFromCache(),
339 - activeKitName = _this$getDataFromCach2.activeKitName;
340 - elementorCommon.dialogsManager.createWidget('confirm', {
341 - id: 'e-revert-kit-deleted-dialog',
342 - // Translators: %s is the name of the active Kit
343 - headerMessage: __('%s was successfully deleted', 'elementor').replace('%s', activeKitName),
344 - message: options.message,
345 - strings: {
346 - confirm: options.strings.confirm,
347 - cancel: options.strings.cancel
348 - },
349 - onConfirm: options.onConfirm,
350 - onCancel: options.onCancel
351 - }).show();
352 - }
353 -
354 - /**
355 - * Retrieving the last imported kit from the elementorAppConfig global
356 - *
357 - * @return {string}
358 - */
359 - }, {
360 - key: "getActiveKitName",
361 - value: function getActiveKitName() {
362 - var lastKit = elementorImportExport.lastImportedSession;
363 - if (lastKit.kit_title) {
364 - return lastKit.kit_title;
365 - }
366 - if (lastKit.kit_name) {
367 - return this.convertNameToTitle(lastKit.kit_name);
368 - }
369 - return __('Your Kit', 'elementor');
370 - }
371 -
372 - /**
373 - * ConvertNameToTitle
374 - *
375 - * @param {string} name
376 - *
377 - * @return {string}
378 - */
379 - }, {
380 - key: "convertNameToTitle",
381 - value: function convertNameToTitle(name) {
382 - return name.split(/[-_]+/).map(function (word) {
383 - return word[0].toUpperCase() + word.substring(1);
384 - }).join(' ');
385 - }
386 - }, {
387 - key: "saveToCache",
388 - value: function saveToCache(referrerKitId) {
389 - sessionStorage.setItem(this.KIT_DATA_KEY, JSON.stringify({
390 - referrerKitId: referrerKitId,
391 - activeKitName: this.activeKitName
392 - }));
393 - }
394 - }, {
395 - key: "getDataFromCache",
396 - value: function getDataFromCache() {
397 - var _this$cachedKitData;
398 - if (this.cachedKitData) {
399 - return this.cachedKitData;
400 - }
401 - try {
402 - this.cachedKitData = JSON.parse(sessionStorage.getItem(this.KIT_DATA_KEY));
403 - } catch (e) {
404 - return {};
405 - }
406 - return (_this$cachedKitData = this.cachedKitData) !== null && _this$cachedKitData !== void 0 ? _this$cachedKitData : {};
407 - }
408 - }, {
409 - key: "clearCache",
410 - value: function clearCache() {
411 - sessionStorage.removeItem(this.KIT_DATA_KEY);
412 - }
413 - }]);
414 -}();
415 -window.addEventListener('load', function () {
416 - new Admin();
417 -});
418 -})();
419 -
420 -/******/ })()
421 -;
273 +//#endregion
274 +})(wp.i18n);
422 275 //# sourceMappingURL=import-export-admin.js.map