| 1 |
/*! elementor - v3.7.7 - 20-09-2022 */ |
| 2 |
/******/ (() => { // webpackBootstrap |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "../assets/dev/js/admin/new-template/behaviors/lock-pro.js": |
| 6 |
/*!*****************************************************************!*\ |
| 7 |
!*** ../assets/dev/js/admin/new-template/behaviors/lock-pro.js ***! |
| 8 |
\*****************************************************************/ |
| 9 |
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 10 |
|
| 11 |
"use strict"; |
| 12 |
|
| 13 |
|
| 14 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 15 |
|
| 16 |
Object.defineProperty(exports, "__esModule", ({ |
| 17 |
value: true |
| 18 |
})); |
| 19 |
exports["default"] = void 0; |
| 20 |
|
| 21 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 22 |
|
| 23 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 24 |
|
| 25 |
var LockPro = /*#__PURE__*/function () { |
| 26 |
function LockPro(elements) { |
| 27 |
(0, _classCallCheck2.default)(this, LockPro); |
| 28 |
this.elements = elements; |
| 29 |
} |
| 30 |
|
| 31 |
(0, _createClass2.default)(LockPro, [{ |
| 32 |
key: "bindEvents", |
| 33 |
value: function bindEvents() { |
| 34 |
var _this$elements = this.elements, |
| 35 |
form = _this$elements.form, |
| 36 |
templateType = _this$elements.templateType; |
| 37 |
form.addEventListener('submit', this.onFormSubmit.bind(this)); |
| 38 |
templateType.addEventListener('change', this.onTemplateTypeChange.bind(this)); // Force checking on render, to make sure that default values are also checked. |
| 39 |
|
| 40 |
this.onTemplateTypeChange(); |
| 41 |
} |
| 42 |
}, { |
| 43 |
key: "onFormSubmit", |
| 44 |
value: function onFormSubmit(e) { |
| 45 |
var lockOptions = this.getCurrentLockOptions(); |
| 46 |
|
| 47 |
if (lockOptions.is_locked) { |
| 48 |
e.preventDefault(); |
| 49 |
} |
| 50 |
} |
| 51 |
}, { |
| 52 |
key: "onTemplateTypeChange", |
| 53 |
value: function onTemplateTypeChange() { |
| 54 |
var lockOptions = this.getCurrentLockOptions(); |
| 55 |
|
| 56 |
if (lockOptions.is_locked) { |
| 57 |
this.lock(lockOptions); |
| 58 |
} else { |
| 59 |
this.unlock(); |
| 60 |
} |
| 61 |
} |
| 62 |
}, { |
| 63 |
key: "getCurrentLockOptions", |
| 64 |
value: function getCurrentLockOptions() { |
| 65 |
var templateType = this.elements.templateType, |
| 66 |
currentOption = templateType.options[templateType.selectedIndex]; |
| 67 |
return JSON.parse(currentOption.dataset.lock || '{}'); |
| 68 |
} |
| 69 |
}, { |
| 70 |
key: "lock", |
| 71 |
value: function lock(lockOptions) { |
| 72 |
this.showLockBadge(lockOptions.badge); |
| 73 |
this.showLockButton(lockOptions.button); |
| 74 |
this.hideSubmitButton(); |
| 75 |
} |
| 76 |
}, { |
| 77 |
key: "unlock", |
| 78 |
value: function unlock() { |
| 79 |
this.hideLockBadge(); |
| 80 |
this.hideLockButton(); |
| 81 |
this.showSubmitButton(); |
| 82 |
} |
| 83 |
}, { |
| 84 |
key: "showLockBadge", |
| 85 |
value: function showLockBadge(badgeConfig) { |
| 86 |
var _this$elements2 = this.elements, |
| 87 |
lockBadge = _this$elements2.lockBadge, |
| 88 |
lockBadgeText = _this$elements2.lockBadgeText, |
| 89 |
lockBadgeIcon = _this$elements2.lockBadgeIcon; |
| 90 |
lockBadgeText.innerText = badgeConfig.text; |
| 91 |
lockBadgeIcon.className = badgeConfig.icon; |
| 92 |
lockBadge.classList.remove('e-hidden'); |
| 93 |
} |
| 94 |
}, { |
| 95 |
key: "hideLockBadge", |
| 96 |
value: function hideLockBadge() { |
| 97 |
this.elements.lockBadge.classList.add('e-hidden'); |
| 98 |
} |
| 99 |
}, { |
| 100 |
key: "showLockButton", |
| 101 |
value: function showLockButton(buttonConfig) { |
| 102 |
var lockButton = this.elements.lockButton; |
| 103 |
lockButton.href = this.replaceLockLinkPlaceholders(buttonConfig.url); |
| 104 |
lockButton.innerText = buttonConfig.text; |
| 105 |
lockButton.classList.remove('e-hidden'); |
| 106 |
} |
| 107 |
}, { |
| 108 |
key: "hideLockButton", |
| 109 |
value: function hideLockButton() { |
| 110 |
this.elements.lockButton.classList.add('e-hidden'); |
| 111 |
} |
| 112 |
}, { |
| 113 |
key: "showSubmitButton", |
| 114 |
value: function showSubmitButton() { |
| 115 |
this.elements.submitButton.classList.remove('e-hidden'); |
| 116 |
} |
| 117 |
}, { |
| 118 |
key: "hideSubmitButton", |
| 119 |
value: function hideSubmitButton() { |
| 120 |
this.elements.submitButton.classList.add('e-hidden'); |
| 121 |
} |
| 122 |
}, { |
| 123 |
key: "replaceLockLinkPlaceholders", |
| 124 |
value: function replaceLockLinkPlaceholders(link) { |
| 125 |
return link.replace(/%%utm_source%%/g, 'wp-add-new').replace(/%%utm_medium%%/g, 'wp-dash'); |
| 126 |
} |
| 127 |
}]); |
| 128 |
return LockPro; |
| 129 |
}(); |
| 130 |
|
| 131 |
exports["default"] = LockPro; |
| 132 |
|
| 133 |
/***/ }), |
| 134 |
|
| 135 |
/***/ "../assets/dev/js/admin/new-template/layout.js": |
| 136 |
/*!*****************************************************!*\ |
| 137 |
!*** ../assets/dev/js/admin/new-template/layout.js ***! |
| 138 |
\*****************************************************/ |
| 139 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 140 |
|
| 141 |
"use strict"; |
| 142 |
/* provided dependency */ var __ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n")["__"]; |
| 143 |
|
| 144 |
|
| 145 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 146 |
|
| 147 |
var _lockPro = _interopRequireDefault(__webpack_require__(/*! ./behaviors/lock-pro */ "../assets/dev/js/admin/new-template/behaviors/lock-pro.js")); |
| 148 |
|
| 149 |
var NewTemplateView = __webpack_require__(/*! elementor-admin/new-template/view */ "../assets/dev/js/admin/new-template/view.js"); |
| 150 |
|
| 151 |
module.exports = elementorModules.common.views.modal.Layout.extend({ |
| 152 |
getModalOptions: function getModalOptions() { |
| 153 |
return { |
| 154 |
id: 'elementor-new-template-modal' |
| 155 |
}; |
| 156 |
}, |
| 157 |
getLogoOptions: function getLogoOptions() { |
| 158 |
return { |
| 159 |
title: __('New Template', 'elementor') |
| 160 |
}; |
| 161 |
}, |
| 162 |
initialize: function initialize() { |
| 163 |
elementorModules.common.views.modal.Layout.prototype.initialize.apply(this, arguments); |
| 164 |
this.showLogo(); |
| 165 |
this.showContentView(); |
| 166 |
this.initElements(); |
| 167 |
this.lockProBehavior = new _lockPro.default(this.elements); |
| 168 |
this.lockProBehavior.bindEvents(); |
| 169 |
}, |
| 170 |
initElements: function initElements() { |
| 171 |
var container = this.$el[0], |
| 172 |
root = '#elementor-new-template__form'; |
| 173 |
this.elements = { |
| 174 |
form: container.querySelector(root), |
| 175 |
submitButton: container.querySelector("".concat(root, "__submit")), |
| 176 |
lockButton: container.querySelector("".concat(root, "__lock_button")), |
| 177 |
templateType: container.querySelector("".concat(root, "__template-type")), |
| 178 |
lockBadge: container.querySelector("".concat(root, "__template-type-badge")), |
| 179 |
lockBadgeText: container.querySelector("".concat(root, "__template-type-badge__text")), |
| 180 |
lockBadgeIcon: container.querySelector("".concat(root, "__template-type-badge__icon")) |
| 181 |
}; |
| 182 |
}, |
| 183 |
showContentView: function showContentView() { |
| 184 |
this.modalContent.show(new NewTemplateView()); |
| 185 |
} |
| 186 |
}); |
| 187 |
|
| 188 |
/***/ }), |
| 189 |
|
| 190 |
/***/ "../assets/dev/js/admin/new-template/view.js": |
| 191 |
/*!***************************************************!*\ |
| 192 |
!*** ../assets/dev/js/admin/new-template/view.js ***! |
| 193 |
\***************************************************/ |
| 194 |
/***/ ((module) => { |
| 195 |
|
| 196 |
"use strict"; |
| 197 |
|
| 198 |
|
| 199 |
module.exports = Marionette.ItemView.extend({ |
| 200 |
id: 'elementor-new-template-dialog-content', |
| 201 |
template: '#tmpl-elementor-new-template', |
| 202 |
ui: {}, |
| 203 |
events: {}, |
| 204 |
onRender: function onRender() {} |
| 205 |
}); |
| 206 |
|
| 207 |
/***/ }), |
| 208 |
|
| 209 |
/***/ "@wordpress/i18n": |
| 210 |
/*!**************************!*\ |
| 211 |
!*** external "wp.i18n" ***! |
| 212 |
\**************************/ |
| 213 |
/***/ ((module) => { |
| 214 |
|
| 215 |
"use strict"; |
| 216 |
module.exports = wp.i18n; |
| 217 |
|
| 218 |
/***/ }), |
| 219 |
|
| 220 |
/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js": |
| 221 |
/*!****************************************************************!*\ |
| 222 |
!*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***! |
| 223 |
\****************************************************************/ |
| 224 |
/***/ ((module) => { |
| 225 |
|
| 226 |
function _classCallCheck(instance, Constructor) { |
| 227 |
if (!(instance instanceof Constructor)) { |
| 228 |
throw new TypeError("Cannot call a class as a function"); |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 233 |
|
| 234 |
/***/ }), |
| 235 |
|
| 236 |
/***/ "../node_modules/@babel/runtime/helpers/createClass.js": |
| 237 |
/*!*************************************************************!*\ |
| 238 |
!*** ../node_modules/@babel/runtime/helpers/createClass.js ***! |
| 239 |
\*************************************************************/ |
| 240 |
/***/ ((module) => { |
| 241 |
|
| 242 |
function _defineProperties(target, props) { |
| 243 |
for (var i = 0; i < props.length; i++) { |
| 244 |
var descriptor = props[i]; |
| 245 |
descriptor.enumerable = descriptor.enumerable || false; |
| 246 |
descriptor.configurable = true; |
| 247 |
if ("value" in descriptor) descriptor.writable = true; |
| 248 |
Object.defineProperty(target, descriptor.key, descriptor); |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
function _createClass(Constructor, protoProps, staticProps) { |
| 253 |
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
| 254 |
if (staticProps) _defineProperties(Constructor, staticProps); |
| 255 |
Object.defineProperty(Constructor, "prototype", { |
| 256 |
writable: false |
| 257 |
}); |
| 258 |
return Constructor; |
| 259 |
} |
| 260 |
|
| 261 |
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 262 |
|
| 263 |
/***/ }), |
| 264 |
|
| 265 |
/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js": |
| 266 |
/*!***********************************************************************!*\ |
| 267 |
!*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! |
| 268 |
\***********************************************************************/ |
| 269 |
/***/ ((module) => { |
| 270 |
|
| 271 |
function _interopRequireDefault(obj) { |
| 272 |
return obj && obj.__esModule ? obj : { |
| 273 |
"default": obj |
| 274 |
}; |
| 275 |
} |
| 276 |
|
| 277 |
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 278 |
|
| 279 |
/***/ }) |
| 280 |
|
| 281 |
/******/ }); |
| 282 |
/************************************************************************/ |
| 283 |
/******/ // The module cache |
| 284 |
/******/ var __webpack_module_cache__ = {}; |
| 285 |
/******/ |
| 286 |
/******/ // The require function |
| 287 |
/******/ function __webpack_require__(moduleId) { |
| 288 |
/******/ // Check if module is in cache |
| 289 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 290 |
/******/ if (cachedModule !== undefined) { |
| 291 |
/******/ return cachedModule.exports; |
| 292 |
/******/ } |
| 293 |
/******/ // Create a new module (and put it into the cache) |
| 294 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 295 |
/******/ // no module.id needed |
| 296 |
/******/ // no module.loaded needed |
| 297 |
/******/ exports: {} |
| 298 |
/******/ }; |
| 299 |
/******/ |
| 300 |
/******/ // Execute the module function |
| 301 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 302 |
/******/ |
| 303 |
/******/ // Return the exports of the module |
| 304 |
/******/ return module.exports; |
| 305 |
/******/ } |
| 306 |
/******/ |
| 307 |
/************************************************************************/ |
| 308 |
var __webpack_exports__ = {}; |
| 309 |
// This entry need to be wrapped in an IIFE because it need to be in strict mode. |
| 310 |
(() => { |
| 311 |
"use strict"; |
| 312 |
/*!***********************************************************!*\ |
| 313 |
!*** ../assets/dev/js/admin/new-template/new-template.js ***! |
| 314 |
\***********************************************************/ |
| 315 |
|
| 316 |
|
| 317 |
var NewTemplateLayout = __webpack_require__(/*! elementor-admin/new-template/layout */ "../assets/dev/js/admin/new-template/layout.js"); |
| 318 |
|
| 319 |
var NewTemplateModule = elementorModules.ViewModule.extend({ |
| 320 |
getDefaultSettings: function getDefaultSettings() { |
| 321 |
return { |
| 322 |
selectors: { |
| 323 |
addButton: '.page-title-action:first, #elementor-template-library-add-new' |
| 324 |
} |
| 325 |
}; |
| 326 |
}, |
| 327 |
getDefaultElements: function getDefaultElements() { |
| 328 |
var selectors = this.getSettings('selectors'); |
| 329 |
return { |
| 330 |
$addButton: jQuery(selectors.addButton) |
| 331 |
}; |
| 332 |
}, |
| 333 |
bindEvents: function bindEvents() { |
| 334 |
this.elements.$addButton.on('click', this.onAddButtonClick); |
| 335 |
elementorCommon.elements.$window.on('hashchange', this.showModalByHash.bind(this)); |
| 336 |
}, |
| 337 |
showModalByHash: function showModalByHash() { |
| 338 |
if ('#add_new' === location.hash) { |
| 339 |
this.layout.showModal(); |
| 340 |
location.hash = ''; |
| 341 |
} |
| 342 |
}, |
| 343 |
onInit: function onInit() { |
| 344 |
elementorModules.ViewModule.prototype.onInit.apply(this, arguments); |
| 345 |
this.layout = new NewTemplateLayout(); |
| 346 |
this.showModalByHash(); |
| 347 |
}, |
| 348 |
onAddButtonClick: function onAddButtonClick(event) { |
| 349 |
event.preventDefault(); |
| 350 |
this.layout.showModal(); |
| 351 |
} |
| 352 |
}); |
| 353 |
jQuery(function () { |
| 354 |
window.elementorNewTemplate = new NewTemplateModule(); |
| 355 |
}); |
| 356 |
})(); |
| 357 |
|
| 358 |
/******/ })() |
| 359 |
; |
| 360 |
//# sourceMappingURL=new-template.js.map |