diff --git a/assets/js/ctct-plugin-admin.js b/assets/js/ctct-plugin-admin.js index ff49600d..086f7b38 100644 --- a/assets/js/ctct-plugin-admin.js +++ b/assets/js/ctct-plugin-admin.js @@ -86,7 +86,7 @@ eval("window.CTCTNewsletter = {};\n(function (window, $, app) {\n /**\n * @co \***********************************************/ /***/ (function() { -eval("window.CTCT_OptIns = {};\n(function (window, app) {\n /**\n * @constructor\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.init = function () {\n app.cache();\n app.bindEvents();\n };\n\n /**\n * Cache DOM elements.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.cache = function () {\n app.cache = {\n optinNoConn: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox #_ctct_opt_in_not_connected'),\n list: document.querySelectorAll('#cmb2-metabox-ctct_0_list_metabox .attached-posts-wrap .attached li'),\n title: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id-email-optin-title'),\n optin: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in'),\n instruct: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in-instructions')\n };\n };\n\n /**\n * Attach callbacks to events.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.bindEvents = function () {\n // Only fire show/hide if we have the normal checkbox.\n if (app.cache.optinNoConn.length) {\n // Fire once to get our loaded state set up.\n app.toggleNoConnectionFields();\n\n // Bind to fire when needed.\n Array.from(app.cache.optinNoConn).forEach(function (item) {\n item.addEventListener('change', function () {\n app.toggleNoConnectionFields();\n });\n });\n }\n\n // Only fire show/hide if we have the normal checkbox.\n if (app.cache.list.length) {\n // Fire once to get our loaded state set up.\n app.toggleConnectionFields();\n\n // Bind to fire when needed.\n Array.from(app.cache.list).forEach(function (item) {\n item.addEventListener('change', function () {\n app.toggleConnectionFields();\n });\n });\n }\n };\n\n /**\n * Toggle unnecessary, unconnected optin fields if we're not showing the opt-in.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.toggleNoConnectionFields = function () {\n if (app.cache.optinNoConn.checked) {\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'block';\n });\n } else {\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'none';\n });\n }\n };\n\n /**\n * Toggle unnecessary, *connected* optin fields if we're not showing the opt-in.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.toggleConnectionFields = function () {\n // If checked, show them, else hide it.\n if (0 <= app.cache.list.length) {\n Array.from(app.cache.title).forEach(function (item) {\n item.style.display = 'block';\n });\n Array.from(app.cache.optin).forEach(function (item) {\n item.style.display = 'block';\n });\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'block';\n });\n //app.cache.instruct.slideDown();\n } else {\n Array.from(app.cache.title).forEach(function (item) {\n item.style.display = 'none';\n });\n Array.from(app.cache.optin).forEach(function (item) {\n item.style.display = 'none';\n });\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'none';\n });\n }\n };\n app.init();\n})(window, window.CTCT_OptIns);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9hc3NldHMvanMvY3RjdC1wbHVnaW4tYWRtaW4vb3B0aW5zLmpzIiwibmFtZXMiOlsid2luZG93IiwiQ1RDVF9PcHRJbnMiLCJhcHAiLCJpbml0IiwiY2FjaGUiLCJiaW5kRXZlbnRzIiwib3B0aW5Ob0Nvbm4iLCJkb2N1bWVudCIsInF1ZXJ5U2VsZWN0b3JBbGwiLCJsaXN0IiwidGl0bGUiLCJvcHRpbiIsImluc3RydWN0IiwibGVuZ3RoIiwidG9nZ2xlTm9Db25uZWN0aW9uRmllbGRzIiwiQXJyYXkiLCJmcm9tIiwiZm9yRWFjaCIsIml0ZW0iLCJhZGRFdmVudExpc3RlbmVyIiwidG9nZ2xlQ29ubmVjdGlvbkZpZWxkcyIsImNoZWNrZWQiLCJzdHl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BQUNDLElBQUksRUFBSztRQUNoREEsSUFBSSxDQUFDSSxLQUFLLENBQUNDLE9BQU8sR0FBRyxNQUFNO01BQzVCLENBQUMsQ0FBQztJQUNIO0VBQ0QsQ0FBQztFQUVEckIsR0FBRyxDQUFDQyxJQUFJLENBQUMsQ0FBQztBQUNYLENBQUMsRUFBR0gsTUFBTSxFQUFFQSxNQUFNLENBQUNDLFdBQVksQ0FBQyIsImlnbm9yZUxpc3QiOltdfQ==\n//# sourceURL=webpack-internal:///./assets/js/ctct-plugin-admin/optins.js\n"); +eval("window.CTCT_OptIns = {};\n(function (window, app) {\n /**\n * @constructor\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.init = function () {\n app.cache();\n app.bindEvents();\n };\n\n /**\n * Cache DOM elements.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.cache = function () {\n app.cache = {\n optinNoConn: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox #_ctct_opt_in_not_connected'),\n list: document.querySelectorAll('#cmb2-metabox-ctct_0_list_metabox .attached-posts-wrap .retrieved li'),\n title: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id-email-optin-title'),\n optin: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in'),\n instruct: document.querySelectorAll('#cmb2-metabox-ctct_1_optin_metabox .cmb2-id--ctct-opt-in-instructions')\n };\n };\n\n /**\n * Attach callbacks to events.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.bindEvents = function () {\n if (app.cache.optinNoConn.length) {\n // Fire once to get our loaded state set up.\n app.toggleNoConnectionFields();\n\n // Bind to fire when needed.\n Array.from(app.cache.optinNoConn).forEach(function (item) {\n item.addEventListener('change', function () {\n app.toggleNoConnectionFields();\n });\n });\n } else {\n // Fire once to get our loaded state set up.\n app.toggleConnectionFields();\n\n // Bind to fire when needed.\n Array.from(app.cache.list).forEach(function (item) {\n item.addEventListener('change', function () {\n app.toggleConnectionFields();\n });\n });\n }\n };\n\n /**\n * Toggle unnecessary, unconnected optin fields if we're not showing the opt-in.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.toggleNoConnectionFields = function () {\n if (app.cache.optinNoConn.checked) {\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'block';\n });\n } else {\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'none';\n });\n }\n };\n\n /**\n * Toggle unnecessary, *connected* optin fields if we're not showing the opt-in.\n *\n * @author Constant Contact\n * @since 1.0.0\n */\n app.toggleConnectionFields = function () {\n // If checked, show them, else hide it.\n if (0 < app.cache.list.length) {\n Array.from(app.cache.title).forEach(function (item) {\n item.style.display = 'block';\n });\n Array.from(app.cache.optin).forEach(function (item) {\n item.style.display = 'block';\n });\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'block';\n });\n //app.cache.instruct.slideDown();\n } else {\n Array.from(app.cache.title).forEach(function (item) {\n item.style.display = 'none';\n });\n Array.from(app.cache.optin).forEach(function (item) {\n item.style.display = 'none';\n });\n Array.from(app.cache.instruct).forEach(function (item) {\n item.style.display = 'none';\n });\n }\n };\n app.init();\n})(window, window.CTCT_OptIns);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9hc3NldHMvanMvY3RjdC1wbHVnaW4tYWRtaW4vb3B0aW5zLmpzIiwibmFtZXMiOlsid2luZG93IiwiQ1RDVF9PcHRJbnMiLCJhcHAiLCJpbml0IiwiY2FjaGUiLCJiaW5kRXZlbnRzIiwib3B0aW5Ob0Nvbm4iLCJkb2N1bWVudCIsInF1ZXJ5U2VsZWN0b3JBbGwiLCJsaXN0IiwidGl0bGUiLCJvcHRpbiIsImluc3RydWN0IiwibGVuZ3RoIiwidG9nZ2xlTm9Db25uZWN0aW9uRmllbGRzIiwiQXJyYXkiLCJmcm9tIiwiZm9yRWFjaCIsIml0ZW0iLCJhZGRFdmVudExpc3Rlbm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MaXN0IjpbXX0=\n//# sourceURL=webpack-internal:///./assets/js/ctct-plugin-admin/optins.js\n"); /***/ }) diff --git a/assets/js/ctct-plugin-admin.min.js b/assets/js/ctct-plugin-admin.min.js index 2fda16e7..3f22977a 100644 --- a/assets/js/ctct-plugin-admin.min.js +++ b/assets/js/ctct-plugin-admin.min.js @@ -1,2 +1,2 @@ -!function(){var t={23:function(){window.CTCTAJAX={},function(t,e,n){var c=this;n.init=function(){n.handleReviewAJAX()},n.handleReviewAJAX=function(){e("#ctct-admin-notice-review_request").on("click","a",(function(n){var i="dismissed";e(c).hasClass("ctct-review")&&(i="reviewed");var o={action:"constant_contact_review_ajax_handler","ctct-review-action":i};e.ajax({url:t.ajaxurl,data:o,dataType:"json",success:function(c){t.console&&console.log(c),n.preventDefault(),e("#ctct-admin-notice-review_request").hide()},error:function(e,n,c){t.console&&console.log([n,c])}})}))},e(n.init)}(window,jQuery,window.CTCTAJAX)},603:function(){window.CTCTBuilder={},function(t,e,n){n.init=function(){e('#cmb2-metabox-ctct_2_fields_metabox option[value="email"]:selected').length&&e("#ctct-no-email-error").remove(),n.cache(),n.bindEvents(),n.selectBinds(),n.modifyFields(),e("#ctct_0_description_metabox h2.hndle").removeClass("ui-sortable-handle, hndle"),e("head").append('')},n.cache=function(){n.$c={window:e(t),body:e("body")},n.isLeaveWarningBound=!1},n.bindLeaveWarning=function(){n.isLeaveWarningBound||(e(t).bind("beforeunload",(function(){return t.ctctTexts.leavewarning})),n.isLeaveWarningBound=!0)},n.unbindLeaveWarning=function(){e(t).unbind("beforeunload")},n.bindEvents=function(){e("#post").submit((function(){e(".ctct-email-disabled").removeClass("disabled").prop("disabled",!1),n.unbindLeaveWarning()})),e(".cmb2-wrap input, .cmb2-wrap textarea").on("input",(function(){"undefined"!=typeof tinyMCE&&n.bindLeaveWarning()})),e(document).on("cmb2_shift_rows_complete",(function(){n.modifyFields(),n.bindLeaveWarning(),n.removeDuplicateMappings()})),e(document).on("cmb2_add_row",(function(t){e("#custom_fields_group_repeat .postbox").last().find(".map select").val("none"),n.modifyFields(),n.selectBinds(),n.removeDuplicateMappings()})),n.removeDuplicateMappings(),e("#ctct-reset-css").on("click",(function(t){t.preventDefault();var n=["#_ctct_form_description_font_size","#_ctct_form_submit_button_font_size","#_ctct_form_label_placement"],c=["#_ctct_form_padding_top","#_ctct_form_padding_bottom","#_ctct_form_padding_left","#_ctct_form_padding_right","#_ctct_input_custom_classes"];e(".wp-picker-clear").each((function(){e(this).click()}));for(var i=n.length;i--;){var o=e(n[i]).children("option").first();e(n[i]).val(o.val())}for(i=c.length;i--;)e(c[i]).val("")})),e(document).ready((function(){var t=e("#address_settings");if(t.length>0){var n=t.find('.cmb2-id--ctct-address-fields-include input[type="checkbox"]:checked'),c=t.find('.cmb2-id--ctct-address-fields-require input[type="checkbox"]');0===n.length&&e(c).each((function(){e(this).prop("disabled",!0)})),t.find('.cmb2-id--ctct-address-fields-include input[type="checkbox"]').on("change",(function(){var t=this;t.checked?e(c).each((function(){t.value===e(this).val()&&e(this).prop("disabled",!1)})):e(c).each((function(){t.value===e(this).val()&&(e(this).prop("checked",!1),e(this).prop("disabled",!0))}))}))}}))},n.selectBinds=function(){e("#cmb2-metabox-ctct_2_fields_metabox .cmb2_select").change((function(){n.modifyFields(),n.removeDuplicateMappings(),n.bindLeaveWarning(),e(".form-field-is-custom-field").on("keyup",n.noUniqueWarning)}))},n.validateUniqueFieldLabels=function(){var t=e(".form-field-is-custom-field").map((function(){return e(this).val()})).get();return t.length===t.filter((function(e,n){return t.indexOf(e)===n})).length},n.noUniqueWarning=function(){n.validateUniqueFieldLabels()?e(this).siblings(".ctct-warning").removeClass("ctct-warning-no-unqiue"):e(this).siblings(".ctct-warning").addClass("ctct-warning-no-unqiue")},n.modifyFields=function(){var n=!1,c=1;e("#cmb2-metabox-ctct_2_fields_metabox #custom_fields_group_repeat .cmb-repeatable-grouping").each((function(i,o){var a=e(this).find(".cmb-field-list"),r=e(a).find(".cmb-remove-group-row"),l=e(a).find(".required input[type=checkbox]"),s=l.closest(".cmb-row"),d=e(a).find(".map select option:selected"),u=d.text(),f=e(this).find("h3"),m=e(this).find('input[name*="_ctct_field_label"]'),p=e(this).find('input[name*="_ctct_field_desc"]');if("Custom Text Field"===u&&(u+=" ",u+=c.toString(),c++),f.text(u),0===m.val().length?m.val(u).addClass("ctct-label-filled"):m.addClass("ctct-label-filled"),n||"email"!==e(d).val()?(e(o).find("select").removeClass("disabled ctct-email-disabled").prop("disabled",!1),s.show(),r.show(),e(d).val(),"custom"===e(d).val()?m.addClass("form-field-is-custom-field"):m.removeClass("form-field-is-custom-field")):(n=!0,l.prop("checked",!0),e(o).find("select").addClass("disabled ctct-email-disabled").prop("disabled",!0),s.hide(),r.hide()),t.ctct_admin_placeholders){var b=t.ctct_admin_placeholders[e(o).find("select").val()];b&&b.length&&p.length?p.attr("placeholder","Example: "+b):t.ctct_admin_placeholders.default&&p.attr("placeholder",t.ctct_admin_placeholders.default)}}))},n.removeDuplicateMappings=function(){var t=[],n="#cmb2-metabox-ctct_2_fields_metabox #custom_fields_group_repeat .cmb-repeatable-grouping select",c=e(n);c.each((function(n,c){t.push(e(c).val())})),c.children().show(),t.forEach((function(t){"custom_text_area"!==t&&"custom"!==t&&e(n+" option[value="+t+"]:not( :selected )").hide()}))},e(n.init)}(window,jQuery,window.CTCTBuilder)},90:function(){window.CTCTClipboard={},function(t,e,n){n.init=function(){n.cache(),n.bindEvents()},n.cache=function(){n.$c={window:e(t),copyshortcode:e(".ctct-shortcode-wrap")}},n.copyClick=function(t,e){if(t&&e){e.select(),e.setSelectionRange(0,99999),document.execCommand("copy");var n=t.innerHTML;t.innerHTML=t.dataset.copied,setTimeout((function(){t.innerHTML=n}),3e3)}},n.bindEvents=function(){n.$c.copyshortcode&&n.$c.copyshortcode.each((function(t,e){var c=e.querySelector("input"),i=e.querySelector("button");c&&i&&i.addEventListener("click",(function(t){t.preventDefault(),n.copyClick(this,c)}))}))},n.init()}(window,jQuery,window.CTCTClipboard)},48:function(){window.CTCTForms={},function(t,e,n){n.init=function(){n.cache(),n.bindEvents()},n.cache=function(){n.$c={window:e(t),body:e("body"),disconnect:".ctct-disconnect",redirectToConnectionSettings:".connection-settings-redirect"}},n.bindEvents=function(){e(n.$c.disconnect).on("click",(function(e){return confirm(t.ctctTexts.disconnectconfirm)})),e(n.$c.redirectToConnectionSettings).on("click",(function(e){e.preventDefault(),t.open(e.target.href,"_blank"),t.open(t.ctct_settings.account,"_self")}))},e(n.init)}(window,jQuery,window.CTCTForms)},93:function(){window.CTCTModal={},function(t,e,n){n.init=function(){n.cache(),n.bindEvents()},n.cache=function(){n.$c={window:e(t),modalSelector:e(".ctct-modal"),modalClose:e(".ctct-modal-close"),textareaModal:e("#ctct-custom-textarea-modal"),textareaLink:e("#ctct-open-textarea-info"),deleteLogLink:e("#deletelog")}},n.bindEvents=function(){n.$c.modalClose.on("click",(function(){n.$c.modalSelector.removeClass("ctct-modal-open"),n.$c.modalSelector.hasClass("ctct-custom-textarea-modal")||e.ajax({type:"post",dataType:"json",url:t.ajaxurl,data:{action:"ctct_dismiss_first_modal",ctct_is_dismissed:"true"}})})),n.$c.textareaLink.on("click",(function(){n.$c.textareaModal.addClass("ctct-modal-open")})),n.$c.deleteLogLink.on("click",(function(n){n.preventDefault();var c=e(n.currentTarget).attr("href");e("#confirmdelete").dialog({resizable:!1,height:"auto",width:400,modal:!0,buttons:{Yes:function(){t.location.replace(c)},Cancel:function(){e("#confirmdelete").closest(".ui-dialog-content").dialog("close")}}})}))},e(n.init)}(window,jQuery,window.CTCTModal)},968:function(){var t,e;window.CTCTNewsletter={},window,t=jQuery,(e=window.CTCTNewsletter).init=function(){e.submitNewsletter()},e.submitNewsletter=function(){t(".ctct-body #subscribe").on("submit",(function(e){e.preventDefault();var n=t("#subscribe .ctct-call-to-action"),c=t(".ctct-body #subscribe")[0],i=t('.ctct-call-to-action input[type="text"]')[0],o=e.target.action;!0===i.validity.valid?(t("