diff --git a/assets/js/admin-builder-archive.js b/assets/js/admin-builder-archive.js index 102e2e4d5c..45df5c12d3 100644 --- a/assets/js/admin-builder-archive.js +++ b/assets/js/admin-builder-archive.js @@ -289,6 +289,51 @@ __webpack_require__.r(__webpack_exports__); +window.addEventListener('DOMContentLoaded', function () { + var $ = jQuery; + var axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js").default; + + // Migration Link + $('.directorist_directory_template_library').on('click', function (e) { + e.preventDefault(); + var self = this; + $('.cptm-create-directory-modal__action').after("Installing Templetiq, Please wait.."); + var form_data = new FormData(); + form_data.append('action', 'directorist_directory_type_library'); + form_data.append('directorist_nonce', directorist_admin.directorist_nonce); + + // Response Success Callback + var responseSuccessCallback = function responseSuccessCallback(response) { + var _response$data; + if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.success) { + var _response$data$messag, _response$data2; + var msg = (_response$data$messag = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.message) !== null && _response$data$messag !== void 0 ? _response$data$messag : 'Imported successfully!'; + $('.directorist_template_notice').text(msg); + location.reload(); + return; + } + responseFaildCallback(response); + }; + + // Response Error Callback + var responseFaildCallback = function responseFaildCallback(response) { + var _response$data$messag2, _response$data3; + // console.log( { response } ); + + var msg = (_response$data$messag2 = response === null || response === void 0 || (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.message) !== null && _response$data$messag2 !== void 0 ? _response$data$messag2 : 'Something went wrong please try again'; + var alert_content = "\n