Hustle – Pop-Ups, Slide-ins and Email Opt-ins - Version 7.4.0

Version Description

( 2021-01-11 ) =

  • New: Mailpoet 3 integration
  • New: Mailster integration
Download this release

Release Info

Developer rickjc89
Plugin Icon 128x128 Hustle – Pop-Ups, Slide-ins and Email Opt-ins
Version 7.4.0
Comparing to
See all releases

Code changes from version 7.3.7 to 7.4.0

assets/images/release-highlight-header.png CHANGED
Binary file
assets/images/release-highlight-header@2x.png CHANGED
Binary file
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var e,t,i,n,s,a,o,l,r,d;window.Hustle=(e=jQuery,t=document,i=window,n={},s={},a={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g},o=_.extend({},Backbone.Events),l=Backbone.View.extend({initialize:function(){_.isFunction(this.initMix)&&this.initMix.apply(this,arguments),this.render&&(this.render=_.wrap(this.render,function(e){this.trigger("before_render"),e.call(this),o.trigger("view.rendered",this),this.trigger("rendered")})),_.isFunction(this.init)&&this.init.apply(this,arguments)}}),r=_.memoize(function(e){var t;return function(i){return(t=t||_.template(document.getElementById(e).innerHTML,null,a))(i).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),d=_.memoize(function(e){var t;return function(i){return(t=t||_.template(e,null,a))(i)}}),{define:function(n,a){if(n.split(".").length)!function n(s,o){var l,r=s.split("."),d=r.splice(0,1)[0];d&&(r.length?o[d]=o[d]||{}:(l=a.call(null,e,t,i),o[d]=_.isFunction(l)||void 0===l?l:_.extend(o[d]||{},l)),r.length&&d&&n(r.join("."),o[d]))}(n,s);else{var o=s[n]||{};s[n]=_.extend(o,a.call(null,e,t,i))}},setModule:function(e,t){n[e]=t},getModules:function(){return n},getModule:function(e){return n[e]},get:function(e){var t,i;return e.split(".").length?(t=!1,(i=function(e,n){var s=e.split("."),a=s.splice(0,1)[0];t=n[a],s.length&&i(s.join("."),n[a])})(e,s),t):s[e]||!1},Events:o,View:l,template:r,createTemplate:d,getTemplateOptions:function(){return e.extend(!0,{},a)},consts:{ModuleShowCount:"hustle_module_show_count-"}})}(jQuery);var Optin=window.Optin||{};function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Optin.Models={},function(e){"use strict";Optin.NEVER_SEE_PREFIX="inc_optin_never_see_again-",Optin.COOKIE_PREFIX="inc_optin_long_hidden-",Optin.POPUP_COOKIE_PREFIX="inc_optin_popup_long_hidden-",Optin.SLIDE_IN_COOKIE_PREFIX="inc_optin_slide_in_long_hidden-",Optin.EMBEDDED_COOKIE_PREFIX="inc_optin_embedded_long_hidden-",Optin.template=_.memoize(function(t){var i,n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g};return function(s){return(i=i||_.template(e("#"+t).html(),null,n))(s).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),Optin.templateCompat=_.memoize(function(t){var i;return function(n){return(i=i||_.template(e("#"+t).html()))(n).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),Optin.cookie={get:function(e){for(var t,i=document.cookie.split(";"),n=i.length,s=e+"=",a=0;a<n;a+=1){for(t=i[a];" "===t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(s)){var o=t.substring(s.length,t.length);return o?JSON.parse(o):o}}return null},set:function(t,i,n){var s,a;i=Array.isArray(i)||e.isPlainObject(i)?JSON.stringify(i):i,isNaN(n)?a="":((s=new Date).setTime(s.getTime()+24*n*60*60*1e3),a="; expires="+s.toGMTString()),document.cookie=t+"="+i+a+"; path=/"}},Optin.Mixins={_mixins:{},_servicesMixins:{},_desingMixins:{},_displayMixins:{},add:function(e,t){this._mixins[e]=t},getMixins:function(){return this._mixins},addServicesMixin:function(e,t){this._servicesMixins[e]=t},getServicesMixins:function(){return this._servicesMixins}}}(jQuery),function(e){"use strict";Hustle.Events.on("view.rendered",function(t){if(t instanceof Backbone.View){var i=function(e){e.hide(),e.prop("tabindex","-1"),e.prop("hidden",!0)},n=function(e){e.show(),e.prop("tabindex","0"),e.removeProp("hidden")};"#hustle-wizard-appearance"!==t.$el.selector&&t.$("select:not(.sui-select,.sui-inlabel)").each(function(){SUI.suiSelect(this)}),SUI.tabs({callback:function(e,t){var i=e.closest(".sui-tabs");"tab-cta-helper-enable"===e.attr("id")?i.find("#input-cta-helper-enable").click():"tab-cta-helper-disable"===e.attr("id")&&i.find("#input-cta-helper-disable").click();"tab-schedule-everyday"===e.attr("id")&&i.find("#input-schedule-everyday").click(),"tab-schedule-somedays"===e.attr("id")&&i.find("#input-schedule-somedays").click(),"tab-timezone-server"===e.attr("id")&&i.find("#input-timezone-server").click(),"tab-timezone-custom"===e.attr("id")&&i.find("#input-timezone-custom").click()}}),t.$(".sui-side-tabs").each(function(){var t=e(this),s=t.find(".sui-tabs-menu .sui-tab-item input");if(s.length){var a=function(){var t="";e.each(s,function(){var s=e(this),a=s.parent("label"),o=s.data("tab-menu"),l=e('.sui-tabs-content [data-tab-content="'.concat(o,'"]')),r=e('[data-tab-dependent="'.concat(o,'"]'));s[0].checked?(a.addClass("active"),o&&(t=o,l.addClass("active"),n(r))):(a.removeClass("active"),o!==t&&(l.removeClass("active"),i(r)))})};a(),s.on("change",function(){return a()}),t.find("button.sui-tab-item").on("click",function(){var t=e(this),i=e("#"+t.data("label-for"));i.length&&i.trigger("click").trigger("change")});var o=t.children(".hustle-tabs-option:checked");if(o.length){var l=o.prop("id");t.find('button[data-label-for="'.concat(l,'"]')).trigger("click")}}}),t.$(".sui-side-tabs").each(function(){var t=e(this),s=t.children(".hustle-tabs-option");if(s.length){var a=function(){var a="";e.each(s,function(){var s=e(this),o=s.attr("id"),l=t.find('button[data-label-for="'.concat(o,'"]')),r=l.attr("aria-controls"),d=e('div[id="'.concat(r,'"]'));s[0].checked?(l.addClass("active"),r&&(a=r,n(d))):(l.removeClass("active"),r!==a&&i(d))})};a(),s.on("change",function(){return a()}),t.children(".sui-tabs-menu").find("button.sui-tab-item").on("click",function(){var t=e(this),i=e('input[id="'+t.data("label-for")+'"]');i.length&&i.trigger("click").trigger("change")})}}),t.$(".select-content-switcher-wrapper").each(function(){var t=e(this),s=t.find(".select-content-switcher"),a=s.find("option"),o=function(){var o=s.find(":selected").data("switcher-menu"),l=t.find('.select-switcher-content[data-switcher-content="'.concat(o,'"]'));e.each(a,function(){var s=e(this);if(s.data("switcher-menu")===o)n(l);else{var a=t.find('.select-switcher-content[data-switcher-content="'.concat(s.data("switcher-menu"),'"]'));i(a)}})};o(),s.on("change",function(){return o()})}),t.$(".hustle-toggle-with-container").each(function(){var t=e(this),i=t.find("input[type=checkbox]"),n=e('[data-toggle-content="'.concat(t.data("toggle-on"),'"]')),s=e('[data-toggle-content="'.concat(t.data("toggle-off"),'"]')),a=function(){i[0].checked?(Module.Utils.accessibleShow(n),Module.Utils.accessibleHide(s)):(Module.Utils.accessibleShow(s),Module.Utils.accessibleHide(n))};a(),i.on("change",a)}),t.$(".hustle-radio-with-dependency-to-disable").each(function(){var t=e(this),i=t.data("disable"),n=e('[data-disable-content="'.concat(i,'"]')),s=n.data("disable-off"),a=n.data("disable-on"),o=function(){t.is(":checked")&&(s?s===t.val()?n.prop("disabled",!1):n.prop("disabled",!0):a&&(a===t.val()?n.prop("disabled",!0):n.prop("disabled",!1)))};o(),t.on("change",o)}),t.$(".hustle-select-with-dependency-to-disable").each(function(){var t=e(this),i=t.data("disable"),n=e('[data-disable-content="'.concat(i,'"]')),s=n.data("disable-off"),a=n.data("disable-on"),o=function(){s?s===t.val()?n.prop("disabled",!1):n.prop("disabled",!0):a&&(a===t.val()?n.prop("disabled",!0):n.prop("disabled",!1))};o(),t.on("change",o)}),Module.Utils.showHideDependencyOnSelectChange(t.$el)}}),e(document).ready(function(){e(".hustle-delete-module-button").on("click",function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description"),actionClass:"hustle-single-module-button-action"};Module.deleteModal.open(n,i[0])}),e(".hustle-module-tracking-reset-button").on("click",function(t){t.preventDefault();var i=e(t.target),n={id:i.data("module-id"),nonce:optinVars.single_module_action_nonce,action:"reset-tracking",title:i.data("title"),description:i.data("description"),actionClass:"hustle-single-module-button-action"};Module.deleteModal.open(n,i[0])}),e(".hustle-copy-shortcode-button").on("click",function(t){t.preventDefault();var i=e(t.target),n=i.data("shortcode"),s=i.closest(".sui-with-button-inside");if(void 0!==n){var a=e("<input />");e("body").append(a),a.val(n).trigger("select"),document.execCommand("copy"),a.remove(),Module.Notification.open("success",optinVars.messages.shortcode_copied)}else if(s.length){s.find('input[type="text"]').trigger("select"),document.execCommand("copy")}}),e(".hustle-dismissible-admin-notice .notice-dismiss, .hustle-dismissible-admin-notice .dismiss-notice").on("click",function(t){t.preventDefault();var i=e(t.currentTarget).closest(".hustle-dismissible-admin-notice");e.post(ajaxurl,{action:"hustle_dismiss_notification",name:i.data("name"),_ajax_nonce:optinVars.dismiss_notice_nonce}).always(i.fadeOut())}),e("#hustle-tracking-migration-notice .hustle-notice-dismiss").on("click",function(t){t.preventDefault(),e("#hustle-dismiss-modal-button").on("click",function(t){t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:e(t.currentTarget).data("name"),_ajax_nonce:e(t.currentTarget).data("nonce")}).always(function(){return location.reload()})}),SUI.openModal("hustle-dialog--migrate-dismiss-confirmation",e(".sui-header-title"))}),e(".sui-form-field input[type=number]").length&&e(".sui-form-field input[type=number]").on("keydown",function(t){e(this)[0].hasAttribute("min")&&0<=e(this).attr("min")&&(0!==t.originalEvent.key.replace(/[^0-9^.^,]/,"").length||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.preventDefault())}),setTimeout(function(){e(".hustle-scroll-to").length&&e("html, body").animate({scrollTop:e(".hustle-scroll-to").offset().top},"slow")},100),e(".hustle-check-all").on("click",function(t){var i=e(t.target),n=i.parents(".sui-wrap-hustle").find(".hustle-list"),s=i.is(":checked");n.find(".hustle-listing-checkbox").prop("checked",s),i.parents(".sui-wrap-hustle").find(".hustle-check-all").prop("checked",s),e(".hustle-bulk-apply-button").prop("disabled",!s)}),e(".hustle-list .hustle-listing-checkbox").on("click",function(t){var i=e(t.target),n=i.parents(".sui-wrap-hustle").find(".hustle-list"),s=i.is(":checked")&&!n.find(".hustle-listing-checkbox:not(:checked)").length,a=0===n.find(".hustle-listing-checkbox:checked").length;e(".hustle-check-all").prop("checked",s),e(".hustle-bulk-apply-button").prop("disabled",a)}),e(".hustle-bulk-apply-button").on("click",function(t){var i=e(t.target),n=e("select option:selected",i.closest(".hui-bulk-actions")).val(),s=e(".hustle-list .hustle-listing-checkbox:checked");if(0===s.length||"undefined"===n)return!1;var a=[];if(e.each(s,function(){a.push(e(this).val())}),"delete-all"===n){var o={ids:a.join(","),nonce:i.siblings('input[name="hustle_nonce"]').val(),title:i.data("title"),description:i.data("description"),action:n};return Module.deleteModal.open(o,i[0]),!1}})})}(jQuery),Hustle.define("Modals.Migration",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--migrate",data:{},events:{"click #hustle-migrate-start":"migrateStart","click #hustle-create-new-module":"createModule","click .sui-box-selector":"enableContinue","click .hustle-dialog-migrate-skip":"dismissModal"},initialize:function(){if(this.$el.length){var t="",i="";0===this.$el.data("isFirst")?(t="#hustle-dialog--migrate-slide-2",i="hustle-migrate-start"):(t="#hustle-dialog--migrate-slide-1",i="hustle-migrate-get-started"),this.$(t).addClass("sui-active sui-loaded"),setTimeout(function(){return SUI.openModal("hustle-dialog--migrate",i,e(".sui-wrap-hustle")[0],!1)},100),this.$progressBar=this.$el.find(".sui-progress .sui-progress-bar span"),this.$progressText=this.$el.find(".sui-progress .sui-progress-text span"),this.$partialRows=this.$el.find("#hustle-partial-rows")}},migrateStart:function(t){var i=e(t.target),n=this.$el.find("#hustle-dialog--migrate-slide-2"),s=n.find("#hustle-dialog--migrate-slide-2-description");i.addClass("sui-button-onload"),n.find(".hustle-dialog-migrate-skip").remove(),s.text(s.data("migrate-text")),Module.Utils.accessibleHide(n.find("div[data-migrate-start]")),Module.Utils.accessibleHide(n.find("div[data-migrate-failed]")),Module.Utils.accessibleShow(n.find("div[data-migrate-progress]")),SUI.closeNotice("hustle-dialog--migrate-error-notice"),this.migrateTracking(t),i.removeClass("sui-button-onload"),t.preventDefault()},migrateComplete:function(){var e=this.$("#hustle-dialog--migrate-slide-2"),t=this,i=e.find("#hustle-dialog--migrate-slide-2-title"),n=e.find("#hustle-dialog--migrate-slide-2-description");this.$el.find("sui-button-onload").removeClass("sui-button-onload"),i.text(i.data("done-text")),n.text(n.data("done-text")),Module.Utils.accessibleHide(e.find("div[data-migrate-progress]")),Module.Utils.accessibleShow(e.find("div[data-migrate-done]")),this.$el.closest(".sui-modal").on("click",function(e){return t.closeDialog(e)})},migrateFailed:function(){var t=this.$el.find("#hustle-dialog--migrate-slide-2");t.find("#dialogDescription").text(""),Module.Utils.accessibleHide(t.find("div[data-migrate-start]")),Module.Utils.accessibleShow(t.find("div[data-migrate-failed]")),Module.Utils.accessibleHide(t.find("div[data-migrate-progress]"));var i="hustle-dialog--migrate-error-notice",n=e("#"+i).data("message");Module.Notification.open("error",n,!1,i,!1)},updateProgress:function(e,t,i){void 0===this.totalRows&&(this.totalRows=i,this.$el.find("#hustle-total-rows").text(i)),this.$partialRows.text(e);var n=t+"%";this.$progressBar.css("width",n),100>=t&&this.$progressText.text(t+"%")},migrateTracking:function(t){t.preventDefault();var i=this,n={action:"hustle_migrate_tracking",_ajax_nonce:e(t.currentTarget).data("nonce")};return e.ajax({type:"POST",url:ajaxurl,dataType:"json",data:n,success:function(e){if(e.success){var n=e.data.migrated_rows,s=e.data.migrated_percentage,a=e.data.total_entries||"0";"done"!==e.data.current_meta?(i.updateProgress(n,s,a),i.migrateTracking(t)):(i.updateProgress(n,s,a),setTimeout(function(){return i.migrateComplete()},500))}else i.migrateFailed()},error:function(){i.migrateFailed()}}),!1},createModule:function(t){var i=e(t.target),n=this.$el.find(".sui-box-selector input:checked");if(n.length){this.dismissModal(),i.addClass("sui-button-onload");var s=n.val(),a=void 0!==optinVars.module_page[s]?optinVars.module_page[s]:optinVars.module_page.popup;window.location="?page=".concat(a,"&create-module=true")}t.preventDefault()},closeDialog:function(e){SUI.closeModal(),e.preventDefault(),e.stopPropagation()},enableContinue:function(){this.$el.find("#hustle-create-new-module").prop("disabled",!1)},dismissModal:function(t){t&&t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"migrate_modal",_ajax_nonce:this.$el.data("nonce")})}}))}),Hustle.define("Modals.Preview",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--preview",iframeWindow:null,events:{"click .hustle-modal-close":"close","click .hustle-preview-device-button":"previewDeviceSelected","click #hustle-preview-reload-module-button":"reloadModuleClicked"},open:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.displayModuleName(n),this.maybeHideReloadButton(t),SUI.openModal("hustle-dialog--preview",i,null,!1,!1);var s={action:"open",moduleId:e,moduleType:t,previewData:n};this.initiateIframe(s)},displayModuleName:function(e){e&&this.$("#hustle-dialog--preview-description").html(e.module_name||"")},maybeHideReloadButton:function(e){var t=this.$("#hustle-preview-reload-module-button");"embedded"===e?t.addClass("sui-hidden-important"):t.removeClass("sui-hidden-important")},initiateIframe:function(e){var t=this,i=this.$("#hustle-preview-iframe");void 0===i.attr("src")?(i[0].src=i.data("src"),i.on("load",function(){var n=t.$("#hustle-preview-iframe-container");n.show(),n.prop("aria-hidden",!1),t.$("#hustle-preview-loader").remove(),t.iframeWindow=i[0].contentWindow,t.talkToIframe(e)})):(this.$("#hustle-sr-text-preview-loaded").remove(),this.talkToIframe(e))},close:function(){var e=this;setTimeout(function(){return e.talkToIframe({action:"close"})},500)},reloadModuleClicked:function(){this.talkToIframe({action:"reload"})},previewDeviceSelected:function(t){var i=e(t.currentTarget),n=i.data("device");this.$(".hustle-preview-device-button").removeClass("sui-active"),i.addClass("sui-active"),this.$("#hustle-sr-text-preview-selected-device").html(i.data("selected")),"desktop"===n?(this.$el.removeClass("hustle-preview-mobile"),this.$el.addClass("hustle-preview-desktop")):"mobile"===n&&(this.$el.removeClass("hustle-preview-desktop"),this.$el.addClass("hustle-preview-mobile"))},talkToIframe:function(e){this.iframeWindow&&this.iframeWindow.postMessage(e,window.location)}})}),Hustle.define("Modals.ReleaseHighlight",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--release-highlight",initialize:function(){var e=this;this.$el.length&&(setTimeout(function(){return e.show()},100),this.$el.on("close",function(){return e.dismissModal()}))},show:function(){var t=this;"undefined"!=typeof SUI?SUI.openModal("hustle-dialog--release-highlight",e(".sui-header-title")[0],this.$(".hustle-modal-close"),!0):setTimeout(function(){return t.show()},100)},dismissModal:function(){e.post(ajaxurl,{action:"hustle_dismiss_notification",name:this.$el.data("name"),_ajax_nonce:optinVars.dismiss_notice_nonce})}}))}),Hustle.define("Modals.ReviewConditions",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--review_conditions",events:{"click .hustle-review-conditions-dismiss":"dismissModal"},initialize:function(){this.$el.length&&setTimeout(this.show,100,this)},show:function(t){"undefined"!=typeof SUI&&void 0!==SUI.openModal?SUI.openModal("hustle-dialog--review_conditions",e(".sui-header-title")):setTimeout(t.show,100,t)},dismissModal:function(){e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"41_visibility_behavior_update",_ajax_nonce:this.$el.data("nonce")})}}))}),Hustle.define("Upgrade_Modal",function(){"use strict";return Backbone.View.extend({el:"#wph-upgrade-modal",opts:{},events:{"click .wpmudev-i_close":"close"},initialize:function(e){this.opts=_.extend({},this.opts,e)},close:function(e){e.preventDefault(),e.stopPropagation(),this.$el.removeClass("wpmudev-modal-active")}})}),Hustle.define("Modals.Welcome",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--welcome",events:{"click #hustle-new-create-module":"createModule","click .sui-box-selector":"enableContinue","click #getStarted":"dismissModal","click .sui-modal-skip":"dismissModal","click .hustle-button-dismiss-welcome":"dismissModal"},initialize:function(){this.$el.length&&setTimeout(this.show,100,this)},show:function(t){"undefined"!=typeof SUI?(SUI.openModal("hustle-dialog--welcome",e(".sui-header-title")[0],t.$("#hustle-dialog--welcome-first .sui-button-icon.hustle-button-dismiss-welcome"),!0),SUI.slideModal("hustle-dialog--welcome-first")):setTimeout(t.show,100,t)},createModule:function(t){var i=e(t.target),n=this.$el.find(".sui-box-selector input:checked");if(n.length){i.addClass("sui-button-onload");var s=n.val(),a=void 0!==optinVars.module_page[s]?optinVars.module_page[s]:optinVars.module_page.popup;window.location="?page=".concat(a,"&create-module=true")}t.preventDefault()},enableContinue:function(){this.$el.find("#hustle-new-create-module").prop("disabled",!1)},dismissModal:function(t){t&&t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"welcome_modal",_ajax_nonce:this.$el.data("nonce")})}}))}),function(e){"use strict";Optin.View={},Optin.View.Conditions=Optin.View.Conditions||{};var t=Hustle.View.extend({conditionId:"",className:"sui-builder-field sui-accordion-item sui-accordion-item--open",_template:Optin.template("hustle-visibility-rule-tpl"),template:!1,_defaults:{typeName:"",conditionName:""},_events:{"change input":"changeInput","change textarea":"changeInput","change select":"changeInput"},init:function(t){return this.undelegateEvents(),this.$el.removeData().off(),this.type=t.type,this.groupId=t.groupId,this.filter_type=t.filter_type,this.id=this.conditionId,this.template=void 0!==this.cpt?Optin.template("hustle-visibility-rule-tpl--post_type"):Optin.template("hustle-visibility-rule-tpl--"+this.conditionId),this._defaults={typeName:optinVars.module_type_name,conditionName:optinVars.messages.conditions[this.conditionId]?optinVars.messages.conditions[this.conditionId]:this.conditionId,groupId:this.groupId,id:this.conditionId,source:t.source},this.data=this.getData(),this.render(),this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents(),this.onInit&&_.isFunction(this.onInit)&&this.onInit.apply(this,arguments),this},getData:function(){return _.extend({},this._defaults,this.defaults(),this.model.get(this.conditionId),{type:this.type})},getTitle:function(){return this.title.replace("{type_name}",this.data.typeName)},getBody:function(){return"function"==typeof this.body?this.body.apply(this,arguments):this.body.replace("{type_name}",this.data.typeName)},getHeader:function(){return this.header},countLines:function(e){return e.replace(/\s+$/g,"").split("\n").length},render:function(){this.setProperties();var t=this._template(_.extend({},{title:this.getTitle(),body:this.getBody(),header:this.getHeader()},this._defaults,{type:this.type}));return this.$el.html(""),this.$el.html(t),e(".wph-conditions--box .wph-conditions--item:not(:last-child)").removeClass("wph-conditions--open").addClass("wph-conditions--closed"),e(".wph-conditions--box .wph-conditions--item:not(:last-child) section").hide(),this.rendered&&"function"==typeof this.rendered&&this.rendered.apply(this,arguments),this},updateAttribute:function(e,t){this.data=this.model.get(this.conditionId),this.data[e]=t,this.model.set(this.conditionId,this.data),this.model.trigger("change")},getAttribute:function(e){var t=this.model.get(this.conditionId);return!(!t||!t[e])&&t[e]},refreshLabel:function(){var e=this.getHeader();this.$el.find(".wph-condition--preview").html(""),this.$el.find(".sui-accordion-item-header .sui-tag").html(e)},changeInput:function(t){var i=t.target,n=e(i),s=n.is(".sui-select")?n.val():t.target.value;if(t.stopImmediatePropagation(),n.is(":checkbox")&&(s=n.is(":checked")),n.is(".select2-search__field"))return!1;var a=i.getAttribute("data-attribute");this.updateAttribute(a,s),this.refreshLabel()},getConfigs:function(){return this.defaults()||!0}}),i=function(){e(".wph-conditions--items").data("select2ScrollPosition",{})},n={events:{'change input[type="radio"]':"setCurrentLi"},setCurrentLi:function(t){var i=e(t.target),n=i.closest("li");n.siblings().removeClass("current"),n.toggleClass("current",i.is(":checked"))}};Optin.View.Conditions.posts=t.extend(_.extend({},n,{conditionId:"posts",setProperties:function(){this.title=optinVars.messages.conditions.posts},defaults:function(){return{filter_type:"except",posts:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("posts").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("posts").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"post"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.pages=t.extend(_.extend({},n,{conditionId:"pages",setProperties:function(){this.title=optinVars.messages.conditions.pages},defaults:function(){return{filter_type:"except",pages:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"page"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),optinVars.post_types&&_.each(optinVars.post_types,function(e,s){Optin.View.Conditions[e.name]=t.extend(_.extend({},n,{conditionId:e.name,cpt:!0,setProperties:function(){this.title=e.label},defaults:function(){return{filter_type:"except",selected_cpts:[],postType:s,postTypeLabel:e.label}},getHeader:function(){return this.getAttribute("selected_cpts").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("selected_cpts").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:s}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}}))}),Optin.View.Conditions.categories=t.extend(_.extend({},n,{conditionId:"categories",setProperties:function(){this.title=optinVars.messages.conditions.categories},defaults:function(){return{filter_type:"except",categories:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("categories").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("categories").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"category"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.tags=t.extend(_.extend({},n,{conditionId:"tags",setProperties:function(){this.title=optinVars.messages.conditions.tags},defaults:function(){return{filter_type:"except",tags:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("tags").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("tags").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({width:"100%",tags:"true",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"tag"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.visitor_logged_in_status=t.extend({conditionId:"visitor_logged_in_status",setProperties:function(){this.title=optinVars.messages.conditions.visitor_logged_in},defaults:function(){return{show_to:"logged_in"}},getHeader:function(){return this.getAttribute("show_to").length&&"logged_out"===this.getAttribute("show_to")?optinVars.messages.condition_labels.logged_out:optinVars.messages.condition_labels.logged_in},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.shown_less_than=t.extend({conditionId:"shown_less_than",setProperties:function(){this.title=optinVars.messages.conditions.shown_less_than},defaults:function(){return{less_or_more:"less_than",less_than:""}},getHeader:function(){return 0<this.getAttribute("less_than")?"less_than"===this.getAttribute("less_or_more")?optinVars.messages.condition_labels.number_views.replace("{number}",this.getAttribute("less_than")):optinVars.messages.condition_labels.number_views_more.replace("{number}",this.getAttribute("less_than")):optinVars.messages.condition_labels.any},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.visitor_device=t.extend({conditionId:"visitor_device",setProperties:function(){this.title=optinVars.messages.conditions.only_on_mobile},defaults:function(){return{filter_type:"mobile"}},getHeader:function(){return"not_mobile"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.desktop_only:optinVars.messages.condition_labels.mobile_only},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.from_referrer=t.extend({conditionId:"from_referrer",disable:["from_referrer"],setProperties:function(){this.title=optinVars.messages.conditions.from_specific_ref},defaults:function(){return{filter_type:"true",refs:""}},getHeader:function(){var e=0;return this.getAttribute("refs").length&&(e=this.countLines(this.getAttribute("refs"))),e?("false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.except_these:optinVars.messages.condition_labels.only_these).replace("{number}",e):"false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.any:optinVars.messages.condition_labels.none},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.source_of_arrival=t.extend({conditionId:"source_of_arrival",setProperties:function(){this.title=optinVars.messages.conditions.from_search_engine},defaults:function(){return{source_direct:"false",source_external:"false",source_internal:"false",source_not_search:"false",source_search:"false"}},getHeader:function(){var e=0,t=_.isTrue(this.getAttribute("source_direct"))&&++e,i=_.isTrue(this.getAttribute("source_external"))&&++e,n=_.isTrue(this.getAttribute("source_internal"))&&++e,s=_.isTrue(this.getAttribute("source_search"))&&++e,a=_.isTrue(this.getAttribute("source_not_search"))&&++e;return s&&a||t&&n&&i?optinVars.messages.condition_labels.any:e?optinVars.messages.condition_labels.any_conditions.replace("{number}",e):optinVars.messages.condition_labels.any},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.on_url=t.extend({conditionId:"on_url",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_url},defaults:function(){return{filter_type:"except",urls:""}},getHeader:function(){var e=0;return this.getAttribute("urls").length&&(e=this.countLines(this.getAttribute("urls"))),e?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",e):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.on_browser=t.extend({conditionId:"on_browser",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_browser},defaults:function(){return{browsers:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("browsers").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("browsers").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("browsers")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.visitor_commented=t.extend({conditionId:"visitor_commented",setProperties:function(){this.title=optinVars.messages.conditions.visitor_has_never_commented},defaults:function(){return{filter_type:"true"}},getHeader:function(){return"false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.false:optinVars.messages.condition_labels.true},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.user_roles=t.extend({conditionId:"user_roles",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_roles},defaults:function(){return{roles:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("roles").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("roles").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("roles")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.page_templates=t.extend({conditionId:"page_templates",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_templates},defaults:function(){return{templates:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("templates").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("templates").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("templates")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.user_registration=t.extend({conditionId:"user_registration",setProperties:function(){this.title=optinVars.messages.conditions.user_registration},defaults:function(){return{from_date:0,to_date:0}},getHeader:function(){return(0<this.getAttribute("from_date")?optinVars.messages.condition_labels.reg_date.replace("{number}",this.getAttribute("from_date")):optinVars.messages.condition_labels.immediately)+" - "+(0<this.getAttribute("to_date")?optinVars.messages.condition_labels.reg_date.replace("{number}",this.getAttribute("to_date")):optinVars.messages.condition_labels.forever)},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.visitor_country=t.extend({conditionId:"visitor_country",setProperties:function(){this.title=optinVars.messages.conditions.not_in_a_country},defaults:function(){return{countries:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("countries").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("countries").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("countries")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wp_conditions=t.extend({conditionId:"wp_conditions",setProperties:function(){this.title=optinVars.messages.conditions.wp_conditions},defaults:function(){return{wp_conditions:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wp_conditions").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wp_conditions").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wp_conditions")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.archive_pages=t.extend({conditionId:"archive_pages",setProperties:function(){this.title=optinVars.messages.conditions.archive_pages},defaults:function(){return{archive_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("archive_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("archive_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("archive_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wc_pages=t.extend(_.extend({},n,{conditionId:"wc_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_pages},defaults:function(){return{filter_type:"all"}},getHeader:function(){return"none"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())}})),Optin.View.Conditions.wc_categories=t.extend(_.extend({},n,{conditionId:"wc_categories",setProperties:function(){this.title=optinVars.messages.conditions.wc_categories},defaults:function(){return{filter_type:"except",wc_categories:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("wc_categories").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_categories").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"wc_category"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.wc_tags=t.extend(_.extend({},n,{conditionId:"wc_tags",setProperties:function(){this.title=optinVars.messages.conditions.wc_tags},defaults:function(){return{filter_type:"except",wc_tags:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("wc_tags").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_tags").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"wc_tag"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.wc_archive_pages=t.extend({conditionId:"wc_archive_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_archive_pages},defaults:function(){return{wc_archive_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wc_archive_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_archive_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wc_archive_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wc_static_pages=t.extend({conditionId:"wc_static_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_static_pages},defaults:function(){return{wc_static_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wc_static_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_static_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wc_static_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.cookie_set=t.extend({conditionId:"cookie_set",setProperties:function(){this.title=optinVars.messages.conditions.cookie_set},defaults:function(){return{cookie_name:"",cookie_value:"",filter_type:"exists",cookie_value_conditions:"anything"}},changeInput:function(t){var i,n,s,a=t.target,o=e(a),l=o.is(".sui-select")?o.val():t.target.value;if(t.stopImmediatePropagation(),void 0!==o.find(":selected").data("switcher-menu")&&(n=(n=o.closest(".select-content-switcher-wrapper").find('.select-switcher-content[data-switcher-content="'.concat(o.find(":selected").data("switcher-menu"),'"] input')).val())||"",i=this.updateAttribute("cookie_value",n)),"filter_type"===o.data("attribute")&&(s=o.closest(".sui-side-tabs").find('.sui-tab-boxed:not(.active) input[data-attribute="cookie_name"]').val(),o.closest(".sui-side-tabs").find('.sui-tab-boxed.active input[data-attribute="cookie_name"]').val(s),i=this.updateAttribute("cookie_name",s)),o.is(":checkbox")&&(l=o.is(":checked")),o.is(".select2-search__field"))return!1;var r=a.getAttribute("data-attribute");return i=this.updateAttribute(r,l),this.refreshLabel(),i},getHeader:function(){return this.getAttribute("cookie_name")?"exists"===this.getAttribute("filter_type")?"anything"===this.getAttribute("cookie_value_conditions")?optinVars.messages.condition_labels.cookie_anything.replace("{name}",this.getAttribute("cookie_name")).replace(/(<([^>]+)>)/gi,""):optinVars.messages.condition_labels.cookie_value.replace("{name}",this.getAttribute("cookie_name")).replace("{value_condition}",optinVars.wp_cookie_set[this.getAttribute("cookie_value_conditions")]).replace("{value}",this.getAttribute("cookie_value")).replace(/(<([^>]+)>)/gi,""):optinVars.messages.condition_labels.cookie_doesnt_exist.replace("{name}",this.getAttribute("cookie_name")).replace(/(<([^>]+)>)/gi,""):"-"},body:function(){return this.template(this.getData())}}),e(document).trigger("hustleAddViewConditions",[t])}(jQuery),Hustle.define("imageUploader",function(){"use strict";return Backbone.View.extend({events:{"click .hustle-image-uploader-browse":"open","click .hustle-image-uploader-clear":"clear"},mediaFrame:!1,initialize:function(e){if(this.attribute=e.attribute,!this.model||!this.attribute)throw new Error("Undefined model or attribute.");this.render()},render:function(){return this.defineMediaFrame(),this},showImagePreviewOrButton:function(){var e=this.model.get(this.attribute);""===e||void 0===e?this.$el.removeClass("sui-has_file"):this.$el.addClass("sui-has_file")},defineMediaFrame:function(){var e=this;this.mediaFrame=wp.media({title:optinVars.media_uploader.select_or_upload,button:{text:optinVars.media_uploader.use_this_image},multiple:!1}).on("select",function(){var t,i,n=e.mediaFrame.state().get("selection").first().toJSON();n&&n.url&&(t=n.url,i="",e.model.set(e.attribute,t),n.sizes&&n.sizes.thumbnail&&n.sizes.thumbnail.url&&(i=n.sizes.thumbnail.url),e.$el.find(".sui-upload-file .hustle-upload-file-url").text(t),e.$el.find(".sui-image-preview").css("background-image","url( "+i+" )"),e.showImagePreviewOrButton())})},open:function(e){e.preventDefault(),this.mediaFrame.open()},clear:function(e){e.preventDefault(),this.model.set(this.attribute,""),this.$el.find(".sui-upload-file .hustle-upload-file-url").text(""),this.$el.find(".sui-image-preview").css("background-image","url()"),this.showImagePreviewOrButton()}})}),Hustle.define("Modals.Edit_Field",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--edit-field",events:{'change input[name="time_format"]':"changeTimeFormat",'blur input[name="name"]':"trimName","change input":"fieldUpdated",'click input[type="radio"]':"fieldUpdated","change select":"fieldUpdated",'change input[name="version"]':"handleCaptchaSave"},initialize:function(e){var t=this;this.field=e.field,this.changed={},this.fieldData=e.fieldData,this.model=e.model,this.render(),this.$el.off("close").on("close",function(){return t.modalClosed()}),this.$("#hustle-apply-changes").off("mouseup").on("mouseup",function(e){return t.applyChanges(e)})},render:function(){this.renderHeader(),this.renderLabels(),this.renderSettings(),this.renderStyling(),this.handleCaptchaSave(),this.$(".hustle-data-pane").first().trigger("click"),this.$(".sui-select").SUIselect2({dropdownParent:e("#hustle-dialog--edit-field .sui-box"),dropdownCssClass:"sui-select-dropdown"})},renderHeader:function(){this.$(".hustle-field-tag-container").length||this.$(".sui-box-header").append('<div class="sui-actions-left hustle-field-tag-container"><span class="sui-tag"></span></div>'),this.$(".sui-box-header .sui-tag").text(this.field.type)},renderLabels:function(){if(-1!==e.inArray(this.field.type,["recaptcha","gdpr","submit"]))return this.$("#hustle-data-tab--labels").removeClass("hustle-data-pane").addClass("sui-hidden"),void this.$("#hustle-data-pane--labels").addClass("sui-hidden");this.$("#hustle-data-tab--labels").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--labels").removeClass("sui-hidden");var t="hustle-"+this.field.type+"-field-labels-tpl";e("#"+t).length||(t="hustle-common-field-labels-tpl");var i=Optin.template(t);this.$("#hustle-data-pane--labels").html(i(this.fieldData)),Hustle.Events.trigger("view.rendered",this)},renderSettings:function(){if("hidden"===this.field.type)return this.$("#hustle-data-tab--settings").removeClass("hustle-data-pane").addClass("sui-hidden"),this.$("#hustle-data-pane--settings").addClass("sui-hidden"),void Module.Utils.accessibleHide(this.$("[data-tabs]"));Module.Utils.accessibleShow(this.$("[data-tabs]")),this.$("#hustle-data-tab--settings").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--settings").removeClass("sui-hidden"),e(document).on("focusin",function(t){e(t.target).closest(".wp-link-input").length&&t.stopImmediatePropagation()});var t="hustle-"+this.field.type+"-field-settings-tpl";e("#"+t).length||(t="hustle-common-field-settings-tpl");var i=Optin.template(t);if(this.$("#hustle-data-pane--settings").html(i(this.fieldData)),Hustle.Events.trigger("view.rendered",this),"gdpr"===this.field.type){wp.editor.remove("gdpr_message"),wp.editor.initialize("gdpr_message",{tinymce:{wpautop:!1,toolbar1:"bold,italic,strikethrough,link",valid_elements:"a[href|target=_blank],strong/b,i,u,s,em,del",forced_root_block:""},quicktags:{buttons:"strong,em,del,link"}})}else if("recaptcha"===this.field.type){var n={tinymce:{toolbar:["bold italic link alignleft aligncenter alignright"]},quicktags:!0};wp.editor.remove("v3_recaptcha_badge_replacement"),wp.editor.initialize("v3_recaptcha_badge_replacement",n),wp.editor.remove("v2_invisible_badge_replacement"),wp.editor.initialize("v2_invisible_badge_replacement",n)}},renderStyling:function(){if("hidden"===this.field.type)return this.$("#hustle-data-tab--styling").removeClass("hustle-data-pane").addClass("sui-hidden"),void this.$("#hustle-data-pane--styling").addClass("sui-hidden");this.$("#hustle-data-tab--styling").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--styling").removeClass("sui-hidden");var t="hustle-"+this.field.type+"-field-styling-tpl";e("#"+t).length||(t="hustle-common-field-styling-tpl");var i=Optin.template(t);this.$("#hustle-data-pane--styling").html(i(this.fieldData))},fieldUpdated:function(t){var i=e(t.target),n=i.attr("name"),s=i.is(":checkbox")?i.is(":checked"):i.val();this.changed[n]=s},modalClosed:function(){this.undelegateEvents(),this.stopListening()},changeTimeFormat:function(t){"12"===e(t.target).val()?(e("#hustle-date-format").closest(".sui-form-field").show(),e('input[name="time_hours"]').prop("min",1).prop("max",12)):(e("#hustle-date-format").closest(".sui-form-field").hide(),e('input[name="time_hours"]').prop("min",0).prop("max",23))},handleCaptchaSave:function(){if("recaptcha"===this.field.type){var t=e("#available_recaptchas").val();if(t){t=t.split(",");var i=e('input[name="version"]:checked').val();-1===_.indexOf(t,i)?e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled","disabled"):e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled",!1)}else e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled","disabled")}},trimName:function(e){var t=this.$(e.target),i=t.val().trim().replace(/ /g,"_");t.val(i)},applyChanges:function(e){var t=this.$(e.target),i=Object.assign({},this.model.get("form_elements"));if("gdpr"===this.field.type&&"undefined"!=typeof tinyMCE){var n=tinyMCE.get("gdpr_message"),s=this.$("textarea#gdpr_message"),a="true"===s.attr("aria-hidden")?n.getContent():s.val();this.changed.gdpr_message=a}else if("recaptcha"===this.field.type&&"undefined"!=typeof tinyMCE){var o=tinyMCE.get("v3_recaptcha_badge_replacement"),l=this.$("textarea#v3_recaptcha_badge_replacement"),r="true"===l.attr("aria-hidden")?o.getContent():l.val();this.changed.v3_recaptcha_badge_replacement=r;var d=tinyMCE.get("v2_invisible_badge_replacement"),c=this.$("textarea#v2_invisible_badge_replacement"),u="true"===c.attr("aria-hidden")?d.getContent():c.val();this.changed.v2_invisible_badge_replacement=u}if(Object.keys(this.changed).length){var h=_.extend({},this.field);if(_.extend(this.field,this.changed),("name"in this.changed&&"email"!==h.name&&"email"===this.field.name||"name"in this.changed&&!this.field.name.trim().length)&&(this.field.name=h.name,delete this.changed.name),"email"===h.name&&(this.field.name="email",delete this.changed.name),this.field.name!==h.name){for(var p=this.field.name,g=0,f=p;f in i;)f=p+"-"+ ++g;this.field.name=f,this.changed.name=f}"name"in this.changed||(i[this.field.name]=this.field,this.model.unset("form_elements",{silent:!0}),this.model.set("form_elements",i)),this.trigger("field:updated",this.field,this.changed,h)}t.addClass("sui-button-onload"),setTimeout(function(){return t.removeClass("sui-button-onload")},300)}})}),Hustle.define("Modals.EditSchedule",function(e){"use strict";return Backbone.View.extend({el:"#hustle-schedule-dialog-content",dialogId:"hustle-dialog--add-schedule",events:{"click #hustle-schedule-save":"saveSchedule","click .hustle-schedule-cancel":"cancel","click .hustle-schedule-delete":"openDeleteModal","change .hustle-datepicker-field[name=start_date]":"changeMinDate","change [name=not_schedule_start]":"changeMinDate",'change .hustle-checkbox-with-dependencies input[type="checkbox"]':"checkboxWithDependenciesChanged",'change select[name="custom_timezone"]':"customTimezoneChanged"},initialize:function(e){this.model=e.model},open:function(){var t=this.dialogId;this.renderContent(),e(".hustle-datepicker-field").datepicker({beforeShow:function(){e("#ui-datepicker-div").addClass("sui-calendar")},dateFormat:"m/d/yy"}),this.$(".sui-select").SUIselect2({dropdownParent:e("#".concat(this.dialogId," .sui-box")),dropdownCssClass:"sui-select-dropdown"}),this.changeMinDate(),SUI.openModal(t,"hustle-schedule-focus",void 0,!1)},changeMinDate:function(){var t;e("[name=not_schedule_end]").is(":checked")||e("[name=not_schedule_start]").is(":checked")||(t=e("[name=start_date]").val()),e(".hustle-datepicker-field[name=end_date]").datepicker("option",{minDate:t})},renderContent:function(){var t=Optin.template("hustle-schedule-dialog-content-tpl"),i=e("#hustle-schedule-dialog-content"),n=Object.assign({},this.model.get("schedule"));n.is_schedule=this.model.get("is_schedule"),n.serverCurrentTime=this.getTimeToDisplay("server"),n.customCurrentTime=this.getTimeToDisplay("custom"),this.setElement(t(n)),i.html(this.$el),Hustle.Events.trigger("view.rendered",this),this.refreshViewOnRender(n)},refreshViewOnRender:function(t){this.$(".hustle-checkbox-with-dependencies input").each(function(){e(this).trigger("change")}),"server"===t.time_to_use?e("#tab-timezone-server").click():e("#tab-timezone-custom").click(),"all"===t.active_days?e("#tab-schedule-everyday").click():e("#tab-schedule-somedays").click();var i=this.$('select[name="custom_timezone"]').val(),n=t.custom_timezone;n!==i&&this.$('select[name="custom_timezone"]').val(n).trigger("change")},getTimeToDisplay:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.model.get("schedule"),n=!1,s=!1;if("server"===e)n=optinVars.schedule.wp_gmt_offset||0;else{var a=t||i.custom_timezone;if(a.includes("UTC")){var o=a.replace("UTC","");n=o.length?parseFloat(o):0}else{s=moment().tz(a).format("hh:mm a")}}if(!1===s&&!1!==n){var l=Date.now()+3600*n*1e3;s=moment.utc(l).format("hh:mm a")}return s},saveSchedule:function(t){var i=e(t.currentTarget),n=this.processFormForSave(),s="1"===this.model.get("is_schedule");i.addClass("sui-button-onload"),i.prop("disabled",!0),setTimeout(function(){i.removeClass("sui-button-onload"),i.prop("disabled",!1)},500),this.model.set("is_schedule","1"),this.model.set("schedule",n),this.model.userHasChange(),this.closeModal(),s||Module.Notification.open("success",optinVars.schedule.new_schedule_set,!1),this.trigger("schedule:updated")},processFormForSave:function(){var t=e("#hustle-edit-schedule-form");return Module.Utils.serializeObject(t)},cancel:function(){this.renderContent(),this.closeModal()},openDeleteModal:function(t){var i="hustle-dialog--delete-schedule",n=Optin.template("hustle-delete-schedule-dialog-content-tpl"),s=e(t.currentTarget),a={id:s.data("id"),title:s.data("title"),description:s.data("description"),action:"delete",actionClass:"hustle-button-delete"},o=n(a),l=e("#"+i+" #hustle-delete-schedule-dialog-content");l.find("button.hustle-delete-confirm").length||l.append(o),e("#"+i+" #hustle-dialog--delete-schedule-title").html(a.title),e("#"+i+" #hustle-dialog--delete-schedule-description").html(a.description),SUI.replaceModal(i,"hustle-schedule-notice",void 0,!0),e("#hustle-delete-schedule-dialog-content").off("submit").on("submit",e.proxy(this.deactivateSchedule,this))},deactivateSchedule:function(e){e.preventDefault(),this.closeModal(),this.model.set("is_schedule","0"),this.model.userHasChange(),this.trigger("schedule:updated")},checkboxWithDependenciesChanged:function(t){var i=e(t.currentTarget),n=i.data("disable-on"),s=i.data("hide-on");if(n){var a=this.$('[data-checkbox-content="'.concat(n,'"]'));i.is(":checked")?(a.addClass("sui-disabled"),a.prop("disabled",!0),a.parent().hasClass("select-container")&&a.parent().addClass("sui-disabled")):(a.removeClass("sui-disabled"),a.prop("disabled",!1),a.parent().hasClass("select-container")&&a.parent().removeClass("sui-disabled"))}if(s){var o=this.$('[data-checkbox-content="'.concat(s,'"]'));i.is(":checked")?Module.Utils.accessibleHide(o):Module.Utils.accessibleShow(o)}},customTimezoneChanged:function(t){var i=e(t.currentTarget).val(),n=this.$("#hustle-custom-timezone-current-time"),s=this.getTimeToDisplay("custom",i);n.text(s)},closeModal:function(){e(".hustle-datepicker-field").datepicker("destroy"),SUI.closeModal()}})}),Hustle.define("Modals.Optin_Fields",function(){"use strict";return Backbone.View.extend({el:"#hustle-dialog--optin-fields",model:{},selectedFields:[],events:{"click .sui-box-selector input":"selectFields","click #hustle-insert-fields":"insertFields"},initialize:function(e){var t=this;this.model=e.model,this.selectedFields=[],this.$el.off("close").on("close",function(){return t.closeModalActions()})},selectFields:function(e){var t=this.$(e.target),i=t.val();this.$el.find('label[for="'+t.attr("id")+'"]').toggleClass("selected"),t.prop("checked")?this.selectedFields.push(i):this.selectedFields=_.without(this.selectedFields,i)},insertFields:function(e){var t=this.$(e.target);t.addClass("sui-button-onload"),this.trigger("fields:added",this.selectedFields),setTimeout(function(){t.removeClass("sui-button-onload"),SUI.closeModal()},300)},closeModalActions:function(){this.undelegateEvents(),this.stopListening();var e=Object.keys(this.model.get("form_elements")),t=".sui-box-selector";e.includes("recaptcha")&&(t+=":not(.hustle-optin-insert-field-label--recaptcha)"),e.includes("gdpr")&&(t+=":not(.hustle-optin-insert-field-label--gdpr)");var i=this.$el.find(t),n=i.find("input");setTimeout(function(){i.removeClass("selected"),n.prop("checked",!1),n[0].checked=!1},200)}})}),Hustle.define("Modals.PublishFlow",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--publish-flow",initialize:function(){},open:function(){var t=this.$("#hustle-dialog--publish-flow-icon");t.length||(t=e('<span id="hustle-dialog--publish-flow-icon" class="sui-lg" aria-hidden="true" style="margin-bottom: 20px;"></span>')).insertBefore("#hustle-dialog--publish-flow-title"),this.setLoading(),this.$(".sui-box").find(".sui-image").css("max-height",""),SUI.openModal("hustle-dialog--publish-flow",e(".hustle-publish-button")[0],this.$(".hustle-modal-close")[0],!0)},setLoading:function(){var e=this.$("#hustle-dialog--publish-flow-icon"),t=this.$(".sui-box"),i=this.$(".sui-box-header .hustle-modal-close"),n=this.$("#hustle-dialog--publish-flow-title"),s=this.$("#hustle-dialog--publish-flow-description"),a=this.$("#hustle-published-notice-with-schedule-end");e.removeClass("sui-icon-"+t.data("ready-icon")),e.addClass("sui-icon-"+t.data("loading-icon")),"loader"===t.attr("data-loading-icon")&&e.addClass("sui-loading"),n.text(t.data("loading-title")),s.text(t.data("loading-desc")),a.hide(),i.hide()},setPublished:function(e,t){var i=this.$("#hustle-dialog--publish-flow-icon"),n=this.$(".sui-box"),s=this.$(".sui-box-header .hustle-modal-close"),a=this.$("#hustle-dialog--publish-flow-title"),o=this.$("#hustle-dialog--publish-flow-description"),l=this.$("#hustle-published-notice-with-schedule-end"),r=e?n.data("ready-desc-alt"):n.data("ready-desc");i.removeClass("sui-icon-"+n.data("loading-icon")),i.addClass("sui-icon-"+n.data("ready-icon")),"loader"===n.attr("data-loading-icon")&&i.removeClass("sui-loading"),e&&t?(n.find(".sui-image").css("max-height","120px"),l.show()):l.hide(),a.text(n.data("ready-title")),o.text(r),a.focus(),s.show()}})}),Hustle.define("Modals.Visibility_Conditions",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--visibility-options",selectedConditions:[],opts:{groupId:0,conditions:[]},events:{"click .sui-box-selector input":"selectConditions"},initialize:function(t){e("#hustle-add-conditions").off("click").on("click",e.proxy(this.addConditions,this)),this.opts=_.extend({},this.opts,t),this.selectedConditions=this.opts.conditions,this.$(".hustle-visibility-condition-option").prop("checked",!1).prop("disabled",!1);var i,n=_createForOfIteratorHelper(this.selectedConditions);try{for(n.s();!(i=n.n()).done;){var s=i.value;this.$("#hustle-condition--"+s).prop("checked",!0).prop("disabled",!0)}}catch(e){n.e(e)}finally{n.f()}},selectConditions:function(e){var t=this.$(e.target),i=this.$el.find('label[for="'+t.attr("id")+'"]'),n=t.val();i.toggleClass("selected"),t.prop("checked")?this.selectedConditions.push(n):this.selectedConditions=_.without(this.selectedConditions,n)},addConditions:function(e){var t=this,i=this.$(e.target);i.addClass("sui-button-onload"),this.trigger("conditions:added",{groupId:this.opts.groupId,conditions:this.selectedConditions}),setTimeout(function(){SUI.closeModal(),i.removeClass("sui-button-onload"),t.undelegateEvents()},500)}})}),function(e){"use strict";Optin.listingBase=Hustle.View.extend({el:".sui-wrap-hustle",logShown:!1,moduleType:"",previewView:null,_events:{"click .hustle-create-module":"openCreateModal","click .hustle-manage-tracking-button":"openManageTrackingModal","click .hustle-import-module-button":"openImportModal","click .hustle-upgrade-modal-button":"openUpgradeModal","click .hustle-single-module-button-action":"handleSingleModuleAction","click .hustle-preview-module-button":"previewModule","click form.sui-bulk-actions .hustle-bulk-apply-button":"bulkActionCheck","click #hustle-dialog--delete .hustle-delete":"bulkActionSend","click #hustle-bulk-action-reset-tracking-confirmation .hustle-delete":"bulkActionSend","click .sui-accordion-item-action .hustle-onload-icon-action":"addLoadingIconToActionsButton"},initialize:function(t){this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents(),this.moduleType=t.moduleType;var i=Hustle.get("Modals.New_Module"),n=Hustle.get("Modals.ImportModule");this.newModuleModal=new i(this.moduleType,this.getPreviewView()),this.ImportModal=new n,e(".sui-accordion-item-header").on("click",e.proxy(this.openTrackingChart,this)),e(".hustle-display-chart").length&&this.openTrackingChart(e(".hustle-display-chart")),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if("true"===Module.Utils.getUrlParam("create-module")&&setTimeout(function(){e(".hustle-create-module").trigger("click")},100),"true"===Module.Utils.getUrlParam("requires-pro")){var t=this;setTimeout(function(){return t.openUpgradeModal()},100)}if(Module.Utils.getUrlParam("show-notice")){var i="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",n=Module.Utils.getUrlParam("notice"),s=n&&"undefined"!==optinVars.messages[n]?optinVars.messages[n]:Module.Utils.getUrlParam("notice-message"),a=Module.Utils.getUrlParam("notice-close",null),o="false"!==a&&a;void 0!==s&&s.length&&Module.Notification.open(i,s,o)}var l=Module.Utils.getUrlParam("view-stats");if(l){var r=e('.hustle-list .sui-accordion-item-header[data-id="'+l+'"]');r.trigger("click"),e("html, body").animate({scrollTop:r.closest(".sui-accordion-item").offset().top-40},1e3)}},handleSingleModuleAction:function(e){this.addLoadingIcon(e),Module.handleActions.initAction(e,"listing",this)},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.getPreviewView().open(i.data("id"),i.data("type"),i,{module_name:i.data("name")})},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},openTrackingChart:function(t){var i="";if(t.target){if(e(t.target).closest(".sui-accordion-item-action").length)return!0;t.preventDefault(),t.stopPropagation(),i=e(t.currentTarget)}else i=t;var n=this,s=i.parent(),a=s.find(".sui-chartjs-animated");if(s.hasClass("sui-accordion-item--disabled")?s.removeClass("sui-accordion-item--open"):s.hasClass("sui-accordion-item--open")?s.removeClass("sui-accordion-item--open"):s.addClass("sui-accordion-item--open"),s.find(".sui-accordion-item-data").addClass("sui-onload"),a.removeClass("sui-chartjs-loaded"),s.hasClass("sui-accordion-item--open")){var o={id:i.data("id"),_ajax_nonce:i.data("nonce"),action:"hustle_tracking_data"};e.ajax({url:ajaxurl,type:"POST",data:o,success:function(e){e.success&&e.data&&(s.find(".sui-accordion-item-body").html(e.data.html),n.trackingChart.init(s,e.data.charts_data),a=s.find(".sui-chartjs-animated"),SUI.suiTabs()),s.find(".sui-accordion-item-data").removeClass("sui-onload"),a.addClass("sui-chartjs-loaded")},error:function(){s.find(".sui-accordion-item-data").removeClass("sui-onload"),a.addClass("sui-chartjs-loaded")}})}},getChecked:function(t){var i=".sui-wrap-hustle .sui-accordion-item-title input[type=checkbox]";return"checked"===t&&(i+=":checked"),e(i)},bulkActionCheck:function(t){var i=e(t.target),n=i.closest(".hustle-bulk-actions-container").find('select[name="hustle_action"] option:selected').val();if(0===this.getChecked("checked").length||"undefined"===n)return!1;if("delete"===n){var s={actionClass:"hustle-delete",action:"delete",title:i.data("delete-title"),description:i.data("delete-description")};return Module.deleteModal.open(s,i[0]),!1}if("reset-tracking"===n){var a={actionClass:"hustle-delete",action:"reset-tracking",title:i.data("reset-title"),description:i.data("reset-description")};return Module.deleteModal.open(a,i[0]),!1}this.bulkActionSend(t,n)},bulkActionSend:function(t,i){t.preventDefault(),this.addLoadingIcon(t);var n=i||e(t.target).data("hustle-action"),s=this.getChecked("checked");if(0===s.length)return!1;var a=[];e.each(s,function(){a.push(e(this).val())});var o=e(".sui-bulk-actions .hustle-bulk-apply-button"),l={ids:a,hustle:n,type:o.data("type"),_ajax_nonce:o.data("nonce"),action:"hustle_listing_bulk"};e.ajax({url:ajaxurl,type:"POST",data:l,success:function(e){e.success?location.reload():SUI.closeModal()}})},addLoadingIcon:function(t){var i=e(t.currentTarget);i.hasClass("sui-button")&&i.addClass("sui-button-onload")},addLoadingIconToActionsButton:function(t){e(t.currentTarget).closest(".sui-accordion-item-action").find(".sui-dropdown-anchor").addClass("sui-button-onload")},openCreateModal:function(t){!1===e(t.currentTarget).data("enabled")?this.openUpgradeModal():this.newModuleModal.open()},openUpgradeModal:function(t){var i=this.$("#hustle-create-new-module")[0];t&&(t.preventDefault(),t.stopPropagation(),i=t.currentTarget),e(".sui-button-onload").removeClass("sui-button-onload"),e("#hustle-modal--upgrade-to-pro").length&&SUI.openModal("hustle-modal--upgrade-to-pro",i,"hustle-button--upgrade-to-pro",!0)},openImportModal:function(t){!1===e(t.currentTarget).data("enabled")?this.openUpgradeModal():this.ImportModal.open(t)},openManageTrackingModal:function(t){var i=Optin.template("hustle-manage-tracking-form-tpl"),n=e("#hustle-dialog--manage-tracking"),s=e(t.currentTarget),a=s.data("module-id"),o={enabledTrackings:s.data("tracking-types").split(",")};n.find("#hustle-manage-tracking-form-container").html(i(o)),n.find("#hustle-button-toggle-tracking-types").data("module-id",a),SUI.openModal("hustle-dialog--manage-tracking",s,"hustle-module-tracking--inline",!0)},trackingChart:{chartsData:{},theCharts:{},init:function(t,i){var n=this;t.find("select.hustle-conversion-type").each(function(i,s){SUI.suiSelect(s),e(s).on("change.select2",function(e){return n.conversionTypeChanged(e,t)})}),this.chartsData=i,Object.values(i).forEach(function(e){return n.updateChart(e)})},conversionTypeChanged:function(t,i){var n=e(t.currentTarget),s=n.val(),a=n.data("moduleType"),o=this.chartsData[a],l=i.find(".hustle-tracking-".concat(a,"-conversions-count")),r=i.find(".hustle-tracking-".concat(a,"-conversions-rate"));l.text(o[s].conversions_count),r.text(o[s].conversion_rate+"%"),this.updateChart(o,s,!1)},updateChart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e.views,s=[{label:"Submissions",data:e[t].conversions,backgroundColor:["#E1F6FF"],borderColor:["#17A8E3"],borderWidth:2,pointRadius:0,pointHitRadius:20,pointHoverRadius:5,pointHoverBorderColor:"#17A8E3",pointHoverBackgroundColor:"#17A8E3"},{label:"Views",data:n,backgroundColor:["#F8F8F8"],borderColor:["#DDDDDD"],borderWidth:2,pointRadius:0,pointHitRadius:20,pointHoverRadius:5,pointHoverBorderColor:"#DDDDDD",pointHoverBackgroundColor:"#DDDDDD"}];void 0!==this.theCharts[e.id]?i?(this.theCharts[e.id].destroy(),this.createNewChart(e,s)):(this.theCharts[e.id].data.datasets=s,this.theCharts[e.id].update()):this.createNewChart(e,s)},createNewChart:function(e,t){var i=Math.max.apply(Math,_toConsumableArray(e.views))+2,n=document.getElementById(e.id);if(Math.max.apply(Math,_toConsumableArray(e.views))<Math.max.apply(Math,_toConsumableArray(e.conversions))&&(i=Math.max.apply(Math,_toConsumableArray(e.conversions))+2),n){var s={labels:e.days,datasets:t},a={maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"}}],yAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"},ticks:{beginAtZero:!1,min:0,max:i,stepSize:1}}]},elements:{line:{tension:0},point:{radius:.5}},tooltips:{custom:function(e){e&&(e.displayColors=!1)},callbacks:{title:function(e){return 0===e[0].datasetIndex?optinVars.labels.submissions.replace("%d",e[0].yLabel):1===e[0].datasetIndex?optinVars.labels.views.replace("%d",e[0].yLabel):void 0},label:function(e){return e.xLabel},labelTextColor:function(){return"#AAAAAA"}}}};this.theCharts[e.id]=new Chart(n,{type:"line",fill:"start",data:s,options:a})}}}})}(jQuery),Hustle.define("Modals.New_Module",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--create-new-module",previewView:null,moduleType:"",moduleName:!1,moduleMode:"optin",moduleTemplate:"none",$moveForwardButton:null,data:{},mainDialogLabelId:"hustle-create-new-module-dialog-label",mainDialogDescriptionId:"hustle-create-new-module-dialog-description",events:{'keydown input[name="name"]':"nameChanged","click #hustle-create-module":"createModule",'change input[name="mode"]':"modeChanged","click #hustle-go-to-templates-button":"goToTemplatesStep","click .hustle-template-select-button":"createNonSshare","click .hustle-template-preview-button":"previewTemplate","click .hustle-modal-go-back":"goToStepOne"},initialize:function(e,t){this.moduleType=e,this.previewView=t;var i="social_sharing"!==this.moduleType?"#hustle-go-to-templates-button":"#hustle-create-module";this.$moveForwardButton=this.$(i)},open:function(){SUI.openModal("hustle-dialog--create-new-module","hustle-create-new-module","hustle-module-name"),"social_sharing"!==this.moduleType&&this.goToStepOne()},nameChanged:function(t){var i=this;setTimeout(function(){i.$(".sui-error-message").hide();var n=e(t.currentTarget).val().trim();0===n.length?(i.moduleName=!1,i.$moveForwardButton.prop("disabled",!0),i.$("#error-empty-name").closest(".sui-form-field").addClass("sui-form-field-error"),i.$("#error-empty-name").show()):(i.moduleName=n,i.$moveForwardButton.prop("disabled",!1),i.$("#error-empty-name").closest(".sui-form-field").removeClass("sui-form-field-error"),i.$("#error-empty-name").hide())},300)},modeChanged:function(t){var i=e(t.currentTarget).val();this.moduleMode=i},goToStepOne:function(e){var t=e?"back":null;this.$el.attr("aria-labelledby",this.mainDialogLabelId),this.$el.attr("aria-describedby",this.mainDialogDescriptionId),SUI.slideModal("hustle-create-new-module-step-1","hustle-module-name",t)},goToTemplatesStep:function(e){if(e.preventDefault(),this.isNameValid()&&this.isModeValid()){var t="optin"===this.moduleMode?"optin-templates":"informational-templates",i="hustle-create-new-module-dialog-step-".concat(t,"-label"),n="hustle-create-new-module-dialog-step-".concat(t,"-description");this.$el.attr("aria-labelledby",i),this.$el.attr("aria-describedby",n),SUI.slideModal("hustle-create-new-module-step-".concat(t),this.$el.find("#hustle-create-new-module-step-".concat(t," .hustle-template-option--none"))[0],"next")}},isNameValid:function(){return!1!==this.moduleName},isModeValid:function(){return"optin"===this.moduleMode||"informational"===this.moduleMode},createNonSshare:function(t){var i=e(t.currentTarget).data("template");this.moduleTemplate=i,this.createModule(t)},createModule:function(t){var i=this.$el.data("nonce"),n=this.$el.data("error-message"),s=e(t.currentTarget),a={module_name:this.moduleName,module_type:this.moduleType,module_mode:this.moduleMode,module_template:this.moduleTemplate,action:"hustle_create_new_module",_ajax_nonce:i};s.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:a}).done(function(e){e&&e.data&&e.data.redirect_url?window.location.replace(e.data.redirect_url):(s.removeClass("sui-button-onload"),Module.Notification.open("error",n,!1))}).fail(function(){s.removeClass("sui-button-onload"),Module.Notification.open("error",n,!1)})},previewTemplate:function(t){var i=e(t.currentTarget);this.previewView.open(0,i.data("module-type"),i,{module_name:i.data("name"),module_type:i.data("module-type"),template_name:i.data("template"),template_mode:i.data("module-mode")})}})}),Hustle.define("Modals.ImportModule",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--import",events:{"change #hustle-import-file-input":"selectUploadFile","click .sui-upload-file":"changeFile","click .sui-upload-file button":"resetUploadFile","click .hustle-import-check-all-checkbox":"checkAll","change .hustle-module-meta-checkbox":"uncheckAllOption"},initialize:function(){},open:function(t){var i=e(t.currentTarget),n=i.data("module-id"),s=Optin.template("hustle-import-modal-options-tpl"),a=e("#hustle-dialog--import"),o=a.find("#hustle-import-module-submit-button"),l=void 0===n,r={isNew:l,isOptin:"optin"===i.data("module-mode")};a.find("#hustle-import-modal-options").html(s(r)),l?(o.removeAttr("data-module-id"),SUI.tabs(),a.find(".sui-tab-item").on("click",function(){var t=e(this);e("#"+t.data("label-for")).click()})):o.attr("data-module-id",n),SUI.openModal("hustle-dialog--import",t.currentTarget,"hustle-import-file-input",!0)},selectUploadFile:function(t){t.preventDefault();var i=e(t.target).val().replace(/C:\\fakepath\\/i,"");SUI.closeNotice("hustle-dialog--import-error-notice"),i?(e(".sui-upload-file span:first").text(i),e(".sui-upload").addClass("sui-has_file"),e("#hustle-import-module-submit-button").prop("disabled",!1)):(e(".sui-upload").removeClass("sui-has_file"),e(".sui-upload-file span:first").text(""),e("#hustle-import-module-submit-button").prop("disabled",!0))},resetUploadFile:function(t){t.stopPropagation(),e("#hustle-import-file-input").val("").trigger("change")},changeFile:function(){e("#hustle-import-file-input").trigger("click")},checkAll:function(t){var i=e(t.currentTarget),n=i.is(":checked");i.closest(".hui-inputs-list").find("input.hustle-module-meta-checkbox:not(.hustle-import-check-all-checkbox)").prop("checked",n)},uncheckAllOption:function(t){var i=e(t.currentTarget).closest(".hui-inputs-list").find(".hustle-import-check-all-checkbox");i.is(":checked")&&i.prop("checked",!1)}})}),Hustle.define("Mixins.Model_Updater",function(e){"use strict";return{initMix:function(){this.events=_.extend({},this.events,this._events),this.delegateEvents()},_events:{"change textarea":"_updateText",'change input[type="text"]':"_updateText",'change input[type="url"]':"_updateText",'change input[type="hidden"]':"_updateText",'change input[type="number"]':"_updateText",'change input[type="checkbox"]':"_updateCheckbox","change input[type=radio]":"_updateRadios","change select":"_updateSelect"},_updateText:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,t.target.value,a))},_updateCheckbox:function(t){var i=e(t.target),n=i.data("attribute"),s=i.val(),a=this[i.data("model")||"model"],o=_.isTrue(i.data("silent"))?{silent:!0}:{};if(a&&n)if(t.stopPropagation(),"on"!==s){var l=[],r=a.get.call(a,n);i.is(":checked")?(l=_toConsumableArray(r)).push(s):l=_.without(r,s),a.set.call(a,n,l,o)}else a.set.call(a,n,i.is(":checked")?"1":"0",o)},_updateRadios:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,t.target.value,a))},_updateSelect:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,i.val(),a))}}}),Hustle.define("Mixins.Module_Settings",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-behaviour",events:{},triggersModel:null,init:function(e){var t=this,i=e.BaseModel.extend({defaults:{},initialize:function(e){_.extend(this,e);var i=Hustle.get("Models.Trigger");this.get("triggers")instanceof Backbone.Model||(this.set("triggers",new i(this.triggers),{silent:!0}),t.triggersModel=this.get("triggers"))}});this.model=new i(optinVars.current.settings||{}),this.moduleType=optinVars.current.data.module_type;var n=Hustle.get("Modals.EditSchedule");this.editScheduleView=new n({model:this.model}),this.listenTo(this.model,"change",this.viewChanged),"embedded"!==this.moduleType&&this.listenTo(this.model.get("triggers"),"change",this.triggersViewChanged),this.render()},render:function(){this.renderScheduleSection(),this.editScheduleView.on("schedule:updated",e.proxy(this.renderScheduleSection,this))},renderScheduleSection:function(){var t=this,i=Optin.template("hustle-schedule-row-tpl"),n=e("#hustle-schedule-row"),s=this.model.get("schedule"),a=Object.assign({},s),o={startDate:"",startTime:"",endDate:"",endTime:"",activeDays:"",activeTime:""},l=!1;if(a.is_schedule=this.model.get("is_schedule"),a.is_schedule){var r=Object.assign({},optinVars.schedule.months),d=optinVars.schedule.meridiem;if("0"===a.not_schedule_start){var c=a.start_date.split("/"),u=r[c[0]-1],h=d[a.start_meridiem_offset];o.startDate="".concat(c[1]," ").concat(u," ").concat(c[2]),o.startTime="(".concat(a.start_hour,":").concat(a.start_minute," ").concat(h,")")}if("0"===a.not_schedule_end){var p=a.end_date.split("/"),g=r[p[0]-1],f=d[a.end_meridiem_offset];o.endDate="".concat(p[1]," ").concat(g," ").concat(p[2]),o.endTime="(".concat(a.end_hour,":").concat(a.end_minute," ").concat(f,")"),l=this.isScheduleFinished(a)}if("week_days"===a.active_days){var m=optinVars.schedule.week_days,_=a.week_days.map(function(e){return m[e].toUpperCase()});o.activeDays=_.join(", ")}if("0"===a.is_active_all_day){var v=d[a.day_start_meridiem_offset],b=d[a.day_end_meridiem_offset],w="".concat(a.day_start_hour,":").concat(a.day_start_minute," ").concat(v),y="".concat(a.day_end_hour,":").concat(a.day_end_minute," ").concat(b);o.activeTime=w+" - "+y}}a.strings=o,a.hasFinished=l,n.html(i(a)),n.find(".hustle-button-open-schedule-dialog").on("click",function(){return t.editScheduleView.open()})},isScheduleFinished:function(e){var t=(new Date).getTime(),i=e.time_to_use,n=e.end_date,s=e.end_hour,a=e.end_minute,o=e.end_meridiem_offset,l="".concat(n," ").concat(s,":").concat(a," ").concat(o),r=!1,d=!1;if("server"===i)d=optinVars.schedule.wp_gmt_offset;else{var c=e.custom_timezone;if(c.includes("UTC")){var u=c.replace("UTC","");d=u.length?parseFloat(u):0}else{r=moment.tz(l,"MM/DD/YYYY hh:mm aa",c).format("x")}}if(!1===r&&!1!==d){var h=60*d,p=0<h?"+":"-",g=Math.abs(h),f=sprintf("%s%02d:%02d",p,g/60,g%60);r=moment.parseZone(l+" "+f,"MM/DD/YYYY hh:mm a Z").format("x")}return t>r},viewChanged:function(e){var t=e.changed;if("on_submit"in t){var i=this.$("#hustle-on-submit-delay-wrapper");i.length&&("nothing"!==t.on_submit?i.removeClass("sui-hidden"):i.addClass("sui-hidden"))}},triggersViewChanged:function(e){var t=e.changed;if("on_scroll"in t){var i=this.$("#hustle-on-scroll--scrolled-toggle-wrapper"),n=this.$("#hustle-on-scroll--selector-toggle-wrapper");(i.length||n.length)&&("scrolled"===t.on_scroll?(i.removeClass("sui-hidden"),n.addClass("sui-hidden")):(n.removeClass("sui-hidden"),i.addClass("sui-hidden")))}}})}),Hustle.define("Mixins.Module_Content",function(){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-content",events:{},init:function(e){this.model=new e.BaseModel(optinVars.current.content||{}),this.moduleType=optinVars.current.data.module_type,this.listenTo(this.model,"change",this.modelUpdated),this.render()},render:function(){this.initImageUploaders(),"true"===Module.Utils.getUrlParam("new")&&Module.Notification.open("success",optinVars.messages.module_created,1e4)},initImageUploaders:function(){for(var e=Hustle.get("imageUploader"),t=0,i=["feature_image","background_image"];t<i.length;t++){var n=i[t],s=this.$("#hustle-choose-"+n);s.length&&new e({el:s,model:this.model,attribute:n,moduleType:this.moduleType})}},modelUpdated:function(e){Hustle.Events.trigger("modules.view.contentUpdate",e.changed)}})}),Hustle.define("Mixins.Module_Design",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-appearance",cssEditor:!1,fontFamilies:{},fontFamiliesOptions:[],updatedProperties:{},contentPropIsShown:{title:!0,sub_title:!0,main_content:!0,feature_image:!0,background_image:!0,show_never_see_link:!0,show_cta:!0},events:{"click .hustle-css-stylable":"insertSelector","click .hustle-reset-settings-block > button":"resetSettingsBlock","change [data-link-fields]":"linkFieldsChanged","change [data-linked-fields]":"linkedFieldsChanged","change .hustle-font-family-select":"fontFamilyUpdated",'change select[name="feature_image_width_option"]':"updateFeatureImageWidth","click .sui-accordion-item":"initiateFontFamilySelectOnAccordionClick","click .hustle-button-apply-global-font":"applyGlobalFontClicked","change .hustle-required-field":"requiredFieldChanged"},init:function(t){this.model=new t.BaseModel(optinVars.current.design||{});var i=this,n="hustle-colorpickers-initialized";e("#tab-content-customize_colors-custom .sui-accordion-item").on("click",function(){var t=e(this),s=t.find(".sui-colorpicker-input");!t.hasClass(n)&&s.length&&(t.addClass(n),i.createPickers(s))}),this.$(".sui-accordion-item").on("click",function(){var t=e(this),i=t.find("select.none-sui:not([multiple])");!t.hasClass(n)&&i.length&&(t.addClass(n),i.removeClass("none-sui"),i.each(function(){SUI.suiSelect(this)}))}),this.beforeRender(),this.render()},beforeRender:function(){var e=this;this.listenTo(this.model,"change",this.modelUpdated),Hustle.Events.on("modules.view.contentUpdate",function(t){return e.contentModelUpdated(t)}),Hustle.Events.on("modules.view.emailsUpdate",function(t){return e.emailsModelUpdated(t)}),Hustle.Events.on("modules.view.integrationsUpdate",function(t){return e.integrationsModelUpdate(t)}),this.setFontFamilyOptions(),this.setVisibilityOnRender()},render:function(){this.toggleDeviceTabs(),this.toggleCtaButtonsTextAlignment(),this.setImageAligmentOptions(),this.toggleFeatureImageSizeSettingRow(),this.toggleFeatureImageSizeRows(),this.addCreatePalettesLink(),this.cssEditor=this.createEditor("hustle_custom_css"),this.setVanillaThemeVisibility(),this.hideOtherOptionsInAcordionItem("feature_image_hide_on_mobile","1"===this.model.get("feature_image_hide_on_mobile")),this.hideOtherOptionsInAcordionItem("feature_image_position",!this.contentPropIsShown.feature_image),optinVars.current.is_optin?(this.setSucccessfulMessageOptionVisibility(optinVars.current.emails),this.formFieldsUpdated(optinVars.current.emails),this.updateMailchimpRelatedAccordions(optinVars.current.integrations_settings)):this.handleStyleChange();var t=this;e.each(["title","sub_title","feature_image","background_image","show_cta","show_never_see_link","main_content"],function(e,i){t.updateElementsRow(i)})},setFontFamilyOptions:function(){var t=this;this.fetchFontFamilyOptions().done(function(i){t.fontFamilies=i.data,e.each(t.fontFamilies,function(e,i){t.fontFamiliesOptions.push({id:e,text:i.label})});var n=t.$('.hustle-font-family-select[name="global_font_family"]');t.initiateFontFamilySelects(n,!0),t.toggleCustomFontInput(n)})},fetchFontFamilyOptions:function(){var t={action:"hustle_fetch_font_families",_ajax_nonce:optinVars.typography.fetch_nonce};return e.post({url:ajaxurl,type:"post",data:t})},initiateFontFamilySelectOnAccordionClick:function(t){var i=this;e(t.currentTarget).find(".hustle-font-family-select").each(function(){i.initiateFontFamilySelects(e(this)),i.toggleCustomFontInput(e(this))})},initiateFontFamilySelects:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(!1===e.data("fonts-loaded")||t)&&(e.SUIselect2("destroy"),e.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:this.fontFamiliesOptions}),e.removeClass("sui-disabled"),e.prop("disabled",!1),e.data("fonts-loaded",!0))},fontFamilyUpdated:function(t){var i,n=e(t.currentTarget),s=n.data("weight"),a=this.$('[name="'.concat(s,'"]')),o=this.$('[name="'.concat(s,'_mobile"]')),l=n.val(),r=[];l&&(i=this.fontFamilies[l].variants);var d=!0;if(void 0!==i){var c,u=_createForOfIteratorHelper(i);try{for(u.s();!(c=u.n()).done;){var h=c.value;r.push({id:h,text:h,selected:d}),!0===d&&(d=!1)}}catch(e){u.e(e)}finally{u.f()}a.html(r),a.SUIselect2("destroy"),a.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:r}),o.html(r),o.SUIselect2("destroy"),o.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:r})}this.toggleCustomFontInput(n)},applyGlobalFontClicked:function(t){var i=this,n=e(t.currentTarget);n.addClass("sui-button-onload"),setTimeout(function(){i.applyGlobalFont(),n.removeClass("sui-button-onload"),Module.Notification.open("success",optinVars.typography.global_font_applied,4e3)},0)},applyGlobalFont:function(){var t,i=this,n=this.$('.hustle-font-family-select:not([name="global_font_family"])'),s=this.model.get("global_font_family"),a="custom"===s,o=this.model.get("global_custom_font_family");n.each(function(){var n=e(this);if(0===n.find('option[value="'+s+'"]').length?(t=new Option(s,s,!0,!1),n.empty().val(null).append(t)):n.val(s),n.trigger("change"),a){var l=n.data("custom");i.$('input[name="'.concat(l,'"]')).val(o).trigger("change")}i.toggleCustomFontInput(n)}),this.globalFontVariantsUpdated(s)},globalFontVariantsUpdated:function(e){var t=this.$(".hustle-font-weight"),i=this.fontFamilies[e].variants,n=[],s=!0;if(void 0!==i){var a,o=_createForOfIteratorHelper(i);try{for(o.s();!(a=o.n()).done;){var l=a.value;n.push({id:l,text:l,selected:s}),!0===s&&(s=!1)}}catch(e){o.e(e)}finally{o.f()}t.html(n),t.SUIselect2("destroy"),t.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:n})}},toggleCustomFontInput:function(e){var t=e.val(),i=e.data("custom"),n=this.$('input[name="'.concat(i,'"]')).closest(".sui-form-field");"custom"===t?Module.Utils.accessibleShow(n):Module.Utils.accessibleHide(n)},toggleDeviceTabs:function(){var e=this.$("#hustle-device_settings-tabs > .sui-tabs-menu"),t=this.$("#hustle-device_settings-tabs > .sui-tabs-content"),i=this.$("#hustle-device_settings-tabs");"1"===this.model.get("enable_mobile_settings")?(i.addClass("hustle-mobile-enabled"),e.prop("aria-hidden",!1),e.prop("hidden",!1),t.find("#tab-content-device_settings-desktop").attr("role","tabpanel"),t.find("#tab-content-device_settings-mobile").prop("aria-hidden",!1)):(i.removeClass("hustle-mobile-enabled"),e.find("#tab-device_settings-desktop").trigger("click"),e.attr("aria-hidden",!0),e.attr("hidden",!0),t.find("#tab-content-device_settings-desktop").removeAttr("role"),t.find("#tab-content-device_settings-mobile").attr("aria-hidden",!0))},createPickers:function(t){var i=this;t.wpColorPicker({change:function(t,i){var n=e(this);n.val()!==i.color.toCSS()&&n.val(i.color.toCSS()).trigger("change")},palettes:["#333333","#FFFFFF","#17A8E3","#E1F6FF","#666666","#AAAAAA","#E6E6E6"]}),t.hasClass("wp-color-picker")&&t.each(function(){var t="hex",n=e(this),s=n.closest(".wp-picker-container").find(".wp-color-result"),a=s.find(".color-alpha"),o=n.closest(".sui-colorpicker-wrap"),l=o.find(".sui-colorpicker-value span[role=button]"),r=o.find(".sui-colorpicker-value"),d=r.find("button"),c=r.find(".hustle-colorpicker-input");!0===n.data("alpha")?(t="rgba",n.on("change",function(e,t){l.find("span").css({"background-color":a.css("background")}),void 0===t&&c.val(n.val())})):n.on("change",function(e,t){l.find("span").css({"background-color":s.css("background-color")}),void 0===t&&c.val(n.val())}),c.on("change",function(){n.val(c.val()),n.trigger("change",[{triggeredByUs:!0}])}),o.find(".sui-colorpicker").addClass("sui-colorpicker-"+t),o.find(".sui-button, span[role=button]").on("click",function(e){s.click(),e.preventDefault(),e.stopPropagation()}),d.on("click",function(e){return i.colorPickerCleared(e,n,i)})})},colorPickerCleared:function(e,t,i){var n=t.data("attribute"),s=i.model.get("color_palette"),a=optinVars.palettes[s][n],o=t.closest(".sui-colorpicker-wrap"),l=o.find(".sui-colorpicker-value"),r=o.find(".sui-colorpicker-value span[role=button]");t.closest(".wp-picker-container").find(".wp-picker-clear").click(),l.find("input").val(a),t.val(a).trigger("change"),r.find("span").css({"background-color":a}),e.preventDefault(),e.stopPropagation()},updatePickers:function(e){var t=this;if(void 0!==optinVars.palettes[e]){var i=optinVars.palettes[e];_.each(i,function(e,i){t.$('input[data-attribute="'+i+'"]').val(e).trigger("change")})}},resetSettingsBlock:function(t){var i=e(t.target);if(i.addClass("sui-button-onload").prop("disabled",!0),i.closest("#hustle-color-palette").length){var n=e('select[data-attribute="color_palette"]').val();this.updatePickers(n)}else{var s=i.closest(".sui-accordion"),a=jQuery.Event("click");a.currentTarget=s,this.initiateFontFamilySelectOnAccordionClick(a),s.find("[data-attribute]").each(function(){var t=e(this),i=t.attr("name");if(void 0!==optinVars.defaults[i]){var n=optinVars.defaults[i],s=t.parent(".sui-tabs");t.val(n),"radio"===t.prop("type")&&t.parent(".sui-tabs")?e("#tab-"+i+"-"+n,s).trigger("click"):t.trigger("sui:change").trigger("change")}})}setTimeout(function(){i.removeClass("sui-button-onload").prop("disabled",!1)},500)},addCreatePalettesLink:function(){var e=this.$("#hustle-create-palette-link"),t=this.$(".select-container.hui-select-palette .list-results");t.find(".hui-button").length||t.append(e)},createEditor:function(e){var t=ace.edit(e);return t.getSession().setMode("ace/mode/css"),t.$blockScrolling=1/0,t.setTheme("ace/theme/sui"),t.getSession().setUseWrapMode(!0),t.getSession().setUseWorker(!1),t.setShowPrintMargin(!1),t.renderer.setShowGutter(!0),t.setHighlightActiveLine(!0),t},updateCustomCss:function(){this.cssEditor&&this.model.set("custom_css",this.cssEditor.getValue())},insertSelector:function(t){var i=e(t.target).data("stylable")+"{}",n=this.cssEditor;n.navigateFileEnd(),n.insert(i),n.navigateLeft(1),n.focus(),t.preventDefault()},modelUpdated:function(){this.addUpdatedProperty(),this.updateViewOnModelUpdate()},addUpdatedProperty:function(){_.extend(this.updatedProperties,this.model.changed)},updateViewOnModelUpdate:function(){var e=this.model,t=Object.keys(e.changed)[0],i=this.getActionOnModelUpdated(t);void 0!==i&&i(t)},getActionOnModelUpdated:function(e){var t=this;return{color_palette:function(){return t.updatePickers(t.model.changed.color_palette)},cta_buttons_alignment:function(){return t.toggleCtaButtonsTextAlignment()},cta_buttons_alignment_mobile:function(){return t.toggleCtaButtonsTextAlignment()},enable_mobile_settings:function(){return t.toggleDeviceTabs()},feature_image_hide_on_mobile:function(e){return t.hideOtherOptionsInAcordionItem(e,"1"===t.model.get(e))},feature_image_fit:function(e){return t.toggleFeatureImageSizeSettingRow(e)},feature_image_fit_mobile:function(e){return t.toggleFeatureImageSizeSettingRow(e)},feature_image_position:function(){return t.toggleFeatureImageSizeRows()},form_layout:function(){t.setImageAligmentOptions(),t.toggleFeatureImageSizeRows()},style:function(){return t.handleStyleChange()},use_vanilla:function(){return t.setVanillaThemeVisibility()}}[e]},toggleCtaButtonsTextAlignment:function(){var e=this.$("#hustle-cta_alignment-form-field"),t=this.$("#hustle-cta_alignment_mobile-form-field");"full"===this.model.get("cta_buttons_alignment")?Module.Utils.accessibleShow(e):Module.Utils.accessibleHide(e),"full"===this.model.get("cta_buttons_alignment_mobile")?Module.Utils.accessibleShow(t):Module.Utils.accessibleHide(t)},hideOtherOptionsInAcordionItem:function(e,t){var i=this.$('[name="'+e+'"]').closest(".sui-box"),n=i.find(".sui-box-settings-row").slice(0,1),s=i.find(".sui-box-settings-row").slice(1);t?(s.addClass("sui-hidden-important"),n.addClass("hustle-no-bottom-line")):(s.removeClass("sui-hidden-important"),n.removeClass("hustle-no-bottom-line"))},toggleFeatureImageSizeSettingRow:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e||"feature_image_fit"===e){var t=this.$("#hustle-feature-image-size-settings-row");"none"!==this.model.get("feature_image_fit")?t.show():t.hide()}if(!e||"feature_image_fit_mobile"===e){var i=this.$("#hustle-feature-image-size-mobile-settings-row");"none"!==this.model.get("feature_image_fit_mobile")?i.show():i.hide()}},handleStyleChange:function(){var e=this.model.get("style"),t=this.$('[data-name="module_cont"]'),i=this.$('[data-name="layout_header"]'),n=this.$('[data-name="layout_content"]'),s=this.$('[data-name="layout_footer"]');"cabriolet"===e?t.find(".sui-accordion-item-title .sui-accordion-note").text(".hustle-layout-body"):t.find(".sui-accordion-item-title .sui-accordion-note").text(".hustle-layout"),"minimal"!==e?(Module.Utils.accessibleHide(n),Module.Utils.accessibleHide(s)):(Module.Utils.accessibleShow(n),Module.Utils.accessibleShow(s)),"simple"!==e?Module.Utils.accessibleShow(i):Module.Utils.accessibleHide(i)},setVanillaThemeVisibility:function(){var e=this.$('[data-toggle-content="use-vanilla"]'),t=this.$('[data-toggle-content="not-use-vanilla"]');"0"===this.model.get("use_vanilla")?(Module.Utils.accessibleShow(e,!0),Module.Utils.accessibleHide(t,!0)):(Module.Utils.accessibleHide(e,!0),Module.Utils.accessibleShow(t,!0))},linkFieldsChanged:function(t){var i=e(t.currentTarget);if("0"!==i.val()){var n=i.attr("name"),s=this.$("[data-linked-fields=".concat(n,"]")),a=s[0].value;s.val(a).trigger("change",{updatedByUs:!0})}},linkedFieldsChanged:function(t,i){if(!i){var n=e(t.currentTarget),s=n.data("linked-fields");if("1"===this.model.get(s))this.$("[data-linked-fields=".concat(s,"]")).val(n.val()).trigger("change",{updatedByUs:!0})}},requiredFieldChanged:function(t){var i=e(t.currentTarget);if(0===i.val().trim().length){var n=i.attr("name");void 0!==optinVars.defaults[n]&&i.val(optinVars.defaults[n])}},setImageAligmentOptions:function(){var e=this.$("#tab-feature_image_position-alignment-above"),t=this.$("#tab-feature_image_position-alignment-below");if("one"===this.model.get("form_layout"))Module.Utils.accessibleShow(e,!0),Module.Utils.accessibleShow(t,!0);else{var i=this.model.get("feature_image_position");"left"!==i&&"right"!==i&&(this.$("#tab-feature_image_position-alignment-left").trigger("click"),this.toggleFeatureImageSizeRows()),Module.Utils.accessibleHide(e,!0),Module.Utils.accessibleHide(t,!0)}},toggleFeatureImageSizeRows:function(){for(var e=this.$("#hustle-feature_image_width-row"),t=this.$("#hustle-feature-image-desktop-width-description"),i=this.$("#hustle-feature_image_height-row"),n=this.$("#hustle-feature-image-desktop-height-description"),s=this.model.get("form_layout"),a=function(){i.show(),n.show(),e.hide(),t.hide()},o=function(){i.hide(),n.hide(),e.show(),t.show()},l=!0,r=0,d=["title","sub_title","show_cta","main_content"];r<d.length;r++){var c=d[r];this.contentPropIsShown[c]&&(l=!1)}if(l&&"two"!==s&&"four"!==s)a();else if(optinVars.current.is_optin)if("three"!==s)if("four"!==s){var u=this.model.get("feature_image_position");"below"===u||"above"===u?a():o()}else l?o():(i.show(),n.hide(),e.show(),t.show());else a();else o()},updateFeatureImageWidth:function(t){var i=e(t.currentTarget).val(),n=this.$('input[name="feature_image_width"]');"custom"!==i?(this.$('select[name="feature_image_width_unit"]').val("%").trigger("sui:change").trigger("change"),n.prop("disabled",!0),n.val(i).trigger("change")):n.prop("disabled",!1)},contentModelUpdated:function(e){var t=Object.keys(e)[0],i=this.getActionOnContentModelUpdated(t);void 0!==i&&(i(e,t),this.toggleFeatureImageSizeRows(),this.updateElementsRow(t))},setVisibilityOnRender:function(){this.contentPropIsShown.feature_image=""!==optinVars.current.content.feature_image,this.contentPropIsShown.background_image=""!==optinVars.current.content.background_image,this.contentPropIsShown.show_cta="0"!==optinVars.current.content.show_cta,this.contentPropIsShown.title=""!==optinVars.current.content.title,this.contentPropIsShown.sub_title=""!==optinVars.current.content.sub_title,this.contentPropIsShown.show_never_see_link="0"!==optinVars.current.content.show_never_see_link,this.contentPropIsShown.optin_form=optinVars.current.is_optin,this.contentPropIsShown.main_content=""!==optinVars.current.content.main_content},getActionOnContentModelUpdated:function(e){var t=this;return{background_image:function(e){return t.contentPropIsShown.background_image=""!==e.background_image},feature_image:function(e){t.contentPropIsShown.feature_image=""!==e.feature_image,t.hideOtherOptionsInAcordionItem("feature_image_position",!t.contentPropIsShown.feature_image)},main_content:function(e){return t.contentPropIsShown.main_content=""!==e.main_content},show_cta:function(e){return t.contentPropIsShown.show_cta="0"!==e.show_cta},show_never_see_link:function(e){return t.contentPropIsShown.show_never_see_link="0"!==e.show_never_see_link},sub_title:function(e){return t.contentPropIsShown.sub_title=""!==e.sub_title},title:function(e){return t.contentPropIsShown.title=""!==e.title}}[e]},updateElementsRow:function(e){var t=this.$("#hustle-wizard-appearance-desktop, #hustle-wizard-appearance-mobiles").find('.sui-accordion-item[data-name="'.concat(e,'"]'));this.contentPropIsShown[e]?t.show():t.hide(),optinVars.current.is_optin?this.handleTypographyTabs(e):this.updateRow(e)},updateRow:function(t){var i=this;e.each({"hustle-typography-elements-row":["show_cta","title","sub_title","main_content"],"hustle-appearance-customize-elements-row":["feature_image","background_image","show_cta"]},function(n,s){if(s.includes(t)){var a,o=!1,l=_createForOfIteratorHelper(s);try{for(l.s();!(a=l.n()).done;){var r=a.value;i.contentPropIsShown[r]&&(o=!0)}}catch(e){l.e(e)}finally{l.f()}o?e("."+n).show():e("."+n).hide()}})},handleTypographyTabs:function(e){var t=["show_cta","title","sub_title","main_content"];if("embedded"!==optinVars.current.data.module_type&&t.push("show_never_see_link"),t.includes(e)){var i,n=this.$(".hustle-typography-tabs"),s=n.find(".sui-tabs-menu"),a=!1,o=_createForOfIteratorHelper(t);try{for(o.s();!(i=o.n()).done;){var l=i.value;this.contentPropIsShown[l]&&(a=!0)}}catch(e){o.e(e)}finally{o.f()}a?Module.Utils.accessibleShow(s):(Module.Utils.accessibleHide(s),n.find("#tab-custom-typography-optin").trigger("click"),n.find("#tab-custom-typography_mobile-optin").trigger("click"))}},emailsModelUpdated:function(e){var t=Object.keys(e)[0],i=this.getActionOnEmailsModelUpdated(t);void 0!==i&&i(e,t)},getActionOnEmailsModelUpdated:function(e){var t=this;return{form_elements:function(e){return t.formFieldsUpdated(e)},after_successful_submission:function(e){return t.setSucccessfulMessageOptionVisibility(e)}}[e]},setSucccessfulMessageOptionVisibility:function(e){var t=this.$('[data-name="success_message"]');t.length>0&&("show_success"===e.after_successful_submission?t.show():t.hide())},formFieldsUpdated:function(e){this.handleRecaptcha(e.form_elements),this.handleGdpr(e.form_elements),this.handleCalendar(e.form_elements)},handleRecaptcha:function(e){var t=this.$('[data-name="recaptcha"]'),i=!1;void 0!==e.recaptcha&&(i="v3_recaptcha"===e.recaptcha.version&&"0"===e.recaptcha.v3_recaptcha_show_badge||"v2_invisible"===e.recaptcha.version&&"0"===e.recaptcha.v2_invisible_show_badge),i?t.show():t.hide()},handleGdpr:function(e){var t=this.$('[data-name="gdpr"]');void 0!==e.gdpr?t.show():t.hide()},handleCalendar:function(e){var t=!1;for(var i in e){if("calendar"===e[i].type){t=!0;break}}t?this.$('[data-name="calendar"]').show():this.$('[data-name="calendar"]').hide()},integrationsModelUpdate:function(e){"active_integrations"in e.changed&&this.updateMailchimpRelatedAccordions(e.changed)},updateMailchimpRelatedAccordions:function(e){for(var t=e.active_integrations.split(",").includes("mailchimp"),i=0,n=["form_extras","checkbox","dropdown","select"];i<n.length;i++){var s=n[i];t?this.$('[data-name="'.concat(s,'"]')).show():this.$('[data-name="'.concat(s,'"]')).hide()}}})}),Hustle.define("Mixins.Module_Display",function(){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-display",events:{},init:function(e){this.model=new e.BaseModel(optinVars.current.display||{}),this.moduleType=optinVars.current.data.module_type,this.listenTo(this.model,"change",this.viewChanged),this.render()},render:function(){},viewChanged:function(){}})}),Hustle.define("Mixins.Module_Emails",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-emails",events:{"click .hustle-optin-field--add":"addFields","click .hustle-optin-field--edit":"editField","click .sui-builder-field":"maybeEditField","click .hustle-optin-field--delete":"deleteFieldOnClick","click ul.list-results li":"setFieldOption","click .hustle-optin-field--copy":"duplicateField"},init:function(e){this.model=new e.BaseModel(optinVars.current.emails||{}),this.listenTo(this.model,"change",this.modelUpdated),this.render()},render:function(){var t=this.model.get("form_elements");for(var i in t){var n=t[i];t[i]=_.extend({},this.getFieldDefaults(n.type),n),"submit"!==i&&this.addFieldToPanel(t[i])}this.model.set("form_elements",t,{silent:!0});var s=this.$("#hustle-form-fields-container").sortable({axis:"y",containment:".sui-box-builder"});return s.on("sortupdate",e.proxy(this.fieldsOrderChanged,this,s)),this.$("#hustle-email-day").datepicker({beforeShow:function(){e("#ui-datepicker-div").addClass("sui-calendar")},dateFormat:"MM dd, yy"}),this.$("#hustle-email-time").timepicker({timeFormat:"h:mm p",interval:"1",minTime:"0",maxTime:"11:59pm",defaultTime:null,startTime:"00:00",dynamic:!1,dropdown:!0,scrollbar:!0,change:function(){e("#hustle-email-time").trigger("change")}}),this.updateDynamicValueFields(),this},modelUpdated:function(e){var t=e.changed,i=Object.keys(t)[0],n=this.getActionOnModelUpdated(i);void 0!==n&&n(t),Hustle.Events.trigger("modules.view.emailsUpdate",t)},getActionOnModelUpdated:function(e){var t=this;return{auto_close_success_message:function(){return t.autoCloseSuccessMessageUpdated()},form_elements:function(){return t.updateDynamicValueFields()}}[e]},autoCloseSuccessMessageUpdated:function(){var e=this.$("#section-auto-close-success-message .sui-row");"1"===this.model.get("auto_close_success_message")?e.removeClass("sui-hidden"):e.addClass("sui-hidden")},resetDynamicValueFieldsPlaceholders:function(){this.$("select.hustle-field-options").html(""),this.$(".hustle-fields-placeholders-options").length&&this.$(".hustle-fields-placeholders-options").html("")},updateDynamicValueFields:function(){var t=this.model.get("form_elements");for(var i in this.resetDynamicValueFieldsPlaceholders(),t)"submit"!==i&&"recaptcha"!==i&&"gdpr"!==i&&(this.addFieldToDynamicValueFields(t[i]),this.$("select.hustle-field-options").trigger("sui:change"));this.$("div.select-list-container .list-results:empty").each(function(){var t=e(this).closest(".select-container").find("select.hustle-field-options").data("type");e(this).html('<li style="cursor: default; pointer-events: none;">'+optinVars.form_fields.no_fields_of_type_notice.replace("{field_type}",t)+"</li>")})},fieldsOrderChanged:function(e){var t,i=this.model.get("form_elements"),n=e.sortable("toArray",{attribute:"data-field-id"}),s={},a=_createForOfIteratorHelper(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;s[o]=i[o]}}catch(e){a.e(e)}finally{a.f()}s=_.extend({},s,i),this.model.set("form_elements",s)},addFields:function(t){SUI.openModal("hustle-dialog--optin-fields",e(t.currentTarget)[0],this.$("#hustle-dialog--optin-fields .sui-box-header .sui-button-icon")[0],!0),new(Hustle.get("Modals.Optin_Fields"))({model:this.model}).on("fields:added",e.proxy(this.addNewFields,this))},maybeEditField:function(t){e(t.target).closest(".sui-dropdown").length||this.editField(t)},editField:function(t){var i=e(t.target),n=i.closest(".sui-builder-field").data("field-id"),s=this.model.get("form_elements")[n],a=Object.assign({},this.getFieldViewDefaults(s.type),s);new(Hustle.get("Modals.Edit_Field"))({field:s,fieldData:a,model:this.model}).on("field:updated",e.proxy(this.formFieldUpdated,this)),SUI.openModal("hustle-dialog--edit-field",i[0],this.$("#hustle-dialog--edit-field .sui-box-header .sui-button-icon")[0],!0)},formFieldUpdated:function(e,t,i){if(Object.keys(t).length){if("name"in t)return this.addNewFields(e.type,e,i.name),void this.deleteField(i.name);var n=this.$("#hustle-optin-field--"+e.name);if("required"in t){var s=n.find(".sui-error"),a=e.required;_.isTrue(a)?s.show():_.isFalse(a)&&s.hide()}if("label"in t)this.updateDynamicValueFields(),n.find(".hustle-field-label-text").text(e.label)}},deleteFieldOnClick:function(t){var i=e(t.target).closest(".sui-builder-field").data("field-id");this.deleteField(i)},setFieldOption:function(t){var i=e(t.target),n=i.find("span:eq(1)").text();i.closest(".sui-insert-variables").find('input[type="text"]').val(n).trigger("change")},deleteField:function(t){var i=this.$("#hustle-optin-field--"+t),n=Object.assign({},this.model.get("form_elements"));delete n[t],this.model.set("form_elements",n),-1!==jQuery.inArray(t,["gdpr","recaptcha"])?(i.addClass("sui-hidden"),e("#hustle-optin-insert-field--"+t).prop("disabled",!1).prop("checked",!1)):i.remove()},duplicateField:function(t){var i=e(t.target).closest(".sui-builder-field").data("field-id"),n=Object.assign({},this.model.get("form_elements")),s=Object.assign({},n[i]);delete s.name,s.can_delete=!0,this.addNewFields(s.type,s)},addNewFields:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=Object.assign({},this.model.get("form_elements"));if(Array.isArray(e)){var s,a=_createForOfIteratorHelper(e);try{for(a.s();!(s=a.n()).done;){var o=s.value,l=this.getFieldDefaults(o);t&&o in t&&_.extend(l,t[o]),this.addFieldToPanel(l),n[l.name]=l}}catch(e){a.e(e)}finally{a.f()}}else{var r=this.getFieldDefaults(e);if(t&&_.extend(r,t),this.addFieldToPanel(r,i),null===i)n[r.name]=r;else{var d=[];jQuery.each(n,function(e,t){d[e]=t,e===i&&(d[r.name]=r)}),n=d}}this.model.set("form_elements",n)},addFieldToDynamicValueFields:function(t){var i;(i=e("<div>"+t.name+"</div>")).find("script").remove(),t.name=i.html(),(i=e("<div>"+t.label+"</div>")).find("script").remove(),t.label=i.html();var n=e("<option/>",{value:t.name,"data-content":"{"+t.name+"}"}).text(t.label),s='<li><button value="{'.concat(t.name,'}">').concat(t.label,"</button></li>");this.$('select.hustle-field-options:not([data-type]), select.hustle-field-options[data-type="'+t.type+'"]').append(n),this.$(".hustle-fields-placeholders-options").length&&this.$(".hustle-fields-placeholders-options").append(s)},addFieldToPanel:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=Optin.template("hustle-form-field-row-tpl"),s=this.$("#hustle-form-fields-container");if(t=_.extend({},this.getFieldViewDefaults(t.type),t),-1!==jQuery.inArray(t.type,["gdpr","recaptcha"]))this.$("#hustle-optin-field--"+t.type).removeClass("sui-hidden"),e("#hustle-optin-insert-field--"+t.type).prop("checked",!0).prop("disabled",!0);else if(null===i)s.append(n(t));else{var a=this.$("#hustle-optin-field--"+i);0<a.length?a.after(n(t)):s.append(n(t))}},getNewFieldId:function(e){for(var t=Object.assign({},this.model.get("form_elements")),i=e;i in t&&-1===jQuery.inArray(i,["gdpr","recaptcha","submit"]);)i=e+"-"+Math.floor(99*Math.random());return i},getFieldDefaults:function(e){var t=this.getNewFieldId(e),i={label:optinVars.form_fields.label[e+"_label"],required:"false",css_classes:"",type:e,name:t,required_error_message:optinVars.form_fields.required_error_message.replace("{field}",e),validation_message:optinVars.form_fields.validation_message.replace("{field}",e),placeholder:""};switch(e){case"timepicker":i.time_format="12",i.time_hours="9",i.time_minutes="30",i.time_period="am",i.validation_message=optinVars.form_fields.time_validation_message,i.required_error_message=optinVars.form_fields.is_required.replace("{field}",i.label),i.validate="false";break;case"datepicker":i.date_format="mm/dd/yy",i.validation_message=optinVars.form_fields.date_validation_message,i.required_error_message=optinVars.form_fields.is_required.replace("{field}",i.label),i.validate="false";break;case"recaptcha":i.threshold="0.5",i.version="v2_checkbox",i.recaptcha_type="compact",i.recaptcha_theme="light",i.v2_invisible_theme="light",i.recaptcha_language="automatic",i.v2_invisible_show_badge="1",i.v2_invisible_badge_replacement=optinVars.form_fields.recaptcha_badge_replacement,i.v3_recaptcha_show_badge="1",i.v3_recaptcha_badge_replacement=optinVars.form_fields.recaptcha_badge_replacement,i.validation_message=optinVars.form_fields.recaptcha_validation_message,i.error_message=optinVars.form_fields.recaptcha_error_message;break;case"gdpr":i.gdpr_message=optinVars.form_fields.gdpr_message,i.required="true",i.required_error_message=optinVars.form_fields.gdpr_required_error_message;break;case"email":i.validate="true";break;case"url":i.required_error_message=optinVars.form_fields.url_required_error_message,i.validate="true";break;case"phone":i.validate="false";break;case"hidden":i.default_value="user_ip",i.custom_value="";break;case"number":case"text":i.required_error_message=optinVars.form_fields.cant_empty}return i},getFieldViewDefaults:function(e){var t={required:"false",validated:"false",placeholder_placeholder:optinVars.form_fields.label.placeholder,label_placeholder:"",name_placeholder:"",icon:"send",css_classes:"",type:e,name:e,placeholder:optinVars.form_fields.label[e+"_placeholder"],can_delete:!0,fieldId:this.getNewFieldId(e)};switch(e){case"email":t.icon="mail";break;case"name":t.icon="profile-male";break;case"phone":t.icon="phone";break;case"address":t.icon="pin";break;case"url":t.icon="web-globe-world";break;case"text":t.icon="style-type";break;case"number":t.icon="element-number";break;case"timepicker":t.icon="clock";break;case"datepicker":t.icon="calendar";break;case"recaptcha":t.icon="recaptcha";break;case"gdpr":t.icon="gdpr";break;case"hidden":t.icon="eye-hide"}return t}})}),Hustle.define("Module.IntegrationsView",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-box-section-integrations",events:{"click .connect-integration":"connectIntegration","keypress .connect-integration":"preventEnterKeyFromDoingThings"},init:function(e){this.model=new e.BaseModel(optinVars.current.integrations_settings||{}),this.moduleId=optinVars.current.data.module_id,this.listenTo(this.model,"change",function(e){return Hustle.Events.trigger("modules.view.integrationsUpdate",e)}),this.listenTo(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.render()},render:function(){var e=this.$el.find("#hustle-not-connected-providers-section"),t=this.$el.find("#hustle-connected-providers-section");0<e.length&&0<t.length&&this.renderProvidersTables()},renderProvidersTables:function(){var t=this,i={};this.$el.find(".hustle-integrations-display").html('<div class="sui-notice hustle-integration-loading-notice">\n\t\t\t\t\t\t<div class="sui-notice-content">\n\t\t\t\t\t\t\t<div class="sui-notice-message">\n\n\t\t\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-loader sui-loading sui-md" aria-hidden="true"></span>\n\t\t\t\t\t\t\t\t<p>'.concat(optinVars.integrations.fetching_list,"</p>\n\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")),i.action="hustle_provider_get_form_providers",i._ajax_nonce=optinVars.integrations.action_nonce,i.data={moduleId:this.moduleId},e.post({url:ajaxurl,type:"post",data:i}).done(function(e){if(e&&e.success){var i=t.$el.find("#hustle-integrations-active-integrations"),n=t.$el.find("#hustle-integrations-active-count");t.$el.find("#hustle-not-connected-providers-section").html(e.data.not_connected),t.$el.find("#hustle-connected-providers-section").html(e.data.connected),i.val()!==e.data.list_connected&&i.val(e.data.list_connected).trigger("change"),n.val()!==String(e.data.list_connected_total)&&n.val(e.data.list_connected_total).trigger("change")}}).always(function(){t.$el.find(".sui-box-body").removeClass("sui-block-content-center"),t.$el.find(".hustle-integration-loading-notice").remove()})},preventEnterKeyFromDoingThings:function(e){13===e.which&&e.preventDefault()},connectIntegration:function(e){Module.integrationsModal.open(e)}}))}),Hustle.define("Mixins.Module_Visibility",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-conditions-group",events:{"click .hustle-add-new-visibility-group":"addNewGroup","click .hustle-choose-conditions":"openConditionsModal","click .hustle-remove-visibility-group":"removeGroup","change .visibility-group-filter-type":"updateAttribute","change .visibility-group-show-hide":"updateAttribute","change .visibility-group-apply-on":"updateGroupApplyOn"},init:function(t){var i=t.BaseModel.extend({defaults:{conditions:""},initialize:function(e){if(_.extend(this,e),!(this.get("conditions")instanceof Backbone.Model)){_.isEmpty(this.get("conditions"))&&_.isArray(this.get("conditions"))&&(this.conditions={});var t=Hustle.get("Model");this.set("conditions",new t(this.conditions),{silent:!0})}}});this.model=new i(optinVars.current.visibility||{}),this.moduleType=optinVars.current.data.module_type,this.activeConditions={},this.render(),e("#hustle-general-conditions").on("click",e.proxy(this.switchConditions,this)),e("#hustle-wc-conditions").on("click",e.proxy(this.switchConditions,this)),this.groupId=""},render:function(){var t=this.model.get("conditions").toJSON();if(e.isEmptyObject(t))this.addNewGroup();else{for(var i in t){var n=this.model.get("conditions."+i);n instanceof Backbone.Model||(_.isEmpty(n)&&_.isArray(n)&&(n={}),n=this.getConditionsGroupModel(n),this.model.set("conditions."+i,n,{silent:!0})),this.addGroupToPanel(n,"render")}this.maybeToggleGroupsBin()}},afterRender:function(){this.bindRemoveConditions()},bindRemoveConditions:function(){e("#hustle-conditions-group .hustle-remove-visibility-condition").off("click").on("click",e.proxy(this.removeCondition,this))},openConditionsModal:function(t){var i=e(t.currentTarget),n=i.data("group-id"),s=this.model.get("conditions."+n),a=void 0!==s?Object.keys(s.toJSON()):[];new(Hustle.get("Modals.Visibility_Conditions"))({groupId:n,conditions:a}).on("conditions:added",e.proxy(this.addNewConditions,this)),this.groupId=n,SUI.openModal("hustle-dialog--visibility-options",i[0],this.$("#hustle-dialog--visibility-options .sui-box-header .sui-button-icon")[0],!0)},addNewConditions:function(t){var i=this,n=t.groupId,s=t.conditions,a=this.model.get("conditions."+n);e.each(s,function(e,t){if(a.get(t))return!0;i.addConditionToPanel(t,{},n,a,"new")}),this.bindRemoveConditions(),Hustle.Events.trigger("view.rendered",this)},addGroupToPanel:function(t,i){var n=t.get("group_id"),s=e("#hustle-visibility-conditions-box"),a=Optin.template("hustle-visibility-group-box-tpl")(_.extend({},{groupId:n,apply_on_floating:t.get("apply_on_floating"),apply_on_inline:t.get("apply_on_inline"),apply_on_widget:t.get("apply_on_widget"),apply_on_shortcode:t.get("apply_on_shortcode"),show_or_hide_conditions:t.get("show_or_hide_conditions"),filter_type:t.get("filter_type")}));e(a).insertBefore(s.find(".hustle-add-new-visibility-group")),this.activeConditions[n]={};var o=this,l=t.toJSON();e.each(l,function(e,s){if("object"!==_typeof(s))return!0;o.addConditionToPanel(e,s,n,t,i)})},addConditionToPanel:function(t,i,n,s,a){if(void 0!==Optin.View.Conditions[t]){var o=new Optin.View.Conditions[t]({type:this.moduleType,model:s,groupId:n,source:a});if(o){var l=this.$("#hustle-visibility-group-"+n+" .sui-box-builder-body");return l.find(".sui-builder-field").length||(l.find(".sui-box-builder-message-block").hide(),l.find(".sui-button-dashed").show()),e.isEmptyObject(i)?s.set(t,o.getConfigs()):s.set(t,i),this.activeConditions[n][t]=o,e(o.$el).appendTo(l.find(".sui-builder-fields")),o}}},addNewGroup:function(){var e=this.getConditionsGroupModel(),t=e.get("group_id");this.model.set("conditions."+t,e),this.addGroupToPanel(e,"new"),this.maybeToggleGroupsBin(),Hustle.Events.trigger("view.rendered",this)},switchConditions:function(t){t.preventDefault(),"hustle-wc-conditions"===e(t.currentTarget).prop("id")?(e("#hustle-dialog--visibility-options .general_condition").hide(),e("#hustle-dialog--visibility-options .wc_condition").show()):(e("#hustle-dialog--visibility-options .wc_condition").hide(),e("#hustle-dialog--visibility-options .general_condition").show())},removeGroup:function(t){var i=e(t.currentTarget).data("group-id"),n=this.$("#hustle-visibility-group-"+i);delete this.activeConditions[i],this.model.get("conditions").unset(i),n.remove(),Object.keys(this.activeConditions).length||this.addNewGroup(),this.maybeToggleGroupsBin()},removeCondition:function(t){var i=e(t.currentTarget),n=i.data("condition-id"),s=i.data("group-id"),a=this.$("#hustle-visibility-group-"+s+" .sui-box-builder-body");this.activeConditions[s][n].remove(),delete this.activeConditions[s][n],this.model.get("conditions."+s).unset(n),a.find(".sui-builder-field").length||a.find(".sui-box-builder-message-block").show(),this.bindRemoveConditions()},updateAttribute:function(t){t.stopPropagation();var i=e(t.target),n=i.data("group-id"),s=i.data("group-attribute"),a=i.val();this.model.get("conditions."+n).set(s,a)},updateGroupApplyOn:function(t){t.stopPropagation();var i=e(t.target),n=i.data("group-id"),s=i.data("property"),a=i.is(":checked"),o=this.model.get("conditions."+n);("embedded"===this.moduleType&&-1!==e.inArray(s,["apply_on_inline","apply_on_widget","apply_on_shortcode"])||"social_sharing"===this.moduleType&&-1!==e.inArray(s,["apply_on_floating","apply_on_inline","apply_on_widget","apply_on_shortcode"]))&&o.set(s,a)},getConditionsGroupModel:function(e){if(e)"embedded"!==this.moduleType||e.apply_on_inline&&e.apply_on_widget&&e.apply_on_shortcode?"social_sharing"!==this.moduleType||e.apply_on_floating&&e.apply_on_inline&&e.apply_on_widget&&e.apply_on_shortcode||(e.apply_on_floating||(e.apply_on_floating=!0),e.apply_on_inline||(e.apply_on_inline=!0),e.apply_on_widget||(e.apply_on_widget=!0),e.apply_on_shortcode||(e.apply_on_shortcode=!1)):(e.apply_on_inline||(e.apply_on_inline=!0),e.apply_on_widget||(e.apply_on_widget=!0),e.apply_on_shortcode||(e.apply_on_shortcode=!1));else{var t=(new Date).getTime().toString(16);this.model.get("conditions."+t),e={group_id:t,show_or_hide_conditions:"show",filter_type:"all"},"embedded"===this.moduleType?(e.apply_on_inline=!0,e.apply_on_widget=!0,e.apply_on_shortcode=!1):"social_sharing"===this.moduleType&&(e.apply_on_floating=!0,e.apply_on_inline=!0,e.apply_on_widget=!0,e.apply_on_shortcode=!1)}return new(Hustle.get("Model"))(e)},maybeToggleGroupsBin:function(){var t=this.model.get("conditions"),i=e("#hustle-conditions-group .sui-box-builder-header .hustle-remove-visibility-group");1===Object.keys(t.toJSON()).length?Module.Utils.accessibleHide(i):Module.Utils.accessibleShow(i)}})}),Hustle.define("Mixins.Wizard_View",function(e,t,i){"use strict";return{moduleType:"",el:".sui-wrap-hustle",publishModal:{},previewView:null,events:{"click .sui-sidenav .sui-vertical-tab a":"sidenav","change select.sui-mobile-nav":"sidenavMobile","click a.hustle-go-to-tab":"sidenav","click a.notify-error-tab":"sidenav","click .hustle-action-save":"saveChanges","click .wpmudev-button-navigation":"doButtonNavigation","change #hustle-module-name":"updateModuleName","click #hustle-preview-module":"previewModule","blur input.sui-form-control":"removeErrorMessage","click .hustle-single-module-button-action":"handleSingleModuleAction"},init:function(t){var n=this;this.setTabsViews(t),Hustle.Events.on("modules.view.switch_status",function(e){return n.switchStatusTo(e)}),e(i).off("popstate",e.proxy(this.updateTabOnPopstate,this)),e(i).on("popstate",e.proxy(this.updateTabOnPopstate,this)),e(document).off("tinymce-editor-init",e.proxy(this.tinymceReady,this)),e(document).on("tinymce-editor-init",e.proxy(this.tinymceReady,this)),void 0!==this._events&&(this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents());var s=Hustle.get("Modals.PublishFlow");return this.publishModal=new s,this.renderTabs(),this},setTabsViews:function(e){this.contentView=e.contentView,this.emailsView=e.emailsView,this.designView=e.designView,this.integrationsView=e.integrationsView,this.visibilityView=e.visibilityView,this.settingsView=e.settingsView,this.moduleType=this.model.get("module_type"),"embedded"===this.moduleType&&(this.displayView=e.displayView)},renderTabs:function(){this.contentView.delegateEvents(),this.emailsView.delegateEvents(),this.integrationsView.delegateEvents(),this.designView.delegateEvents(),"embedded"===this.moduleType&&this.displayView.delegateEvents(),this.visibilityView.delegateEvents(),this.visibilityView.afterRender(),this.settingsView.delegateEvents()},sidenav:function(t){t.preventDefault();var i=e(t.target).data("tab");i&&this.goToTab(i,!0)},sidenavMobile:function(t){var i=e(t.currentTarget).val();i&&this.goToTab(i,!0)},goToTab:function(t,i){var n=this.$el.find('a[data-tab="'+t+'"]'),s=n.closest(".sui-vertical-tabs").find(".sui-vertical-tab a"),a=this.$el.find(".sui-box[data-tab]"),o=this.$el.find('.sui-box[data-tab="'+t+'"]');if(i){var l={tabName:t},r=this.model.get("module_id");history.pushState(l,"Hustle "+this.moduleType+" wizard","admin.php?page="+optinVars.current.wizard_page+"&id="+r+"&section="+t)}s.removeClass("current"),a.hide(),n.addClass("current"),o.show(),e(".sui-wrap-hustle")[0].scrollIntoView()},updateTabOnPopstate:function(e){var t=e.originalEvent.state;t&&this.goToTab(t.tabName)},doButtonNavigation:function(t){t.preventDefault();var i="prev"===e(t.target).data("direction")?"prev":"next",n=this.getNextOrPrevTabName(i);this.goToTab(n,!0)},getNextOrPrevTabName:function(t){var i=e("#hustle-module-wizard-view .sui-sidenav ul li a.current");i.data("tab");return"prev"===t?i.parent().prev().find("a").data("tab"):i.parent().next().find("a").data("tab")},tinymceReady:function(e,t){var i=this;t.on("change",function(){("main_content"===t.id?i.contentView.model:i.emailsView.model).set(t.id,t.getContent())})},setContentFromTinymce:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("social_sharing"!==this.moduleType&&"undefined"!=typeof tinyMCE){var t=tinyMCE.get("main_content"),i=this.$("textarea#main_content"),n="true"===i.attr("aria-hidden")?t.getContent():i.val();this.contentView.model.set("main_content",n,{silent:e});var s=tinyMCE.get("success_message"),a=this.$("textarea#success_message"),o="true"===a.attr("aria-hidden")?s.getContent():a.val();this.emailsView.model.set("success_message",o,{silent:e});var l=tinyMCE.get("email_body"),r=this.$("textarea#email_body"),d="true"===a.attr("aria-hidden")?l.getContent():r.val();this.emailsView.model.set("email_body",d,{silent:e})}},sanitizeData:function(){var e=this.contentView.model.get("cta_url");0!==e.indexOf("mailto:")&&0!==e.indexOf("tel:")&&(/^(f|ht)tps?:\/\//i.test(e)||(e="https://"+e,this.contentView.model.set("cta_url",e,{silent:!0})))},save:function(){this.setContentFromTinymce(!0),this.sanitizeData();var t=this.$el.find("#hustle-module-wizard-view"),i=t.data("id"),n={action:"hustle_save_module",_ajax_nonce:t.data("nonce"),id:i,module:this.model.toJSON()};return _.extend(n,this.getDataToSave()),e.ajax({url:ajaxurl,type:"POST",data:n,dataType:"json"})},getDataToSave:function(){var e={content:this.contentView.model.toJSON(),emails:this.emailsView.model.toJSON(),design:this.designView.updatedProperties,integrations_settings:this.integrationsView.model.toJSON(),visibility:this.visibilityView.model.toJSON(),settings:this.settingsView.model.toJSON()};return e.design.custom_css=this.designView.cssEditor.getValue(),"embedded"===this.moduleType&&(e.display=this.displayView.model.toJSON()),e},saveChanges:function(t){var i=this;t.preventDefault();var n=this.model.get("active"),s=e(t.currentTarget),a=String(s.data("active")),o=a!==n,l="0"!==a;this.disableButtonsOnSave(s),o&&l&&this.publishModal.open(),this.model.set("active",a,{silent:!0}),this.save().done(function(t){if(!0===t.success){if(Module.hasChanges=!1,i.switchStatusTo("saved"),o){if(l){var n="social_sharing"!==i.model.get("module_type")&&"1"===i.settingsView.model.get("is_schedule"),s=!1;if(n)s="1"!==i.settingsView.model.get("schedule").not_schedule_end;i.publishModal.setPublished(n,s)}i.updateViewOnActiveChange()}}else{var a=t.data,r="";void 0===a.data?r=optinVars.messages.module_error_reload:(void 0!==a.data.icon_error?(_.each(a.data.icon_error,function(t){e("#hustle-platform-"+t).find(".sui-error-message").show(),e("#hustle-platform-"+t+" .hustle-social-url-field").addClass("sui-form-field-error"),e("#hustle-platform-"+t).not(".sui-accordion-item--open").find(".sui-accordion-open-indicator").click()}),r='<a href="#" data-tab="services" class="notify-error-tab"> '+optinVars.module_tabs.services+" </a>"):void 0!==a.data.selector_error&&(_.each(a.data.selector_error,function(t){e('input[name="'+t+'_css_selector"]').siblings(".sui-error-message").show(),e('input[name="'+t+'_css_selector"]').parent(".sui-form-field").addClass("sui-form-field-error")}),_.isEmpty(r)||(r+=" and "),r=r+'<a href="#" data-tab="display" class="notify-error-tab"> '+optinVars.module_tabs.display+" </a>"),r=optinVars.messages.module_error.replace("{page}",r)),i.switchStatusTo("unsaved"),Module.Notification.open("error",r,!1)}}).always(function(){i.enableSaveButtons()})},updateModuleName:function(t){var i=e(t.target).val();if(i.length)this.$("#hustle-module-name-wrapper").removeClass("sui-form-field-error"),this.$("#hustle-module-name-error").hide(),this.$("#hustle-module-name-error").html(""),this.model.set("module_name",i);else{var n=this.$("#hustle-module-name-error").data("error-message");this.$("#hustle-module-name-wrapper").addClass("sui-form-field-error"),this.$("#hustle-module-name-error").html(n),this.$("#hustle-module-name-error").show()}},disableButtonsOnSave:function(e){e.addClass("sui-button-onload"),this.$(".hustle-action-save").prop("disabled",!0),this.$(".wpmudev-button-navigation").prop("disabled",!0)},enableSaveButtons:function(){this.$(".sui-button-onload").removeClass("sui-button-onload"),this.$(".hustle-action-save").prop("disabled",!1),this.$(".wpmudev-button-navigation").prop("disabled",!1)},switchStatusTo:function(e){"saved"===e?(this.$el.find("#hustle-unsaved-changes-status").addClass("sui-hidden"),this.$el.find("#hustle-saved-changes-status").removeClass("sui-hidden")):(this.$el.find("#hustle-unsaved-changes-status").removeClass("sui-hidden"),this.$el.find("#hustle-saved-changes-status").addClass("sui-hidden"))},updateViewOnActiveChange:function(){var e="1"===this.model.get("active"),t=this.$(".sui-status-module .sui-tag"),i=e?optinVars.messages.commons.published:optinVars.messages.commons.draft;t.text(i),e?t.addClass("sui-tag-blue"):t.removeClass("sui-tag-blue");var n=this.$("#hustle-draft-button-save-draft-text"),s=this.$("#hustle-draft-button-unpublish-text");e?(n.addClass("sui-hidden-important"),s.removeClass("sui-hidden-important")):(n.removeClass("sui-hidden-important"),s.addClass("sui-hidden-important"));var a=this.$(".hustle-publish-button"),o=e?a.data("update"):a.data("publish");a.find(".button-text").text(o)},removeErrorMessage:function(t){if(t.target.value){var i=e(t.target).parent(".sui-form-field");i.removeClass("sui-form-field-error"),i.find(".sui-error-message").hide()}},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.setContentFromTinymce(!0),this.sanitizeData();var n=_.extend({},this.model.toJSON(),this.getDataToSave()),s=n.module_name.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");n.module_name=s,this.getPreviewView().open(this.model.get("module_id"),this.model.get("module_type"),i,n)},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},previewModuleold:function(t){t.preventDefault(),this.setContentFromTinymce(!0),this.sanitizeData();var i=e(t.currentTarget),n=this.model.get("module_id"),s=_.extend({},this.model.toJSON(),this.getDataToSave());i.addClass("sui-button-onload"),Module.preview.open(n,i,s)},handleSingleModuleAction:function(e){Module.handleActions.initAction(e,"listing",this)}}}),Hustle.define("Settings.Palettes",function(e){"use strict";return Backbone.View.extend({el:"#palettes-box",events:{"click .hustle-create-palette":"openCreatePaletteModal","click .hustle-delete-button":"openDeletePaletteModal","click .hustle-button-delete":"delettePalette"},initialize:function(){var e=Hustle.get("Settings.Palettes_Modal");this.paletteModal=new e},openCreatePaletteModal:function(e){this.paletteModal.open(e)},openDeletePaletteModal:function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),title:i.data("title"),description:i.data("description"),action:"delete",nonce:i.data("nonce"),actionClass:"hustle-button-delete"};Module.deleteModal.open(n,i[0]),e(".hustle-button-delete").on("click",e.proxy(this.delettePalette,this))},delettePalette:function(t){t.preventDefault();var i=e(t.currentTarget),n=i.data("form-id"),s=i.data(),a=e("#"+n),o=new FormData(a[0]);e.each(s,function(e,t){return o.append(e,t)}),o.append("_ajax_nonce",optinVars.settings_palettes_action_nonce),o.append("action","hustle_handle_palette_actions"),e.ajax({url:ajaxurl,type:"POST",data:o,contentType:!1,processData:!1}).done(function(t){t.data.url?location.replace(t.data.url):t.data.notification&&Module.Notification.open(t.data.notification.status,t.data.notification.message,t.data.notification.delay),t.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){Module.Notification.open("error",optinVars.messages.commons.generic_ajax_error),e(".sui-button-onload").removeClass("sui-button-onload")})}})}),Hustle.define("Settings.Data_Settings",function(e){"use strict";return Backbone.View.extend({el:"#data-box",events:{"click #hustle-dialog-open--reset-data-settings":"dataDialog"},dataDialog:function(t){t.preventDefault();var i=this.$(t.target),n=e("#hustle-dialog--reset-data-settings");SUI.openModal("hustle-dialog--reset-data-settings",i[0],n.find(".sui-box-header .sui-button-icon")[0],!0),e("#hustle-reset-settings").off("click").on("click",e.proxy(this.settingsReset))},settingsReset:function(t){var i=e(t.currentTarget),n=i.closest(".sui-modal").find("button, .sui-button");n.prop("disabled",!0),i.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_reset_settings",_ajax_nonce:i.data("nonce")},success:function(){e("#"+i.data("notice")).show(),SUI.closeModal(),i.removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("success",optinVars.messages.settings_was_reset),window.setTimeout(function(){return location.reload(!0)},2e3)},error:function(){SUI.closeModal(),i.removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("error",optinVars.messages.something_went_wrong)}})}})}),Hustle.define("Settings.Palettes_Modal",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--edit-palette",events:{"click .hustle-button-action":"handleAction","click .hustle-modal-close":"closeCreatePaletteModal","change #hustle-palette-module-type":"updateModulesOptions"},initialize:function(){},open:function(t){void 0!==e(t.currentTarget).data("slug")?this.handleAction(t):(this.$("#hustle-palette-module-type").trigger("change"),SUI.openModal("hustle-dialog--edit-palette",t.currentTarget,"hustle-palette-name",!1))},handleAction:function(t){t.preventDefault();var i=this,n=e(t.currentTarget),s=n.data("form-id");n.addClass("sui-button-onload"),Module.Utils.accessibleHide(this.$(".sui-error-message"));var a=new FormData,o=!1;if(void 0!==s){var l=e("#"+s);l.length&&(a=new FormData(l[0]),l.find(".hustle-required-field").each(function(t,i){var n=e(i);if(!n.val().trim().length){var s=n.data("error-message"),a=n.siblings(".sui-error-message");a.html(s),Module.Utils.accessibleShow(a),o=!0}}))}if(o)e(".sui-button-onload").removeClass("sui-button-onload");else{var r=n.data();e.each(r,function(e,t){return a.append(e,t)}),a.append("_ajax_nonce",optinVars.settings_palettes_action_nonce),a.append("action","hustle_handle_palette_actions"),e.ajax({url:ajaxurl,type:"POST",data:a,contentType:!1,processData:!1}).done(function(n){n.data.callback&&"function"==typeof i[n.data.callback]?i[n.data.callback](n.data,n.success,t):n.data.url?location.replace(n.data.url):n.data.notification&&Module.Notification.open(n.data.notification.status,n.data.notification.message,n.data.notification.delay),n.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload")})}},actionOpenEditPalette:function(t,i,n){this.actionGoToSecondStep(t),SUI.openModal("hustle-dialog--edit-palette",n.currentTarget,"hustle-palette-name",!1),t.palette_data.name&&e("#hustle-dialog--edit-palette").find("#hustle-palette-name").val(t.palette_data.name)},actionGoToSecondStep:function(e){var t=this.$("#hustle-edit-palette-first-step"),i=this.$("#hustle-edit-palette-second-step"),n=this.$(".hustle-button-action"),s=e.palette_data,a=Optin.template("hustle-dialog--edit-palette-tpl");Module.Utils.accessibleHide(t,!0),i.html(a(s)),this.initiateSecondStepElements(),Module.Utils.accessibleShow(i,!0),i.focus(),n.data("step",3),n.addClass("sui-button-blue"),Module.Utils.accessibleHide(n.find("#hustle-step-button-text")),Module.Utils.accessibleShow(n.find("#hustle-finish-button-text"))},initiateSecondStepElements:function(){this.$(".sui-accordion").each(function(){SUI.suiAccordion(this)}),SUI.suiTabs(),SUI.tabs(),this.createPickers()},closeCreatePaletteModal:function(){var e=this,t=this.$("#hustle-edit-palette-first-step"),i=this.$("#hustle-edit-palette-second-step"),n=this.$(".hustle-button-action");setTimeout(function(){Module.Utils.accessibleHide(e.$(".sui-error-message")),Module.Utils.accessibleHide(i,!0),i.html(""),Module.Utils.accessibleShow(t,!0),n.removeClass("sui-button-blue"),n.data("step",2),Module.Utils.accessibleShow(n.find("#hustle-step-button-text")),Module.Utils.accessibleHide(n.find("#hustle-finish-button-text"))},500)},createPickers:function(){var t=this.$(".sui-colorpicker-input");t.wpColorPicker({change:function(t,i){var n=e(this);n.val()!==i.color.toCSS()&&n.val(i.color.toCSS()).trigger("change")},palettes:["#333333","#FFFFFF","#17A8E3","#E1F6FF","#666666","#AAAAAA","#E6E6E6"]}),t.hasClass("wp-color-picker")&&t.each(function(){var t=e(this),i=t.closest(".sui-colorpicker-wrap"),n=i.find(".sui-colorpicker-value span[role=button]"),s=i.find(".sui-colorpicker-value"),a=s.find("button"),o=s.find(".hustle-colorpicker-input"),l=t.closest(".wp-picker-container"),r=l.find(".wp-color-result"),d=r.find(".color-alpha"),c=l.find(".wp-picker-clear"),u="hex";!0===t.data("alpha")?(u="rgba",t.on("change",function(){n.find("span").css({"background-color":d.css("background")}),"undefined"==typeof data&&o.val(t.val())})):t.on("change",function(){n.find("span").css({"background-color":r.css("background-color")}),"undefined"==typeof data&&o.val(t.val())}),o.on("change",function(){t.val(o.val()),t.trigger("change",[{triggeredByUs:!0}])}),i.find(".sui-colorpicker").addClass("sui-colorpicker-"+u),i.find(".sui-button, span[role=button]").on("click",function(e){r.click(),e.preventDefault(),e.stopPropagation()}),a.on("click",function(i){var a=t.data("attribute"),o=e("#hustle-palette-module-fallback").val(),l=optinVars.palettes[o][a];c.click(),s.find("input").val(l),t.val(l).trigger("change"),n.find("span").css({"background-color":l}),i.preventDefault(),i.stopPropagation()})})},updateModulesOptions:function(t){var i=e(t.currentTarget).val(),n=this.$("#hustle-palette-module-name"),s="";e.each(optinVars.current[i],function(e,t){s+='<option value="'.concat(e,'">').concat(t,"</option>")}),n.html(s),this.$(".sui-select:not(.hustle-select-ajax)").SUIselect2({dropdownCssClass:"sui-select-dropdown",dropdownParent:this.$(".sui-box")})}})}),Hustle.define("Settings.Permissions_View",function(e){"use strict";return Backbone.View.extend({el:"#permissions-box",initialize:function(){e(function(){function t(){e(".select2-selection__rendered li:first-child .select2-selection__choice__remove").off("click").text("").on("click",function(e){e.stopImmediatePropagation(),e.preventDefault()})}e("select").on("change.select2",function(){t()}),t()})}})}),Hustle.define("Settings.Privacy_Settings",function(e){"use strict";return Backbone.View.extend({el:"#privacy-box",events:{"click #hustle-dialog-open--delete-ips":"openDeleteIpsDialog"},initialize:function(){e("#hustle-delete-ips-submit").on("click",this.handleIpDeletion)},openDeleteIpsDialog:function(t){SUI.openModal("hustle-dialog--delete-ips",e(t.currentTarget)[0],this.$("#hustle-dialog--delete-ips .sui-box-header .sui-button-icon")[0],!0),t.preventDefault()},handleIpDeletion:function(t){t.preventDefault();var i=e(t.currentTarget),n=e("#"+i.data("formId")),s=new FormData(n[0]);s.append("action","hustle_remove_ips"),s.append("_ajax_nonce",i.data("nonce")),i.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:s,contentType:!1,processData:!1,success:function(t){Module.Notification.open("success",t.data.message),SUI.closeModal(),e(".sui-button-onload").removeClass("sui-button-onload")},error:function(){SUI.closeModal(),e(".sui-button-onload").removeClass("sui-button-onload"),Module.Notification.open("error",optinVars.messages.something_went_wrong)}})}})}),Hustle.define("Settings.reCaptcha_Settings",function(e){"use strict";return Backbone.View.extend({el:"#recaptcha-box",data:{},initialize:function(){this.maybeRenderRecaptchas()},maybeRenderRecaptchas:function(){for(var t=this,i=this,n=!1,s=function(){var s=o[a],l=t.$("#hustle-modal-recaptcha-".concat(s,"-0")),r=t.$('input[name="'.concat(s,'_site_key"]')).val().trim(),d=t.$('input[name="'.concat(s,'_secret_key"]')).val().trim();r&&d?(l.data("sitekey",r),n?HUI.maybeRenderRecaptcha(l.closest(".sui-form-field")):e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_load_recaptcha_preview"}}).done(function(e){e.success&&(n=!0,i.$("#hustle-recaptcha-script-container").html(e.data),setTimeout(function(){return HUI.maybeRenderRecaptcha(l.closest(".sui-form-field"))},1e3))}),t.$(".hustle-recaptcha-".concat(s,"-preview-notice")).hide(),l.show()):(t.$(".hustle-recaptcha-".concat(s,"-preview-notice")).show(),l.hide())},a=0,o=["v2_checkbox","v2_invisible","v3_recaptcha"];a<o.length;a++)s()}})}),Hustle.define("Settings.Top_Metrics_View",function(){"use strict";return Backbone.View.extend({el:"#top-metrics-box",events:{"click .sui-checkbox input":"maybeDisableInputs"},initialize:function(){this.maybeDisableInputs()},maybeDisableInputs:function(){var e=this.$el.find("input:checked"),t=this.$el.find("input:not(:checked)"),i=this.$el.find('button[type="submit"]'),n=i.parent(),s=t.next("span");3<=e.length?(t.prop("disabled",!0),s.addClass("sui-tooltip"),s.css("opacity","1"),i.prop("disabled",!1),n.removeClass("sui-tooltip")):(i.prop("disabled",!0),t.prop("disabled",!1),s.removeClass("sui-tooltip"),s.css("opacity",""),n.addClass("sui-tooltip"))}})}),Hustle.define("Integration_Modal_Handler",function(e){"use strict";return Backbone.View.extend({events:{"click .hustle-provider-connect":"connectAddOn","click .hustle-provider-disconnect":"disconnectAddOn","click .hustle-provider-next":"submitNextStep","click .hustle-provider-back":"goPrevStep","click .hustle-refresh-email-lists":"refreshLists","click .hustle-provider-form-disconnect":"disconnectAddOnForm","click .hustle-provider-clear-radio-options":"clearRadioOptions","change select#group":"showInterests"},initialize:function(e){var t=this;return this.slug=e.slug,this.nonce=e.nonce,this.action=e.action,this.moduleId=e.moduleId,this.multi_id=e.multiId,this.globalMultiId=e.globalMultiId,this.step=0,this.next_step=!1,this.prev_step=!1,this.$el.off("close").on("close",function(){return t.modalClosed()}),this.render()},render:function(){var e={};e.action=this.action,e._ajax_nonce=this.nonce,e.data={},e.data.slug=this.slug,e.data.step=this.step,e.data.current_step=this.step,this.moduleId&&(e.data.module_id=this.moduleId),this.multi_id&&(e.data.multi_id=this.multi_id),this.globalMultiId&&(e.data.global_multi_id=this.globalMultiId),this.request(e,!1,!0)},applyLoader:function(e){e.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload")},resetLoader:function(e){e.find(".sui-button").removeClass("sui-button-onload")},request:function(t,i,n){var s=this;n&&(this.$el.find(".sui-box-body").addClass("sui-block-content-center").html('<p class="sui-loading-dialog" aria-label="Loading content"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),this.$el.find(".sui-box-footer").html(""),this.$el.find(".integration-header").html("")),this.applyLoader(this.$el),this.ajax=e.post({url:ajaxurl,type:"post",data:t}).done(function(e){if(e&&e.success){var t=e.data.data;if(i||!_.isUndefined(t.is_close)&&t.is_close?SUI.closeModal():(s.renderBody(e),s.renderFooter(e),s.onRender(t),s.resetLoader(s.$el)),!_.isUndefined(t.notification)&&!_.isUndefined(t.notification.type)&&!_.isUndefined(t.notification.text))Module.Notification.open(t.notification.type,t.notification.text);if("mailchimp"===s.slug){var n=s.$el.find("#group");n.length&&n.trigger("change")}}else s.renderBody(e),s.renderFooter(e)}),this.ajax.always(function(e){s.$el.find(".hustle-modal-close").off("click").on("click",function(){SUI.closeModal()}),s.$el.find(".sui-box-body").removeClass("sui-block-content-center"),s.$el.find(".sui-loading-dialog").remove(),e&&e.success&&e.data||s.showGenericErrorMessage()})},renderBody:function(t){if(t.data&&t.data.data){this.$el.find(".sui-box-body").html(t.data.data.html);var i=this.$el.find(".sui-box-body .integration-header").remove();if(0<i.length&&this.$el.find(".integration-header").html(i.html()),this.$el.find(".sui-box-body").html().trim().length){var n=this.$el.find(".sui-box-body").children(),s=!0;e.each(n,function(t,i){e(i).is(":hidden")||(s=!1)}),s?(this.$el.find(".sui-box-body").addClass("sui-hidden"),this.$el.find(".sui-box-footer").css("padding-top","")):(this.$el.find(".sui-box-body select").each(function(){SUI.suiSelect(this)}),this.$el.find(".sui-box-body .sui-notice").next().is('input[type="hidden"]')&&this.$el.find(".sui-box-body .sui-notice").css({"margin-bottom":"0"}))}else this.$el.find(".sui-box-body").addClass("sui-hidden"),this.$el.find(".sui-box-footer").css("padding-top","")}},renderFooter:function(e){if(e.data&&e.data.data){var t=e.data.data.buttons,i=this.$el.find(".sui-box-body"),n=this.$el.find(".sui-box-footer");i.removeClass("sui-spacing-bottom--0").removeClass("sui-spacing-bottom--30"),n.removeClass("sui-hidden").removeClass("sui-hidden-important").removeClass("sui-content-center").removeClass("sui-content-right").removeClass("sui-content-separated").html(""),_.each(t,function(e){n.append(e.markup)}),0===n.find(".sui-button").length?(n.addClass("sui-hidden-important"),i.addClass("sui-spacing-bottom--30")):(i.addClass("sui-spacing-bottom--0"),n.find(".sui-button").hasClass("sui-button-center")?n.addClass("sui-content-center"):n.find(".sui-button").hasClass("sui-button-right")?n.find(".sui-button").hasClass("sui-button-left")||n.addClass("sui-content-right"):n.addClass("sui-content-separated"))}},onRender:function(t){this.delegateEvents(),_.isUndefined(t.opt_in_provider_current_step)||(this.step=+t.opt_in_provider_current_step),_.isUndefined(t.opt_in_provider_has_next_step)||(this.next_step=t.opt_in_provider_has_next_step),_.isUndefined(t.opt_in_provider_has_prev_step)||(this.prev_step=t.opt_in_provider_has_prev_step),this.$el.find("select").each(function(){SUI.suiSelect(this)}),this.$el.find(".sui-select").SUIselect2({dropdownCssClass:"sui-select-dropdown",dropdownParent:e("#hustle-integration-dialog .sui-box")})},refreshLists:function(t){t.preventDefault(),t.stopPropagation();var i=this,n=e(t.currentTarget),s=this.moduleId,a=this.slug,o=e("#form_id").length?"forms":"lists",l=this.nonce;n.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_refresh_email_lists",id:s,slug:a,type:o,_ajax_nonce:l}}).done(function(e){if(e.success&&void 0!==e.data.select){var t=n.siblings(".sui-select");t.SUIselect2("destroy"),t.SUIselect2({dropdownParent:i.$(".sui-box"),dropdownCssClass:"sui-select-dropdown"})}}).fail(function(){}).always(function(){n.removeClass("sui-button-onload")})},submitNextStep:function(){var t={},i=this.$el.find("form"),n={slug:this.slug,step:this.getStep(),current_step:this.step},s=i.serialize();this.moduleId&&(n.module_id=this.moduleId),s=s+"&"+e.param(n),t.action=this.action,t._ajax_nonce=this.nonce,t.data=s,this.request(t,!1,!1)},goPrevStep:function(){var e={},t={slug:this.slug,step:this.getPrevStep(),current_step:this.step};this.moduleId&&(t.module_id=this.moduleId),this.multi_id&&(t.multi_id=this.multi_id),e.action=this.action,e._ajax_nonce=this.nonce,e.data=t,this.request(e,!1,!1)},getStep:function(){return this.next_step?this.step+1:this.step},getPrevStep:function(){return this.prev_step?this.step-1:this.step},connectAddOn:function(){var t={},i=this.$el.find("form"),n={slug:this.slug,step:this.getStep(),current_step:this.step},s=i.serialize();this.moduleId&&(n.module_id=this.moduleId),this.multi_id&&(n.multi_id=this.multi_id),s=s+"&"+e.param(n),t.action=this.action,t._ajax_nonce=this.nonce,t.data=s,this.request(t,!1,!1)},disconnectAddOn:function(){var t=this,i=this.$el.find(".sui-box-logo img").attr("src"),n=this.$el.find("#dialogTitle2").html(),s={},a={},o={};s.action="hustle_provider_deactivate",s._ajax_nonce=this.nonce,s.data={},s.data.slug=this.slug,s.data.img=i,s.data.title=n,this.globalMultiId&&(s.data.global_multi_id=this.globalMultiId),a.action="hustle_provider_is_on_module",a._ajax_nonce=this.nonce,a.data={},a.data.slug=this.slug,a.data.globalMultiId=this.globalMultiId,this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:a,success:function(e){!0===e.success&&(o=e)},complete:function(){!0===o.success?Module.integrationsActiveRemove.open(o.data,s,t):t.request(s,!0,!1)}})},disconnectAddOnForm:function(){var t={},i=e("#hustle-integrations-active-count").val(),n=e("#hustle-integrations-active-integrations").val();t.action="hustle_provider_form_deactivate",t._ajax_nonce=this.nonce,t.data={},t.data.slug=this.slug,t.data.module_id=this.moduleId,this.multi_id&&(t.data.multi_id=this.multi_id),"1"===i&&n===this.slug&&"local_list"!==this.slug?Module.integrationsAllRemove.open(t,this):"1"===i&&"local_list"===this.slug?(Module.Notification.open("error",optinVars.messages.integraiton_required),SUI.closeModal()):this.request(t,!0,!1)},modalClosed:function(){this.ajax.abort(),Hustle.Events.trigger("hustle:providers:reload")},clearRadioOptions:function(){this.$("input[type=radio]",this.$el).prop("checked",!1)},showInterests:function(t){var i=this,n=e(t.currentTarget),s=n.data("nonce"),a=n.val(),o={},l=i.$el.find("form"),r={slug:i.slug,group:a,module_id:i.moduleId},d=l.serialize();d=d+"&"+e.param(r),o.action="hustle_mailchimp_get_group_interests",o._ajax_nonce=s,o.data=d,i.applyLoader(i.$el),e.ajax({url:ajaxurl,type:"POST",data:o}).done(function(e){e.success&&(l.find(".sui-form-field").slice(1).remove(),l.find(".sui-form-field:first-child").after(e.data),i.$el.find(".sui-select").SUIselect2({dropdownCssClass:"sui-select-dropdown"}))}).fail(function(){}).always(function(){i.resetLoader(i.$el)})},showGenericErrorMessage:function(){this.$el.find(".sui-box-body").html('<div id="hustle-request-error-reload-notice" role="alert" aria-live="assertive" class="sui-notice"></div>'),this.$el.find(".sui-box-footer").html(""),SUI.openNotice("hustle-request-error-reload-notice","<p>"+optinVars.messages.request_error_reload_notice+"</p>",{type:"error",autoclose:{show:!1}})}})});var Module=window.Module||{};function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}Hustle.define("Model",function(e){"use strict";return Backbone.Model.extend({initialize:function(){this.on("change",this.userHasChange,this),Backbone.Model.prototype.initialize.apply(this,arguments),e(window).on("beforeunload",this.changesNotSaved)},userHasChange:function(){Module.hasChanges=!0,Hustle.Events.trigger("modules.view.switch_status","unsaved")},changesNotSaved:function(){if(Module.hasChanges)return"You have unsaved changes"}})}),Hustle.define("Models.M",function(){"use strict";return Hustle.get("Model").extend({toJSON:function(){var e,t=_.clone(this.attributes);for(e in t)(t[e]instanceof Backbone.Model||t[e]instanceof Backbone.Collection)&&(t[e]=t[e].toJSON());return t},set:function(e,t,i){var n,s,a;"string"==typeof e&&-1!==e.indexOf(".")?(n=e.split(".")[0],s=e.split(".")[1],(a=this.get(n))&&a instanceof Backbone.Model&&(a.set(s,t,i),this.trigger("change:"+e,e,t,i),this.trigger("change:"+n,e,t,i))):Backbone.Model.prototype.set.call(this,e,t,i)},get:function(e){var t,i;return"string"==typeof e&&-1!==e.indexOf(".")?(t=e.split(".")[0],i=e.split(".")[1],this.get(t).get(i)):Backbone.Model.prototype.get.call(this,e)}})}),Hustle.define("Models.Trigger",function(){"use strict";return Hustle.get("Model").extend({defaults:{trigger:"time",on_time_delay:0,on_time_unit:"seconds",on_scroll:"scrolled",on_scroll_page_percent:"20",on_scroll_css_selector:"",enable_on_click_element:"1",on_click_element:"",enable_on_click_shortcode:"1",on_exit_intent:"1",on_exit_intent_per_session:"1",on_exit_intent_delayed:"0",on_exit_intent_delayed_time:5,on_exit_intent_delayed_unit:"seconds",on_adblock:"0"}})}),Module.Model=Hustle.get("Models.M").extend({defaults:{module_name:"",moduleType:"popup",active:"0"}}),function(e){"use strict";var t=window.Module||{};t.Notification={id:null,$floatingContainer:null,open:function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4e3,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hustle-only-active-notification",a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.id=s;var o={type:t||"",icon:"info",dismiss:{},autoclose:{}};if(a){if(this.$floatingContainer=e("#hustle-floating-notifications-wrapper"),this.createFloatingNoticeWrapper(),!1!==n){var l=parseInt(n);isNaN(l)&&(n=4e3)}o.dismiss={show:!1===n,label:optinVars.messages.commons.dismiss},o.autoclose={show:!1!==n,time:n}}else o.autoclose.show=!1,o.dismiss.show=!1;i="<p>".concat(i,"</p>"),SUI.openNotice(s,i,o)},createFloatingNoticeWrapper:function(){var t=this.id;e("#"+t).length||this.$floatingContainer.append('<div\n\t\t\t\t\trole="alert"\n\t\t\t\t\tid="'.concat(t,'"\n\t\t\t\t\tclass="sui-notice"\n\t\t\t\t\taria-live="assertive"\n\t\t\t\t></div>'))}},t.integrationsModal={$popup:{},open:function(t){var i=this,n=e(t.target);n.hasClass("connect-integration")||(n=n.closest(".connect-integration")),e("#hustle-integration-dialog").closest(".sui-modal").length&&e("#hustle-integration-dialog").closest(".sui-modal").remove();var s=n.data("nonce"),a=n.data("slug"),o=n.data("title"),l=n.data("image"),r=n.data("action"),d=n.data("module_id"),c=n.data("multi_id"),u=n.data("global_multi_id"),h=Optin.template("hustle-integration-dialog-tpl");e(".sui-wrap-hustle").append(h({image:l,title:o})),this.$popup=e("#hustle-integration-dialog");var p=Hustle.get("Integration_Modal_Handler");this.view=new p({slug:a,nonce:s,action:r,moduleId:d,multiId:c,globalMultiId:u,el:this.$popup}),this.$popup.on("close",function(){return i.close()}),SUI.openModal("hustle-integration-dialog",n[0],this.$popup.find(".sui-box .hustle-modal-close")[0],!0),this.$popup.on("click",".sui-tab-item",function(t){var i=e(t.currentTarget);i.closest(".sui-side-tabs").find(".sui-tab-item").removeClass("active"),i.addClass("active")})},close:function(){this.view&&(this.$popup.closest(".sui-modal").remove(),this.view.remove())}},t.integrationsAllRemove={referrer:{},open:function(t,i){var n=this;this.referrer=i;var s=e("#hustle-dialog--final-delete"),a=s.find(".sui-box-header .sui-button-icon");a.on("click",n.close),s.find("#hustle-delete-final-button-cancel").on("click",n.close),e("#hustle-delete-final-button").off("click").on("click",function(){var s,a,o;e("#hustle-delete-final-button").addClass("sui-button-onload"),s=t,a=i,n.deleteIntegration(s,a),o=t,n.insertLocalList(o),n.close()}),e("#hustle-delete-final-button").prop("disabled",!1);var o=e('#hustle-connected-providers-section button[data-slug="'+t.data.slug+'"]');SUI.replaceModal("hustle-dialog--final-delete",o[0],a[0],!0)},close:function(){e("#hustle-delete-final-button").removeClass("sui-button-onload"),e("#hustle-delete-final-button").prop("disabled",!1)},confirmDelete:function(e,t){this.deleteIntegration(e,t),this.insertLocal(e),this.close()},deleteIntegration:function(e,t){t.request(e,!0,!1)},insertLocalList:function(i){var n={id:i.data.module_id,_ajax_nonce:i._ajax_nonce,action:"hustle_provider_insert_local_list"};e.ajax({url:ajaxurl,type:"POST",data:n,success:function(e){e.success?Hustle.Events.trigger("hustle:providers:reload"):t.Notification.open("error",optinVars.messages.something_went_wrong)},error:function(){t.Notification.open("error",optinVars.messages.something_went_wrong)}})}},t.integrationsActiveRemove={$popup:{},_deferred:{},open:function(t,i,n){var s=this,a=e("#hustle-dialog--remove-active"),o=Optin.template("hustle-modules-active-integration-tpl"),l=Optin.template("hustle-modules-active-integration-img-tpl"),r=Optin.template("hustle-modules-active-integration-header-tpl"),d=Optin.template("hustle-modules-active-integration-desc-tpl");e("#hustle-dialog--remove-active tbody").html(""),e("#hustle-dialog--remove-active .sui-box-logo").html(""),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-title").html(""),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-description").html(""),e("#hustle-dialog--remove-active .sui-box-logo").append(l({image:i.data.img,title:i.data.slug})),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-title").append(r({title:i.data.title.replace(/Connect|Configure/gi," ")})),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-description").append(d({title:i.data.title.replace(/Connect|Configure/gi," ")})),e.each(t,function(t,i){e("#hustle-dialog--remove-active tbody").append(o({name:i.name,type:i.type,editUrl:i.edit_url}))}),a.find("#hustle-remove-active-integration-back").off("click").on("click",function(){s.back(n)}),e("#hustle-remove-active-button").off("click").on("click",function(){var a,o,l;e(this).addClass("sui-button-onload"),a=i,o=n,l=t,s.removeIntegration(a,o,l)});var c="";c=n.globalMultiId?e('button[data-global_multi_id="'+n.globalMultiId+'"]'):e('button[data-slug="'+i.data.slug+'"]'),SUI.replaceModal("hustle-dialog--remove-active",c[0],a.find(".hustle-modal-close")[0],!0)},close:function(){SUI.closeModal()},back:function(t){this.close(),"hubspot"===t.slug||"constantcontact"===t.slug||"zapier"===t.slug?e('button[data-slug="'+t.slug+'"]').trigger("click"):e('button[data-global_multi_id="'+t.globalMultiId+'"]').trigger("click")},removeIntegration:function(t,i,n){var s=this;e.each(n,function(e,i){t.data.slug===i.active.active_integrations&&s.insertLocalList(t,e)}),i.request(t,!0,!1),e("#hustle-remove-active-button").removeClass("sui-button-onload")},insertLocalList:function(i,n){var s={id:n,_ajax_nonce:i._ajax_nonce,action:"hustle_provider_insert_local_list"};e.ajax({url:ajaxurl,type:"POST",data:s,success:function(e){!1===e.success&&t.Notification.open("error",optinVars.messages.something_went_wrong)},error:function(){t.Notification.open("error",optinVars.messages.something_went_wrong)}})}},t.ProviderMigration={$popup:{},open:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e("#hustle-dialog-migrate--"+t),s=this;i&&e("#integration-migrate").attr("data-id",i),setTimeout(function(){return SUI.openModal("hustle-dialog-migrate--"+t,e(".sui-header-title")[0],e("#hustle-dialog-migrate--"+t+" .sui-box-header .sui-button-icon")[0],!0)},300),n.find("#integration-migrate").on("click",function(){var a=n.find("form"),o={},l={slug:t,global_multi_id:i},r=a.serialize();e("#integration-migrate").addClass("sui-button-onload"),o._ajax_nonce=e("#integration-migrate").data("nonce"),o.action="hustle_provider_migrate_aweber",r=r+"&"+e.param(l),o.data=r,s.reauth(n,o,i,t)})},reauth:function(i,n,s,a){var o=e(".hustle_migration_notice__"+a+'[data-id="'+s+'"]');this.ajax=e.post({url:ajaxurl,type:"post",data:n}).done(function(n){n&&n.success?(SUI.closeModal(),o.hide(),t.Notification.open("success",optinVars.messages.aweber_migration_success,!1)):(e(i).find("#integration-migrate").removeClass("sui-button-onload"),e(i).find(".sui-error-message").removeClass("sui-hidden"),e(i).find(".sui-form-field").addClass("sui-form-field-error"))})}},t.deleteModal={open:function(t,i){var n="hustle-dialog--delete",s=Optin.template("hustle-dialog--delete-tpl")(t);e("#"+n+" #hustle-delete-dialog-content").html(s),e("#"+n+" #hustle-dialog--delete-title").html(t.title),e("#"+n+" .hustle-cancel-button").on("click",function(){return SUI.closeModal(n)}),e("#"+n+" .hustle-delete-confirm").on("click",function(t){e(t.currentTarget).addClass("sui-button-onload")}),SUI.openModal(n,i,e("#"+n+".hustle-modal-close")[0],!0)}},t.hasChanges=!1}(jQuery),function(e){"use strict";var t=window.Module||{};t.Utils={getUrlParam:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=optinVars.urlParams;return void 0!==i[e]?i[e]:t},accessibleHide:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.hide(),e.attr("aria-hidden",!0),e.prop("hidden",!0),t&&e.prop("tabindex","-1"),i&&void 0!==i.name&&(void 0!==i.value?e.attr(i.name,i.value):e.removeAttr(i.name))},accessibleShow:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.show(),e.prop("aria-hidden",!1),e.removeClass("sui-hidden"),e.prop("hidden",!1),t&&e.attr("tabindex","0"),i&&void 0!==i.name&&(void 0!==i.value?e.attr(i.name,i.value):e.removeAttr(i.name))},showHideDependencyOnSelectChange:function(i){(i?i.find("select.hustle-select-with-container"):e("select.hustle-select-with-container")).each(function(){var i=e(this),n=e('[data-field-content="'.concat(this.name,'"]')),s=!!i.data("content-on")&&i.data("content-on").split(","),a=!!i.data("content-off")&&i.data("content-off").split(","),o=function(){var e=i.val();(s?s.includes(e):!a.includes(e))?t.Utils.accessibleShow(n):t.Utils.accessibleHide(n)};o(),i.on("change",function(){return o()})})},serializeObject:function(t){var i={},n=t.serializeArray();return e.each(n,function(){void 0!==i[this.name]?(i[this.name].push||(i[this.name]=[i[this.name]]),i[this.name].push(this.value||"")):i[this.name]=this.value||""}),t.find("input:disabled[name]").each(function(){i[this.name]=this.value||""}),t.find("select:disabled[name]").each(function(){i[this.name]=this.value||""}),t.find('input[type="checkbox"]:not(:checked)').each(function(){void 0===i[this.name]?i[this.name]="0":"0"!==i[this.name]||t.find('input[name="'.concat(this.name,'"]:checked')).length?Array.isArray(i[this.name])||(i[this.name]=[i[this.name]]):i[this.name]=[]}),i}},t.handleActions={context:"",$target:null,responseData:{},initAction:function(i,n){var s=this;i.preventDefault(),this.context=n,this.$target=e(i.currentTarget);var a=this,o=this.$target.data("form-id"),l=this.$target.data(),r=new FormData;if(void 0!==o){var d=e("#"+o);d.length&&(r=new FormData(d[0]))}e.each(l,function(e,t){return r.append(e,t)}),r.append("context",this.context),r.append("_ajax_nonce",optinVars.single_module_action_nonce),r.append("action","hustle_module_handle_single_action"),e.ajax({url:ajaxurl,type:"POST",data:r,contentType:!1,processData:!1}).done(function(i){i.data.callback&&"function"==typeof a[i.data.callback]?(s.responseData=i.data,a[i.data.callback]()):i.data.url?window.location.assign(i.data.url):i.data.notification?t.Notification.open(i.data.notification.status,i.data.notification.message,i.data.notification.delay):i.success||t.Notification.open("error",optinVars.messages.something_went_wrong,!1),i.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload")})},actionToggleTracking:function(){var i,n;if(this.responseData.is_embed_or_sshare){var s=e('.hustle-manage-tracking-button[data-module-id="'+this.$target.data("module-id")+'"]');s.data("tracking-types",this.responseData.enabled_types),n=0!==this.responseData.enabled_types.length,i=s.parents(".sui-accordion-item"),SUI.closeModal()}else n=1-(this.responseData.was_enabled?1:0),i=this.$target.parents(".sui-accordion-item"),this.$target.data("enabled",n),this.$target.find(".hustle-toggle-tracking-button-description").toggleClass("sui-hidden");i.hasClass("sui-accordion-item--open")&&i.find(".sui-accordion-open-indicator").trigger("click").trigger("click");var a=this.responseData.is_active&&!n;this.toggleTrackingDisabledTag(a,i),t.Notification.open("success",this.responseData.message,1e4)},actionToggleStatus:function(){"listing"===this.context?this.listingToggleStatus():this.dashboardToggleStatus()},listingToggleStatus:function(){var e=this.$target.closest(".sui-accordion-item"),t=e.find(".sui-accordion-item-title span.sui-tag");t.toggleClass("sui-tag-blue"),t.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden"),this.$target.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden"),e.hasClass("sui-accordion-item--open")&&e.find(".sui-accordion-open-indicator").trigger("click").trigger("click");var i=this.responseData.is_active&&!this.responseData.is_tracking_enabled;this.toggleTrackingDisabledTag(i,e)},dashboardToggleStatus:function(){var e=this.responseData.is_active;this.$target.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden");var t=this.$target.parents("td.hui-status").find("span.sui-tooltip");t.removeClass("sui-draft sui-published"),e?t.addClass("sui-published").attr("data-tooltip",optinVars.messages.commons.published):t.addClass("sui-draft").attr("data-tooltip",optinVars.messages.commons.draft)},actionImportDisplayError:function(){var e=this.responseData.message,i=this.$target.closest(".sui-modal"),n=i.find(".sui-modal-content").attr("id")+"-error-notice";t.Notification.open("error",e,!1,n,!1),i.find('input[name="import_file"]').focus()},toggleTrackingDisabledTag:function(e,t){var i=t.find(".hustle-analytics-disabled-tag");e?i.removeClass("sui-hidden"):i.addClass("sui-hidden")}};var i=window.Optin||{};i.globalMixin=function(){_.mixin({toBool:function(e){return _.isBoolean(e)?e:_.isString(e)&&-1!==["true","false","1"].indexOf(e.toLowerCase())?"true"===e.toLowerCase()||"1"===e.toLowerCase():_.isNumber(e)?!!e:!(_.isUndefined(e)||_.isNull(e)||_.isNaN(e))&&e},isTrue:function(e){return!(_.isUndefined(e)||_.isNull(e)||_.isNaN(e))&&(_.isNumber(e)?0!==e:(e=e.toString().toLowerCase(),-1!==["1","true","on"].indexOf(e)))},isFalse:function(e){return!_.isTrue(e)},controlBase:function(e,t,i){return i=_.isUndefined(i)?"checked":i,e=_.toBool(e),t=_.isBoolean(e)?_.isTrue(t):t,_.isEqual(e,t)?i+"="+i:""},checked:function(e,t){return _.controlBase(e,t,"checked")},selected:function(e,t){return _.controlBase(e,t,"selected")},disabled:function(e,t){return _.controlBase(e,t,"disabled")},class:function(e,t,i){return _.isTrue(e)?t:void 0!==i?i:""}})},i.globalMixin(),Backbone.Model.prototype.toJSON=function(){var e,t=_.clone(this.attributes);for(e in t)(t[e]instanceof Backbone.Model||Backbone.Collection&&t[e]instanceof Backbone.Collection)&&(t[e]=t[e].toJSON());return t}}(jQuery),Hustle.define("SShare.Content_View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Module_Content"),{el:"#hustle-wizard-content",activePlatforms:[],events:{"change select.hustle-select-field-variables":"addPlaceholderToField","click ul.wpmudev-tabs-menu li label":"toggleCheckbox","click .hustle-choose-platforms":"openPlatformsModal"},render:function(){var t=this.model.toJSON();if(void 0!==t.social_icons&&t.social_icons)for(var i in t.social_icons)this.addPlatformToPanel(i,t.social_icons[i]);var n=this.$("#hustle-social-services").sortable({axis:"y",containment:".sui-box-builder"});for(var s in n.on("sortupdate",e.proxy(this.platformsOrderChanged,this,n)),optinVars.social_platforms)this.addPlatformToDialog(s);this.bindRemoveService(),"true"===Module.Utils.getUrlParam("new")&&Module.Notification.open("success",optinVars.messages.module_created,1e4)},bindRemoveService:function(){e("#hustle-wizard-content .hustle-remove-social-service").off("click").on("click",e.proxy(this.removeService,this))},openPlatformsModal:function(){var t=this.model.get("social_icons"),i=void 0!==t?Object.keys(t):[];new(Hustle.get("Modals.Services_Platforms"))(i).on("platforms:added",e.proxy(this.addNewPlatforms,this)),SUI.openModal("hustle-dialog--add-platforms",this.$(".hustle-choose-platforms")[0],this.$("#hustle-dialog--add-platforms .hustle-modal-close")[0],!0)},addNewPlatforms:function(t){var i=this;this.model.get("social_icons")||this.model.set("social_icons",{});var n=this,s=_.extend({},this.model.get("social_icons"));e.each(t,function(e,t){if(s&&t in s)return!0;n.addPlatformToPanel(t,{});var a=i.getPlatformDefaults(t);s[t]=a}),this.bindRemoveService(),this.model.set("social_icons",s),Hustle.Events.trigger("view.rendered",this)},addPlatformToPanel:function(e,t){var i=Optin.template("hustle-platform-row-tpl"),n=this.$("#hustle-social-services");t=_.extend({},this.getPlatformViewDefaults(e),t),this.activePlatforms.push(e),n.append(i(t))},addPlatformToDialog:function(t){var i=Optin.template("hustle-add-platform-li-tpl"),n=e("#hustle_add_platforms_container"),s=this.getPlatformViewDefaults(t);n.append(i(s))},getPlatformDefaults:function(e){var t={platform:e,label:e in optinVars.social_platforms?optinVars.social_platforms[e]:e,type:"click",counter:"0",link:""};return"email"===e&&(t.title="{post_title}",t.message=optinVars.social_platforms_data.email_message_default),t},getPlatformViewDefaults:function(e){var t=this.model.toJSON(),i=void 0===t.counter_enabled?"true":t.counter_enabled,n={fivehundredpx:"500px"},s=-1!==optinVars.social_platforms_with_endpoints.indexOf(e),a=-1!==optinVars.social_platforms_with_api.indexOf(e),o=e in n?n[e]:e;return _.extend({},this.getPlatformDefaults(e),{platform_style:o,counter_enabled:i,hasEndpoint:s,hasCounter:a})},platformsOrderChanged:function(e){var t,i=this.model.get("social_icons"),n=e.sortable("toArray",{attribute:"data-platform"}),s={},a=_createForOfIteratorHelper(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;s[o]=i[o]}}catch(e){a.e(e)}finally{a.f()}this.model.set("social_icons",s),this.model.trigger("change",this.model)},removeService:function(t){var i=e(t.currentTarget).data("platform"),n=this.model.get("social_icons");this.$("#hustle-platform-"+i).remove(),this.activePlatforms=_.without(this.activePlatforms,i),delete n[i],this.model.trigger("change",this.model),t.stopPropagation()},modelUpdated:function(e){var t,i=e.changed,n=void 0!==Object.keys(i)[0]?Object.keys(i)[0]:"";if("service_type"in i&&this.serviceTypeUpdated(i.service_type),"click_counter"in i)this.clickCounterUpdated(i.click_counter);else if(-1!==n.indexOf("_counter")){var s=n.slice(0,-8);s in(t=this.model.get("social_icons"))&&(t[s].counter=parseInt(i[n])),this.model.unset(n,{silent:!0})}if(-1!==n.indexOf("_link")){var a=n.slice(0,-5);a in(t=this.model.get("social_icons"))&&(t[a].link=i[n]),this.model.unset(n,{silent:!0})}if(-1!==n.indexOf("_type")){var o=n.slice(0,-5);o in(t=this.model.get("social_icons"))&&(t[o].type="native"===i[n]?"native":"click"),this.model.unset(n,{silent:!0})}if("email_title"in i){"email"in(t=this.model.get("social_icons"))&&(t.email.title=i[n]),this.model.unset(n,{silent:!0})}if("email_message"in i){"email"in(t=this.model.get("social_icons"))&&(t.email.message=i[n]),this.model.unset(n,{silent:!0})}},serviceTypeUpdated:function(t){var i=this.$("#wpmudev-sshare-counter-options"),n=e(".wph-wizard-services-icons-native"),s=e(".wph-wizard-services-icons-custom");"native"===t?(i.removeClass("wpmudev-hidden"),s.addClass("wpmudev-hidden"),n.removeClass("wpmudev-hidden")):(i.addClass("wpmudev-hidden"),n.addClass("wpmudev-hidden"),s.removeClass("wpmudev-hidden"))},clickCounterUpdated:function(t){var i=e("#wpmudev-sshare-counter-options .hustle-twitter-notice");"native"===t?i.removeClass("wpmudev-hidden"):i.hasClass("wpmudev-hidden")||i.addClass("wpmudev-hidden"),e("#wph-wizard-services-icons-native .wpmudev-social-item").each(function(){var i=e(this).find(".toggle-checkbox").is(":checked"),n=e(this).find("input.wpmudev-input_number");"none"!==t&&i?n.removeClass("wpmudev-hidden"):n.hasClass("wpmudev-hidden")||n.addClass("wpmudev-hidden")}),e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong").removeClass("wpmudev-hidden"),"none"===t?e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong:first-child").addClass("wpmudev-hidden"):e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong:nth-child(2)").addClass("wpmudev-hidden")},toggleCheckbox:function(e){e.preventDefault(),e.stopPropagation();var t=this.$(e.target).closest("li");if(!t.hasClass("current")){t.addClass("current"),t.siblings().removeClass("current");var i=t.find("input"),n=i.data("attribute");this.model.set(n,i.val())}},setSocialIcons:function(){var e=this.model.toJSON();e=this.getSocialIconsData(e),this.model.set("social_icons",e.social_icons,{silent:!0})},getSocialIconsData:function(t){var i=e("#wph-wizard-services-icons-"+t.service_type+" .wpmudev-social-item"),n={};return i.each(function(){var t=e(this),i=t.find("input.toggle-checkbox"),s=i.data("id"),a=t.find("input.wpmudev-input_number"),o=t.find("input.wpmudev-input_text");a.length&&(0>parseInt(a.val())&&a.val(0));i.is(":checked")&&(n[s]={enabled:!0,counter:a.length?a.val():"0",link:o.length?o.val():""})}),i.length&&(t.social_icons=n),t},addPlaceholderToField:function(t){var i=e(t.currentTarget),n=i.val(),s=i.data("field"),a=e('[name="'.concat(s,'"]')),o=a.val()+n;a.val(o).trigger("change")}}))}),Hustle.define("SShare.Design_View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Model_Updater"),Hustle.get("Mixins.Module_Design"),{beforeRender:function(){this.listenTo(this.model,"change",this.modelUpdated),Hustle.Events.off("modules.view.displayTypeUpdated").on("modules.view.displayTypeUpdated",e.proxy(this.viewChangedDisplayTab,this))},render:function(){var t=this;this.createPickers(e(".sui-colorpicker-input")),e('a[data-tab="appearance"]').on("click",e.proxy(this.updatePreview,this)),e('.sui-box[data-tab="display"] .sui-button[data-direction="next"').on("click",e.proxy(this.updatePreview,this)),e('.sui-box[data-tab="visibility"] .sui-button[data-direction="prev"').on("click",e.proxy(this.updatePreview,this)),this.updateSocialIconsPickers(),setTimeout(function(){return t.updatePreview()},100)},updatePreview:function(){e("#hui-preview-social-shares-floating").trigger("hustle_update_prewiev")},modelUpdated:function(e){var t=Object.keys(e.changed)[0],i=this.getActionOnContentModelUpdated(t);void 0!==i&&i(),this.updatePreview()},getActionOnContentModelUpdated:function(e){var t=this;return{icon_style:function(){return t.updateSocialIconsPickers()}}[e]},updateSocialIconsPickers:function(){var t=this.model.get("icon_style");"flat"===t?(e("#hustle-floating-icons-custom-background").addClass("sui-hidden"),e("#hustle-widget-icons-custom-background").addClass("sui-hidden")):(e("#hustle-floating-icons-custom-background").removeClass("sui-hidden"),e("#hustle-widget-icons-custom-background").removeClass("sui-hidden")),"outline"===t?(this.$(".hustle-icon-bg-color-label").addClass("sui-hidden"),this.$(".hustle-icon-border-color-label").removeClass("sui-hidden"),e("#hustle-floating-counter-border").addClass("sui-hidden"),e("#hustle-widget-counter-border").addClass("sui-hidden")):(this.$(".hustle-icon-bg-color-label").removeClass("sui-hidden"),this.$(".hustle-icon-border-color-label").addClass("sui-hidden"),e("#hustle-floating-counter-border").removeClass("sui-hidden"),e("#hustle-widget-counter-border").removeClass("sui-hidden"))},viewChangedDisplayTab:function(t){var i=t.get("inline_enabled"),n=t.get("widget_enabled"),s=t.get("shortcode_enabled"),a=t.get("float_desktop_enabled"),o=t.get("float_mobile_enabled"),l=_.intersection([1,"1","true"],[i,n,s]).length,r=_.intersection([1,"1","true"],[o,a]).length;r?(e("#hustle-appearance-floating-icons-row").show(),e("#hustle-appearance-floating-icons-placeholder").hide()):(e("#hustle-appearance-floating-icons-row").hide(),e("#hustle-appearance-floating-icons-placeholder").show()),l?(e("#hustle-appearance-widget-icons-row").show(),e("#hustle-appearance-widget-icons-placeholder").hide()):(e("#hustle-appearance-widget-icons-row").hide(),e("#hustle-appearance-widget-icons-placeholder").show()),l||r?(e("#hustle-appearance-icons-style").show(),e("#hustle-appearance-empty-message").hide()):(e("#hustle-appearance-icons-style").hide(),e("#hustle-appearance-empty-message").show(),e("#hustle-appearance-floating-icons-placeholder").hide(),e("#hustle-appearance-widget-icons-placeholder").hide())},colorPickerCleared:function(e,t){var i=t.data("attribute"),n=optinVars.palettes.sshare_defaults[i],s=t.closest(".sui-colorpicker-wrap"),a=s.find(".sui-colorpicker-value"),o=s.find(".sui-colorpicker-value span[role=button]");t.closest(".wp-picker-container").find(".wp-picker-clear").click(),a.find("input").val(n),t.val(n).trigger("change"),o.find("span").css({"background-color":n}),e.preventDefault(),e.stopPropagation()},updatePickers:function(){var e=this;if(void 0!==optinVars.palettes.sshare_defaults){var t=optinVars.palettes.sshare_defaults;_.each(t,function(t,i){e.$('input[data-attribute="'+i+'"]').val(t).trigger("change")})}}}))}),Hustle.define("SShare.Display_View",function(){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Module_Display"),{viewChanged:function(e){_.intersection(["float_desktop_enabled","float_mobile_enabled","inline_enabled","widget_enabled","shortcode_enabled"],Object.keys(e)).length?Hustle.Events.trigger("modules.view.displayTypeUpdated",this.model):"float_desktop_position"in e?"right"===e.float_desktop_position?(this.$("#hustle-float_desktop-left-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-right-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-offset-x-wrapper").removeClass("sui-hidden")):"left"===e.float_desktop_position?(this.$("#hustle-float_desktop-left-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-right-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-offset-x-wrapper").removeClass("sui-hidden")):this.$("#hustle-float_desktop-offset-x-wrapper").addClass("sui-hidden"):"float_desktop_position_y"in e?"bottom"===e.float_desktop_position_y?(this.$("#hustle-float_desktop-top-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-bottom-offset-label").removeClass("sui-hidden")):(this.$("#hustle-float_desktop-top-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-bottom-offset-label").addClass("sui-hidden")):"float_mobile_position"in e?"right"===e.float_mobile_position?(this.$("#hustle-float_mobile-left-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-right-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-offset-x-wrapper").removeClass("sui-hidden")):"left"===e.float_mobile_position?(this.$("#hustle-float_mobile-left-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-right-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-offset-x-wrapper").removeClass("sui-hidden")):this.$("#hustle-float_mobile-offset-x-wrapper").addClass("sui-hidden"):"float_mobile_position_y"in e&&("bottom"===e.float_mobile_position_y?(this.$("#hustle-float_mobile-top-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-bottom-offset-label").removeClass("sui-hidden")):(this.$("#hustle-float_mobile-top-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-bottom-offset-label").addClass("sui-hidden")))}}))}),Hustle.define("Modals.Services_Platforms",function(){"use strict";return Backbone.View.extend({el:"#hustle-dialog--add-platforms",selectedPlatforms:[],events:{"click .sui-box-selector input":"selectPlatforms","click #hustle-add-platforms":"addPlatforms"},initialize:function(e){this.selectedPlatforms=e,this.$(".hustle-add-platforms-option").prop("checked",!1).prop("disabled",!1);var t,i=_createForOfIteratorHelper(this.selectedPlatforms);try{for(i.s();!(t=i.n()).done;){var n=t.value;this.$("#hustle-social--"+n).prop("checked",!0).prop("disabled",!0)}}catch(e){i.e(e)}finally{i.f()}},selectPlatforms:function(e){var t=this.$(e.target),i=this.$el.find('label[for="'+t.attr("id")+'"]'),n=t.val();i.toggleClass("selected"),t.prop("checked")?this.selectedPlatforms.push(n):this.selectedPlatforms=_.without(this.selectedPlatforms,n)},checkPlatforms:function(){var e,t=_createForOfIteratorHelper(this.selectedPlatforms);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.$("#hustle-social--"+i).prop("checked")||(this.selectedPlatforms=_.without(this.selectedPlatforms,i))}}catch(e){t.e(e)}finally{t.f()}},addPlatforms:function(e){var t=this.$(e.target);t.addClass("sui-button-onload"),this.checkPlatforms(),this.trigger("platforms:added",this.selectedPlatforms),setTimeout(function(){SUI.closeModal(),t.removeClass("sui-button-onload")},500)}})}),Hustle.define("SShare.View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Wizard_View"),{_events:{"hustle_update_prewiev #hui-preview-social-shares-floating":"updatePreview"},updatePreview:function(){var t=_.extend({},this.model.toJSON(),this.getDataToSave());e.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"hustle_preview_module",id:this.model.get("module_id"),previewData:t},success:function(t){if(t.success){var i=e("#hui-preview-social-shares-floating"),n=e("#hui-preview-social-shares-widget");i.html(t.data.floatingHtml),n.html(t.data.widgetHtml),t.data.style&&i.append(t.data.style),e(".hustle-share-icon").on("click",function(e){return e.preventDefault()})}}})},setTabsViews:function(e){this.contentView=e.contentView,this.displayView=e.displayView,this.designView=e.designView,this.visibilityView=e.visibilityView,this.moduleType=this.model.get("module_type")},renderTabs:function(){this.contentView.delegateEvents(),this.designView.delegateEvents(),this.displayView.delegateEvents(),this.visibilityView.delegateEvents(),this.visibilityView.afterRender()},sanitizeData:function(){},getDataToSave:function(){return{content:this.contentView.model.toJSON(),display:this.displayView.model.toJSON(),design:this.designView.model.toJSON(),visibility:this.visibilityView.model.toJSON()}}}))}),function(){"use strict";var e;(e="_page_hustle_popup_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_popup";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),l=Hustle.get("Module.IntegrationsView"),r=Module.Model,d=Hustle.get("Models.M");new t({model:new r(optinVars.current.data||{}),contentView:new i({BaseModel:d}),emailsView:new n({BaseModel:d}),designView:new s({BaseModel:d}),integrationsView:new l({BaseModel:d}),visibilityView:new a({BaseModel:d}),settingsView:new o({BaseModel:d})})}}()}(),function(){"use strict";var e;(e="_page_hustle_slidein_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_slidein";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),l=Hustle.get("Module.IntegrationsView"),r=Module.Model,d=Hustle.get("Models.M");new t({model:new r(optinVars.current.data||{}),contentView:new i({BaseModel:d}),emailsView:new n({BaseModel:d}),designView:new s({BaseModel:d}),integrationsView:new l({BaseModel:d}),visibilityView:new a({BaseModel:d}),settingsView:new o({BaseModel:d})})}}()}(),function(){"use strict";var e;(e="_page_hustle_embedded_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_embedded";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Display")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),l=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),r=Hustle.get("Module.IntegrationsView"),d=Module.Model,c=Hustle.get("Models.M");new t({model:new d(optinVars.current.data||{}),contentView:new i({BaseModel:c}),emailsView:new n({BaseModel:c}),designView:new s({BaseModel:c}),integrationsView:new r({BaseModel:c}),displayView:new a({BaseModel:c}),visibilityView:new o({BaseModel:c}),settingsView:new l({BaseModel:c})})}}()}(),function(){"use strict";var e;(e="_page_hustle_sshare_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_sshare";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.get("SShare.View"),i=Hustle.get("SShare.Content_View"),n=Hustle.get("SShare.Display_View"),s=Hustle.get("SShare.Design_View"),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Module.Model,l=Hustle.get("Models.M");new t({model:new o(optinVars.current.data||{}),contentView:new i({BaseModel:l}),displayView:new n({BaseModel:l}),designView:new s({BaseModel:l}),visibilityView:new a({BaseModel:l})})}}()}(),Hustle.define("Dashboard.View",function(e){"use strict";"toplevel_page_hustle"===pagenow&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .hustle-preview-module-button":"previewModule","click .hustle-delete-module-button":"openDeleteModal","click .hustle-free-version-create":"showUpgradeModal","click .sui-dropdown .hustle-onload-icon-action":"addLoadingIconToActionsButton","click .hustle-single-module-button-action":"handleSingleModuleAction"},initialize:function(){e("#hustle-dialog--welcome").length?this.openWelcomeDialog():e("#hustle-dialog--migrate").length?this.openMigrateDialog():e("#hustle-dialog--release-highlight").length&&this.openReleaseHighlightDialog(),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if(Module.Utils.getUrlParam("show-notice")){var e="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",t=Module.Utils.getUrlParam("notice"),i=t&&"undefined"!==optinVars.messages[t]?optinVars.messages[t]:Module.Utils.getUrlParam("notice-message");void 0!==i&&i.length&&Module.Notification.open(e,i)}},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.getPreviewView().open(i.data("id"),i.data("type"),i,{module_name:i.data("name")})},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},showUpgradeModal:function(t){void 0!==t&&t.preventDefault(),e("#wph-upgrade-modal").addClass("wpmudev-modal-active")},openDeleteModal:function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description")};Module.deleteModal.open(n,i[0])},addLoadingIconToActionsButton:function(t){e(t.currentTarget).closest(".sui-dropdown").find(".sui-dropdown-anchor").addClass("sui-button-onload")},openWelcomeDialog:function(){Hustle.get("Modals.Welcome")},openMigrateDialog:function(){Hustle.get("Modals.Migration")},openReleaseHighlightDialog:function(){Hustle.get("Modals.ReleaseHighlight")},handleSingleModuleAction:function(e){Module.handleActions.initAction(e,"dashboard",this)}}))}),Hustle.define("Integrations.View",function(e){"use strict";var t="_page_hustle_integrations";t===pagenow.substr(pagenow.length-t.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .connect-integration":"connectIntegration","keypress .connect-integration":"preventEnterKeyFromDoingThings"},initialize:function(){this.stopListening(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.listenTo(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.render()},render:function(){var e=this.$el.find("#hustle-not-connected-providers-section"),t=this.$el.find("#hustle-connected-providers-section");0<e.length&&0<t.length&&this.renderProvidersTables(),optinVars.integration_redirect&&this.handleIntegrationRedirect()},renderProvidersTables:function(){var t=this,i={};this.$el.find(".hustle-integrations-display").html('<div class="sui-notice hustle-integration-loading-notice">\n\t\t\t\t\t\t<div class="sui-notice-content">\n\t\t\t\t\t\t\t<div class="sui-notice-message">\n\n\t\t\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-loader sui-loading sui-md" aria-hidden="true"></span>\n\t\t\t\t\t\t\t\t<p>'.concat(optinVars.fetching_list,"</p>\n\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")),i.action="hustle_provider_get_providers",i._ajax_nonce=optinVars.providers_action_nonce,i.data={},e.post({url:ajaxurl,type:"post",data:i}).done(function(e){e&&e.success&&(t.$el.find("#hustle-not-connected-providers-section").html(e.data.not_connected),t.$el.find("#hustle-connected-providers-section").html(e.data.connected))}).always(function(){t.$el.find(".hustle-integration-loading-notice").remove()})},preventEnterKeyFromDoingThings:function(e){13===e.which&&e.preventDefault()},connectIntegration:function(e){Module.integrationsModal.open(e)},handleIntegrationRedirect:function(){var e=optinVars.integration_redirect,t=optinVars.integrations_migrate;if(window.history.pushState({},document.title,optinVars.integrations_url),"notification"===e.action){var i="success"===e.status?"success":"error",n=e.delay?e.delay:1e4;Module.Notification.open(i,e.message,n)}if(t.hasOwnProperty("provider_modal")&&"aweber"===t.provider_modal&&Module.ProviderMigration.open(t.provider_modal,t.integration_id),t.hasOwnProperty("migration_notificaiton")){var s="success"===t.migration_notificaiton.status?"success":"error",a=t.migration_notificaiton.delay?t.migration_notificaiton.delay:1e4;Module.Notification.open(s,t.migration_notificaiton.message,a)}}}))}),Hustle.define("Entries.View",function(e){"use strict";var t="_page_hustle_entries";t===pagenow.substr(pagenow.length-t.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .sui-pagination-wrap .hustle-open-inline-filter":"openFilterInline","click .sui-pagination-wrap .hustle-open-dialog-filter":"openFilterModal","click .hustle-delete-entry-button":"openDeleteModal","click .sui-active-filter-remove":"removeFilter","change input[name=search_email]":"toggleClearButton","change input[name=date_range]":"toggleClearButton","apply.daterangepicker input[name=date_range]":"toggleClearButton","click .hustle-entries-clear-filter":"clearFilter"},initialize:function(){this.initializeDaterangepicker();var t=e(".hui-entries-alert");t.length&&(t.attr("colspan",t.closest(".sui-table").find("> thead tr th").length),t.find("i").hide(),t.find("span").removeClass("sui-screen-reader-text")),e("input[name=search_email]").trigger("change")},initializeDaterangepicker:function(){var t=this.$(".hui-box-actions input.hustle-entries-filter-date"),i=this.$("#hustle-dialog--filter-entries input.hustle-entries-filter-date"),n=function(t,i){e(this).val(i.startDate.format("MM/DD/YYYY")+" - "+i.endDate.format("MM/DD/YYYY"))},s={autoUpdateInput:!1,autoApply:!0,alwaysShowCalendars:!0,locale:optinVars.daterangepicker,ranges:this.getDaterangepickerRanges()};t.daterangepicker(s),t.on("apply.daterangepicker",n);var a=Object.assign({parentEl:"#hustle-dialog--filter-entries .sui-box-body"},s);i.daterangepicker(a),i.on("apply.daterangepicker",n)},getDaterangepickerRanges:function(){var e={},t=optinVars.daterangepicker.ranges,i={today:[moment(),moment()],yesterday:[moment().subtract(1,"days"),moment().subtract(1,"days")],last_seven_days:[moment().subtract(6,"days"),moment()],last_thirty_days:[moment().subtract(29,"days"),moment()],this_month:[moment().startOf("month"),moment().endOf("month")],last_month:[moment().subtract(1,"month").startOf("month"),moment().subtract(1,"month").endOf("month")]};for(var n in i){var s=t[n],a=i[n];e[s]=a}return e},openFilterInline:function(e){var t=this.$(e.target),i=t.closest(".sui-pagination-wrap").find(".sui-button-icon"),n=t.closest(".hui-actions-bar").next(".sui-pagination-filter");i.toggleClass("sui-active"),n.toggleClass("sui-open"),e.preventDefault(),e.stopPropagation()},openFilterModal:function(t){t.preventDefault(),SUI.openModal("hustle-dialog--filter-entries",e(t.currentTarget)[0],this.$("#hustle-dialog--filter-entries .hustle-modal-close")[0],!0)},removeFilter:function(e){var t=this.$(e.target).data("filter"),i=new RegExp("&"+t+"=[^&]*","i");-1!==["order_by","search_email","date_range"].indexOf(t)&&(location.href=location.href.replace(i,""))},openDeleteModal:function(t){t.preventDefault();var i=e(t.target),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description"),actionClass:""};Module.deleteModal.open(n,i[0])},toggleClearButton:function(t){var i=e(t.target).closest("form"),n=i.find(".hustle-entries-clear-filter");i.find("input[name=search_email]").val()||i.find("input[name=date_range]").val()?n.prop("disabled",!1):n.prop("disabled",!0)},clearFilter:function(e){e.preventDefault(),this.$("input[name=search_email]").val(""),this.$("input[name=date_range]").val(""),this.toggleClearButton(e)}}))}),Hustle.define("ProviderNotice.View",function(e){"use strict";new(Backbone.View.extend({el:".hustle-provider-notice",cookieKey:"",events:{"click .dismiss-provider-migration-notice":"HideProviderNotice"},initialize:function(){this.cookieKey="provider_migration_notice_",e(".hustle-provider-notice").length&&this.showProviderNotice()},HideProviderNotice:function(t){Optin.cookie.set(this.cookieKey+e(t.currentTarget).data("name"),1,7),location.reload()},showProviderNotice:function(){var t=e(".hustle-provider-notice").data("name");1!==Optin.cookie.get(this.cookieKey+t)&&e(".hustle_migration_notice__"+t).show()}}))}),Hustle.define("Settings.View",function(e,t,i){"use strict";var n="_page_hustle_settings";n===pagenow.substr(pagenow.length-n.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .sui-sidenav .sui-vertical-tab a":"sidenav","change select.sui-mobile-nav":"sidenavMobile","click .sui-pagination-wrap > button":"pagination","click .hustle-load-on-click":"addLoadingState","click .hustle-settings-save":"handleSave"},initialize:function(){var t=Hustle.get("Settings.reCaptcha_Settings"),n=Hustle.get("Settings.Top_Metrics_View"),s=Hustle.get("Settings.Privacy_Settings"),a=Hustle.get("Settings.Permissions_View"),o=Hustle.get("Settings.Data_Settings"),l=Hustle.get("Settings.Palettes");this.recaptchaView=new t,new n,new s,new a,new o,new l,e(i).off("popstate",e.proxy(this.tabUpdate,this)),e(i).on("popstate",e.proxy(this.tabUpdate,this)),Hustle.Events.trigger("view.rendered",this),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if(Module.Utils.getUrlParam("show-notice")){var e="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",t=Module.Utils.getUrlParam("notice"),i=t&&"undefined"!==optinVars.messages[t]?optinVars.messages[t]:Module.Utils.getUrlParam("notice-message");void 0!==i&&i.length&&Module.Notification.open(e,i)}else Module.Utils.getUrlParam("404-downgrade-modal")&&this.$("#hustle-dialog--404-downgrade").length&&SUI.openModal("hustle-dialog--404-downgrade","hustle-popup-number")},sidenav:function(t){var i=e(t.target).data("tab");i&&this.tabJump(i,!0),t.preventDefault()},sidenavMobile:function(t){var i=e(t.currentTarget).val();i&&this.tabJump(i,!0)},tabUpdate:function(e){var t=e.originalEvent.state;t&&this.tabJump(t.tabSelected)},tabJump:function(e,t){var i=this.$el.find('a[data-tab="'+e+'"]'),n=i.closest(".sui-vertical-tabs").find(".sui-vertical-tab"),s=this.$el.find(".sui-box[data-tab]"),a=this.$el.find('.sui-box[data-tab="'+e+'"]');t&&history.pushState({tabSelected:e},"Hustle Settings","admin.php?page=hustle_settings&section="+e),n.removeClass("current"),s.hide(),i.parent().addClass("current"),a.show()},pagination:function(e){var t=this.$(e.target).closest(".sui-pagination-wrap"),i=t.find(".sui-button-icon"),n=t.next(".sui-pagination-filter");i.toggleClass("sui-active"),n.toggleClass("sui-open"),e.preventDefault(),e.stopPropagation()},handleSave:function(t){t.preventDefault();var i=this,n=e(t.currentTarget),s=n.data("form-id"),a=n.data(),o=new FormData;if(tinyMCE.triggerSave(),void 0!==s){var l=e("#"+s);l.length&&(o=new FormData(l[0]),e.each(l.find("input[type=checkbox]"),function(){var t=e(this);t.is(":checked")||o.append(t.attr("name"),"0")}))}e.each(a,function(e,t){return o.append(e,t)}),o.append("_ajax_nonce",optinVars.current.save_settings_nonce),o.append("action","hustle_save_settings"),n.addClass("sui-button-onload"),n.prop("disabled",!0),e.ajax({url:ajaxurl,type:"POST",data:o,contentType:!1,processData:!1}).done(function(t){t.data?(t.data.callback&&"undefined"!==i[t.data.callback]&&i[t.data.callback](n,t.data,t.success),t.data.url?!0===t.data.url?location.reload():location.replace(t.data.url):t.data.notification&&Module.Notification.open(t.data.notification.status,t.data.notification.message,t.data.notification.delay),t.data.url||(e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1))):(t.success?Module.Notification.open("success",optinVars.messages.settings_saved):Module.Notification.open("error",optinVars.messages.something_went_wrong_reload),e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1))}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("error",optinVars.messages.something_went_wrong)})},actionSaveRecaptcha:function(){this.recaptchaView.maybeRenderRecaptchas()},addLoadingState:function(t){e(t.currentTarget).addClass("sui-button-onload")}}))});
1
+ !function(){"use strict";var e,t,i,n,s,a,o,l,r,d;window.Hustle=(e=jQuery,t=document,i=window,n={},s={},a={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g},o=_.extend({},Backbone.Events),l=Backbone.View.extend({initialize:function(){_.isFunction(this.initMix)&&this.initMix.apply(this,arguments),this.render&&(this.render=_.wrap(this.render,function(e){this.trigger("before_render"),e.call(this),o.trigger("view.rendered",this),this.trigger("rendered")})),_.isFunction(this.init)&&this.init.apply(this,arguments)}}),r=_.memoize(function(e){var t;return function(i){return(t=t||_.template(document.getElementById(e).innerHTML,null,a))(i).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),d=_.memoize(function(e){var t;return function(i){return(t=t||_.template(e,null,a))(i)}}),{define:function(n,a){if(n.split(".").length)!function n(s,o){var l,r=s.split("."),d=r.splice(0,1)[0];d&&(r.length?o[d]=o[d]||{}:(l=a.call(null,e,t,i),o[d]=_.isFunction(l)||void 0===l?l:_.extend(o[d]||{},l)),r.length&&d&&n(r.join("."),o[d]))}(n,s);else{var o=s[n]||{};s[n]=_.extend(o,a.call(null,e,t,i))}},setModule:function(e,t){n[e]=t},getModules:function(){return n},getModule:function(e){return n[e]},get:function(e){var t,i;return e.split(".").length?(t=!1,(i=function(e,n){var s=e.split("."),a=s.splice(0,1)[0];t=n[a],s.length&&i(s.join("."),n[a])})(e,s),t):s[e]||!1},Events:o,View:l,template:r,createTemplate:d,getTemplateOptions:function(){return e.extend(!0,{},a)},consts:{ModuleShowCount:"hustle_module_show_count-"}})}(jQuery);var Optin=window.Optin||{};function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Optin.Models={},function(e){"use strict";Optin.NEVER_SEE_PREFIX="inc_optin_never_see_again-",Optin.COOKIE_PREFIX="inc_optin_long_hidden-",Optin.POPUP_COOKIE_PREFIX="inc_optin_popup_long_hidden-",Optin.SLIDE_IN_COOKIE_PREFIX="inc_optin_slide_in_long_hidden-",Optin.EMBEDDED_COOKIE_PREFIX="inc_optin_embedded_long_hidden-",Optin.template=_.memoize(function(t){var i,n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g};return function(s){return(i=i||_.template(e("#"+t).html(),null,n))(s).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),Optin.templateCompat=_.memoize(function(t){var i;return function(n){return(i=i||_.template(e("#"+t).html()))(n).replace("/*<![CDATA[*/","").replace("/*]]>*/","")}}),Optin.cookie={get:function(e){for(var t,i=document.cookie.split(";"),n=i.length,s=e+"=",a=0;a<n;a+=1){for(t=i[a];" "===t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(s)){var o=t.substring(s.length,t.length);return o?JSON.parse(o):o}}return null},set:function(t,i,n){var s,a;i=Array.isArray(i)||e.isPlainObject(i)?JSON.stringify(i):i,isNaN(n)?a="":((s=new Date).setTime(s.getTime()+24*n*60*60*1e3),a="; expires="+s.toGMTString()),document.cookie=t+"="+i+a+"; path=/"}},Optin.Mixins={_mixins:{},_servicesMixins:{},_desingMixins:{},_displayMixins:{},add:function(e,t){this._mixins[e]=t},getMixins:function(){return this._mixins},addServicesMixin:function(e,t){this._servicesMixins[e]=t},getServicesMixins:function(){return this._servicesMixins}}}(jQuery),function(e){"use strict";Hustle.Events.on("view.rendered",function(t){if(t instanceof Backbone.View){var i=function(e){e.hide(),e.prop("tabindex","-1"),e.prop("hidden",!0)},n=function(e){e.show(),e.prop("tabindex","0"),e.removeProp("hidden")};"#hustle-wizard-appearance"!==t.$el.selector&&t.$("select:not(.sui-select,.sui-inlabel)").each(function(){SUI.suiSelect(this)}),SUI.tabs({callback:function(e,t){var i=e.closest(".sui-tabs");"tab-cta-helper-enable"===e.attr("id")?i.find("#input-cta-helper-enable").click():"tab-cta-helper-disable"===e.attr("id")&&i.find("#input-cta-helper-disable").click();"tab-schedule-everyday"===e.attr("id")&&i.find("#input-schedule-everyday").click(),"tab-schedule-somedays"===e.attr("id")&&i.find("#input-schedule-somedays").click(),"tab-timezone-server"===e.attr("id")&&i.find("#input-timezone-server").click(),"tab-timezone-custom"===e.attr("id")&&i.find("#input-timezone-custom").click()}}),t.$(".sui-side-tabs").each(function(){var t=e(this),s=t.find(".sui-tabs-menu .sui-tab-item input");if(s.length){var a=function(){var t="";e.each(s,function(){var s=e(this),a=s.parent("label"),o=s.data("tab-menu"),l=e('.sui-tabs-content [data-tab-content="'.concat(o,'"]')),r=e('[data-tab-dependent="'.concat(o,'"]'));s[0].checked?(a.addClass("active"),o&&(t=o,l.addClass("active"),n(r))):(a.removeClass("active"),o!==t&&(l.removeClass("active"),i(r)))})};a(),s.on("change",function(){return a()}),t.find("button.sui-tab-item").on("click",function(){var t=e(this),i=e("#"+t.data("label-for"));i.length&&i.trigger("click").trigger("change")});var o=t.children(".hustle-tabs-option:checked");if(o.length){var l=o.prop("id");t.find('button[data-label-for="'.concat(l,'"]')).trigger("click")}}}),t.$(".sui-side-tabs").each(function(){var t=e(this),s=t.children(".hustle-tabs-option");if(s.length){var a=function(){var a="";e.each(s,function(){var s=e(this),o=s.attr("id"),l=t.find('button[data-label-for="'.concat(o,'"]')),r=l.attr("aria-controls"),d=e('div[id="'.concat(r,'"]'));s[0].checked?(l.addClass("active"),r&&(a=r,n(d))):(l.removeClass("active"),r!==a&&i(d))})};a(),s.on("change",function(){return a()}),t.children(".sui-tabs-menu").find("button.sui-tab-item").on("click",function(){var t=e(this),i=e('input[id="'+t.data("label-for")+'"]');i.length&&i.trigger("click").trigger("change")})}}),t.$(".select-content-switcher-wrapper").each(function(){var t=e(this),s=t.find(".select-content-switcher"),a=s.find("option"),o=function(){var o=s.find(":selected").data("switcher-menu"),l=t.find('.select-switcher-content[data-switcher-content="'.concat(o,'"]'));e.each(a,function(){var s=e(this);if(s.data("switcher-menu")===o)n(l);else{var a=t.find('.select-switcher-content[data-switcher-content="'.concat(s.data("switcher-menu"),'"]'));i(a)}})};o(),s.on("change",function(){return o()})}),t.$(".hustle-toggle-with-container").each(function(){var t=e(this),i=t.find("input[type=checkbox]"),n=e('[data-toggle-content="'.concat(t.data("toggle-on"),'"]')),s=e('[data-toggle-content="'.concat(t.data("toggle-off"),'"]')),a=function(){i[0].checked?(Module.Utils.accessibleShow(n),Module.Utils.accessibleHide(s)):(Module.Utils.accessibleShow(s),Module.Utils.accessibleHide(n))};a(),i.on("change",a)}),t.$(".hustle-radio-with-dependency-to-disable").each(function(){var t=e(this),i=t.data("disable"),n=e('[data-disable-content="'.concat(i,'"]')),s=n.data("disable-off"),a=n.data("disable-on"),o=function(){t.is(":checked")&&(s?s===t.val()?n.prop("disabled",!1):n.prop("disabled",!0):a&&(a===t.val()?n.prop("disabled",!0):n.prop("disabled",!1)))};o(),t.on("change",o)}),t.$(".hustle-select-with-dependency-to-disable").each(function(){var t=e(this),i=t.data("disable"),n=e('[data-disable-content="'.concat(i,'"]')),s=n.data("disable-off"),a=n.data("disable-on"),o=function(){s?s===t.val()?n.prop("disabled",!1):n.prop("disabled",!0):a&&(a===t.val()?n.prop("disabled",!0):n.prop("disabled",!1))};o(),t.on("change",o)}),Module.Utils.showHideDependencyOnSelectChange(t.$el)}}),e(document).ready(function(){e(".hustle-delete-module-button").on("click",function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description"),actionClass:"hustle-single-module-button-action"};Module.deleteModal.open(n,i[0])}),e(".hustle-module-tracking-reset-button").on("click",function(t){t.preventDefault();var i=e(t.target),n={id:i.data("module-id"),nonce:optinVars.single_module_action_nonce,action:"reset-tracking",title:i.data("title"),description:i.data("description"),actionClass:"hustle-single-module-button-action"};Module.deleteModal.open(n,i[0])}),e(".hustle-copy-shortcode-button").on("click",function(t){t.preventDefault();var i=e(t.target),n=i.data("shortcode"),s=i.closest(".sui-with-button-inside");if(void 0!==n){var a=e("<input />");e("body").append(a),a.val(n).trigger("select"),document.execCommand("copy"),a.remove(),Module.Notification.open("success",optinVars.messages.shortcode_copied)}else if(s.length){s.find('input[type="text"]').trigger("select"),document.execCommand("copy")}}),e(".hustle-dismissible-admin-notice .notice-dismiss, .hustle-dismissible-admin-notice .dismiss-notice").on("click",function(t){t.preventDefault();var i=e(t.currentTarget).closest(".hustle-dismissible-admin-notice");e.post(ajaxurl,{action:"hustle_dismiss_notification",name:i.data("name"),_ajax_nonce:optinVars.dismiss_notice_nonce}).always(i.fadeOut())}),e("#hustle-tracking-migration-notice .hustle-notice-dismiss").on("click",function(t){t.preventDefault(),e("#hustle-dismiss-modal-button").on("click",function(t){t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:e(t.currentTarget).data("name"),_ajax_nonce:e(t.currentTarget).data("nonce")}).always(function(){return location.reload()})}),SUI.openModal("hustle-dialog--migrate-dismiss-confirmation",e(".sui-header-title"))}),e(".sui-form-field input[type=number]").length&&e(".sui-form-field input[type=number]").on("keydown",function(t){e(this)[0].hasAttribute("min")&&0<=e(this).attr("min")&&(0!==t.originalEvent.key.replace(/[^0-9^.^,]/,"").length||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.preventDefault())}),setTimeout(function(){e(".hustle-scroll-to").length&&e("html, body").animate({scrollTop:e(".hustle-scroll-to").offset().top},"slow")},100),e(".hustle-check-all").on("click",function(t){var i=e(t.target),n=i.parents(".sui-wrap-hustle").find(".hustle-list"),s=i.is(":checked");n.find(".hustle-listing-checkbox").prop("checked",s),i.parents(".sui-wrap-hustle").find(".hustle-check-all").prop("checked",s),e(".hustle-bulk-apply-button").prop("disabled",!s)}),e(".hustle-list .hustle-listing-checkbox").on("click",function(t){var i=e(t.target),n=i.parents(".sui-wrap-hustle").find(".hustle-list"),s=i.is(":checked")&&!n.find(".hustle-listing-checkbox:not(:checked)").length,a=0===n.find(".hustle-listing-checkbox:checked").length;e(".hustle-check-all").prop("checked",s),e(".hustle-bulk-apply-button").prop("disabled",a)}),e(".hustle-bulk-apply-button").on("click",function(t){var i=e(t.target),n=e("select option:selected",i.closest(".hui-bulk-actions")).val(),s=e(".hustle-list .hustle-listing-checkbox:checked");if(0===s.length||"undefined"===n)return!1;var a=[];if(e.each(s,function(){a.push(e(this).val())}),"delete-all"===n){var o={ids:a.join(","),nonce:i.siblings('input[name="hustle_nonce"]').val(),title:i.data("title"),description:i.data("description"),action:n};return Module.deleteModal.open(o,i[0]),!1}})})}(jQuery),Hustle.define("Modals.Migration",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--migrate",data:{},events:{"click #hustle-migrate-start":"migrateStart","click #hustle-create-new-module":"createModule","click .sui-box-selector":"enableContinue","click .hustle-dialog-migrate-skip":"dismissModal"},initialize:function(){if(this.$el.length){var t="",i="";0===this.$el.data("isFirst")?(t="#hustle-dialog--migrate-slide-2",i="hustle-migrate-start"):(t="#hustle-dialog--migrate-slide-1",i="hustle-migrate-get-started"),this.$(t).addClass("sui-active sui-loaded"),setTimeout(function(){return SUI.openModal("hustle-dialog--migrate",i,e(".sui-wrap-hustle")[0],!1)},100),this.$progressBar=this.$el.find(".sui-progress .sui-progress-bar span"),this.$progressText=this.$el.find(".sui-progress .sui-progress-text span"),this.$partialRows=this.$el.find("#hustle-partial-rows")}},migrateStart:function(t){var i=e(t.target),n=this.$el.find("#hustle-dialog--migrate-slide-2"),s=n.find("#hustle-dialog--migrate-slide-2-description");i.addClass("sui-button-onload"),n.find(".hustle-dialog-migrate-skip").remove(),s.text(s.data("migrate-text")),Module.Utils.accessibleHide(n.find("div[data-migrate-start]")),Module.Utils.accessibleHide(n.find("div[data-migrate-failed]")),Module.Utils.accessibleShow(n.find("div[data-migrate-progress]")),SUI.closeNotice("hustle-dialog--migrate-error-notice"),this.migrateTracking(t),i.removeClass("sui-button-onload"),t.preventDefault()},migrateComplete:function(){var e=this.$("#hustle-dialog--migrate-slide-2"),t=this,i=e.find("#hustle-dialog--migrate-slide-2-title"),n=e.find("#hustle-dialog--migrate-slide-2-description");this.$el.find("sui-button-onload").removeClass("sui-button-onload"),i.text(i.data("done-text")),n.text(n.data("done-text")),Module.Utils.accessibleHide(e.find("div[data-migrate-progress]")),Module.Utils.accessibleShow(e.find("div[data-migrate-done]")),this.$el.closest(".sui-modal").on("click",function(e){return t.closeDialog(e)})},migrateFailed:function(){var t=this.$el.find("#hustle-dialog--migrate-slide-2");t.find("#dialogDescription").text(""),Module.Utils.accessibleHide(t.find("div[data-migrate-start]")),Module.Utils.accessibleShow(t.find("div[data-migrate-failed]")),Module.Utils.accessibleHide(t.find("div[data-migrate-progress]"));var i="hustle-dialog--migrate-error-notice",n=e("#"+i).data("message");Module.Notification.open("error",n,!1,i,!1)},updateProgress:function(e,t,i){void 0===this.totalRows&&(this.totalRows=i,this.$el.find("#hustle-total-rows").text(i)),this.$partialRows.text(e);var n=t+"%";this.$progressBar.css("width",n),100>=t&&this.$progressText.text(t+"%")},migrateTracking:function(t){t.preventDefault();var i=this,n={action:"hustle_migrate_tracking",_ajax_nonce:e(t.currentTarget).data("nonce")};return e.ajax({type:"POST",url:ajaxurl,dataType:"json",data:n,success:function(e){if(e.success){var n=e.data.migrated_rows,s=e.data.migrated_percentage,a=e.data.total_entries||"0";"done"!==e.data.current_meta?(i.updateProgress(n,s,a),i.migrateTracking(t)):(i.updateProgress(n,s,a),setTimeout(function(){return i.migrateComplete()},500))}else i.migrateFailed()},error:function(){i.migrateFailed()}}),!1},createModule:function(t){var i=e(t.target),n=this.$el.find(".sui-box-selector input:checked");if(n.length){this.dismissModal(),i.addClass("sui-button-onload");var s=n.val(),a=void 0!==optinVars.module_page[s]?optinVars.module_page[s]:optinVars.module_page.popup;window.location="?page=".concat(a,"&create-module=true")}t.preventDefault()},closeDialog:function(e){SUI.closeModal(),e.preventDefault(),e.stopPropagation()},enableContinue:function(){this.$el.find("#hustle-create-new-module").prop("disabled",!1)},dismissModal:function(t){t&&t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"migrate_modal",_ajax_nonce:this.$el.data("nonce")})}}))}),Hustle.define("Modals.Preview",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--preview",iframeWindow:null,events:{"click .hustle-modal-close":"close","click .hustle-preview-device-button":"previewDeviceSelected","click #hustle-preview-reload-module-button":"reloadModuleClicked"},open:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.displayModuleName(n),this.maybeHideReloadButton(t),SUI.openModal("hustle-dialog--preview",i,null,!1,!1);var s={action:"open",moduleId:e,moduleType:t,previewData:n};this.initiateIframe(s)},displayModuleName:function(e){e&&this.$("#hustle-dialog--preview-description").html(e.module_name||"")},maybeHideReloadButton:function(e){var t=this.$("#hustle-preview-reload-module-button");"embedded"===e?t.addClass("sui-hidden-important"):t.removeClass("sui-hidden-important")},initiateIframe:function(e){var t=this,i=this.$("#hustle-preview-iframe");void 0===i.attr("src")?(i[0].src=i.data("src"),i.on("load",function(){var n=t.$("#hustle-preview-iframe-container");n.show(),n.prop("aria-hidden",!1),t.$("#hustle-preview-loader").remove(),t.iframeWindow=i[0].contentWindow,t.talkToIframe(e)})):(this.$("#hustle-sr-text-preview-loaded").remove(),this.talkToIframe(e))},close:function(){var e=this;setTimeout(function(){return e.talkToIframe({action:"close"})},500)},reloadModuleClicked:function(){this.talkToIframe({action:"reload"})},previewDeviceSelected:function(t){var i=e(t.currentTarget),n=i.data("device");this.$(".hustle-preview-device-button").removeClass("sui-active"),i.addClass("sui-active"),this.$("#hustle-sr-text-preview-selected-device").html(i.data("selected")),"desktop"===n?(this.$el.removeClass("hustle-preview-mobile"),this.$el.addClass("hustle-preview-desktop")):"mobile"===n&&(this.$el.removeClass("hustle-preview-desktop"),this.$el.addClass("hustle-preview-mobile"))},talkToIframe:function(e){this.iframeWindow&&this.iframeWindow.postMessage(e,window.location)}})}),Hustle.define("Modals.ReleaseHighlight",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--release-highlight",initialize:function(){var e=this;this.$el.length&&(setTimeout(function(){return e.show()},100),this.$el.on("close",function(){return e.dismissModal()}))},show:function(){var t=this;"undefined"!=typeof SUI?SUI.openModal("hustle-dialog--release-highlight",e(".sui-header-title")[0],this.$(".hustle-modal-close"),!0):setTimeout(function(){return t.show()},100)},dismissModal:function(){e.post(ajaxurl,{action:"hustle_dismiss_notification",name:this.$el.data("name"),_ajax_nonce:optinVars.dismiss_notice_nonce})}}))}),Hustle.define("Modals.ReviewConditions",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--review_conditions",events:{"click .hustle-review-conditions-dismiss":"dismissModal"},initialize:function(){this.$el.length&&setTimeout(this.show,100,this)},show:function(t){"undefined"!=typeof SUI&&void 0!==SUI.openModal?SUI.openModal("hustle-dialog--review_conditions",e(".sui-header-title")):setTimeout(t.show,100,t)},dismissModal:function(){e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"41_visibility_behavior_update",_ajax_nonce:this.$el.data("nonce")})}}))}),Hustle.define("Upgrade_Modal",function(){"use strict";return Backbone.View.extend({el:"#wph-upgrade-modal",opts:{},events:{"click .wpmudev-i_close":"close"},initialize:function(e){this.opts=_.extend({},this.opts,e)},close:function(e){e.preventDefault(),e.stopPropagation(),this.$el.removeClass("wpmudev-modal-active")}})}),Hustle.define("Modals.Welcome",function(e){"use strict";new(Backbone.View.extend({el:"#hustle-dialog--welcome",events:{"click #hustle-new-create-module":"createModule","click .sui-box-selector":"enableContinue","click #getStarted":"dismissModal","click .sui-modal-skip":"dismissModal","click .hustle-button-dismiss-welcome":"dismissModal"},initialize:function(){this.$el.length&&setTimeout(this.show,100,this)},show:function(t){"undefined"!=typeof SUI?(SUI.openModal("hustle-dialog--welcome",e(".sui-header-title")[0],t.$("#hustle-dialog--welcome-first .sui-button-icon.hustle-button-dismiss-welcome"),!0),SUI.slideModal("hustle-dialog--welcome-first")):setTimeout(t.show,100,t)},createModule:function(t){var i=e(t.target),n=this.$el.find(".sui-box-selector input:checked");if(n.length){i.addClass("sui-button-onload");var s=n.val(),a=void 0!==optinVars.module_page[s]?optinVars.module_page[s]:optinVars.module_page.popup;window.location="?page=".concat(a,"&create-module=true")}t.preventDefault()},enableContinue:function(){this.$el.find("#hustle-new-create-module").prop("disabled",!1)},dismissModal:function(t){t&&t.preventDefault(),e.post(ajaxurl,{action:"hustle_dismiss_notification",name:"welcome_modal",_ajax_nonce:this.$el.data("nonce")})}}))}),function(e){"use strict";Optin.View={},Optin.View.Conditions=Optin.View.Conditions||{};var t=Hustle.View.extend({conditionId:"",className:"sui-builder-field sui-accordion-item sui-accordion-item--open",_template:Optin.template("hustle-visibility-rule-tpl"),template:!1,_defaults:{typeName:"",conditionName:""},_events:{"change input":"changeInput","change textarea":"changeInput","change select":"changeInput"},init:function(t){return this.undelegateEvents(),this.$el.removeData().off(),this.type=t.type,this.groupId=t.groupId,this.filter_type=t.filter_type,this.id=this.conditionId,this.template=void 0!==this.cpt?Optin.template("hustle-visibility-rule-tpl--post_type"):Optin.template("hustle-visibility-rule-tpl--"+this.conditionId),this._defaults={typeName:optinVars.module_type_name,conditionName:optinVars.messages.conditions[this.conditionId]?optinVars.messages.conditions[this.conditionId]:this.conditionId,groupId:this.groupId,id:this.conditionId,source:t.source},this.data=this.getData(),this.render(),this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents(),this.onInit&&_.isFunction(this.onInit)&&this.onInit.apply(this,arguments),this},getData:function(){return _.extend({},this._defaults,this.defaults(),this.model.get(this.conditionId),{type:this.type})},getTitle:function(){return this.title.replace("{type_name}",this.data.typeName)},getBody:function(){return"function"==typeof this.body?this.body.apply(this,arguments):this.body.replace("{type_name}",this.data.typeName)},getHeader:function(){return this.header},countLines:function(e){return e.replace(/\s+$/g,"").split("\n").length},render:function(){this.setProperties();var t=this._template(_.extend({},{title:this.getTitle(),body:this.getBody(),header:this.getHeader()},this._defaults,{type:this.type}));return this.$el.html(""),this.$el.html(t),e(".wph-conditions--box .wph-conditions--item:not(:last-child)").removeClass("wph-conditions--open").addClass("wph-conditions--closed"),e(".wph-conditions--box .wph-conditions--item:not(:last-child) section").hide(),this.rendered&&"function"==typeof this.rendered&&this.rendered.apply(this,arguments),this},updateAttribute:function(e,t){this.data=this.model.get(this.conditionId),this.data[e]=t,this.model.set(this.conditionId,this.data),this.model.trigger("change")},getAttribute:function(e){var t=this.model.get(this.conditionId);return!(!t||!t[e])&&t[e]},refreshLabel:function(){var e=this.getHeader();this.$el.find(".wph-condition--preview").html(""),this.$el.find(".sui-accordion-item-header .sui-tag").html(e)},changeInput:function(t){var i=t.target,n=e(i),s=n.is(".sui-select")?n.val():t.target.value;if(t.stopImmediatePropagation(),n.is(":checkbox")&&(s=n.is(":checked")),n.is(".select2-search__field"))return!1;var a=i.getAttribute("data-attribute");this.updateAttribute(a,s),this.refreshLabel()},getConfigs:function(){return this.defaults()||!0}}),i=function(){e(".wph-conditions--items").data("select2ScrollPosition",{})},n={events:{'change input[type="radio"]':"setCurrentLi"},setCurrentLi:function(t){var i=e(t.target),n=i.closest("li");n.siblings().removeClass("current"),n.toggleClass("current",i.is(":checked"))}};Optin.View.Conditions.posts=t.extend(_.extend({},n,{conditionId:"posts",setProperties:function(){this.title=optinVars.messages.conditions.posts},defaults:function(){return{filter_type:"except",posts:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("posts").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("posts").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"post"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.pages=t.extend(_.extend({},n,{conditionId:"pages",setProperties:function(){this.title=optinVars.messages.conditions.pages},defaults:function(){return{filter_type:"except",pages:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"page"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),optinVars.post_types&&_.each(optinVars.post_types,function(e,s){Optin.View.Conditions[e.name]=t.extend(_.extend({},n,{conditionId:e.name,cpt:!0,setProperties:function(){this.title=e.label},defaults:function(){return{filter_type:"except",selected_cpts:[],postType:s,postTypeLabel:e.label}},getHeader:function(){return this.getAttribute("selected_cpts").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("selected_cpts").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:s}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}}))}),Optin.View.Conditions.categories=t.extend(_.extend({},n,{conditionId:"categories",setProperties:function(){this.title=optinVars.messages.conditions.categories},defaults:function(){return{filter_type:"except",categories:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("categories").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("categories").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"category"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.tags=t.extend(_.extend({},n,{conditionId:"tags",setProperties:function(){this.title=optinVars.messages.conditions.tags},defaults:function(){return{filter_type:"except",tags:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("tags").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("tags").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({width:"100%",tags:"true",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"tag"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.visitor_logged_in_status=t.extend({conditionId:"visitor_logged_in_status",setProperties:function(){this.title=optinVars.messages.conditions.visitor_logged_in},defaults:function(){return{show_to:"logged_in"}},getHeader:function(){return this.getAttribute("show_to").length&&"logged_out"===this.getAttribute("show_to")?optinVars.messages.condition_labels.logged_out:optinVars.messages.condition_labels.logged_in},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.shown_less_than=t.extend({conditionId:"shown_less_than",setProperties:function(){this.title=optinVars.messages.conditions.shown_less_than},defaults:function(){return{less_or_more:"less_than",less_than:""}},getHeader:function(){return 0<this.getAttribute("less_than")?"less_than"===this.getAttribute("less_or_more")?optinVars.messages.condition_labels.number_views.replace("{number}",this.getAttribute("less_than")):optinVars.messages.condition_labels.number_views_more.replace("{number}",this.getAttribute("less_than")):optinVars.messages.condition_labels.any},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.visitor_device=t.extend({conditionId:"visitor_device",setProperties:function(){this.title=optinVars.messages.conditions.only_on_mobile},defaults:function(){return{filter_type:"mobile"}},getHeader:function(){return"not_mobile"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.desktop_only:optinVars.messages.condition_labels.mobile_only},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.from_referrer=t.extend({conditionId:"from_referrer",disable:["from_referrer"],setProperties:function(){this.title=optinVars.messages.conditions.from_specific_ref},defaults:function(){return{filter_type:"true",refs:""}},getHeader:function(){var e=0;return this.getAttribute("refs").length&&(e=this.countLines(this.getAttribute("refs"))),e?("false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.except_these:optinVars.messages.condition_labels.only_these).replace("{number}",e):"false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.any:optinVars.messages.condition_labels.none},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.source_of_arrival=t.extend({conditionId:"source_of_arrival",setProperties:function(){this.title=optinVars.messages.conditions.from_search_engine},defaults:function(){return{source_direct:"false",source_external:"false",source_internal:"false",source_not_search:"false",source_search:"false"}},getHeader:function(){var e=0,t=_.isTrue(this.getAttribute("source_direct"))&&++e,i=_.isTrue(this.getAttribute("source_external"))&&++e,n=_.isTrue(this.getAttribute("source_internal"))&&++e,s=_.isTrue(this.getAttribute("source_search"))&&++e,a=_.isTrue(this.getAttribute("source_not_search"))&&++e;return s&&a||t&&n&&i?optinVars.messages.condition_labels.any:e?optinVars.messages.condition_labels.any_conditions.replace("{number}",e):optinVars.messages.condition_labels.any},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.on_url=t.extend({conditionId:"on_url",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_url},defaults:function(){return{filter_type:"except",urls:""}},getHeader:function(){var e=0;return this.getAttribute("urls").length&&(e=this.countLines(this.getAttribute("urls"))),e?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",e):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.on_browser=t.extend({conditionId:"on_browser",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_browser},defaults:function(){return{browsers:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("browsers").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("browsers").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("browsers")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.visitor_commented=t.extend({conditionId:"visitor_commented",setProperties:function(){this.title=optinVars.messages.conditions.visitor_has_never_commented},defaults:function(){return{filter_type:"true"}},getHeader:function(){return"false"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.false:optinVars.messages.condition_labels.true},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.user_roles=t.extend({conditionId:"user_roles",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_roles},defaults:function(){return{roles:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("roles").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("roles").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("roles")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.page_templates=t.extend({conditionId:"page_templates",setProperties:function(){this.title=optinVars.messages.conditions.on_specific_templates},defaults:function(){return{templates:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("templates").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("templates").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("templates")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.user_registration=t.extend({conditionId:"user_registration",setProperties:function(){this.title=optinVars.messages.conditions.user_registration},defaults:function(){return{from_date:0,to_date:0}},getHeader:function(){return(0<this.getAttribute("from_date")?optinVars.messages.condition_labels.reg_date.replace("{number}",this.getAttribute("from_date")):optinVars.messages.condition_labels.immediately)+" - "+(0<this.getAttribute("to_date")?optinVars.messages.condition_labels.reg_date.replace("{number}",this.getAttribute("to_date")):optinVars.messages.condition_labels.forever)},body:function(){return this.template(this.getData())}}),Optin.View.Conditions.visitor_country=t.extend({conditionId:"visitor_country",setProperties:function(){this.title=optinVars.messages.conditions.not_in_a_country},defaults:function(){return{countries:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("countries").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("countries").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("countries")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wp_conditions=t.extend({conditionId:"wp_conditions",setProperties:function(){this.title=optinVars.messages.conditions.wp_conditions},defaults:function(){return{wp_conditions:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wp_conditions").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wp_conditions").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wp_conditions")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.archive_pages=t.extend({conditionId:"archive_pages",setProperties:function(){this.title=optinVars.messages.conditions.archive_pages},defaults:function(){return{archive_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("archive_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("archive_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("archive_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wc_pages=t.extend(_.extend({},n,{conditionId:"wc_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_pages},defaults:function(){return{filter_type:"all"}},getHeader:function(){return"none"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())}})),Optin.View.Conditions.wc_categories=t.extend(_.extend({},n,{conditionId:"wc_categories",setProperties:function(){this.title=optinVars.messages.conditions.wc_categories},defaults:function(){return{filter_type:"except",wc_categories:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("wc_categories").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_categories").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"wc_category"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.wc_tags=t.extend(_.extend({},n,{conditionId:"wc_tags",setProperties:function(){this.title=optinVars.messages.conditions.wc_tags},defaults:function(){return{filter_type:"except",wc_tags:[]}},onInit:function(){},getHeader:function(){return this.getAttribute("wc_tags").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_tags").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".hustle-select-ajax").SUIselect2({tags:"true",width:"100%",dropdownCssClass:"sui-select-dropdown",ajax:{url:ajaxurl,delay:250,dataType:"json",type:"POST",data:function(e){return{action:"get_new_condition_ids",search:e.term,postType:"wc_tag"}},processResults:function(e){return{results:e.data}},cache:!0},createTag:function(){return!1}}).on("select2:selecting",i).on("select2:unselecting",i)}})),Optin.View.Conditions.wc_archive_pages=t.extend({conditionId:"wc_archive_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_archive_pages},defaults:function(){return{wc_archive_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wc_archive_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_archive_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wc_archive_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.wc_static_pages=t.extend({conditionId:"wc_static_pages",setProperties:function(){this.title=optinVars.messages.conditions.wc_static_pages},defaults:function(){return{wc_static_pages:"",filter_type:"except"}},getHeader:function(){return this.getAttribute("wc_static_pages").length?("only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.only_these:optinVars.messages.condition_labels.except_these).replace("{number}",this.getAttribute("wc_static_pages").length):"only"===this.getAttribute("filter_type")?optinVars.messages.condition_labels.none:optinVars.messages.condition_labels.all},body:function(){return this.template(this.getData())},rendered:function(){this.$(".sui-select").val(this.getAttribute("wc_static_pages")).SUIselect2().on("select2:selecting",i).on("select2:unselecting",i)}}),Optin.View.Conditions.cookie_set=t.extend({conditionId:"cookie_set",setProperties:function(){this.title=optinVars.messages.conditions.cookie_set},defaults:function(){return{cookie_name:"",cookie_value:"",filter_type:"exists",cookie_value_conditions:"anything"}},changeInput:function(t){var i,n,s,a=t.target,o=e(a),l=o.is(".sui-select")?o.val():t.target.value;if(t.stopImmediatePropagation(),void 0!==o.find(":selected").data("switcher-menu")&&(n=(n=o.closest(".select-content-switcher-wrapper").find('.select-switcher-content[data-switcher-content="'.concat(o.find(":selected").data("switcher-menu"),'"] input')).val())||"",i=this.updateAttribute("cookie_value",n)),"filter_type"===o.data("attribute")&&(s=o.closest(".sui-side-tabs").find('.sui-tab-boxed:not(.active) input[data-attribute="cookie_name"]').val(),o.closest(".sui-side-tabs").find('.sui-tab-boxed.active input[data-attribute="cookie_name"]').val(s),i=this.updateAttribute("cookie_name",s)),o.is(":checkbox")&&(l=o.is(":checked")),o.is(".select2-search__field"))return!1;var r=a.getAttribute("data-attribute");return i=this.updateAttribute(r,l),this.refreshLabel(),i},getHeader:function(){return this.getAttribute("cookie_name")?"exists"===this.getAttribute("filter_type")?"anything"===this.getAttribute("cookie_value_conditions")?optinVars.messages.condition_labels.cookie_anything.replace("{name}",this.getAttribute("cookie_name")).replace(/(<([^>]+)>)/gi,""):optinVars.messages.condition_labels.cookie_value.replace("{name}",this.getAttribute("cookie_name")).replace("{value_condition}",optinVars.wp_cookie_set[this.getAttribute("cookie_value_conditions")]).replace("{value}",this.getAttribute("cookie_value")).replace(/(<([^>]+)>)/gi,""):optinVars.messages.condition_labels.cookie_doesnt_exist.replace("{name}",this.getAttribute("cookie_name")).replace(/(<([^>]+)>)/gi,""):"-"},body:function(){return this.template(this.getData())}}),e(document).trigger("hustleAddViewConditions",[t])}(jQuery),Hustle.define("imageUploader",function(){"use strict";return Backbone.View.extend({events:{"click .hustle-image-uploader-browse":"open","click .hustle-image-uploader-clear":"clear"},mediaFrame:!1,initialize:function(e){if(this.attribute=e.attribute,!this.model||!this.attribute)throw new Error("Undefined model or attribute.");this.render()},render:function(){return this.defineMediaFrame(),this},showImagePreviewOrButton:function(){var e=this.model.get(this.attribute);""===e||void 0===e?this.$el.removeClass("sui-has_file"):this.$el.addClass("sui-has_file")},defineMediaFrame:function(){var e=this;this.mediaFrame=wp.media({title:optinVars.media_uploader.select_or_upload,button:{text:optinVars.media_uploader.use_this_image},multiple:!1}).on("select",function(){var t,i,n=e.mediaFrame.state().get("selection").first().toJSON();n&&n.url&&(t=n.url,i="",e.model.set(e.attribute,t),n.sizes&&n.sizes.thumbnail&&n.sizes.thumbnail.url&&(i=n.sizes.thumbnail.url),e.$el.find(".sui-upload-file .hustle-upload-file-url").text(t),e.$el.find(".sui-image-preview").css("background-image","url( "+i+" )"),e.showImagePreviewOrButton())})},open:function(e){e.preventDefault(),this.mediaFrame.open()},clear:function(e){e.preventDefault(),this.model.set(this.attribute,""),this.$el.find(".sui-upload-file .hustle-upload-file-url").text(""),this.$el.find(".sui-image-preview").css("background-image","url()"),this.showImagePreviewOrButton()}})}),Hustle.define("Modals.Edit_Field",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--edit-field",events:{'change input[name="time_format"]':"changeTimeFormat",'blur input[name="name"]':"trimName","change input":"fieldUpdated",'click input[type="radio"]':"fieldUpdated","change select":"fieldUpdated",'change input[name="version"]':"handleCaptchaSave"},initialize:function(e){var t=this;this.field=e.field,this.changed={},this.fieldData=e.fieldData,this.model=e.model,this.render(),this.$el.off("close").on("close",function(){return t.modalClosed()}),this.$("#hustle-apply-changes").off("mouseup").on("mouseup",function(e){return t.applyChanges(e)})},render:function(){this.renderHeader(),this.renderLabels(),this.renderSettings(),this.renderStyling(),this.handleCaptchaSave(),this.$(".hustle-data-pane").first().trigger("click"),this.$(".sui-select").SUIselect2({dropdownParent:e("#hustle-dialog--edit-field .sui-box"),dropdownCssClass:"sui-select-dropdown"})},renderHeader:function(){this.$(".hustle-field-tag-container").length||this.$(".sui-box-header").append('<div class="sui-actions-left hustle-field-tag-container"><span class="sui-tag"></span></div>'),this.$(".sui-box-header .sui-tag").text(this.field.type)},renderLabels:function(){if(-1!==e.inArray(this.field.type,["recaptcha","gdpr","submit"]))return this.$("#hustle-data-tab--labels").removeClass("hustle-data-pane").addClass("sui-hidden"),void this.$("#hustle-data-pane--labels").addClass("sui-hidden");this.$("#hustle-data-tab--labels").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--labels").removeClass("sui-hidden");var t="hustle-"+this.field.type+"-field-labels-tpl";e("#"+t).length||(t="hustle-common-field-labels-tpl");var i=Optin.template(t);this.$("#hustle-data-pane--labels").html(i(this.fieldData)),Hustle.Events.trigger("view.rendered",this)},renderSettings:function(){if("hidden"===this.field.type)return this.$("#hustle-data-tab--settings").removeClass("hustle-data-pane").addClass("sui-hidden"),this.$("#hustle-data-pane--settings").addClass("sui-hidden"),void Module.Utils.accessibleHide(this.$("[data-tabs]"));Module.Utils.accessibleShow(this.$("[data-tabs]")),this.$("#hustle-data-tab--settings").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--settings").removeClass("sui-hidden"),e(document).on("focusin",function(t){e(t.target).closest(".wp-link-input").length&&t.stopImmediatePropagation()});var t="hustle-"+this.field.type+"-field-settings-tpl";e("#"+t).length||(t="hustle-common-field-settings-tpl");var i=Optin.template(t);if(this.$("#hustle-data-pane--settings").html(i(this.fieldData)),Hustle.Events.trigger("view.rendered",this),"gdpr"===this.field.type){wp.editor.remove("gdpr_message"),wp.editor.initialize("gdpr_message",{tinymce:{wpautop:!1,toolbar1:"bold,italic,strikethrough,link",valid_elements:"a[href|target=_blank],strong/b,i,u,s,em,del",forced_root_block:""},quicktags:{buttons:"strong,em,del,link"}})}else if("recaptcha"===this.field.type){var n={tinymce:{toolbar:["bold italic link alignleft aligncenter alignright"]},quicktags:!0};wp.editor.remove("v3_recaptcha_badge_replacement"),wp.editor.initialize("v3_recaptcha_badge_replacement",n),wp.editor.remove("v2_invisible_badge_replacement"),wp.editor.initialize("v2_invisible_badge_replacement",n)}},renderStyling:function(){if("hidden"===this.field.type)return this.$("#hustle-data-tab--styling").removeClass("hustle-data-pane").addClass("sui-hidden"),void this.$("#hustle-data-pane--styling").addClass("sui-hidden");this.$("#hustle-data-tab--styling").removeClass("sui-hidden").addClass("hustle-data-pane"),this.$("#hustle-data-pane--styling").removeClass("sui-hidden");var t="hustle-"+this.field.type+"-field-styling-tpl";e("#"+t).length||(t="hustle-common-field-styling-tpl");var i=Optin.template(t);this.$("#hustle-data-pane--styling").html(i(this.fieldData))},fieldUpdated:function(t){var i=e(t.target),n=i.attr("name"),s=i.is(":checkbox")?i.is(":checked"):i.val();this.changed[n]=s},modalClosed:function(){this.undelegateEvents(),this.stopListening()},changeTimeFormat:function(t){"12"===e(t.target).val()?(e("#hustle-date-format").closest(".sui-form-field").show(),e('input[name="time_hours"]').prop("min",1).prop("max",12)):(e("#hustle-date-format").closest(".sui-form-field").hide(),e('input[name="time_hours"]').prop("min",0).prop("max",23))},handleCaptchaSave:function(){if("recaptcha"===this.field.type){var t=e("#available_recaptchas").val();if(t){t=t.split(",");var i=e('input[name="version"]:checked').val();-1===_.indexOf(t,i)?e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled","disabled"):e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled",!1)}else e("#hustle-dialog--edit-field").find("#hustle-apply-changes").attr("disabled","disabled")}},trimName:function(e){var t=this.$(e.target),i=t.val().trim().replace(/ /g,"_");t.val(i)},applyChanges:function(e){var t=this.$(e.target),i=Object.assign({},this.model.get("form_elements"));if("gdpr"===this.field.type&&"undefined"!=typeof tinyMCE){var n=tinyMCE.get("gdpr_message"),s=this.$("textarea#gdpr_message"),a="true"===s.attr("aria-hidden")?n.getContent():s.val();this.changed.gdpr_message=a}else if("recaptcha"===this.field.type&&"undefined"!=typeof tinyMCE){var o=tinyMCE.get("v3_recaptcha_badge_replacement"),l=this.$("textarea#v3_recaptcha_badge_replacement"),r="true"===l.attr("aria-hidden")?o.getContent():l.val();this.changed.v3_recaptcha_badge_replacement=r;var d=tinyMCE.get("v2_invisible_badge_replacement"),c=this.$("textarea#v2_invisible_badge_replacement"),u="true"===c.attr("aria-hidden")?d.getContent():c.val();this.changed.v2_invisible_badge_replacement=u}if(Object.keys(this.changed).length){var h=_.extend({},this.field);if(_.extend(this.field,this.changed),("name"in this.changed&&"email"!==h.name&&"email"===this.field.name||"name"in this.changed&&!this.field.name.trim().length)&&(this.field.name=h.name,delete this.changed.name),"email"===h.name&&(this.field.name="email",delete this.changed.name),this.field.name!==h.name){for(var p=this.field.name,g=0,f=p;f in i;)f=p+"-"+ ++g;this.field.name=f,this.changed.name=f}"name"in this.changed||(i[this.field.name]=this.field,this.model.unset("form_elements",{silent:!0}),this.model.set("form_elements",i)),this.trigger("field:updated",this.field,this.changed,h)}t.addClass("sui-button-onload"),setTimeout(function(){return t.removeClass("sui-button-onload")},300)}})}),Hustle.define("Modals.EditSchedule",function(e){"use strict";return Backbone.View.extend({el:"#hustle-schedule-dialog-content",dialogId:"hustle-dialog--add-schedule",events:{"click #hustle-schedule-save":"saveSchedule","click .hustle-schedule-cancel":"cancel","click .hustle-schedule-delete":"openDeleteModal","change .hustle-datepicker-field[name=start_date]":"changeMinDate","change [name=not_schedule_start]":"changeMinDate",'change .hustle-checkbox-with-dependencies input[type="checkbox"]':"checkboxWithDependenciesChanged",'change select[name="custom_timezone"]':"customTimezoneChanged"},initialize:function(e){this.model=e.model},open:function(){var t=this.dialogId;this.renderContent(),e(".hustle-datepicker-field").datepicker({beforeShow:function(){e("#ui-datepicker-div").addClass("sui-calendar")},dateFormat:"m/d/yy"}),this.$(".sui-select").SUIselect2({dropdownParent:e("#".concat(this.dialogId," .sui-box")),dropdownCssClass:"sui-select-dropdown"}),this.changeMinDate(),SUI.openModal(t,"hustle-schedule-focus",void 0,!1)},changeMinDate:function(){var t;e("[name=not_schedule_end]").is(":checked")||e("[name=not_schedule_start]").is(":checked")||(t=e("[name=start_date]").val()),e(".hustle-datepicker-field[name=end_date]").datepicker("option",{minDate:t})},renderContent:function(){var t=Optin.template("hustle-schedule-dialog-content-tpl"),i=e("#hustle-schedule-dialog-content"),n=Object.assign({},this.model.get("schedule"));n.is_schedule=this.model.get("is_schedule"),n.serverCurrentTime=this.getTimeToDisplay("server"),n.customCurrentTime=this.getTimeToDisplay("custom"),this.setElement(t(n)),i.html(this.$el),Hustle.Events.trigger("view.rendered",this),this.refreshViewOnRender(n)},refreshViewOnRender:function(t){this.$(".hustle-checkbox-with-dependencies input").each(function(){e(this).trigger("change")}),"server"===t.time_to_use?e("#tab-timezone-server").click():e("#tab-timezone-custom").click(),"all"===t.active_days?e("#tab-schedule-everyday").click():e("#tab-schedule-somedays").click();var i=this.$('select[name="custom_timezone"]').val(),n=t.custom_timezone;n!==i&&this.$('select[name="custom_timezone"]').val(n).trigger("change")},getTimeToDisplay:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.model.get("schedule"),n=!1,s=!1;if("server"===e)n=optinVars.schedule.wp_gmt_offset||0;else{var a=t||i.custom_timezone;if(a.includes("UTC")){var o=a.replace("UTC","");n=o.length?parseFloat(o):0}else{s=moment().tz(a).format("hh:mm a")}}if(!1===s&&!1!==n){var l=Date.now()+3600*n*1e3;s=moment.utc(l).format("hh:mm a")}return s},saveSchedule:function(t){var i=e(t.currentTarget),n=this.processFormForSave(),s="1"===this.model.get("is_schedule");i.addClass("sui-button-onload"),i.prop("disabled",!0),setTimeout(function(){i.removeClass("sui-button-onload"),i.prop("disabled",!1)},500),this.model.set("is_schedule","1"),this.model.set("schedule",n),this.model.userHasChange(),this.closeModal(),s||Module.Notification.open("success",optinVars.schedule.new_schedule_set,!1),this.trigger("schedule:updated")},processFormForSave:function(){var t=e("#hustle-edit-schedule-form");return Module.Utils.serializeObject(t)},cancel:function(){this.renderContent(),this.closeModal()},openDeleteModal:function(t){var i="hustle-dialog--delete-schedule",n=Optin.template("hustle-delete-schedule-dialog-content-tpl"),s=e(t.currentTarget),a={id:s.data("id"),title:s.data("title"),description:s.data("description"),action:"delete",actionClass:"hustle-button-delete"},o=n(a),l=e("#"+i+" #hustle-delete-schedule-dialog-content");l.find("button.hustle-delete-confirm").length||l.append(o),e("#"+i+" #hustle-dialog--delete-schedule-title").html(a.title),e("#"+i+" #hustle-dialog--delete-schedule-description").html(a.description),SUI.replaceModal(i,"hustle-schedule-notice",void 0,!0),e("#hustle-delete-schedule-dialog-content").off("submit").on("submit",e.proxy(this.deactivateSchedule,this))},deactivateSchedule:function(e){e.preventDefault(),this.closeModal(),this.model.set("is_schedule","0"),this.model.userHasChange(),this.trigger("schedule:updated")},checkboxWithDependenciesChanged:function(t){var i=e(t.currentTarget),n=i.data("disable-on"),s=i.data("hide-on");if(n){var a=this.$('[data-checkbox-content="'.concat(n,'"]'));i.is(":checked")?(a.addClass("sui-disabled"),a.prop("disabled",!0),a.parent().hasClass("select-container")&&a.parent().addClass("sui-disabled")):(a.removeClass("sui-disabled"),a.prop("disabled",!1),a.parent().hasClass("select-container")&&a.parent().removeClass("sui-disabled"))}if(s){var o=this.$('[data-checkbox-content="'.concat(s,'"]'));i.is(":checked")?Module.Utils.accessibleHide(o):Module.Utils.accessibleShow(o)}},customTimezoneChanged:function(t){var i=e(t.currentTarget).val(),n=this.$("#hustle-custom-timezone-current-time"),s=this.getTimeToDisplay("custom",i);n.text(s)},closeModal:function(){e(".hustle-datepicker-field").datepicker("destroy"),SUI.closeModal()}})}),Hustle.define("Modals.Optin_Fields",function(){"use strict";return Backbone.View.extend({el:"#hustle-dialog--optin-fields",model:{},selectedFields:[],events:{"click .sui-box-selector input":"selectFields","click #hustle-insert-fields":"insertFields"},initialize:function(e){var t=this;this.model=e.model,this.selectedFields=[],this.$el.off("close").on("close",function(){return t.closeModalActions()})},selectFields:function(e){var t=this.$(e.target),i=t.val();this.$el.find('label[for="'+t.attr("id")+'"]').toggleClass("selected"),t.prop("checked")?this.selectedFields.push(i):this.selectedFields=_.without(this.selectedFields,i)},insertFields:function(e){var t=this.$(e.target);t.addClass("sui-button-onload"),this.trigger("fields:added",this.selectedFields),setTimeout(function(){t.removeClass("sui-button-onload"),SUI.closeModal()},300)},closeModalActions:function(){this.undelegateEvents(),this.stopListening();var e=Object.keys(this.model.get("form_elements")),t=".sui-box-selector";e.includes("recaptcha")&&(t+=":not(.hustle-optin-insert-field-label--recaptcha)"),e.includes("gdpr")&&(t+=":not(.hustle-optin-insert-field-label--gdpr)");var i=this.$el.find(t),n=i.find("input");setTimeout(function(){i.removeClass("selected"),n.prop("checked",!1),n[0].checked=!1},200)}})}),Hustle.define("Modals.PublishFlow",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--publish-flow",initialize:function(){},open:function(){var t=this.$("#hustle-dialog--publish-flow-icon");t.length||(t=e('<span id="hustle-dialog--publish-flow-icon" class="sui-lg" aria-hidden="true" style="margin-bottom: 20px;"></span>')).insertBefore("#hustle-dialog--publish-flow-title"),this.setLoading(),this.$(".sui-box").find(".sui-image").css("max-height",""),SUI.openModal("hustle-dialog--publish-flow",e(".hustle-publish-button")[0],this.$(".hustle-modal-close")[0],!0)},setLoading:function(){var e=this.$("#hustle-dialog--publish-flow-icon"),t=this.$(".sui-box"),i=this.$(".sui-box-header .hustle-modal-close"),n=this.$("#hustle-dialog--publish-flow-title"),s=this.$("#hustle-dialog--publish-flow-description"),a=this.$("#hustle-published-notice-with-schedule-end");e.removeClass("sui-icon-"+t.data("ready-icon")),e.addClass("sui-icon-"+t.data("loading-icon")),"loader"===t.attr("data-loading-icon")&&e.addClass("sui-loading"),n.text(t.data("loading-title")),s.text(t.data("loading-desc")),a.hide(),i.hide()},setPublished:function(e,t){var i=this.$("#hustle-dialog--publish-flow-icon"),n=this.$(".sui-box"),s=this.$(".sui-box-header .hustle-modal-close"),a=this.$("#hustle-dialog--publish-flow-title"),o=this.$("#hustle-dialog--publish-flow-description"),l=this.$("#hustle-published-notice-with-schedule-end"),r=e?n.data("ready-desc-alt"):n.data("ready-desc");i.removeClass("sui-icon-"+n.data("loading-icon")),i.addClass("sui-icon-"+n.data("ready-icon")),"loader"===n.attr("data-loading-icon")&&i.removeClass("sui-loading"),e&&t?(n.find(".sui-image").css("max-height","120px"),l.show()):l.hide(),a.text(n.data("ready-title")),o.text(r),a.focus(),s.show()}})}),Hustle.define("Modals.Visibility_Conditions",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--visibility-options",selectedConditions:[],opts:{groupId:0,conditions:[]},events:{"click .sui-box-selector input":"selectConditions"},initialize:function(t){e("#hustle-add-conditions").off("click").on("click",e.proxy(this.addConditions,this)),this.opts=_.extend({},this.opts,t),this.selectedConditions=this.opts.conditions,this.$(".hustle-visibility-condition-option").prop("checked",!1).prop("disabled",!1);var i,n=_createForOfIteratorHelper(this.selectedConditions);try{for(n.s();!(i=n.n()).done;){var s=i.value;this.$("#hustle-condition--"+s).prop("checked",!0).prop("disabled",!0)}}catch(e){n.e(e)}finally{n.f()}},selectConditions:function(e){var t=this.$(e.target),i=this.$el.find('label[for="'+t.attr("id")+'"]'),n=t.val();i.toggleClass("selected"),t.prop("checked")?this.selectedConditions.push(n):this.selectedConditions=_.without(this.selectedConditions,n)},addConditions:function(e){var t=this,i=this.$(e.target);i.addClass("sui-button-onload"),this.trigger("conditions:added",{groupId:this.opts.groupId,conditions:this.selectedConditions}),setTimeout(function(){SUI.closeModal(),i.removeClass("sui-button-onload"),t.undelegateEvents()},500)}})}),function(e){"use strict";Optin.listingBase=Hustle.View.extend({el:".sui-wrap-hustle",logShown:!1,moduleType:"",previewView:null,_events:{"click .hustle-create-module":"openCreateModal","click .hustle-manage-tracking-button":"openManageTrackingModal","click .hustle-import-module-button":"openImportModal","click .hustle-upgrade-modal-button":"openUpgradeModal","click .hustle-single-module-button-action":"handleSingleModuleAction","click .hustle-preview-module-button":"previewModule","click form.sui-bulk-actions .hustle-bulk-apply-button":"bulkActionCheck","click #hustle-dialog--delete .hustle-delete":"bulkActionSend","click #hustle-bulk-action-reset-tracking-confirmation .hustle-delete":"bulkActionSend","click .sui-accordion-item-action .hustle-onload-icon-action":"addLoadingIconToActionsButton"},initialize:function(t){this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents(),this.moduleType=t.moduleType;var i=Hustle.get("Modals.New_Module"),n=Hustle.get("Modals.ImportModule");this.newModuleModal=new i(this.moduleType,this.getPreviewView()),this.ImportModal=new n,e(".sui-accordion-item-header").on("click",e.proxy(this.openTrackingChart,this)),e(".hustle-display-chart").length&&this.openTrackingChart(e(".hustle-display-chart")),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if("true"===Module.Utils.getUrlParam("create-module")&&setTimeout(function(){e(".hustle-create-module").trigger("click")},100),"true"===Module.Utils.getUrlParam("requires-pro")){var t=this;setTimeout(function(){return t.openUpgradeModal()},100)}if(Module.Utils.getUrlParam("show-notice")){var i="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",n=Module.Utils.getUrlParam("notice"),s=n&&"undefined"!==optinVars.messages[n]?optinVars.messages[n]:Module.Utils.getUrlParam("notice-message"),a=Module.Utils.getUrlParam("notice-close",null),o="false"!==a&&a;void 0!==s&&s.length&&Module.Notification.open(i,s,o)}var l=Module.Utils.getUrlParam("view-stats");if(l){var r=e('.hustle-list .sui-accordion-item-header[data-id="'+l+'"]');r.trigger("click"),e("html, body").animate({scrollTop:r.closest(".sui-accordion-item").offset().top-40},1e3)}},handleSingleModuleAction:function(e){this.addLoadingIcon(e),Module.handleActions.initAction(e,"listing",this)},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.getPreviewView().open(i.data("id"),i.data("type"),i,{module_name:i.data("name")})},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},openTrackingChart:function(t){var i="";if(t.target){if(e(t.target).closest(".sui-accordion-item-action").length)return!0;t.preventDefault(),t.stopPropagation(),i=e(t.currentTarget)}else i=t;var n=this,s=i.parent(),a=s.find(".sui-chartjs-animated");if(s.hasClass("sui-accordion-item--disabled")?s.removeClass("sui-accordion-item--open"):s.hasClass("sui-accordion-item--open")?s.removeClass("sui-accordion-item--open"):s.addClass("sui-accordion-item--open"),s.find(".sui-accordion-item-data").addClass("sui-onload"),a.removeClass("sui-chartjs-loaded"),s.hasClass("sui-accordion-item--open")){var o={id:i.data("id"),_ajax_nonce:i.data("nonce"),action:"hustle_tracking_data"};e.ajax({url:ajaxurl,type:"POST",data:o,success:function(e){e.success&&e.data&&(s.find(".sui-accordion-item-body").html(e.data.html),n.trackingChart.init(s,e.data.charts_data),a=s.find(".sui-chartjs-animated"),SUI.suiTabs()),s.find(".sui-accordion-item-data").removeClass("sui-onload"),a.addClass("sui-chartjs-loaded")},error:function(){s.find(".sui-accordion-item-data").removeClass("sui-onload"),a.addClass("sui-chartjs-loaded")}})}},getChecked:function(t){var i=".sui-wrap-hustle .sui-accordion-item-title input[type=checkbox]";return"checked"===t&&(i+=":checked"),e(i)},bulkActionCheck:function(t){var i=e(t.target),n=i.closest(".hustle-bulk-actions-container").find('select[name="hustle_action"] option:selected').val();if(0===this.getChecked("checked").length||"undefined"===n)return!1;if("delete"===n){var s={actionClass:"hustle-delete",action:"delete",title:i.data("delete-title"),description:i.data("delete-description")};return Module.deleteModal.open(s,i[0]),!1}if("reset-tracking"===n){var a={actionClass:"hustle-delete",action:"reset-tracking",title:i.data("reset-title"),description:i.data("reset-description")};return Module.deleteModal.open(a,i[0]),!1}this.bulkActionSend(t,n)},bulkActionSend:function(t,i){t.preventDefault(),this.addLoadingIcon(t);var n=i||e(t.target).data("hustle-action"),s=this.getChecked("checked");if(0===s.length)return!1;var a=[];e.each(s,function(){a.push(e(this).val())});var o=e(".sui-bulk-actions .hustle-bulk-apply-button"),l={ids:a,hustle:n,type:o.data("type"),_ajax_nonce:o.data("nonce"),action:"hustle_listing_bulk"};e.ajax({url:ajaxurl,type:"POST",data:l,success:function(e){e.success?location.reload():SUI.closeModal()}})},addLoadingIcon:function(t){var i=e(t.currentTarget);i.hasClass("sui-button")&&i.addClass("sui-button-onload")},addLoadingIconToActionsButton:function(t){e(t.currentTarget).closest(".sui-accordion-item-action").find(".sui-dropdown-anchor").addClass("sui-button-onload")},openCreateModal:function(t){!1===e(t.currentTarget).data("enabled")?this.openUpgradeModal():this.newModuleModal.open()},openUpgradeModal:function(t){var i=this.$("#hustle-create-new-module")[0];t&&(t.preventDefault(),t.stopPropagation(),i=t.currentTarget),e(".sui-button-onload").removeClass("sui-button-onload"),e("#hustle-modal--upgrade-to-pro").length&&SUI.openModal("hustle-modal--upgrade-to-pro",i,"hustle-button--upgrade-to-pro",!0)},openImportModal:function(t){!1===e(t.currentTarget).data("enabled")?this.openUpgradeModal():this.ImportModal.open(t)},openManageTrackingModal:function(t){var i=Optin.template("hustle-manage-tracking-form-tpl"),n=e("#hustle-dialog--manage-tracking"),s=e(t.currentTarget),a=s.data("module-id"),o={enabledTrackings:s.data("tracking-types").split(",")};n.find("#hustle-manage-tracking-form-container").html(i(o)),n.find("#hustle-button-toggle-tracking-types").data("module-id",a),SUI.openModal("hustle-dialog--manage-tracking",s,"hustle-module-tracking--inline",!0)},trackingChart:{chartsData:{},theCharts:{},init:function(t,i){var n=this;t.find("select.hustle-conversion-type").each(function(i,s){SUI.suiSelect(s),e(s).on("change.select2",function(e){return n.conversionTypeChanged(e,t)})}),this.chartsData=i,Object.values(i).forEach(function(e){return n.updateChart(e)})},conversionTypeChanged:function(t,i){var n=e(t.currentTarget),s=n.val(),a=n.data("moduleType"),o=this.chartsData[a],l=i.find(".hustle-tracking-".concat(a,"-conversions-count")),r=i.find(".hustle-tracking-".concat(a,"-conversions-rate"));l.text(o[s].conversions_count),r.text(o[s].conversion_rate+"%"),this.updateChart(o,s,!1)},updateChart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all",i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e.views,s=[{label:"Submissions",data:e[t].conversions,backgroundColor:["#E1F6FF"],borderColor:["#17A8E3"],borderWidth:2,pointRadius:0,pointHitRadius:20,pointHoverRadius:5,pointHoverBorderColor:"#17A8E3",pointHoverBackgroundColor:"#17A8E3"},{label:"Views",data:n,backgroundColor:["#F8F8F8"],borderColor:["#DDDDDD"],borderWidth:2,pointRadius:0,pointHitRadius:20,pointHoverRadius:5,pointHoverBorderColor:"#DDDDDD",pointHoverBackgroundColor:"#DDDDDD"}];void 0!==this.theCharts[e.id]?i?(this.theCharts[e.id].destroy(),this.createNewChart(e,s)):(this.theCharts[e.id].data.datasets=s,this.theCharts[e.id].update()):this.createNewChart(e,s)},createNewChart:function(e,t){var i=Math.max.apply(Math,_toConsumableArray(e.views))+2,n=document.getElementById(e.id);if(Math.max.apply(Math,_toConsumableArray(e.views))<Math.max.apply(Math,_toConsumableArray(e.conversions))&&(i=Math.max.apply(Math,_toConsumableArray(e.conversions))+2),n){var s={labels:e.days,datasets:t},a={maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"}}],yAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"},ticks:{beginAtZero:!1,min:0,max:i,stepSize:1}}]},elements:{line:{tension:0},point:{radius:.5}},tooltips:{custom:function(e){e&&(e.displayColors=!1)},callbacks:{title:function(e){return 0===e[0].datasetIndex?optinVars.labels.submissions.replace("%d",e[0].yLabel):1===e[0].datasetIndex?optinVars.labels.views.replace("%d",e[0].yLabel):void 0},label:function(e){return e.xLabel},labelTextColor:function(){return"#AAAAAA"}}}};this.theCharts[e.id]=new Chart(n,{type:"line",fill:"start",data:s,options:a})}}}})}(jQuery),Hustle.define("Modals.New_Module",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--create-new-module",previewView:null,moduleType:"",moduleName:!1,moduleMode:"optin",moduleTemplate:"none",$moveForwardButton:null,data:{},mainDialogLabelId:"hustle-create-new-module-dialog-label",mainDialogDescriptionId:"hustle-create-new-module-dialog-description",events:{'keydown input[name="name"]':"nameChanged","click #hustle-create-module":"createModule",'change input[name="mode"]':"modeChanged","click #hustle-go-to-templates-button":"goToTemplatesStep","click .hustle-template-select-button":"createNonSshare","click .hustle-template-preview-button":"previewTemplate","click .hustle-modal-go-back":"goToStepOne"},initialize:function(e,t){this.moduleType=e,this.previewView=t;var i="social_sharing"!==this.moduleType?"#hustle-go-to-templates-button":"#hustle-create-module";this.$moveForwardButton=this.$(i)},open:function(){SUI.openModal("hustle-dialog--create-new-module","hustle-create-new-module","hustle-module-name"),"social_sharing"!==this.moduleType&&this.goToStepOne()},nameChanged:function(t){var i=this;setTimeout(function(){i.$(".sui-error-message").hide();var n=e(t.currentTarget).val().trim();0===n.length?(i.moduleName=!1,i.$moveForwardButton.prop("disabled",!0),i.$("#error-empty-name").closest(".sui-form-field").addClass("sui-form-field-error"),i.$("#error-empty-name").show()):(i.moduleName=n,i.$moveForwardButton.prop("disabled",!1),i.$("#error-empty-name").closest(".sui-form-field").removeClass("sui-form-field-error"),i.$("#error-empty-name").hide())},300)},modeChanged:function(t){var i=e(t.currentTarget).val();this.moduleMode=i},goToStepOne:function(e){var t=e?"back":null;this.$el.attr("aria-labelledby",this.mainDialogLabelId),this.$el.attr("aria-describedby",this.mainDialogDescriptionId),SUI.slideModal("hustle-create-new-module-step-1","hustle-module-name",t)},goToTemplatesStep:function(e){if(e.preventDefault(),this.isNameValid()&&this.isModeValid()){var t="optin"===this.moduleMode?"optin-templates":"informational-templates",i="hustle-create-new-module-dialog-step-".concat(t,"-label"),n="hustle-create-new-module-dialog-step-".concat(t,"-description");this.$el.attr("aria-labelledby",i),this.$el.attr("aria-describedby",n),SUI.slideModal("hustle-create-new-module-step-".concat(t),this.$el.find("#hustle-create-new-module-step-".concat(t," .hustle-template-option--none"))[0],"next")}},isNameValid:function(){return!1!==this.moduleName},isModeValid:function(){return"optin"===this.moduleMode||"informational"===this.moduleMode},createNonSshare:function(t){var i=e(t.currentTarget).data("template");this.moduleTemplate=i,this.createModule(t)},createModule:function(t){var i=this.$el.data("nonce"),n=this.$el.data("error-message"),s=e(t.currentTarget),a={module_name:this.moduleName,module_type:this.moduleType,module_mode:this.moduleMode,module_template:this.moduleTemplate,action:"hustle_create_new_module",_ajax_nonce:i};s.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:a}).done(function(e){e&&e.data&&e.data.redirect_url?window.location.replace(e.data.redirect_url):(s.removeClass("sui-button-onload"),Module.Notification.open("error",n,!1))}).fail(function(){s.removeClass("sui-button-onload"),Module.Notification.open("error",n,!1)})},previewTemplate:function(t){var i=e(t.currentTarget);this.previewView.open(0,i.data("module-type"),i,{module_name:i.data("name"),module_type:i.data("module-type"),template_name:i.data("template"),template_mode:i.data("module-mode")})}})}),Hustle.define("Modals.ImportModule",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--import",events:{"change #hustle-import-file-input":"selectUploadFile","click .sui-upload-file":"changeFile","click .sui-upload-file button":"resetUploadFile","click .hustle-import-check-all-checkbox":"checkAll","change .hustle-module-meta-checkbox":"uncheckAllOption"},initialize:function(){},open:function(t){var i=e(t.currentTarget),n=i.data("module-id"),s=Optin.template("hustle-import-modal-options-tpl"),a=e("#hustle-dialog--import"),o=a.find("#hustle-import-module-submit-button"),l=void 0===n,r={isNew:l,isOptin:"optin"===i.data("module-mode")};a.find("#hustle-import-modal-options").html(s(r)),l?(o.removeAttr("data-module-id"),SUI.tabs(),a.find(".sui-tab-item").on("click",function(){var t=e(this);e("#"+t.data("label-for")).click()})):o.attr("data-module-id",n),SUI.openModal("hustle-dialog--import",t.currentTarget,"hustle-import-file-input",!0)},selectUploadFile:function(t){t.preventDefault();var i=e(t.target).val().replace(/C:\\fakepath\\/i,"");SUI.closeNotice("hustle-dialog--import-error-notice"),i?(e(".sui-upload-file span:first").text(i),e(".sui-upload").addClass("sui-has_file"),e("#hustle-import-module-submit-button").prop("disabled",!1)):(e(".sui-upload").removeClass("sui-has_file"),e(".sui-upload-file span:first").text(""),e("#hustle-import-module-submit-button").prop("disabled",!0))},resetUploadFile:function(t){t.stopPropagation(),e("#hustle-import-file-input").val("").trigger("change")},changeFile:function(){e("#hustle-import-file-input").trigger("click")},checkAll:function(t){var i=e(t.currentTarget),n=i.is(":checked");i.closest(".hui-inputs-list").find("input.hustle-module-meta-checkbox:not(.hustle-import-check-all-checkbox)").prop("checked",n)},uncheckAllOption:function(t){var i=e(t.currentTarget).closest(".hui-inputs-list").find(".hustle-import-check-all-checkbox");i.is(":checked")&&i.prop("checked",!1)}})}),Hustle.define("Mixins.Model_Updater",function(e){"use strict";return{initMix:function(){this.events=_.extend({},this.events,this._events),this.delegateEvents()},_events:{"change textarea":"_updateText",'change input[type="text"]':"_updateText",'change input[type="url"]':"_updateText",'change input[type="hidden"]':"_updateText",'change input[type="number"]':"_updateText",'change input[type="checkbox"]':"_updateCheckbox","change input[type=radio]":"_updateRadios","change select":"_updateSelect"},_updateText:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,t.target.value,a))},_updateCheckbox:function(t){var i=e(t.target),n=i.data("attribute"),s=i.val(),a=this[i.data("model")||"model"],o=_.isTrue(i.data("silent"))?{silent:!0}:{};if(a&&n)if(t.stopPropagation(),"on"!==s){var l=[],r=a.get.call(a,n);i.is(":checked")?(l=_toConsumableArray(r)).push(s):l=_.without(r,s),a.set.call(a,n,l,o)}else a.set.call(a,n,i.is(":checked")?"1":"0",o)},_updateRadios:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,t.target.value,a))},_updateSelect:function(t){var i=e(t.target),n=i.data("attribute"),s=this[i.data("model")||"model"],a=_.isTrue(i.data("silent"))?{silent:!0}:{};s&&n&&(t.stopPropagation(),s.set.call(s,n,i.val(),a))}}}),Hustle.define("Mixins.Module_Settings",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-behaviour",events:{},triggersModel:null,init:function(e){var t=this,i=e.BaseModel.extend({defaults:{},initialize:function(e){_.extend(this,e);var i=Hustle.get("Models.Trigger");this.get("triggers")instanceof Backbone.Model||(this.set("triggers",new i(this.triggers),{silent:!0}),t.triggersModel=this.get("triggers"))}});this.model=new i(optinVars.current.settings||{}),this.moduleType=optinVars.current.data.module_type;var n=Hustle.get("Modals.EditSchedule");this.editScheduleView=new n({model:this.model}),this.listenTo(this.model,"change",this.viewChanged),"embedded"!==this.moduleType&&this.listenTo(this.model.get("triggers"),"change",this.triggersViewChanged),this.render()},render:function(){this.renderScheduleSection(),this.editScheduleView.on("schedule:updated",e.proxy(this.renderScheduleSection,this))},renderScheduleSection:function(){var t=this,i=Optin.template("hustle-schedule-row-tpl"),n=e("#hustle-schedule-row"),s=this.model.get("schedule"),a=Object.assign({},s),o={startDate:"",startTime:"",endDate:"",endTime:"",activeDays:"",activeTime:""},l=!1;if(a.is_schedule=this.model.get("is_schedule"),a.is_schedule){var r=Object.assign({},optinVars.schedule.months),d=optinVars.schedule.meridiem;if("0"===a.not_schedule_start){var c=a.start_date.split("/"),u=r[c[0]-1],h=d[a.start_meridiem_offset];o.startDate="".concat(c[1]," ").concat(u," ").concat(c[2]),o.startTime="(".concat(a.start_hour,":").concat(a.start_minute," ").concat(h,")")}if("0"===a.not_schedule_end){var p=a.end_date.split("/"),g=r[p[0]-1],f=d[a.end_meridiem_offset];o.endDate="".concat(p[1]," ").concat(g," ").concat(p[2]),o.endTime="(".concat(a.end_hour,":").concat(a.end_minute," ").concat(f,")"),l=this.isScheduleFinished(a)}if("week_days"===a.active_days){var m=optinVars.schedule.week_days,_=a.week_days.map(function(e){return m[e].toUpperCase()});o.activeDays=_.join(", ")}if("0"===a.is_active_all_day){var v=d[a.day_start_meridiem_offset],b=d[a.day_end_meridiem_offset],w="".concat(a.day_start_hour,":").concat(a.day_start_minute," ").concat(v),y="".concat(a.day_end_hour,":").concat(a.day_end_minute," ").concat(b);o.activeTime=w+" - "+y}}a.strings=o,a.hasFinished=l,n.html(i(a)),n.find(".hustle-button-open-schedule-dialog").on("click",function(){return t.editScheduleView.open()})},isScheduleFinished:function(e){var t=(new Date).getTime(),i=e.time_to_use,n=e.end_date,s=e.end_hour,a=e.end_minute,o=e.end_meridiem_offset,l="".concat(n," ").concat(s,":").concat(a," ").concat(o),r=!1,d=!1;if("server"===i)d=optinVars.schedule.wp_gmt_offset;else{var c=e.custom_timezone;if(c.includes("UTC")){var u=c.replace("UTC","");d=u.length?parseFloat(u):0}else{r=moment.tz(l,"MM/DD/YYYY hh:mm aa",c).format("x")}}if(!1===r&&!1!==d){var h=60*d,p=0<h?"+":"-",g=Math.abs(h),f=sprintf("%s%02d:%02d",p,g/60,g%60);r=moment.parseZone(l+" "+f,"MM/DD/YYYY hh:mm a Z").format("x")}return t>r},viewChanged:function(e){var t=e.changed;if("on_submit"in t){var i=this.$("#hustle-on-submit-delay-wrapper");i.length&&("nothing"!==t.on_submit?i.removeClass("sui-hidden"):i.addClass("sui-hidden"))}},triggersViewChanged:function(e){var t=e.changed;if("on_scroll"in t){var i=this.$("#hustle-on-scroll--scrolled-toggle-wrapper"),n=this.$("#hustle-on-scroll--selector-toggle-wrapper");(i.length||n.length)&&("scrolled"===t.on_scroll?(i.removeClass("sui-hidden"),n.addClass("sui-hidden")):(n.removeClass("sui-hidden"),i.addClass("sui-hidden")))}}})}),Hustle.define("Mixins.Module_Content",function(){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-content",events:{},init:function(e){this.model=new e.BaseModel(optinVars.current.content||{}),this.moduleType=optinVars.current.data.module_type,this.listenTo(this.model,"change",this.modelUpdated),this.render()},render:function(){this.initImageUploaders(),"true"===Module.Utils.getUrlParam("new")&&Module.Notification.open("success",optinVars.messages.module_created,1e4)},initImageUploaders:function(){for(var e=Hustle.get("imageUploader"),t=0,i=["feature_image","background_image"];t<i.length;t++){var n=i[t],s=this.$("#hustle-choose-"+n);s.length&&new e({el:s,model:this.model,attribute:n,moduleType:this.moduleType})}},modelUpdated:function(e){Hustle.Events.trigger("modules.view.contentUpdate",e.changed)}})}),Hustle.define("Mixins.Module_Design",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-appearance",cssEditor:!1,fontFamilies:{},fontFamiliesOptions:[],updatedProperties:{},contentPropIsShown:{title:!0,sub_title:!0,main_content:!0,feature_image:!0,background_image:!0,show_never_see_link:!0,show_cta:!0},events:{"click .hustle-css-stylable":"insertSelector","click .hustle-reset-settings-block > button":"resetSettingsBlock","change [data-link-fields]":"linkFieldsChanged","change [data-linked-fields]":"linkedFieldsChanged","change .hustle-font-family-select":"fontFamilyUpdated",'change select[name="feature_image_width_option"]':"updateFeatureImageWidth","click .sui-accordion-item":"initiateFontFamilySelectOnAccordionClick","click .hustle-button-apply-global-font":"applyGlobalFontClicked","change .hustle-required-field":"requiredFieldChanged"},init:function(t){this.model=new t.BaseModel(optinVars.current.design||{});var i=this,n="hustle-colorpickers-initialized";e("#tab-content-customize_colors-custom .sui-accordion-item").on("click",function(){var t=e(this),s=t.find(".sui-colorpicker-input");!t.hasClass(n)&&s.length&&(t.addClass(n),i.createPickers(s))}),this.$(".sui-accordion-item").on("click",function(){var t=e(this),i=t.find("select.none-sui:not([multiple])");!t.hasClass(n)&&i.length&&(t.addClass(n),i.removeClass("none-sui"),i.each(function(){SUI.suiSelect(this)}))}),this.beforeRender(),this.render()},beforeRender:function(){var e=this;this.listenTo(this.model,"change",this.modelUpdated),Hustle.Events.on("modules.view.contentUpdate",function(t){return e.contentModelUpdated(t)}),Hustle.Events.on("modules.view.emailsUpdate",function(t){return e.emailsModelUpdated(t)}),Hustle.Events.on("modules.view.integrationsUpdate",function(t){return e.integrationsModelUpdate(t)}),this.setFontFamilyOptions(),this.setVisibilityOnRender()},render:function(){this.toggleDeviceTabs(),this.toggleCtaButtonsTextAlignment(),this.setImageAligmentOptions(),this.toggleFeatureImageSizeSettingRow(),this.toggleFeatureImageSizeRows(),this.addCreatePalettesLink(),this.cssEditor=this.createEditor("hustle_custom_css"),this.setVanillaThemeVisibility(),this.hideOtherOptionsInAcordionItem("feature_image_hide_on_mobile","1"===this.model.get("feature_image_hide_on_mobile")),this.hideOtherOptionsInAcordionItem("feature_image_position",!this.contentPropIsShown.feature_image),optinVars.current.is_optin?(this.setSucccessfulMessageOptionVisibility(optinVars.current.emails),this.formFieldsUpdated(optinVars.current.emails),this.updateMailchimpRelatedAccordions(optinVars.current.integrations_settings)):this.handleStyleChange();var t=this;e.each(["title","sub_title","feature_image","background_image","show_cta","show_never_see_link","main_content"],function(e,i){t.updateElementsRow(i)})},setFontFamilyOptions:function(){var t=this;this.fetchFontFamilyOptions().done(function(i){t.fontFamilies=i.data,e.each(t.fontFamilies,function(e,i){t.fontFamiliesOptions.push({id:e,text:i.label})});var n=t.$('.hustle-font-family-select[name="global_font_family"]');t.initiateFontFamilySelects(n,!0),t.toggleCustomFontInput(n)})},fetchFontFamilyOptions:function(){var t={action:"hustle_fetch_font_families",_ajax_nonce:optinVars.typography.fetch_nonce};return e.post({url:ajaxurl,type:"post",data:t})},initiateFontFamilySelectOnAccordionClick:function(t){var i=this;e(t.currentTarget).find(".hustle-font-family-select").each(function(){i.initiateFontFamilySelects(e(this)),i.toggleCustomFontInput(e(this))})},initiateFontFamilySelects:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(!1===e.data("fonts-loaded")||t)&&(e.SUIselect2("destroy"),e.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:this.fontFamiliesOptions}),e.removeClass("sui-disabled"),e.prop("disabled",!1),e.data("fonts-loaded",!0))},fontFamilyUpdated:function(t){var i,n=e(t.currentTarget),s=n.data("weight"),a=this.$('[name="'.concat(s,'"]')),o=this.$('[name="'.concat(s,'_mobile"]')),l=n.val(),r=[];l&&(i=this.fontFamilies[l].variants);var d=!0;if(void 0!==i){var c,u=_createForOfIteratorHelper(i);try{for(u.s();!(c=u.n()).done;){var h=c.value;r.push({id:h,text:h,selected:d}),!0===d&&(d=!1)}}catch(e){u.e(e)}finally{u.f()}a.html(r),a.SUIselect2("destroy"),a.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:r}),o.html(r),o.SUIselect2("destroy"),o.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:r})}this.toggleCustomFontInput(n)},applyGlobalFontClicked:function(t){var i=this,n=e(t.currentTarget);n.addClass("sui-button-onload"),setTimeout(function(){i.applyGlobalFont(),n.removeClass("sui-button-onload"),Module.Notification.open("success",optinVars.typography.global_font_applied,4e3)},0)},applyGlobalFont:function(){var t,i=this,n=this.$('.hustle-font-family-select:not([name="global_font_family"])'),s=this.model.get("global_font_family"),a="custom"===s,o=this.model.get("global_custom_font_family");n.each(function(){var n=e(this);if(0===n.find('option[value="'+s+'"]').length?(t=new Option(s,s,!0,!1),n.empty().val(null).append(t)):n.val(s),n.trigger("change"),a){var l=n.data("custom");i.$('input[name="'.concat(l,'"]')).val(o).trigger("change")}i.toggleCustomFontInput(n)}),this.globalFontVariantsUpdated(s)},globalFontVariantsUpdated:function(e){var t=this.$(".hustle-font-weight"),i=this.fontFamilies[e].variants,n=[],s=!0;if(void 0!==i){var a,o=_createForOfIteratorHelper(i);try{for(o.s();!(a=o.n()).done;){var l=a.value;n.push({id:l,text:l,selected:s}),!0===s&&(s=!1)}}catch(e){o.e(e)}finally{o.f()}t.html(n),t.SUIselect2("destroy"),t.SUIselect2({dropdownCssClass:"sui-select-dropdown",data:n})}},toggleCustomFontInput:function(e){var t=e.val(),i=e.data("custom"),n=this.$('input[name="'.concat(i,'"]')).closest(".sui-form-field");"custom"===t?Module.Utils.accessibleShow(n):Module.Utils.accessibleHide(n)},toggleDeviceTabs:function(){var e=this.$("#hustle-device_settings-tabs > .sui-tabs-menu"),t=this.$("#hustle-device_settings-tabs > .sui-tabs-content"),i=this.$("#hustle-device_settings-tabs");"1"===this.model.get("enable_mobile_settings")?(i.addClass("hustle-mobile-enabled"),e.prop("aria-hidden",!1),e.prop("hidden",!1),t.find("#tab-content-device_settings-desktop").attr("role","tabpanel"),t.find("#tab-content-device_settings-mobile").prop("aria-hidden",!1)):(i.removeClass("hustle-mobile-enabled"),e.find("#tab-device_settings-desktop").trigger("click"),e.attr("aria-hidden",!0),e.attr("hidden",!0),t.find("#tab-content-device_settings-desktop").removeAttr("role"),t.find("#tab-content-device_settings-mobile").attr("aria-hidden",!0))},createPickers:function(t){var i=this;t.wpColorPicker({change:function(t,i){var n=e(this);n.val()!==i.color.toCSS()&&n.val(i.color.toCSS()).trigger("change")},palettes:["#333333","#FFFFFF","#17A8E3","#E1F6FF","#666666","#AAAAAA","#E6E6E6"]}),t.hasClass("wp-color-picker")&&t.each(function(){var t="hex",n=e(this),s=n.closest(".wp-picker-container").find(".wp-color-result"),a=s.find(".color-alpha"),o=n.closest(".sui-colorpicker-wrap"),l=o.find(".sui-colorpicker-value span[role=button]"),r=o.find(".sui-colorpicker-value"),d=r.find("button"),c=r.find(".hustle-colorpicker-input");!0===n.data("alpha")?(t="rgba",n.on("change",function(e,t){l.find("span").css({"background-color":a.css("background")}),void 0===t&&c.val(n.val())})):n.on("change",function(e,t){l.find("span").css({"background-color":s.css("background-color")}),void 0===t&&c.val(n.val())}),c.on("change",function(){n.val(c.val()),n.trigger("change",[{triggeredByUs:!0}])}),o.find(".sui-colorpicker").addClass("sui-colorpicker-"+t),o.find(".sui-button, span[role=button]").on("click",function(e){s.click(),e.preventDefault(),e.stopPropagation()}),d.on("click",function(e){return i.colorPickerCleared(e,n,i)})})},colorPickerCleared:function(e,t,i){var n=t.data("attribute"),s=i.model.get("color_palette"),a=optinVars.palettes[s][n],o=t.closest(".sui-colorpicker-wrap"),l=o.find(".sui-colorpicker-value"),r=o.find(".sui-colorpicker-value span[role=button]");t.closest(".wp-picker-container").find(".wp-picker-clear").click(),l.find("input").val(a),t.val(a).trigger("change"),r.find("span").css({"background-color":a}),e.preventDefault(),e.stopPropagation()},updatePickers:function(e){var t=this;if(void 0!==optinVars.palettes[e]){var i=optinVars.palettes[e];_.each(i,function(e,i){t.$('input[data-attribute="'+i+'"]').val(e).trigger("change")})}},resetSettingsBlock:function(t){var i=e(t.target);if(i.addClass("sui-button-onload").prop("disabled",!0),i.closest("#hustle-color-palette").length){var n=e('select[data-attribute="color_palette"]').val();this.updatePickers(n)}else{var s=i.closest(".sui-accordion"),a=jQuery.Event("click");a.currentTarget=s,this.initiateFontFamilySelectOnAccordionClick(a),s.find("[data-attribute]").each(function(){var t=e(this),i=t.attr("name");if(void 0!==optinVars.defaults[i]){var n=optinVars.defaults[i],s=t.parent(".sui-tabs");t.val(n),"radio"===t.prop("type")&&t.parent(".sui-tabs")?e("#tab-"+i+"-"+n,s).trigger("click"):t.trigger("sui:change").trigger("change")}})}setTimeout(function(){i.removeClass("sui-button-onload").prop("disabled",!1)},500)},addCreatePalettesLink:function(){var e=this.$("#hustle-create-palette-link"),t=this.$(".select-container.hui-select-palette .list-results");t.find(".hui-button").length||t.append(e)},createEditor:function(e){var t=ace.edit(e);return t.getSession().setMode("ace/mode/css"),t.$blockScrolling=1/0,t.setTheme("ace/theme/sui"),t.getSession().setUseWrapMode(!0),t.getSession().setUseWorker(!1),t.setShowPrintMargin(!1),t.renderer.setShowGutter(!0),t.setHighlightActiveLine(!0),t},updateCustomCss:function(){this.cssEditor&&this.model.set("custom_css",this.cssEditor.getValue())},insertSelector:function(t){var i=e(t.target).data("stylable")+"{}",n=this.cssEditor;n.navigateFileEnd(),n.insert(i),n.navigateLeft(1),n.focus(),t.preventDefault()},modelUpdated:function(){this.addUpdatedProperty(),this.updateViewOnModelUpdate()},addUpdatedProperty:function(){_.extend(this.updatedProperties,this.model.changed)},updateViewOnModelUpdate:function(){var e=this.model,t=Object.keys(e.changed)[0],i=this.getActionOnModelUpdated(t);void 0!==i&&i(t)},getActionOnModelUpdated:function(e){var t=this;return{color_palette:function(){return t.updatePickers(t.model.changed.color_palette)},cta_buttons_alignment:function(){return t.toggleCtaButtonsTextAlignment()},cta_buttons_alignment_mobile:function(){return t.toggleCtaButtonsTextAlignment()},enable_mobile_settings:function(){return t.toggleDeviceTabs()},feature_image_hide_on_mobile:function(e){return t.hideOtherOptionsInAcordionItem(e,"1"===t.model.get(e))},feature_image_fit:function(e){return t.toggleFeatureImageSizeSettingRow(e)},feature_image_fit_mobile:function(e){return t.toggleFeatureImageSizeSettingRow(e)},feature_image_position:function(){return t.toggleFeatureImageSizeRows()},form_layout:function(){t.setImageAligmentOptions(),t.toggleFeatureImageSizeRows()},style:function(){return t.handleStyleChange()},use_vanilla:function(){return t.setVanillaThemeVisibility()}}[e]},toggleCtaButtonsTextAlignment:function(){var e=this.$("#hustle-cta_alignment-form-field"),t=this.$("#hustle-cta_alignment_mobile-form-field");"full"===this.model.get("cta_buttons_alignment")?Module.Utils.accessibleShow(e):Module.Utils.accessibleHide(e),"full"===this.model.get("cta_buttons_alignment_mobile")?Module.Utils.accessibleShow(t):Module.Utils.accessibleHide(t)},hideOtherOptionsInAcordionItem:function(e,t){var i=this.$('[name="'+e+'"]').closest(".sui-box"),n=i.find(".sui-box-settings-row").slice(0,1),s=i.find(".sui-box-settings-row").slice(1);t?(s.addClass("sui-hidden-important"),n.addClass("hustle-no-bottom-line")):(s.removeClass("sui-hidden-important"),n.removeClass("hustle-no-bottom-line"))},toggleFeatureImageSizeSettingRow:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e||"feature_image_fit"===e){var t=this.$("#hustle-feature-image-size-settings-row");"none"!==this.model.get("feature_image_fit")?t.show():t.hide()}if(!e||"feature_image_fit_mobile"===e){var i=this.$("#hustle-feature-image-size-mobile-settings-row");"none"!==this.model.get("feature_image_fit_mobile")?i.show():i.hide()}},handleStyleChange:function(){var e=this.model.get("style"),t=this.$('[data-name="module_cont"]'),i=this.$('[data-name="layout_header"]'),n=this.$('[data-name="layout_content"]'),s=this.$('[data-name="layout_footer"]');"cabriolet"===e?t.find(".sui-accordion-item-title .sui-accordion-note").text(".hustle-layout-body"):t.find(".sui-accordion-item-title .sui-accordion-note").text(".hustle-layout"),"minimal"!==e?(Module.Utils.accessibleHide(n),Module.Utils.accessibleHide(s)):(Module.Utils.accessibleShow(n),Module.Utils.accessibleShow(s)),"simple"!==e?Module.Utils.accessibleShow(i):Module.Utils.accessibleHide(i)},setVanillaThemeVisibility:function(){var e=this.$('[data-toggle-content="use-vanilla"]'),t=this.$('[data-toggle-content="not-use-vanilla"]');"0"===this.model.get("use_vanilla")?(Module.Utils.accessibleShow(e,!0),Module.Utils.accessibleHide(t,!0)):(Module.Utils.accessibleHide(e,!0),Module.Utils.accessibleShow(t,!0))},linkFieldsChanged:function(t){var i=e(t.currentTarget);if("0"!==i.val()){var n=i.attr("name"),s=this.$("[data-linked-fields=".concat(n,"]")),a=s[0].value;s.val(a).trigger("change",{updatedByUs:!0})}},linkedFieldsChanged:function(t,i){if(!i){var n=e(t.currentTarget),s=n.data("linked-fields");if("1"===this.model.get(s))this.$("[data-linked-fields=".concat(s,"]")).val(n.val()).trigger("change",{updatedByUs:!0})}},requiredFieldChanged:function(t){var i=e(t.currentTarget);if(0===i.val().trim().length){var n=i.attr("name");void 0!==optinVars.defaults[n]&&i.val(optinVars.defaults[n])}},setImageAligmentOptions:function(){var e=this.$("#tab-feature_image_position-alignment-above"),t=this.$("#tab-feature_image_position-alignment-below");if("one"===this.model.get("form_layout"))Module.Utils.accessibleShow(e,!0),Module.Utils.accessibleShow(t,!0);else{var i=this.model.get("feature_image_position");"left"!==i&&"right"!==i&&(this.$("#tab-feature_image_position-alignment-left").trigger("click"),this.toggleFeatureImageSizeRows()),Module.Utils.accessibleHide(e,!0),Module.Utils.accessibleHide(t,!0)}},toggleFeatureImageSizeRows:function(){for(var e=this.$("#hustle-feature_image_width-row"),t=this.$("#hustle-feature-image-desktop-width-description"),i=this.$("#hustle-feature_image_height-row"),n=this.$("#hustle-feature-image-desktop-height-description"),s=this.model.get("form_layout"),a=function(){i.show(),n.show(),e.hide(),t.hide()},o=function(){i.hide(),n.hide(),e.show(),t.show()},l=!0,r=0,d=["title","sub_title","show_cta","main_content"];r<d.length;r++){var c=d[r];this.contentPropIsShown[c]&&(l=!1)}if(l&&"two"!==s&&"four"!==s)a();else if(optinVars.current.is_optin)if("three"!==s)if("four"!==s){var u=this.model.get("feature_image_position");"below"===u||"above"===u?a():o()}else l?o():(i.show(),n.hide(),e.show(),t.show());else a();else o()},updateFeatureImageWidth:function(t){var i=e(t.currentTarget).val(),n=this.$('input[name="feature_image_width"]');"custom"!==i?(this.$('select[name="feature_image_width_unit"]').val("%").trigger("sui:change").trigger("change"),n.prop("disabled",!0),n.val(i).trigger("change")):n.prop("disabled",!1)},contentModelUpdated:function(e){var t=Object.keys(e)[0],i=this.getActionOnContentModelUpdated(t);void 0!==i&&(i(e,t),this.toggleFeatureImageSizeRows(),this.updateElementsRow(t))},setVisibilityOnRender:function(){this.contentPropIsShown.feature_image=""!==optinVars.current.content.feature_image,this.contentPropIsShown.background_image=""!==optinVars.current.content.background_image,this.contentPropIsShown.show_cta="0"!==optinVars.current.content.show_cta,this.contentPropIsShown.title=""!==optinVars.current.content.title,this.contentPropIsShown.sub_title=""!==optinVars.current.content.sub_title,this.contentPropIsShown.show_never_see_link="0"!==optinVars.current.content.show_never_see_link,this.contentPropIsShown.optin_form=optinVars.current.is_optin,this.contentPropIsShown.main_content=""!==optinVars.current.content.main_content},getActionOnContentModelUpdated:function(e){var t=this;return{background_image:function(e){return t.contentPropIsShown.background_image=""!==e.background_image},feature_image:function(e){t.contentPropIsShown.feature_image=""!==e.feature_image,t.hideOtherOptionsInAcordionItem("feature_image_position",!t.contentPropIsShown.feature_image)},main_content:function(e){return t.contentPropIsShown.main_content=""!==e.main_content},show_cta:function(e){return t.contentPropIsShown.show_cta="0"!==e.show_cta},show_never_see_link:function(e){return t.contentPropIsShown.show_never_see_link="0"!==e.show_never_see_link},sub_title:function(e){return t.contentPropIsShown.sub_title=""!==e.sub_title},title:function(e){return t.contentPropIsShown.title=""!==e.title}}[e]},updateElementsRow:function(e){var t=this.$("#hustle-wizard-appearance-desktop, #hustle-wizard-appearance-mobiles").find('.sui-accordion-item[data-name="'.concat(e,'"]'));this.contentPropIsShown[e]?t.show():t.hide(),optinVars.current.is_optin?this.handleTypographyTabs(e):this.updateRow(e)},updateRow:function(t){var i=this;e.each({"hustle-typography-elements-row":["show_cta","title","sub_title","main_content"],"hustle-appearance-customize-elements-row":["feature_image","background_image","show_cta"]},function(n,s){if(s.includes(t)){var a,o=!1,l=_createForOfIteratorHelper(s);try{for(l.s();!(a=l.n()).done;){var r=a.value;i.contentPropIsShown[r]&&(o=!0)}}catch(e){l.e(e)}finally{l.f()}o?e("."+n).show():e("."+n).hide()}})},handleTypographyTabs:function(e){var t=["show_cta","title","sub_title","main_content"];if("embedded"!==optinVars.current.data.module_type&&t.push("show_never_see_link"),t.includes(e)){var i,n=this.$(".hustle-typography-tabs"),s=n.find(".sui-tabs-menu"),a=!1,o=_createForOfIteratorHelper(t);try{for(o.s();!(i=o.n()).done;){var l=i.value;this.contentPropIsShown[l]&&(a=!0)}}catch(e){o.e(e)}finally{o.f()}a?Module.Utils.accessibleShow(s):(Module.Utils.accessibleHide(s),n.find("#tab-custom-typography-optin").trigger("click"),n.find("#tab-custom-typography_mobile-optin").trigger("click"))}},emailsModelUpdated:function(e){var t=Object.keys(e)[0],i=this.getActionOnEmailsModelUpdated(t);void 0!==i&&i(e,t)},getActionOnEmailsModelUpdated:function(e){var t=this;return{form_elements:function(e){return t.formFieldsUpdated(e)},after_successful_submission:function(e){return t.setSucccessfulMessageOptionVisibility(e)}}[e]},setSucccessfulMessageOptionVisibility:function(e){var t=this.$('[data-name="success_message"]');t.length>0&&("show_success"===e.after_successful_submission?t.show():t.hide())},formFieldsUpdated:function(e){this.handleRecaptcha(e.form_elements),this.handleGdpr(e.form_elements),this.handleCalendar(e.form_elements)},handleRecaptcha:function(e){var t=this.$('[data-name="recaptcha"]'),i=!1;void 0!==e.recaptcha&&(i="v3_recaptcha"===e.recaptcha.version&&"0"===e.recaptcha.v3_recaptcha_show_badge||"v2_invisible"===e.recaptcha.version&&"0"===e.recaptcha.v2_invisible_show_badge),i?t.show():t.hide()},handleGdpr:function(e){var t=this.$('[data-name="gdpr"]');void 0!==e.gdpr?t.show():t.hide()},handleCalendar:function(e){var t=!1;for(var i in e){if("calendar"===e[i].type){t=!0;break}}t?this.$('[data-name="calendar"]').show():this.$('[data-name="calendar"]').hide()},integrationsModelUpdate:function(e){"active_integrations"in e.changed&&this.updateMailchimpRelatedAccordions(e.changed)},updateMailchimpRelatedAccordions:function(e){for(var t=e.active_integrations.split(",").includes("mailchimp"),i=0,n=["form_extras","checkbox","dropdown","select"];i<n.length;i++){var s=n[i];t?this.$('[data-name="'.concat(s,'"]')).show():this.$('[data-name="'.concat(s,'"]')).hide()}}})}),Hustle.define("Mixins.Module_Display",function(){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-display",events:{},init:function(e){this.model=new e.BaseModel(optinVars.current.display||{}),this.moduleType=optinVars.current.data.module_type,this.listenTo(this.model,"change",this.viewChanged),this.render()},render:function(){},viewChanged:function(){}})}),Hustle.define("Mixins.Module_Emails",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-wizard-emails",events:{"click .hustle-optin-field--add":"addFields","click .hustle-optin-field--edit":"editField","click .sui-builder-field":"maybeEditField","click .hustle-optin-field--delete":"deleteFieldOnClick","click ul.list-results li":"setFieldOption","click .hustle-optin-field--copy":"duplicateField"},init:function(e){this.model=new e.BaseModel(optinVars.current.emails||{}),this.listenTo(this.model,"change",this.modelUpdated),this.render()},render:function(){var t=this.model.get("form_elements");for(var i in t){var n=t[i];t[i]=_.extend({},this.getFieldDefaults(n.type),n),"submit"!==i&&this.addFieldToPanel(t[i])}this.model.set("form_elements",t,{silent:!0});var s=this.$("#hustle-form-fields-container").sortable({axis:"y",containment:".sui-box-builder"});return s.on("sortupdate",e.proxy(this.fieldsOrderChanged,this,s)),this.$("#hustle-email-day").datepicker({beforeShow:function(){e("#ui-datepicker-div").addClass("sui-calendar")},dateFormat:"MM dd, yy"}),this.$("#hustle-email-time").timepicker({timeFormat:"h:mm p",interval:"1",minTime:"0",maxTime:"11:59pm",defaultTime:null,startTime:"00:00",dynamic:!1,dropdown:!0,scrollbar:!0,change:function(){e("#hustle-email-time").trigger("change")}}),this.updateDynamicValueFields(),this},modelUpdated:function(e){var t=e.changed,i=Object.keys(t)[0],n=this.getActionOnModelUpdated(i);void 0!==n&&n(t),Hustle.Events.trigger("modules.view.emailsUpdate",t)},getActionOnModelUpdated:function(e){var t=this;return{auto_close_success_message:function(){return t.autoCloseSuccessMessageUpdated()},form_elements:function(){return t.updateDynamicValueFields()}}[e]},autoCloseSuccessMessageUpdated:function(){var e=this.$("#section-auto-close-success-message .sui-row");"1"===this.model.get("auto_close_success_message")?e.removeClass("sui-hidden"):e.addClass("sui-hidden")},resetDynamicValueFieldsPlaceholders:function(){this.$("select.hustle-field-options").html(""),this.$(".hustle-fields-placeholders-options").length&&this.$(".hustle-fields-placeholders-options").html("")},updateDynamicValueFields:function(){var t=this.model.get("form_elements");for(var i in this.resetDynamicValueFieldsPlaceholders(),t)"submit"!==i&&"recaptcha"!==i&&"gdpr"!==i&&(this.addFieldToDynamicValueFields(t[i]),this.$("select.hustle-field-options").trigger("sui:change"));this.$("div.select-list-container .list-results:empty").each(function(){var t=e(this).closest(".select-container").find("select.hustle-field-options").data("type");e(this).html('<li style="cursor: default; pointer-events: none;">'+optinVars.form_fields.no_fields_of_type_notice.replace("{field_type}",t)+"</li>")})},fieldsOrderChanged:function(e){var t,i=this.model.get("form_elements"),n=e.sortable("toArray",{attribute:"data-field-id"}),s={},a=_createForOfIteratorHelper(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;s[o]=i[o]}}catch(e){a.e(e)}finally{a.f()}s=_.extend({},s,i),this.model.set("form_elements",s)},addFields:function(t){SUI.openModal("hustle-dialog--optin-fields",e(t.currentTarget)[0],this.$("#hustle-dialog--optin-fields .sui-box-header .sui-button-icon")[0],!0),new(Hustle.get("Modals.Optin_Fields"))({model:this.model}).on("fields:added",e.proxy(this.addNewFields,this))},maybeEditField:function(t){e(t.target).closest(".sui-dropdown").length||this.editField(t)},editField:function(t){var i=e(t.target),n=i.closest(".sui-builder-field").data("field-id"),s=this.model.get("form_elements")[n],a=Object.assign({},this.getFieldViewDefaults(s.type),s);new(Hustle.get("Modals.Edit_Field"))({field:s,fieldData:a,model:this.model}).on("field:updated",e.proxy(this.formFieldUpdated,this)),SUI.openModal("hustle-dialog--edit-field",i[0],this.$("#hustle-dialog--edit-field .sui-box-header .sui-button-icon")[0],!0)},formFieldUpdated:function(e,t,i){if(Object.keys(t).length){if("name"in t)return this.addNewFields(e.type,e,i.name),void this.deleteField(i.name);var n=this.$("#hustle-optin-field--"+e.name);if("required"in t){var s=n.find(".sui-error"),a=e.required;_.isTrue(a)?s.show():_.isFalse(a)&&s.hide()}if("label"in t)this.updateDynamicValueFields(),n.find(".hustle-field-label-text").text(e.label)}},deleteFieldOnClick:function(t){var i=e(t.target).closest(".sui-builder-field").data("field-id");this.deleteField(i)},setFieldOption:function(t){var i=e(t.target),n=i.find("span:eq(1)").text();i.closest(".sui-insert-variables").find('input[type="text"]').val(n).trigger("change")},deleteField:function(t){var i=this.$("#hustle-optin-field--"+t),n=Object.assign({},this.model.get("form_elements"));delete n[t],this.model.set("form_elements",n),-1!==jQuery.inArray(t,["gdpr","recaptcha"])?(i.addClass("sui-hidden"),e("#hustle-optin-insert-field--"+t).prop("disabled",!1).prop("checked",!1)):i.remove()},duplicateField:function(t){var i=e(t.target).closest(".sui-builder-field").data("field-id"),n=Object.assign({},this.model.get("form_elements")),s=Object.assign({},n[i]);delete s.name,s.can_delete=!0,this.addNewFields(s.type,s)},addNewFields:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=Object.assign({},this.model.get("form_elements"));if(Array.isArray(e)){var s,a=_createForOfIteratorHelper(e);try{for(a.s();!(s=a.n()).done;){var o=s.value,l=this.getFieldDefaults(o);t&&o in t&&_.extend(l,t[o]),this.addFieldToPanel(l),n[l.name]=l}}catch(e){a.e(e)}finally{a.f()}}else{var r=this.getFieldDefaults(e);if(t&&_.extend(r,t),this.addFieldToPanel(r,i),null===i)n[r.name]=r;else{var d=[];jQuery.each(n,function(e,t){d[e]=t,e===i&&(d[r.name]=r)}),n=d}}this.model.set("form_elements",n)},addFieldToDynamicValueFields:function(t){var i;(i=e("<div>"+t.name+"</div>")).find("script").remove(),t.name=i.html(),(i=e("<div>"+t.label+"</div>")).find("script").remove(),t.label=i.html();var n=e("<option/>",{value:t.name,"data-content":"{"+t.name+"}"}).text(t.label),s='<li><button value="{'.concat(t.name,'}">').concat(t.label,"</button></li>");this.$('select.hustle-field-options:not([data-type]), select.hustle-field-options[data-type="'+t.type+'"]').append(n),this.$(".hustle-fields-placeholders-options").length&&this.$(".hustle-fields-placeholders-options").append(s)},addFieldToPanel:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=Optin.template("hustle-form-field-row-tpl"),s=this.$("#hustle-form-fields-container");if(t=_.extend({},this.getFieldViewDefaults(t.type),t),-1!==jQuery.inArray(t.type,["gdpr","recaptcha"]))this.$("#hustle-optin-field--"+t.type).removeClass("sui-hidden"),e("#hustle-optin-insert-field--"+t.type).prop("checked",!0).prop("disabled",!0);else if(null===i)s.append(n(t));else{var a=this.$("#hustle-optin-field--"+i);0<a.length?a.after(n(t)):s.append(n(t))}},getNewFieldId:function(e){for(var t=Object.assign({},this.model.get("form_elements")),i=e;i in t&&-1===jQuery.inArray(i,["gdpr","recaptcha","submit"]);)i=e+"-"+Math.floor(99*Math.random());return i},getFieldDefaults:function(e){var t=this.getNewFieldId(e),i={label:optinVars.form_fields.label[e+"_label"],required:"false",css_classes:"",type:e,name:t,required_error_message:optinVars.form_fields.required_error_message.replace("{field}",e),validation_message:optinVars.form_fields.validation_message.replace("{field}",e),placeholder:""};switch(e){case"timepicker":i.time_format="12",i.time_hours="9",i.time_minutes="30",i.time_period="am",i.validation_message=optinVars.form_fields.time_validation_message,i.required_error_message=optinVars.form_fields.is_required.replace("{field}",i.label),i.validate="false";break;case"datepicker":i.date_format="mm/dd/yy",i.validation_message=optinVars.form_fields.date_validation_message,i.required_error_message=optinVars.form_fields.is_required.replace("{field}",i.label),i.validate="false";break;case"recaptcha":i.threshold="0.5",i.version="v2_checkbox",i.recaptcha_type="compact",i.recaptcha_theme="light",i.v2_invisible_theme="light",i.recaptcha_language="automatic",i.v2_invisible_show_badge="1",i.v2_invisible_badge_replacement=optinVars.form_fields.recaptcha_badge_replacement,i.v3_recaptcha_show_badge="1",i.v3_recaptcha_badge_replacement=optinVars.form_fields.recaptcha_badge_replacement,i.validation_message=optinVars.form_fields.recaptcha_validation_message,i.error_message=optinVars.form_fields.recaptcha_error_message;break;case"gdpr":i.gdpr_message=optinVars.form_fields.gdpr_message,i.required="true",i.required_error_message=optinVars.form_fields.gdpr_required_error_message;break;case"email":i.validate="true";break;case"url":i.required_error_message=optinVars.form_fields.url_required_error_message,i.validate="true";break;case"phone":i.validate="false";break;case"hidden":i.default_value="user_ip",i.custom_value="";break;case"number":case"text":i.required_error_message=optinVars.form_fields.cant_empty}return i},getFieldViewDefaults:function(e){var t={required:"false",validated:"false",placeholder_placeholder:optinVars.form_fields.label.placeholder,label_placeholder:"",name_placeholder:"",icon:"send",css_classes:"",type:e,name:e,placeholder:optinVars.form_fields.label[e+"_placeholder"],can_delete:!0,fieldId:this.getNewFieldId(e)};switch(e){case"email":t.icon="mail";break;case"name":t.icon="profile-male";break;case"phone":t.icon="phone";break;case"address":t.icon="pin";break;case"url":t.icon="web-globe-world";break;case"text":t.icon="style-type";break;case"number":t.icon="element-number";break;case"timepicker":t.icon="clock";break;case"datepicker":t.icon="calendar";break;case"recaptcha":t.icon="recaptcha";break;case"gdpr":t.icon="gdpr";break;case"hidden":t.icon="eye-hide"}return t}})}),Hustle.define("Module.IntegrationsView",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-box-section-integrations",events:{"click .connect-integration":"connectIntegration","keypress .connect-integration":"preventEnterKeyFromDoingThings"},init:function(e){this.model=new e.BaseModel(optinVars.current.integrations_settings||{}),this.moduleId=optinVars.current.data.module_id,this.listenTo(this.model,"change",function(e){return Hustle.Events.trigger("modules.view.integrationsUpdate",e)}),this.listenTo(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.render()},render:function(){var e=this.$el.find("#hustle-not-connected-providers-section"),t=this.$el.find("#hustle-connected-providers-section");0<e.length&&0<t.length&&this.renderProvidersTables()},renderProvidersTables:function(){var t=this,i={};this.$el.find(".hustle-integrations-display").html('<div class="sui-notice hustle-integration-loading-notice">\n\t\t\t\t\t\t<div class="sui-notice-content">\n\t\t\t\t\t\t\t<div class="sui-notice-message">\n\n\t\t\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-loader sui-loading sui-md" aria-hidden="true"></span>\n\t\t\t\t\t\t\t\t<p>'.concat(optinVars.integrations.fetching_list,"</p>\n\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")),i.action="hustle_provider_get_form_providers",i._ajax_nonce=optinVars.integrations.action_nonce,i.data={moduleId:this.moduleId},e.post({url:ajaxurl,type:"post",data:i}).done(function(e){if(e&&e.success){var i=t.$el.find("#hustle-integrations-active-integrations"),n=t.$el.find("#hustle-integrations-active-count");t.$el.find("#hustle-not-connected-providers-section").html(e.data.not_connected),t.$el.find("#hustle-connected-providers-section").html(e.data.connected),i.val()!==e.data.list_connected&&i.val(e.data.list_connected).trigger("change"),n.val()!==String(e.data.list_connected_total)&&n.val(e.data.list_connected_total).trigger("change")}}).always(function(){t.$el.find(".sui-box-body").removeClass("sui-block-content-center"),t.$el.find(".hustle-integration-loading-notice").remove()})},preventEnterKeyFromDoingThings:function(e){13===e.which&&e.preventDefault()},connectIntegration:function(e){Module.integrationsModal.open(e)}}))}),Hustle.define("Mixins.Module_Visibility",function(e){"use strict";return _.extend({},Hustle.get("Mixins.Model_Updater"),{el:"#hustle-conditions-group",events:{"click .hustle-add-new-visibility-group":"addNewGroup","click .hustle-choose-conditions":"openConditionsModal","click .hustle-remove-visibility-group":"removeGroup","change .visibility-group-filter-type":"updateAttribute","change .visibility-group-show-hide":"updateAttribute","change .visibility-group-apply-on":"updateGroupApplyOn"},init:function(t){var i=t.BaseModel.extend({defaults:{conditions:""},initialize:function(e){if(_.extend(this,e),!(this.get("conditions")instanceof Backbone.Model)){_.isEmpty(this.get("conditions"))&&_.isArray(this.get("conditions"))&&(this.conditions={});var t=Hustle.get("Model");this.set("conditions",new t(this.conditions),{silent:!0})}}});this.model=new i(optinVars.current.visibility||{}),this.moduleType=optinVars.current.data.module_type,this.activeConditions={},this.render(),e("#hustle-general-conditions").on("click",e.proxy(this.switchConditions,this)),e("#hustle-wc-conditions").on("click",e.proxy(this.switchConditions,this)),this.groupId=""},render:function(){var t=this.model.get("conditions").toJSON();if(e.isEmptyObject(t))this.addNewGroup();else{for(var i in t){var n=this.model.get("conditions."+i);n instanceof Backbone.Model||(_.isEmpty(n)&&_.isArray(n)&&(n={}),n=this.getConditionsGroupModel(n),this.model.set("conditions."+i,n,{silent:!0})),this.addGroupToPanel(n,"render")}this.maybeToggleGroupsBin()}},afterRender:function(){this.bindRemoveConditions()},bindRemoveConditions:function(){e("#hustle-conditions-group .hustle-remove-visibility-condition").off("click").on("click",e.proxy(this.removeCondition,this))},openConditionsModal:function(t){var i=e(t.currentTarget),n=i.data("group-id"),s=this.model.get("conditions."+n),a=void 0!==s?Object.keys(s.toJSON()):[];new(Hustle.get("Modals.Visibility_Conditions"))({groupId:n,conditions:a}).on("conditions:added",e.proxy(this.addNewConditions,this)),this.groupId=n,SUI.openModal("hustle-dialog--visibility-options",i[0],this.$("#hustle-dialog--visibility-options .sui-box-header .sui-button-icon")[0],!0)},addNewConditions:function(t){var i=this,n=t.groupId,s=t.conditions,a=this.model.get("conditions."+n);e.each(s,function(e,t){if(a.get(t))return!0;i.addConditionToPanel(t,{},n,a,"new")}),this.bindRemoveConditions(),Hustle.Events.trigger("view.rendered",this)},addGroupToPanel:function(t,i){var n=t.get("group_id"),s=e("#hustle-visibility-conditions-box"),a=Optin.template("hustle-visibility-group-box-tpl")(_.extend({},{groupId:n,apply_on_floating:t.get("apply_on_floating"),apply_on_inline:t.get("apply_on_inline"),apply_on_widget:t.get("apply_on_widget"),apply_on_shortcode:t.get("apply_on_shortcode"),show_or_hide_conditions:t.get("show_or_hide_conditions"),filter_type:t.get("filter_type")}));e(a).insertBefore(s.find(".hustle-add-new-visibility-group")),this.activeConditions[n]={};var o=this,l=t.toJSON();e.each(l,function(e,s){if("object"!==_typeof(s))return!0;o.addConditionToPanel(e,s,n,t,i)})},addConditionToPanel:function(t,i,n,s,a){if(void 0!==Optin.View.Conditions[t]){var o=new Optin.View.Conditions[t]({type:this.moduleType,model:s,groupId:n,source:a});if(o){var l=this.$("#hustle-visibility-group-"+n+" .sui-box-builder-body");return l.find(".sui-builder-field").length||(l.find(".sui-box-builder-message-block").hide(),l.find(".sui-button-dashed").show()),e.isEmptyObject(i)?s.set(t,o.getConfigs()):s.set(t,i),this.activeConditions[n][t]=o,e(o.$el).appendTo(l.find(".sui-builder-fields")),o}}},addNewGroup:function(){var e=this.getConditionsGroupModel(),t=e.get("group_id");this.model.set("conditions."+t,e),this.addGroupToPanel(e,"new"),this.maybeToggleGroupsBin(),Hustle.Events.trigger("view.rendered",this)},switchConditions:function(t){t.preventDefault(),"hustle-wc-conditions"===e(t.currentTarget).prop("id")?(e("#hustle-dialog--visibility-options .general_condition").hide(),e("#hustle-dialog--visibility-options .wc_condition").show()):(e("#hustle-dialog--visibility-options .wc_condition").hide(),e("#hustle-dialog--visibility-options .general_condition").show())},removeGroup:function(t){var i=e(t.currentTarget).data("group-id"),n=this.$("#hustle-visibility-group-"+i);delete this.activeConditions[i],this.model.get("conditions").unset(i),n.remove(),Object.keys(this.activeConditions).length||this.addNewGroup(),this.maybeToggleGroupsBin()},removeCondition:function(t){var i=e(t.currentTarget),n=i.data("condition-id"),s=i.data("group-id"),a=this.$("#hustle-visibility-group-"+s+" .sui-box-builder-body");this.activeConditions[s][n].remove(),delete this.activeConditions[s][n],this.model.get("conditions."+s).unset(n),a.find(".sui-builder-field").length||a.find(".sui-box-builder-message-block").show(),this.bindRemoveConditions()},updateAttribute:function(t){t.stopPropagation();var i=e(t.target),n=i.data("group-id"),s=i.data("group-attribute"),a=i.val();this.model.get("conditions."+n).set(s,a)},updateGroupApplyOn:function(t){t.stopPropagation();var i=e(t.target),n=i.data("group-id"),s=i.data("property"),a=i.is(":checked"),o=this.model.get("conditions."+n);("embedded"===this.moduleType&&-1!==e.inArray(s,["apply_on_inline","apply_on_widget","apply_on_shortcode"])||"social_sharing"===this.moduleType&&-1!==e.inArray(s,["apply_on_floating","apply_on_inline","apply_on_widget","apply_on_shortcode"]))&&o.set(s,a)},getConditionsGroupModel:function(e){if(e)"embedded"!==this.moduleType||e.apply_on_inline&&e.apply_on_widget&&e.apply_on_shortcode?"social_sharing"!==this.moduleType||e.apply_on_floating&&e.apply_on_inline&&e.apply_on_widget&&e.apply_on_shortcode||(e.apply_on_floating||(e.apply_on_floating=!0),e.apply_on_inline||(e.apply_on_inline=!0),e.apply_on_widget||(e.apply_on_widget=!0),e.apply_on_shortcode||(e.apply_on_shortcode=!1)):(e.apply_on_inline||(e.apply_on_inline=!0),e.apply_on_widget||(e.apply_on_widget=!0),e.apply_on_shortcode||(e.apply_on_shortcode=!1));else{var t=(new Date).getTime().toString(16);this.model.get("conditions."+t),e={group_id:t,show_or_hide_conditions:"show",filter_type:"all"},"embedded"===this.moduleType?(e.apply_on_inline=!0,e.apply_on_widget=!0,e.apply_on_shortcode=!1):"social_sharing"===this.moduleType&&(e.apply_on_floating=!0,e.apply_on_inline=!0,e.apply_on_widget=!0,e.apply_on_shortcode=!1)}return new(Hustle.get("Model"))(e)},maybeToggleGroupsBin:function(){var t=this.model.get("conditions"),i=e("#hustle-conditions-group .sui-box-builder-header .hustle-remove-visibility-group");1===Object.keys(t.toJSON()).length?Module.Utils.accessibleHide(i):Module.Utils.accessibleShow(i)}})}),Hustle.define("Mixins.Wizard_View",function(e,t,i){"use strict";return{moduleType:"",el:".sui-wrap-hustle",publishModal:{},previewView:null,events:{"click .sui-sidenav .sui-vertical-tab a":"sidenav","change select.sui-mobile-nav":"sidenavMobile","click a.hustle-go-to-tab":"sidenav","click a.notify-error-tab":"sidenav","click .hustle-action-save":"saveChanges","click .wpmudev-button-navigation":"doButtonNavigation","change #hustle-module-name":"updateModuleName","click #hustle-preview-module":"previewModule","blur input.sui-form-control":"removeErrorMessage","click .hustle-single-module-button-action":"handleSingleModuleAction"},init:function(t){var n=this;this.setTabsViews(t),Hustle.Events.on("modules.view.switch_status",function(e){return n.switchStatusTo(e)}),e(i).off("popstate",e.proxy(this.updateTabOnPopstate,this)),e(i).on("popstate",e.proxy(this.updateTabOnPopstate,this)),e(document).off("tinymce-editor-init",e.proxy(this.tinymceReady,this)),e(document).on("tinymce-editor-init",e.proxy(this.tinymceReady,this)),void 0!==this._events&&(this.events=e.extend(!0,{},this.events,this._events),this.delegateEvents());var s=Hustle.get("Modals.PublishFlow");return this.publishModal=new s,this.renderTabs(),this},setTabsViews:function(e){this.contentView=e.contentView,this.emailsView=e.emailsView,this.designView=e.designView,this.integrationsView=e.integrationsView,this.visibilityView=e.visibilityView,this.settingsView=e.settingsView,this.moduleType=this.model.get("module_type"),"embedded"===this.moduleType&&(this.displayView=e.displayView)},renderTabs:function(){this.contentView.delegateEvents(),this.emailsView.delegateEvents(),this.integrationsView.delegateEvents(),this.designView.delegateEvents(),"embedded"===this.moduleType&&this.displayView.delegateEvents(),this.visibilityView.delegateEvents(),this.visibilityView.afterRender(),this.settingsView.delegateEvents()},sidenav:function(t){t.preventDefault();var i=e(t.target).data("tab");i&&this.goToTab(i,!0)},sidenavMobile:function(t){var i=e(t.currentTarget).val();i&&this.goToTab(i,!0)},goToTab:function(t,i){var n=this.$el.find('a[data-tab="'+t+'"]'),s=n.closest(".sui-vertical-tabs").find(".sui-vertical-tab a"),a=this.$el.find(".sui-box[data-tab]"),o=this.$el.find('.sui-box[data-tab="'+t+'"]');if(i){var l={tabName:t},r=this.model.get("module_id");history.pushState(l,"Hustle "+this.moduleType+" wizard","admin.php?page="+optinVars.current.wizard_page+"&id="+r+"&section="+t)}s.removeClass("current"),a.hide(),n.addClass("current"),o.show(),e(".sui-wrap-hustle")[0].scrollIntoView()},updateTabOnPopstate:function(e){var t=e.originalEvent.state;t&&this.goToTab(t.tabName)},doButtonNavigation:function(t){t.preventDefault();var i="prev"===e(t.target).data("direction")?"prev":"next",n=this.getNextOrPrevTabName(i);this.goToTab(n,!0)},getNextOrPrevTabName:function(t){var i=e("#hustle-module-wizard-view .sui-sidenav ul li a.current");i.data("tab");return"prev"===t?i.parent().prev().find("a").data("tab"):i.parent().next().find("a").data("tab")},tinymceReady:function(e,t){var i=this;t.on("change",function(){("main_content"===t.id?i.contentView.model:i.emailsView.model).set(t.id,t.getContent())})},setContentFromTinymce:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("social_sharing"!==this.moduleType&&"undefined"!=typeof tinyMCE){var t=tinyMCE.get("main_content"),i=this.$("textarea#main_content"),n="true"===i.attr("aria-hidden")?t.getContent():i.val();this.contentView.model.set("main_content",n,{silent:e});var s=tinyMCE.get("success_message"),a=this.$("textarea#success_message"),o="true"===a.attr("aria-hidden")?s.getContent():a.val();this.emailsView.model.set("success_message",o,{silent:e});var l=tinyMCE.get("email_body"),r=this.$("textarea#email_body"),d="true"===a.attr("aria-hidden")?l.getContent():r.val();this.emailsView.model.set("email_body",d,{silent:e})}},sanitizeData:function(){var e=this.contentView.model.get("cta_url");0!==e.indexOf("mailto:")&&0!==e.indexOf("tel:")&&(/^(f|ht)tps?:\/\//i.test(e)||(e="https://"+e,this.contentView.model.set("cta_url",e,{silent:!0})))},save:function(){this.setContentFromTinymce(!0),this.sanitizeData();var t=this.$el.find("#hustle-module-wizard-view"),i=t.data("id"),n={action:"hustle_save_module",_ajax_nonce:t.data("nonce"),id:i,module:this.model.toJSON()};return _.extend(n,this.getDataToSave()),e.ajax({url:ajaxurl,type:"POST",data:n,dataType:"json"})},getDataToSave:function(){var e={content:this.contentView.model.toJSON(),emails:this.emailsView.model.toJSON(),design:this.designView.updatedProperties,integrations_settings:this.integrationsView.model.toJSON(),visibility:this.visibilityView.model.toJSON(),settings:this.settingsView.model.toJSON()};return e.design.custom_css=this.designView.cssEditor.getValue(),"embedded"===this.moduleType&&(e.display=this.displayView.model.toJSON()),e},saveChanges:function(t){var i=this;t.preventDefault();var n=this.model.get("active"),s=e(t.currentTarget),a=String(s.data("active")),o=a!==n,l="0"!==a;this.disableButtonsOnSave(s),o&&l&&this.publishModal.open(),this.model.set("active",a,{silent:!0}),this.save().done(function(t){if(!0===t.success){if(Module.hasChanges=!1,i.switchStatusTo("saved"),o){if(l){var n="social_sharing"!==i.model.get("module_type")&&"1"===i.settingsView.model.get("is_schedule"),s=!1;if(n)s="1"!==i.settingsView.model.get("schedule").not_schedule_end;i.publishModal.setPublished(n,s)}i.updateViewOnActiveChange()}}else{var a=t.data,r="";void 0===a.data?r=optinVars.messages.module_error_reload:(void 0!==a.data.icon_error?(_.each(a.data.icon_error,function(t){e("#hustle-platform-"+t).find(".sui-error-message").show(),e("#hustle-platform-"+t+" .hustle-social-url-field").addClass("sui-form-field-error"),e("#hustle-platform-"+t).not(".sui-accordion-item--open").find(".sui-accordion-open-indicator").click()}),r='<a href="#" data-tab="services" class="notify-error-tab"> '+optinVars.module_tabs.services+" </a>"):void 0!==a.data.selector_error&&(_.each(a.data.selector_error,function(t){e('input[name="'+t+'_css_selector"]').siblings(".sui-error-message").show(),e('input[name="'+t+'_css_selector"]').parent(".sui-form-field").addClass("sui-form-field-error")}),_.isEmpty(r)||(r+=" and "),r=r+'<a href="#" data-tab="display" class="notify-error-tab"> '+optinVars.module_tabs.display+" </a>"),r=optinVars.messages.module_error.replace("{page}",r)),i.switchStatusTo("unsaved"),Module.Notification.open("error",r,!1)}}).always(function(){i.enableSaveButtons()})},updateModuleName:function(t){var i=e(t.target).val();if(i.length)this.$("#hustle-module-name-wrapper").removeClass("sui-form-field-error"),this.$("#hustle-module-name-error").hide(),this.$("#hustle-module-name-error").html(""),this.model.set("module_name",i);else{var n=this.$("#hustle-module-name-error").data("error-message");this.$("#hustle-module-name-wrapper").addClass("sui-form-field-error"),this.$("#hustle-module-name-error").html(n),this.$("#hustle-module-name-error").show()}},disableButtonsOnSave:function(e){e.addClass("sui-button-onload"),this.$(".hustle-action-save").prop("disabled",!0),this.$(".wpmudev-button-navigation").prop("disabled",!0)},enableSaveButtons:function(){this.$(".sui-button-onload").removeClass("sui-button-onload"),this.$(".hustle-action-save").prop("disabled",!1),this.$(".wpmudev-button-navigation").prop("disabled",!1)},switchStatusTo:function(e){"saved"===e?(this.$el.find("#hustle-unsaved-changes-status").addClass("sui-hidden"),this.$el.find("#hustle-saved-changes-status").removeClass("sui-hidden")):(this.$el.find("#hustle-unsaved-changes-status").removeClass("sui-hidden"),this.$el.find("#hustle-saved-changes-status").addClass("sui-hidden"))},updateViewOnActiveChange:function(){var e="1"===this.model.get("active"),t=this.$(".sui-status-module .sui-tag"),i=e?optinVars.messages.commons.published:optinVars.messages.commons.draft;t.text(i),e?t.addClass("sui-tag-blue"):t.removeClass("sui-tag-blue");var n=this.$("#hustle-draft-button-save-draft-text"),s=this.$("#hustle-draft-button-unpublish-text");e?(n.addClass("sui-hidden-important"),s.removeClass("sui-hidden-important")):(n.removeClass("sui-hidden-important"),s.addClass("sui-hidden-important"));var a=this.$(".hustle-publish-button"),o=e?a.data("update"):a.data("publish");a.find(".button-text").text(o)},removeErrorMessage:function(t){if(t.target.value){var i=e(t.target).parent(".sui-form-field");i.removeClass("sui-form-field-error"),i.find(".sui-error-message").hide()}},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.setContentFromTinymce(!0),this.sanitizeData();var n=_.extend({},this.model.toJSON(),this.getDataToSave()),s=n.module_name.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");n.module_name=s,this.getPreviewView().open(this.model.get("module_id"),this.model.get("module_type"),i,n)},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},previewModuleold:function(t){t.preventDefault(),this.setContentFromTinymce(!0),this.sanitizeData();var i=e(t.currentTarget),n=this.model.get("module_id"),s=_.extend({},this.model.toJSON(),this.getDataToSave());i.addClass("sui-button-onload"),Module.preview.open(n,i,s)},handleSingleModuleAction:function(e){Module.handleActions.initAction(e,"listing",this)}}}),Hustle.define("Settings.Palettes",function(e){"use strict";return Backbone.View.extend({el:"#palettes-box",events:{"click .hustle-create-palette":"openCreatePaletteModal","click .hustle-delete-button":"openDeletePaletteModal","click .hustle-button-delete":"delettePalette"},initialize:function(){var e=Hustle.get("Settings.Palettes_Modal");this.paletteModal=new e},openCreatePaletteModal:function(e){this.paletteModal.open(e)},openDeletePaletteModal:function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),title:i.data("title"),description:i.data("description"),action:"delete",nonce:i.data("nonce"),actionClass:"hustle-button-delete"};Module.deleteModal.open(n,i[0]),e(".hustle-button-delete").on("click",e.proxy(this.delettePalette,this))},delettePalette:function(t){t.preventDefault();var i=e(t.currentTarget),n=i.data("form-id"),s=i.data(),a=e("#"+n),o=new FormData(a[0]);e.each(s,function(e,t){return o.append(e,t)}),o.append("_ajax_nonce",optinVars.settings_palettes_action_nonce),o.append("action","hustle_handle_palette_actions"),e.ajax({url:ajaxurl,type:"POST",data:o,contentType:!1,processData:!1}).done(function(t){t.data.url?location.replace(t.data.url):t.data.notification&&Module.Notification.open(t.data.notification.status,t.data.notification.message,t.data.notification.delay),t.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){Module.Notification.open("error",optinVars.messages.commons.generic_ajax_error),e(".sui-button-onload").removeClass("sui-button-onload")})}})}),Hustle.define("Settings.Data_Settings",function(e){"use strict";return Backbone.View.extend({el:"#data-box",events:{"click #hustle-dialog-open--reset-data-settings":"dataDialog"},dataDialog:function(t){t.preventDefault();var i=this.$(t.target),n=e("#hustle-dialog--reset-data-settings");SUI.openModal("hustle-dialog--reset-data-settings",i[0],n.find(".sui-box-header .sui-button-icon")[0],!0),e("#hustle-reset-settings").off("click").on("click",e.proxy(this.settingsReset))},settingsReset:function(t){var i=e(t.currentTarget),n=i.closest(".sui-modal").find("button, .sui-button");n.prop("disabled",!0),i.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_reset_settings",_ajax_nonce:i.data("nonce")},success:function(){e("#"+i.data("notice")).show(),SUI.closeModal(),i.removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("success",optinVars.messages.settings_was_reset),window.setTimeout(function(){return location.reload(!0)},2e3)},error:function(){SUI.closeModal(),i.removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("error",optinVars.messages.something_went_wrong)}})}})}),Hustle.define("Settings.Palettes_Modal",function(e){"use strict";return Backbone.View.extend({el:"#hustle-dialog--edit-palette",events:{"click .hustle-button-action":"handleAction","click .hustle-modal-close":"closeCreatePaletteModal","change #hustle-palette-module-type":"updateModulesOptions"},initialize:function(){},open:function(t){void 0!==e(t.currentTarget).data("slug")?this.handleAction(t):(this.$("#hustle-palette-module-type").trigger("change"),SUI.openModal("hustle-dialog--edit-palette",t.currentTarget,"hustle-palette-name",!1))},handleAction:function(t){t.preventDefault();var i=this,n=e(t.currentTarget),s=n.data("form-id");n.addClass("sui-button-onload"),Module.Utils.accessibleHide(this.$(".sui-error-message"));var a=new FormData,o=!1;if(void 0!==s){var l=e("#"+s);l.length&&(a=new FormData(l[0]),l.find(".hustle-required-field").each(function(t,i){var n=e(i);if(!n.val().trim().length){var s=n.data("error-message"),a=n.siblings(".sui-error-message");a.html(s),Module.Utils.accessibleShow(a),o=!0}}))}if(o)e(".sui-button-onload").removeClass("sui-button-onload");else{var r=n.data();e.each(r,function(e,t){return a.append(e,t)}),a.append("_ajax_nonce",optinVars.settings_palettes_action_nonce),a.append("action","hustle_handle_palette_actions"),e.ajax({url:ajaxurl,type:"POST",data:a,contentType:!1,processData:!1}).done(function(n){n.data.callback&&"function"==typeof i[n.data.callback]?i[n.data.callback](n.data,n.success,t):n.data.url?location.replace(n.data.url):n.data.notification&&Module.Notification.open(n.data.notification.status,n.data.notification.message,n.data.notification.delay),n.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload")})}},actionOpenEditPalette:function(t,i,n){this.actionGoToSecondStep(t),SUI.openModal("hustle-dialog--edit-palette",n.currentTarget,"hustle-palette-name",!1),t.palette_data.name&&e("#hustle-dialog--edit-palette").find("#hustle-palette-name").val(t.palette_data.name)},actionGoToSecondStep:function(e){var t=this.$("#hustle-edit-palette-first-step"),i=this.$("#hustle-edit-palette-second-step"),n=this.$(".hustle-button-action"),s=e.palette_data,a=Optin.template("hustle-dialog--edit-palette-tpl");Module.Utils.accessibleHide(t,!0),i.html(a(s)),this.initiateSecondStepElements(),Module.Utils.accessibleShow(i,!0),i.focus(),n.data("step",3),n.addClass("sui-button-blue"),Module.Utils.accessibleHide(n.find("#hustle-step-button-text")),Module.Utils.accessibleShow(n.find("#hustle-finish-button-text"))},initiateSecondStepElements:function(){this.$(".sui-accordion").each(function(){SUI.suiAccordion(this)}),SUI.suiTabs(),SUI.tabs(),this.createPickers()},closeCreatePaletteModal:function(){var e=this,t=this.$("#hustle-edit-palette-first-step"),i=this.$("#hustle-edit-palette-second-step"),n=this.$(".hustle-button-action");setTimeout(function(){Module.Utils.accessibleHide(e.$(".sui-error-message")),Module.Utils.accessibleHide(i,!0),i.html(""),Module.Utils.accessibleShow(t,!0),n.removeClass("sui-button-blue"),n.data("step",2),Module.Utils.accessibleShow(n.find("#hustle-step-button-text")),Module.Utils.accessibleHide(n.find("#hustle-finish-button-text"))},500)},createPickers:function(){var t=this.$(".sui-colorpicker-input");t.wpColorPicker({change:function(t,i){var n=e(this);n.val()!==i.color.toCSS()&&n.val(i.color.toCSS()).trigger("change")},palettes:["#333333","#FFFFFF","#17A8E3","#E1F6FF","#666666","#AAAAAA","#E6E6E6"]}),t.hasClass("wp-color-picker")&&t.each(function(){var t=e(this),i=t.closest(".sui-colorpicker-wrap"),n=i.find(".sui-colorpicker-value span[role=button]"),s=i.find(".sui-colorpicker-value"),a=s.find("button"),o=s.find(".hustle-colorpicker-input"),l=t.closest(".wp-picker-container"),r=l.find(".wp-color-result"),d=r.find(".color-alpha"),c=l.find(".wp-picker-clear"),u="hex";!0===t.data("alpha")?(u="rgba",t.on("change",function(){n.find("span").css({"background-color":d.css("background")}),"undefined"==typeof data&&o.val(t.val())})):t.on("change",function(){n.find("span").css({"background-color":r.css("background-color")}),"undefined"==typeof data&&o.val(t.val())}),o.on("change",function(){t.val(o.val()),t.trigger("change",[{triggeredByUs:!0}])}),i.find(".sui-colorpicker").addClass("sui-colorpicker-"+u),i.find(".sui-button, span[role=button]").on("click",function(e){r.click(),e.preventDefault(),e.stopPropagation()}),a.on("click",function(i){var a=t.data("attribute"),o=e("#hustle-palette-module-fallback").val(),l=optinVars.palettes[o][a];c.click(),s.find("input").val(l),t.val(l).trigger("change"),n.find("span").css({"background-color":l}),i.preventDefault(),i.stopPropagation()})})},updateModulesOptions:function(t){var i=e(t.currentTarget).val(),n=this.$("#hustle-palette-module-name"),s="";e.each(optinVars.current[i],function(e,t){s+='<option value="'.concat(e,'">').concat(t,"</option>")}),n.html(s),this.$(".sui-select:not(.hustle-select-ajax)").SUIselect2({dropdownCssClass:"sui-select-dropdown",dropdownParent:this.$(".sui-box")})}})}),Hustle.define("Settings.Permissions_View",function(e){"use strict";return Backbone.View.extend({el:"#permissions-box",initialize:function(){e(function(){function t(){e(".select2-selection__rendered li:first-child .select2-selection__choice__remove").off("click").text("").on("click",function(e){e.stopImmediatePropagation(),e.preventDefault()})}e("select").on("change.select2",function(){t()}),t()})}})}),Hustle.define("Settings.Privacy_Settings",function(e){"use strict";return Backbone.View.extend({el:"#privacy-box",events:{"click #hustle-dialog-open--delete-ips":"openDeleteIpsDialog"},initialize:function(){e("#hustle-delete-ips-submit").on("click",this.handleIpDeletion)},openDeleteIpsDialog:function(t){SUI.openModal("hustle-dialog--delete-ips",e(t.currentTarget)[0],this.$("#hustle-dialog--delete-ips .sui-box-header .sui-button-icon")[0],!0),t.preventDefault()},handleIpDeletion:function(t){t.preventDefault();var i=e(t.currentTarget),n=e("#"+i.data("formId")),s=new FormData(n[0]);s.append("action","hustle_remove_ips"),s.append("_ajax_nonce",i.data("nonce")),i.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:s,contentType:!1,processData:!1,success:function(t){Module.Notification.open("success",t.data.message),SUI.closeModal(),e(".sui-button-onload").removeClass("sui-button-onload")},error:function(){SUI.closeModal(),e(".sui-button-onload").removeClass("sui-button-onload"),Module.Notification.open("error",optinVars.messages.something_went_wrong)}})}})}),Hustle.define("Settings.reCaptcha_Settings",function(e){"use strict";return Backbone.View.extend({el:"#recaptcha-box",data:{},initialize:function(){this.maybeRenderRecaptchas()},maybeRenderRecaptchas:function(){for(var t=this,i=this,n=!1,s=function(){var s=o[a],l=t.$("#hustle-modal-recaptcha-".concat(s,"-0")),r=t.$('input[name="'.concat(s,'_site_key"]')).val().trim(),d=t.$('input[name="'.concat(s,'_secret_key"]')).val().trim();r&&d?(l.data("sitekey",r),n?HUI.maybeRenderRecaptcha(l.closest(".sui-form-field")):e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_load_recaptcha_preview"}}).done(function(e){e.success&&(n=!0,i.$("#hustle-recaptcha-script-container").html(e.data),setTimeout(function(){return HUI.maybeRenderRecaptcha(l.closest(".sui-form-field"))},1e3))}),t.$(".hustle-recaptcha-".concat(s,"-preview-notice")).hide(),l.show()):(t.$(".hustle-recaptcha-".concat(s,"-preview-notice")).show(),l.hide())},a=0,o=["v2_checkbox","v2_invisible","v3_recaptcha"];a<o.length;a++)s()}})}),Hustle.define("Settings.Top_Metrics_View",function(){"use strict";return Backbone.View.extend({el:"#top-metrics-box",events:{"click .sui-checkbox input":"maybeDisableInputs"},initialize:function(){this.maybeDisableInputs()},maybeDisableInputs:function(){var e=this.$el.find("input:checked"),t=this.$el.find("input:not(:checked)"),i=this.$el.find('button[type="submit"]'),n=i.parent(),s=t.next("span");3<=e.length?(t.prop("disabled",!0),s.addClass("sui-tooltip"),s.css("opacity","1"),i.prop("disabled",!1),n.removeClass("sui-tooltip")):(i.prop("disabled",!0),t.prop("disabled",!1),s.removeClass("sui-tooltip"),s.css("opacity",""),n.addClass("sui-tooltip"))}})}),Hustle.define("Integration_Modal_Handler",function(e){"use strict";return Backbone.View.extend({events:{"click .hustle-provider-connect":"connectAddOn","click .hustle-provider-disconnect":"disconnectAddOn","click .hustle-provider-next":"submitNextStep","click .hustle-provider-back":"goPrevStep","click .hustle-refresh-email-lists":"refreshLists","click .hustle-provider-form-disconnect":"disconnectAddOnForm","click .hustle-provider-clear-radio-options":"clearRadioOptions","change select#group":"showInterests"},initialize:function(e){var t=this;return this.slug=e.slug,this.nonce=e.nonce,this.action=e.action,this.moduleId=e.moduleId,this.multi_id=e.multiId,this.globalMultiId=e.globalMultiId,this.step=0,this.next_step=!1,this.prev_step=!1,this.$el.off("close").on("close",function(){return t.modalClosed()}),this.render()},render:function(){var e={};e.action=this.action,e._ajax_nonce=this.nonce,e.data={},e.data.slug=this.slug,e.data.step=this.step,e.data.current_step=this.step,this.moduleId&&(e.data.module_id=this.moduleId),this.multi_id&&(e.data.multi_id=this.multi_id),this.globalMultiId&&(e.data.global_multi_id=this.globalMultiId),this.request(e,!1,!0)},applyLoader:function(e){e.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload")},resetLoader:function(e){e.find(".sui-button").removeClass("sui-button-onload")},request:function(t,i,n){var s=this;n&&(this.$el.find(".sui-box-body").addClass("sui-block-content-center").html('<p class="sui-loading-dialog" aria-label="Loading content"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),this.$el.find(".sui-box-footer").html(""),this.$el.find(".integration-header").html("")),this.applyLoader(this.$el),this.ajax=e.post({url:ajaxurl,type:"post",data:t}).done(function(e){if(e&&e.success){var t=e.data.data;if(i||!_.isUndefined(t.is_close)&&t.is_close?SUI.closeModal():(s.renderBody(e),s.renderFooter(e),s.onRender(t),s.resetLoader(s.$el)),!_.isUndefined(t.notification)&&!_.isUndefined(t.notification.type)&&!_.isUndefined(t.notification.text))Module.Notification.open(t.notification.type,t.notification.text);if(!_.isUndefined(t.size)){var n=s.$el.closest(".sui-modal");"normal"===t.size&&n.removeClass("sui-modal-sm sui-modal-lg"),"small"===t.size&&(n.addClass("sui-modal-sm"),n.removeClass("sui-modal-lg")),"large"===t.size&&(n.addClass("sui-modal-lg"),n.removeClass("sui-modal-sm"))}if("mailchimp"===s.slug){var a=s.$el.find("#group");a.length&&a.trigger("change")}}else s.renderBody(e),s.renderFooter(e)}),this.ajax.always(function(e){s.$el.find(".hustle-modal-close").off("click").on("click",function(){SUI.closeModal()}),s.$el.find(".sui-box-body").removeClass("sui-block-content-center"),s.$el.find(".sui-loading-dialog").remove(),e&&e.success&&e.data||s.showGenericErrorMessage()})},renderBody:function(t){if(t.data&&t.data.data){this.$el.find(".sui-box-body").html(t.data.data.html);var i=this.$el.find(".sui-box-body .integration-header").remove();if(0<i.length&&this.$el.find(".integration-header").html(i.html()),this.$el.find(".sui-box-body").html().trim().length){var n=this.$el.find(".sui-box-body").children(),s=!0;e.each(n,function(t,i){e(i).is(":hidden")||(s=!1)}),s?(this.$el.find(".sui-box-body").addClass("sui-hidden"),this.$el.find(".sui-box-footer").css("padding-top","")):(this.$el.find(".sui-box-body select").each(function(){SUI.suiSelect(this)}),this.$el.find(".sui-box-body .sui-notice").next().is('input[type="hidden"]')&&this.$el.find(".sui-box-body .sui-notice").css({"margin-bottom":"0"}))}else this.$el.find(".sui-box-body").addClass("sui-hidden"),this.$el.find(".sui-box-footer").css("padding-top","")}},renderFooter:function(e){if(e.data&&e.data.data){var t=e.data.data.buttons,i=this.$el.find(".sui-box-body"),n=this.$el.find(".sui-box-footer");i.removeClass("sui-spacing-bottom--0").removeClass("sui-spacing-bottom--30"),n.removeClass("sui-hidden").removeClass("sui-hidden-important").removeClass("sui-content-center").removeClass("sui-content-right").removeClass("sui-content-separated").html(""),_.each(t,function(e){n.append(e.markup)}),0===n.find(".sui-button").length?(n.addClass("sui-hidden-important"),i.addClass("sui-spacing-bottom--30")):(i.addClass("sui-spacing-bottom--0"),n.find(".sui-button").hasClass("sui-button-center")?n.addClass("sui-content-center"):n.find(".sui-button").hasClass("sui-button-right")?n.find(".sui-button").hasClass("sui-button-left")||n.addClass("sui-content-right"):n.addClass("sui-content-separated"))}},onRender:function(t){this.delegateEvents(),_.isUndefined(t.opt_in_provider_current_step)||(this.step=+t.opt_in_provider_current_step),_.isUndefined(t.opt_in_provider_has_next_step)||(this.next_step=t.opt_in_provider_has_next_step),_.isUndefined(t.opt_in_provider_has_prev_step)||(this.prev_step=t.opt_in_provider_has_prev_step),this.$el.find("select").each(function(){SUI.suiSelect(this)}),this.$el.find(".sui-select").SUIselect2({dropdownCssClass:"sui-select-dropdown",dropdownParent:e("#hustle-integration-dialog .sui-box")})},refreshLists:function(t){t.preventDefault(),t.stopPropagation();var i=this,n=e(t.currentTarget),s=this.moduleId,a=this.slug,o=e("#form_id").length?"forms":"lists",l=this.nonce;n.addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:{action:"hustle_refresh_email_lists",id:s,slug:a,type:o,_ajax_nonce:l}}).done(function(e){if(e.success&&void 0!==e.data.select){var t=n.siblings(".sui-select");t.SUIselect2("destroy"),t.SUIselect2({dropdownParent:i.$(".sui-box"),dropdownCssClass:"sui-select-dropdown"})}}).fail(function(){}).always(function(){n.removeClass("sui-button-onload")})},submitNextStep:function(){var t={},i=this.$el.find("form"),n={slug:this.slug,step:this.getStep(),current_step:this.step},s=i.serialize();this.moduleId&&(n.module_id=this.moduleId),s=s+"&"+e.param(n),t.action=this.action,t._ajax_nonce=this.nonce,t.data=s,this.request(t,!1,!1)},goPrevStep:function(){var e={},t={slug:this.slug,step:this.getPrevStep(),current_step:this.step};this.moduleId&&(t.module_id=this.moduleId),this.multi_id&&(t.multi_id=this.multi_id),e.action=this.action,e._ajax_nonce=this.nonce,e.data=t,this.request(e,!1,!1)},getStep:function(){return this.next_step?this.step+1:this.step},getPrevStep:function(){return this.prev_step?this.step-1:this.step},connectAddOn:function(){var t={},i=this.$el.find("form"),n={slug:this.slug,step:this.getStep(),current_step:this.step},s=i.serialize();this.moduleId&&(n.module_id=this.moduleId),this.multi_id&&(n.multi_id=this.multi_id),s=s+"&"+e.param(n),t.action=this.action,t._ajax_nonce=this.nonce,t.data=s,this.request(t,!1,!1)},disconnectAddOn:function(){var t=this,i=this.$el.find(".sui-box-logo img").attr("src"),n=this.$el.find("#dialogTitle2").html(),s={},a={},o={};s.action="hustle_provider_deactivate",s._ajax_nonce=this.nonce,s.data={},s.data.slug=this.slug,s.data.img=i,s.data.title=n,this.globalMultiId&&(s.data.global_multi_id=this.globalMultiId),a.action="hustle_provider_is_on_module",a._ajax_nonce=this.nonce,a.data={},a.data.slug=this.slug,a.data.globalMultiId=this.globalMultiId,this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload"),e.ajax({url:ajaxurl,type:"POST",data:a,success:function(e){!0===e.success&&(o=e)},complete:function(){!0===o.success?Module.integrationsActiveRemove.open(o.data,s,t):t.request(s,!0,!1)}})},disconnectAddOnForm:function(){var t={},i=e("#hustle-integrations-active-count").val(),n=e("#hustle-integrations-active-integrations").val();t.action="hustle_provider_form_deactivate",t._ajax_nonce=this.nonce,t.data={},t.data.slug=this.slug,t.data.module_id=this.moduleId,this.multi_id&&(t.data.multi_id=this.multi_id),"1"===i&&n===this.slug&&"local_list"!==this.slug?Module.integrationsAllRemove.open(t,this):"1"===i&&"local_list"===this.slug?(Module.Notification.open("error",optinVars.messages.integraiton_required),SUI.closeModal()):this.request(t,!0,!1)},modalClosed:function(){this.ajax.abort(),Hustle.Events.trigger("hustle:providers:reload")},clearRadioOptions:function(){this.$("input[type=radio]",this.$el).prop("checked",!1)},showInterests:function(t){var i=this,n=e(t.currentTarget),s=n.data("nonce"),a=n.val(),o={},l=i.$el.find("form"),r={slug:i.slug,group:a,module_id:i.moduleId},d=l.serialize();d=d+"&"+e.param(r),o.action="hustle_mailchimp_get_group_interests",o._ajax_nonce=s,o.data=d,i.applyLoader(i.$el),e.ajax({url:ajaxurl,type:"POST",data:o}).done(function(e){e.success&&(l.find(".sui-form-field").slice(1).remove(),l.find(".sui-form-field:first-child").after(e.data),i.$el.find(".sui-select").SUIselect2({dropdownCssClass:"sui-select-dropdown"}))}).fail(function(){}).always(function(){i.resetLoader(i.$el)})},showGenericErrorMessage:function(){this.$el.find(".sui-box-body").html('<div id="hustle-request-error-reload-notice" role="alert" aria-live="assertive" class="sui-notice"></div>'),this.$el.find(".sui-box-footer").html(""),SUI.openNotice("hustle-request-error-reload-notice","<p>"+optinVars.messages.request_error_reload_notice+"</p>",{type:"error",autoclose:{show:!1}})}})});var Module=window.Module||{};function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function _createForOfIteratorHelper(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}Hustle.define("Model",function(e){"use strict";return Backbone.Model.extend({initialize:function(){this.on("change",this.userHasChange,this),Backbone.Model.prototype.initialize.apply(this,arguments),e(window).on("beforeunload",this.changesNotSaved)},userHasChange:function(){Module.hasChanges=!0,Hustle.Events.trigger("modules.view.switch_status","unsaved")},changesNotSaved:function(){if(Module.hasChanges)return"You have unsaved changes"}})}),Hustle.define("Models.M",function(){"use strict";return Hustle.get("Model").extend({toJSON:function(){var e,t=_.clone(this.attributes);for(e in t)(t[e]instanceof Backbone.Model||t[e]instanceof Backbone.Collection)&&(t[e]=t[e].toJSON());return t},set:function(e,t,i){var n,s,a;"string"==typeof e&&-1!==e.indexOf(".")?(n=e.split(".")[0],s=e.split(".")[1],(a=this.get(n))&&a instanceof Backbone.Model&&(a.set(s,t,i),this.trigger("change:"+e,e,t,i),this.trigger("change:"+n,e,t,i))):Backbone.Model.prototype.set.call(this,e,t,i)},get:function(e){var t,i;return"string"==typeof e&&-1!==e.indexOf(".")?(t=e.split(".")[0],i=e.split(".")[1],this.get(t).get(i)):Backbone.Model.prototype.get.call(this,e)}})}),Hustle.define("Models.Trigger",function(){"use strict";return Hustle.get("Model").extend({defaults:{trigger:"time",on_time_delay:0,on_time_unit:"seconds",on_scroll:"scrolled",on_scroll_page_percent:"20",on_scroll_css_selector:"",enable_on_click_element:"1",on_click_element:"",enable_on_click_shortcode:"1",on_exit_intent:"1",on_exit_intent_per_session:"1",on_exit_intent_delayed:"0",on_exit_intent_delayed_time:5,on_exit_intent_delayed_unit:"seconds",on_adblock:"0"}})}),Module.Model=Hustle.get("Models.M").extend({defaults:{module_name:"",moduleType:"popup",active:"0"}}),function(e){"use strict";var t=window.Module||{};t.Notification={id:null,$floatingContainer:null,open:function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4e3,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hustle-only-active-notification",a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.id=s;var o={type:t||"",icon:"info",dismiss:{},autoclose:{}};if(a){if(this.$floatingContainer=e("#hustle-floating-notifications-wrapper"),this.createFloatingNoticeWrapper(),!1!==n){var l=parseInt(n);isNaN(l)&&(n=4e3)}o.dismiss={show:!1===n,label:optinVars.messages.commons.dismiss},o.autoclose={show:!1!==n,time:n}}else o.autoclose.show=!1,o.dismiss.show=!1;i="<p>".concat(i,"</p>"),SUI.openNotice(s,i,o)},createFloatingNoticeWrapper:function(){var t=this.id;e("#"+t).length||this.$floatingContainer.append('<div\n\t\t\t\t\trole="alert"\n\t\t\t\t\tid="'.concat(t,'"\n\t\t\t\t\tclass="sui-notice"\n\t\t\t\t\taria-live="assertive"\n\t\t\t\t></div>'))}},t.integrationsModal={$popup:{},open:function(t){var i=this,n=e(t.target);n.hasClass("connect-integration")||(n=n.closest(".connect-integration")),e("#hustle-integration-dialog").closest(".sui-modal").length&&e("#hustle-integration-dialog").closest(".sui-modal").remove();var s=n.data("nonce"),a=n.data("slug"),o=n.data("title"),l=n.data("image"),r=n.data("action"),d=n.data("module_id"),c=n.data("multi_id"),u=n.data("global_multi_id"),h=Optin.template("hustle-integration-dialog-tpl");e(".sui-wrap-hustle").append(h({image:l,title:o})),this.$popup=e("#hustle-integration-dialog");var p=Hustle.get("Integration_Modal_Handler");this.view=new p({slug:a,nonce:s,action:r,moduleId:d,multiId:c,globalMultiId:u,el:this.$popup}),this.$popup.on("close",function(){return i.close()}),SUI.openModal("hustle-integration-dialog",n[0],this.$popup.find(".sui-box .hustle-modal-close")[0],!0),this.$popup.on("click",".sui-tab-item",function(t){var i=e(t.currentTarget);i.closest(".sui-side-tabs").find(".sui-tab-item").removeClass("active"),i.addClass("active")})},close:function(){this.view&&(this.$popup.closest(".sui-modal").remove(),this.view.remove())}},t.integrationsAllRemove={referrer:{},open:function(t,i){var n=this;this.referrer=i;var s=e("#hustle-dialog--final-delete"),a=s.find(".sui-box-header .sui-button-icon");a.on("click",n.close),s.find("#hustle-delete-final-button-cancel").on("click",n.close),e("#hustle-delete-final-button").off("click").on("click",function(){var s,a,o;e("#hustle-delete-final-button").addClass("sui-button-onload"),s=t,a=i,n.deleteIntegration(s,a),o=t,n.insertLocalList(o),n.close()}),e("#hustle-delete-final-button").prop("disabled",!1);var o=e('#hustle-connected-providers-section button[data-slug="'+t.data.slug+'"]');SUI.replaceModal("hustle-dialog--final-delete",o[0],a[0],!0)},close:function(){e("#hustle-delete-final-button").removeClass("sui-button-onload"),e("#hustle-delete-final-button").prop("disabled",!1)},confirmDelete:function(e,t){this.deleteIntegration(e,t),this.insertLocal(e),this.close()},deleteIntegration:function(e,t){t.request(e,!0,!1)},insertLocalList:function(i){var n={id:i.data.module_id,_ajax_nonce:i._ajax_nonce,action:"hustle_provider_insert_local_list"};e.ajax({url:ajaxurl,type:"POST",data:n,success:function(e){e.success?Hustle.Events.trigger("hustle:providers:reload"):t.Notification.open("error",optinVars.messages.something_went_wrong)},error:function(){t.Notification.open("error",optinVars.messages.something_went_wrong)}})}},t.integrationsActiveRemove={$popup:{},_deferred:{},open:function(t,i,n){var s=this,a=e("#hustle-dialog--remove-active"),o=Optin.template("hustle-modules-active-integration-tpl"),l=Optin.template("hustle-modules-active-integration-img-tpl"),r=Optin.template("hustle-modules-active-integration-header-tpl"),d=Optin.template("hustle-modules-active-integration-desc-tpl");e("#hustle-dialog--remove-active tbody").html(""),e("#hustle-dialog--remove-active .sui-box-logo").html(""),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-title").html(""),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-description").html(""),e("#hustle-dialog--remove-active .sui-box-logo").append(l({image:i.data.img,title:i.data.slug})),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-title").append(r({title:i.data.title.replace(/Connect|Configure/gi," ")})),e("#hustle-dialog--remove-active #hustle-dialog--remove-active-description").append(d({title:i.data.title.replace(/Connect|Configure/gi," ")})),e.each(t,function(t,i){e("#hustle-dialog--remove-active tbody").append(o({name:i.name,type:i.type,editUrl:i.edit_url}))}),a.find("#hustle-remove-active-integration-back").off("click").on("click",function(){s.back(n)}),e("#hustle-remove-active-button").off("click").on("click",function(){var a,o,l;e(this).addClass("sui-button-onload"),a=i,o=n,l=t,s.removeIntegration(a,o,l)});var c="";c=n.globalMultiId?e('button[data-global_multi_id="'+n.globalMultiId+'"]'):e('button[data-slug="'+i.data.slug+'"]'),SUI.replaceModal("hustle-dialog--remove-active",c[0],a.find(".hustle-modal-close")[0],!0)},close:function(){SUI.closeModal()},back:function(t){this.close(),"hubspot"===t.slug||"constantcontact"===t.slug||"zapier"===t.slug?e('button[data-slug="'+t.slug+'"]').trigger("click"):e('button[data-global_multi_id="'+t.globalMultiId+'"]').trigger("click")},removeIntegration:function(t,i,n){var s=this;e.each(n,function(e,i){t.data.slug===i.active.active_integrations&&s.insertLocalList(t,e)}),i.request(t,!0,!1),e("#hustle-remove-active-button").removeClass("sui-button-onload")},insertLocalList:function(i,n){var s={id:n,_ajax_nonce:i._ajax_nonce,action:"hustle_provider_insert_local_list"};e.ajax({url:ajaxurl,type:"POST",data:s,success:function(e){!1===e.success&&t.Notification.open("error",optinVars.messages.something_went_wrong)},error:function(){t.Notification.open("error",optinVars.messages.something_went_wrong)}})}},t.ProviderMigration={$popup:{},open:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e("#hustle-dialog-migrate--"+t),s=this;i&&e("#integration-migrate").attr("data-id",i),setTimeout(function(){return SUI.openModal("hustle-dialog-migrate--"+t,e(".sui-header-title")[0],e("#hustle-dialog-migrate--"+t+" .sui-box-header .sui-button-icon")[0],!0)},300),n.find("#integration-migrate").on("click",function(){var a=n.find("form"),o={},l={slug:t,global_multi_id:i},r=a.serialize();e("#integration-migrate").addClass("sui-button-onload"),o._ajax_nonce=e("#integration-migrate").data("nonce"),o.action="hustle_provider_migrate_aweber",r=r+"&"+e.param(l),o.data=r,s.reauth(n,o,i,t)})},reauth:function(i,n,s,a){var o=e(".hustle_migration_notice__"+a+'[data-id="'+s+'"]');this.ajax=e.post({url:ajaxurl,type:"post",data:n}).done(function(n){n&&n.success?(SUI.closeModal(),o.hide(),t.Notification.open("success",optinVars.messages.aweber_migration_success,!1)):(e(i).find("#integration-migrate").removeClass("sui-button-onload"),e(i).find(".sui-error-message").removeClass("sui-hidden"),e(i).find(".sui-form-field").addClass("sui-form-field-error"))})}},t.deleteModal={open:function(t,i){var n="hustle-dialog--delete",s=Optin.template("hustle-dialog--delete-tpl")(t);e("#"+n+" #hustle-delete-dialog-content").html(s),e("#"+n+" #hustle-dialog--delete-title").html(t.title),e("#"+n+" .hustle-cancel-button").on("click",function(){return SUI.closeModal(n)}),e("#"+n+" .hustle-delete-confirm").on("click",function(t){e(t.currentTarget).addClass("sui-button-onload")}),SUI.openModal(n,i,e("#"+n+".hustle-modal-close")[0],!0)}},t.hasChanges=!1}(jQuery),function(e){"use strict";var t=window.Module||{};t.Utils={getUrlParam:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=optinVars.urlParams;return void 0!==i[e]?i[e]:t},accessibleHide:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.hide(),e.attr("aria-hidden",!0),e.prop("hidden",!0),t&&e.prop("tabindex","-1"),i&&void 0!==i.name&&(void 0!==i.value?e.attr(i.name,i.value):e.removeAttr(i.name))},accessibleShow:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.show(),e.prop("aria-hidden",!1),e.removeClass("sui-hidden"),e.prop("hidden",!1),t&&e.attr("tabindex","0"),i&&void 0!==i.name&&(void 0!==i.value?e.attr(i.name,i.value):e.removeAttr(i.name))},showHideDependencyOnSelectChange:function(i){(i?i.find("select.hustle-select-with-container"):e("select.hustle-select-with-container")).each(function(){var i=e(this),n=e('[data-field-content="'.concat(this.name,'"]')),s=!!i.data("content-on")&&i.data("content-on").split(","),a=!!i.data("content-off")&&i.data("content-off").split(","),o=function(){var e=i.val();(s?s.includes(e):!a.includes(e))?t.Utils.accessibleShow(n):t.Utils.accessibleHide(n)};o(),i.on("change",function(){return o()})})},serializeObject:function(t){var i={},n=t.serializeArray();return e.each(n,function(){void 0!==i[this.name]?(i[this.name].push||(i[this.name]=[i[this.name]]),i[this.name].push(this.value||"")):i[this.name]=this.value||""}),t.find("input:disabled[name]").each(function(){i[this.name]=this.value||""}),t.find("select:disabled[name]").each(function(){i[this.name]=this.value||""}),t.find('input[type="checkbox"]:not(:checked)').each(function(){void 0===i[this.name]?i[this.name]="0":"0"!==i[this.name]||t.find('input[name="'.concat(this.name,'"]:checked')).length?Array.isArray(i[this.name])||(i[this.name]=[i[this.name]]):i[this.name]=[]}),i}},t.handleActions={context:"",$target:null,responseData:{},initAction:function(i,n){var s=this;i.preventDefault(),this.context=n,this.$target=e(i.currentTarget);var a=this,o=this.$target.data("form-id"),l=this.$target.data(),r=new FormData;if(void 0!==o){var d=e("#"+o);d.length&&(r=new FormData(d[0]))}e.each(l,function(e,t){return r.append(e,t)}),r.append("context",this.context),r.append("_ajax_nonce",optinVars.single_module_action_nonce),r.append("action","hustle_module_handle_single_action"),e.ajax({url:ajaxurl,type:"POST",data:r,contentType:!1,processData:!1}).done(function(i){i.data.callback&&"function"==typeof a[i.data.callback]?(s.responseData=i.data,a[i.data.callback]()):i.data.url?window.location.assign(i.data.url):i.data.notification?t.Notification.open(i.data.notification.status,i.data.notification.message,i.data.notification.delay):i.success||t.Notification.open("error",optinVars.messages.something_went_wrong,!1),i.data.url||e(".sui-button-onload").removeClass("sui-button-onload")}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload")})},actionToggleTracking:function(){var i,n;if(this.responseData.is_embed_or_sshare){var s=e('.hustle-manage-tracking-button[data-module-id="'+this.$target.data("module-id")+'"]');s.data("tracking-types",this.responseData.enabled_types),n=0!==this.responseData.enabled_types.length,i=s.parents(".sui-accordion-item"),SUI.closeModal()}else n=1-(this.responseData.was_enabled?1:0),i=this.$target.parents(".sui-accordion-item"),this.$target.data("enabled",n),this.$target.find(".hustle-toggle-tracking-button-description").toggleClass("sui-hidden");i.hasClass("sui-accordion-item--open")&&i.find(".sui-accordion-open-indicator").trigger("click").trigger("click");var a=this.responseData.is_active&&!n;this.toggleTrackingDisabledTag(a,i),t.Notification.open("success",this.responseData.message,1e4)},actionToggleStatus:function(){"listing"===this.context?this.listingToggleStatus():this.dashboardToggleStatus()},listingToggleStatus:function(){var e=this.$target.closest(".sui-accordion-item"),t=e.find(".sui-accordion-item-title span.sui-tag");t.toggleClass("sui-tag-blue"),t.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden"),this.$target.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden"),e.hasClass("sui-accordion-item--open")&&e.find(".sui-accordion-open-indicator").trigger("click").trigger("click");var i=this.responseData.is_active&&!this.responseData.is_tracking_enabled;this.toggleTrackingDisabledTag(i,e)},dashboardToggleStatus:function(){var e=this.responseData.is_active;this.$target.find(".hustle-toggle-status-button-description").toggleClass("sui-hidden");var t=this.$target.parents("td.hui-status").find("span.sui-tooltip");t.removeClass("sui-draft sui-published"),e?t.addClass("sui-published").attr("data-tooltip",optinVars.messages.commons.published):t.addClass("sui-draft").attr("data-tooltip",optinVars.messages.commons.draft)},actionImportDisplayError:function(){var e=this.responseData.message,i=this.$target.closest(".sui-modal"),n=i.find(".sui-modal-content").attr("id")+"-error-notice";t.Notification.open("error",e,!1,n,!1),i.find('input[name="import_file"]').focus()},toggleTrackingDisabledTag:function(e,t){var i=t.find(".hustle-analytics-disabled-tag");e?i.removeClass("sui-hidden"):i.addClass("sui-hidden")}};var i=window.Optin||{};i.globalMixin=function(){_.mixin({toBool:function(e){return _.isBoolean(e)?e:_.isString(e)&&-1!==["true","false","1"].indexOf(e.toLowerCase())?"true"===e.toLowerCase()||"1"===e.toLowerCase():_.isNumber(e)?!!e:!(_.isUndefined(e)||_.isNull(e)||_.isNaN(e))&&e},isTrue:function(e){return!(_.isUndefined(e)||_.isNull(e)||_.isNaN(e))&&(_.isNumber(e)?0!==e:(e=e.toString().toLowerCase(),-1!==["1","true","on"].indexOf(e)))},isFalse:function(e){return!_.isTrue(e)},controlBase:function(e,t,i){return i=_.isUndefined(i)?"checked":i,e=_.toBool(e),t=_.isBoolean(e)?_.isTrue(t):t,_.isEqual(e,t)?i+"="+i:""},checked:function(e,t){return _.controlBase(e,t,"checked")},selected:function(e,t){return _.controlBase(e,t,"selected")},disabled:function(e,t){return _.controlBase(e,t,"disabled")},class:function(e,t,i){return _.isTrue(e)?t:void 0!==i?i:""}})},i.globalMixin(),Backbone.Model.prototype.toJSON=function(){var e,t=_.clone(this.attributes);for(e in t)(t[e]instanceof Backbone.Model||Backbone.Collection&&t[e]instanceof Backbone.Collection)&&(t[e]=t[e].toJSON());return t}}(jQuery),Hustle.define("SShare.Content_View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Module_Content"),{el:"#hustle-wizard-content",activePlatforms:[],events:{"change select.hustle-select-field-variables":"addPlaceholderToField","click ul.wpmudev-tabs-menu li label":"toggleCheckbox","click .hustle-choose-platforms":"openPlatformsModal"},render:function(){var t=this.model.toJSON();if(void 0!==t.social_icons&&t.social_icons)for(var i in t.social_icons)this.addPlatformToPanel(i,t.social_icons[i]);var n=this.$("#hustle-social-services").sortable({axis:"y",containment:".sui-box-builder"});for(var s in n.on("sortupdate",e.proxy(this.platformsOrderChanged,this,n)),optinVars.social_platforms)this.addPlatformToDialog(s);this.bindRemoveService(),"true"===Module.Utils.getUrlParam("new")&&Module.Notification.open("success",optinVars.messages.module_created,1e4)},bindRemoveService:function(){e("#hustle-wizard-content .hustle-remove-social-service").off("click").on("click",e.proxy(this.removeService,this))},openPlatformsModal:function(){var t=this.model.get("social_icons"),i=void 0!==t?Object.keys(t):[];new(Hustle.get("Modals.Services_Platforms"))(i).on("platforms:added",e.proxy(this.addNewPlatforms,this)),SUI.openModal("hustle-dialog--add-platforms",this.$(".hustle-choose-platforms")[0],this.$("#hustle-dialog--add-platforms .hustle-modal-close")[0],!0)},addNewPlatforms:function(t){var i=this;this.model.get("social_icons")||this.model.set("social_icons",{});var n=this,s=_.extend({},this.model.get("social_icons"));e.each(t,function(e,t){if(s&&t in s)return!0;n.addPlatformToPanel(t,{});var a=i.getPlatformDefaults(t);s[t]=a}),this.bindRemoveService(),this.model.set("social_icons",s),Hustle.Events.trigger("view.rendered",this)},addPlatformToPanel:function(e,t){var i=Optin.template("hustle-platform-row-tpl"),n=this.$("#hustle-social-services");t=_.extend({},this.getPlatformViewDefaults(e),t),this.activePlatforms.push(e),n.append(i(t))},addPlatformToDialog:function(t){var i=Optin.template("hustle-add-platform-li-tpl"),n=e("#hustle_add_platforms_container"),s=this.getPlatformViewDefaults(t);n.append(i(s))},getPlatformDefaults:function(e){var t={platform:e,label:e in optinVars.social_platforms?optinVars.social_platforms[e]:e,type:"click",counter:"0",link:""};return"email"===e&&(t.title="{post_title}",t.message=optinVars.social_platforms_data.email_message_default),t},getPlatformViewDefaults:function(e){var t=this.model.toJSON(),i=void 0===t.counter_enabled?"true":t.counter_enabled,n={fivehundredpx:"500px"},s=-1!==optinVars.social_platforms_with_endpoints.indexOf(e),a=-1!==optinVars.social_platforms_with_api.indexOf(e),o=e in n?n[e]:e;return _.extend({},this.getPlatformDefaults(e),{platform_style:o,counter_enabled:i,hasEndpoint:s,hasCounter:a})},platformsOrderChanged:function(e){var t,i=this.model.get("social_icons"),n=e.sortable("toArray",{attribute:"data-platform"}),s={},a=_createForOfIteratorHelper(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;s[o]=i[o]}}catch(e){a.e(e)}finally{a.f()}this.model.set("social_icons",s),this.model.trigger("change",this.model)},removeService:function(t){var i=e(t.currentTarget).data("platform"),n=this.model.get("social_icons");this.$("#hustle-platform-"+i).remove(),this.activePlatforms=_.without(this.activePlatforms,i),delete n[i],this.model.trigger("change",this.model),t.stopPropagation()},modelUpdated:function(e){var t,i=e.changed,n=void 0!==Object.keys(i)[0]?Object.keys(i)[0]:"";if("service_type"in i&&this.serviceTypeUpdated(i.service_type),"click_counter"in i)this.clickCounterUpdated(i.click_counter);else if(-1!==n.indexOf("_counter")){var s=n.slice(0,-8);s in(t=this.model.get("social_icons"))&&(t[s].counter=parseInt(i[n])),this.model.unset(n,{silent:!0})}if(-1!==n.indexOf("_link")){var a=n.slice(0,-5);a in(t=this.model.get("social_icons"))&&(t[a].link=i[n]),this.model.unset(n,{silent:!0})}if(-1!==n.indexOf("_type")){var o=n.slice(0,-5);o in(t=this.model.get("social_icons"))&&(t[o].type="native"===i[n]?"native":"click"),this.model.unset(n,{silent:!0})}if("email_title"in i){"email"in(t=this.model.get("social_icons"))&&(t.email.title=i[n]),this.model.unset(n,{silent:!0})}if("email_message"in i){"email"in(t=this.model.get("social_icons"))&&(t.email.message=i[n]),this.model.unset(n,{silent:!0})}},serviceTypeUpdated:function(t){var i=this.$("#wpmudev-sshare-counter-options"),n=e(".wph-wizard-services-icons-native"),s=e(".wph-wizard-services-icons-custom");"native"===t?(i.removeClass("wpmudev-hidden"),s.addClass("wpmudev-hidden"),n.removeClass("wpmudev-hidden")):(i.addClass("wpmudev-hidden"),n.addClass("wpmudev-hidden"),s.removeClass("wpmudev-hidden"))},clickCounterUpdated:function(t){var i=e("#wpmudev-sshare-counter-options .hustle-twitter-notice");"native"===t?i.removeClass("wpmudev-hidden"):i.hasClass("wpmudev-hidden")||i.addClass("wpmudev-hidden"),e("#wph-wizard-services-icons-native .wpmudev-social-item").each(function(){var i=e(this).find(".toggle-checkbox").is(":checked"),n=e(this).find("input.wpmudev-input_number");"none"!==t&&i?n.removeClass("wpmudev-hidden"):n.hasClass("wpmudev-hidden")||n.addClass("wpmudev-hidden")}),e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong").removeClass("wpmudev-hidden"),"none"===t?e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong:first-child").addClass("wpmudev-hidden"):e("#wph-wizard-services-icons-native #wpmudev-counter-title>strong:nth-child(2)").addClass("wpmudev-hidden")},toggleCheckbox:function(e){e.preventDefault(),e.stopPropagation();var t=this.$(e.target).closest("li");if(!t.hasClass("current")){t.addClass("current"),t.siblings().removeClass("current");var i=t.find("input"),n=i.data("attribute");this.model.set(n,i.val())}},setSocialIcons:function(){var e=this.model.toJSON();e=this.getSocialIconsData(e),this.model.set("social_icons",e.social_icons,{silent:!0})},getSocialIconsData:function(t){var i=e("#wph-wizard-services-icons-"+t.service_type+" .wpmudev-social-item"),n={};return i.each(function(){var t=e(this),i=t.find("input.toggle-checkbox"),s=i.data("id"),a=t.find("input.wpmudev-input_number"),o=t.find("input.wpmudev-input_text");a.length&&(0>parseInt(a.val())&&a.val(0));i.is(":checked")&&(n[s]={enabled:!0,counter:a.length?a.val():"0",link:o.length?o.val():""})}),i.length&&(t.social_icons=n),t},addPlaceholderToField:function(t){var i=e(t.currentTarget),n=i.val(),s=i.data("field"),a=e('[name="'.concat(s,'"]')),o=a.val()+n;a.val(o).trigger("change")}}))}),Hustle.define("SShare.Design_View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Model_Updater"),Hustle.get("Mixins.Module_Design"),{beforeRender:function(){this.listenTo(this.model,"change",this.modelUpdated),Hustle.Events.off("modules.view.displayTypeUpdated").on("modules.view.displayTypeUpdated",e.proxy(this.viewChangedDisplayTab,this))},render:function(){var t=this;this.createPickers(e(".sui-colorpicker-input")),e('a[data-tab="appearance"]').on("click",e.proxy(this.updatePreview,this)),e('.sui-box[data-tab="display"] .sui-button[data-direction="next"').on("click",e.proxy(this.updatePreview,this)),e('.sui-box[data-tab="visibility"] .sui-button[data-direction="prev"').on("click",e.proxy(this.updatePreview,this)),this.updateSocialIconsPickers(),setTimeout(function(){return t.updatePreview()},100)},updatePreview:function(){e("#hui-preview-social-shares-floating").trigger("hustle_update_prewiev")},modelUpdated:function(e){var t=Object.keys(e.changed)[0],i=this.getActionOnContentModelUpdated(t);void 0!==i&&i(),this.updatePreview()},getActionOnContentModelUpdated:function(e){var t=this;return{icon_style:function(){return t.updateSocialIconsPickers()}}[e]},updateSocialIconsPickers:function(){var t=this.model.get("icon_style");"flat"===t?(e("#hustle-floating-icons-custom-background").addClass("sui-hidden"),e("#hustle-widget-icons-custom-background").addClass("sui-hidden")):(e("#hustle-floating-icons-custom-background").removeClass("sui-hidden"),e("#hustle-widget-icons-custom-background").removeClass("sui-hidden")),"outline"===t?(this.$(".hustle-icon-bg-color-label").addClass("sui-hidden"),this.$(".hustle-icon-border-color-label").removeClass("sui-hidden"),e("#hustle-floating-counter-border").addClass("sui-hidden"),e("#hustle-widget-counter-border").addClass("sui-hidden")):(this.$(".hustle-icon-bg-color-label").removeClass("sui-hidden"),this.$(".hustle-icon-border-color-label").addClass("sui-hidden"),e("#hustle-floating-counter-border").removeClass("sui-hidden"),e("#hustle-widget-counter-border").removeClass("sui-hidden"))},viewChangedDisplayTab:function(t){var i=t.get("inline_enabled"),n=t.get("widget_enabled"),s=t.get("shortcode_enabled"),a=t.get("float_desktop_enabled"),o=t.get("float_mobile_enabled"),l=_.intersection([1,"1","true"],[i,n,s]).length,r=_.intersection([1,"1","true"],[o,a]).length;r?(e("#hustle-appearance-floating-icons-row").show(),e("#hustle-appearance-floating-icons-placeholder").hide()):(e("#hustle-appearance-floating-icons-row").hide(),e("#hustle-appearance-floating-icons-placeholder").show()),l?(e("#hustle-appearance-widget-icons-row").show(),e("#hustle-appearance-widget-icons-placeholder").hide()):(e("#hustle-appearance-widget-icons-row").hide(),e("#hustle-appearance-widget-icons-placeholder").show()),l||r?(e("#hustle-appearance-icons-style").show(),e("#hustle-appearance-empty-message").hide()):(e("#hustle-appearance-icons-style").hide(),e("#hustle-appearance-empty-message").show(),e("#hustle-appearance-floating-icons-placeholder").hide(),e("#hustle-appearance-widget-icons-placeholder").hide())},colorPickerCleared:function(e,t){var i=t.data("attribute"),n=optinVars.palettes.sshare_defaults[i],s=t.closest(".sui-colorpicker-wrap"),a=s.find(".sui-colorpicker-value"),o=s.find(".sui-colorpicker-value span[role=button]");t.closest(".wp-picker-container").find(".wp-picker-clear").click(),a.find("input").val(n),t.val(n).trigger("change"),o.find("span").css({"background-color":n}),e.preventDefault(),e.stopPropagation()},updatePickers:function(){var e=this;if(void 0!==optinVars.palettes.sshare_defaults){var t=optinVars.palettes.sshare_defaults;_.each(t,function(t,i){e.$('input[data-attribute="'+i+'"]').val(t).trigger("change")})}}}))}),Hustle.define("SShare.Display_View",function(){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Module_Display"),{viewChanged:function(e){_.intersection(["float_desktop_enabled","float_mobile_enabled","inline_enabled","widget_enabled","shortcode_enabled"],Object.keys(e)).length?Hustle.Events.trigger("modules.view.displayTypeUpdated",this.model):"float_desktop_position"in e?"right"===e.float_desktop_position?(this.$("#hustle-float_desktop-left-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-right-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-offset-x-wrapper").removeClass("sui-hidden")):"left"===e.float_desktop_position?(this.$("#hustle-float_desktop-left-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-right-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-offset-x-wrapper").removeClass("sui-hidden")):this.$("#hustle-float_desktop-offset-x-wrapper").addClass("sui-hidden"):"float_desktop_position_y"in e?"bottom"===e.float_desktop_position_y?(this.$("#hustle-float_desktop-top-offset-label").addClass("sui-hidden"),this.$("#hustle-float_desktop-bottom-offset-label").removeClass("sui-hidden")):(this.$("#hustle-float_desktop-top-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_desktop-bottom-offset-label").addClass("sui-hidden")):"float_mobile_position"in e?"right"===e.float_mobile_position?(this.$("#hustle-float_mobile-left-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-right-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-offset-x-wrapper").removeClass("sui-hidden")):"left"===e.float_mobile_position?(this.$("#hustle-float_mobile-left-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-right-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-offset-x-wrapper").removeClass("sui-hidden")):this.$("#hustle-float_mobile-offset-x-wrapper").addClass("sui-hidden"):"float_mobile_position_y"in e&&("bottom"===e.float_mobile_position_y?(this.$("#hustle-float_mobile-top-offset-label").addClass("sui-hidden"),this.$("#hustle-float_mobile-bottom-offset-label").removeClass("sui-hidden")):(this.$("#hustle-float_mobile-top-offset-label").removeClass("sui-hidden"),this.$("#hustle-float_mobile-bottom-offset-label").addClass("sui-hidden")))}}))}),Hustle.define("Modals.Services_Platforms",function(){"use strict";return Backbone.View.extend({el:"#hustle-dialog--add-platforms",selectedPlatforms:[],events:{"click .sui-box-selector input":"selectPlatforms","click #hustle-add-platforms":"addPlatforms"},initialize:function(e){this.selectedPlatforms=e,this.$(".hustle-add-platforms-option").prop("checked",!1).prop("disabled",!1);var t,i=_createForOfIteratorHelper(this.selectedPlatforms);try{for(i.s();!(t=i.n()).done;){var n=t.value;this.$("#hustle-social--"+n).prop("checked",!0).prop("disabled",!0)}}catch(e){i.e(e)}finally{i.f()}},selectPlatforms:function(e){var t=this.$(e.target),i=this.$el.find('label[for="'+t.attr("id")+'"]'),n=t.val();i.toggleClass("selected"),t.prop("checked")?this.selectedPlatforms.push(n):this.selectedPlatforms=_.without(this.selectedPlatforms,n)},checkPlatforms:function(){var e,t=_createForOfIteratorHelper(this.selectedPlatforms);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.$("#hustle-social--"+i).prop("checked")||(this.selectedPlatforms=_.without(this.selectedPlatforms,i))}}catch(e){t.e(e)}finally{t.f()}},addPlatforms:function(e){var t=this.$(e.target);t.addClass("sui-button-onload"),this.checkPlatforms(),this.trigger("platforms:added",this.selectedPlatforms),setTimeout(function(){SUI.closeModal(),t.removeClass("sui-button-onload")},500)}})}),Hustle.define("SShare.View",function(e){"use strict";return Hustle.View.extend(_.extend({},Hustle.get("Mixins.Wizard_View"),{_events:{"hustle_update_prewiev #hui-preview-social-shares-floating":"updatePreview"},updatePreview:function(){var t=_.extend({},this.model.toJSON(),this.getDataToSave());e.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"hustle_preview_module",id:this.model.get("module_id"),previewData:t},success:function(t){if(t.success){var i=e("#hui-preview-social-shares-floating"),n=e("#hui-preview-social-shares-widget");i.html(t.data.floatingHtml),n.html(t.data.widgetHtml),t.data.style&&i.append(t.data.style),e(".hustle-share-icon").on("click",function(e){return e.preventDefault()})}}})},setTabsViews:function(e){this.contentView=e.contentView,this.displayView=e.displayView,this.designView=e.designView,this.visibilityView=e.visibilityView,this.moduleType=this.model.get("module_type")},renderTabs:function(){this.contentView.delegateEvents(),this.designView.delegateEvents(),this.displayView.delegateEvents(),this.visibilityView.delegateEvents(),this.visibilityView.afterRender()},sanitizeData:function(){},getDataToSave:function(){return{content:this.contentView.model.toJSON(),display:this.displayView.model.toJSON(),design:this.designView.model.toJSON(),visibility:this.visibilityView.model.toJSON()}}}))}),function(){"use strict";var e;(e="_page_hustle_popup_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_popup";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),l=Hustle.get("Module.IntegrationsView"),r=Module.Model,d=Hustle.get("Models.M");new t({model:new r(optinVars.current.data||{}),contentView:new i({BaseModel:d}),emailsView:new n({BaseModel:d}),designView:new s({BaseModel:d}),integrationsView:new l({BaseModel:d}),visibilityView:new a({BaseModel:d}),settingsView:new o({BaseModel:d})})}}()}(),function(){"use strict";var e;(e="_page_hustle_slidein_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_slidein";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),l=Hustle.get("Module.IntegrationsView"),r=Module.Model,d=Hustle.get("Models.M");new t({model:new r(optinVars.current.data||{}),contentView:new i({BaseModel:d}),emailsView:new n({BaseModel:d}),designView:new s({BaseModel:d}),integrationsView:new l({BaseModel:d}),visibilityView:new a({BaseModel:d}),settingsView:new o({BaseModel:d})})}}()}(),function(){"use strict";var e;(e="_page_hustle_embedded_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_embedded";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.View.extend(Hustle.get("Mixins.Wizard_View")),i=Hustle.View.extend(Hustle.get("Mixins.Module_Content")),n=Hustle.View.extend(Hustle.get("Mixins.Module_Emails")),s=Hustle.View.extend(Hustle.get("Mixins.Module_Design")),a=Hustle.View.extend(Hustle.get("Mixins.Module_Display")),o=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),l=Hustle.View.extend(Hustle.get("Mixins.Module_Settings")),r=Hustle.get("Module.IntegrationsView"),d=Module.Model,c=Hustle.get("Models.M");new t({model:new d(optinVars.current.data||{}),contentView:new i({BaseModel:c}),emailsView:new n({BaseModel:c}),designView:new s({BaseModel:c}),integrationsView:new r({BaseModel:c}),displayView:new a({BaseModel:c}),visibilityView:new o({BaseModel:c}),settingsView:new l({BaseModel:c})})}}()}(),function(){"use strict";var e;(e="_page_hustle_sshare_listing")===pagenow.substr(pagenow.length-e.length)&&new Optin.listingBase({moduleType:optinVars.current.module_type}),function(){var e="_page_hustle_sshare";if(e===pagenow.substr(pagenow.length-e.length)){var t=Hustle.get("SShare.View"),i=Hustle.get("SShare.Content_View"),n=Hustle.get("SShare.Display_View"),s=Hustle.get("SShare.Design_View"),a=Hustle.View.extend(Hustle.get("Mixins.Module_Visibility")),o=Module.Model,l=Hustle.get("Models.M");new t({model:new o(optinVars.current.data||{}),contentView:new i({BaseModel:l}),displayView:new n({BaseModel:l}),designView:new s({BaseModel:l}),visibilityView:new a({BaseModel:l})})}}()}(),Hustle.define("Dashboard.View",function(e){"use strict";"toplevel_page_hustle"===pagenow&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .hustle-preview-module-button":"previewModule","click .hustle-delete-module-button":"openDeleteModal","click .hustle-free-version-create":"showUpgradeModal","click .sui-dropdown .hustle-onload-icon-action":"addLoadingIconToActionsButton","click .hustle-single-module-button-action":"handleSingleModuleAction"},initialize:function(){e("#hustle-dialog--welcome").length?this.openWelcomeDialog():e("#hustle-dialog--migrate").length?this.openMigrateDialog():e("#hustle-dialog--release-highlight").length&&this.openReleaseHighlightDialog(),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if(Module.Utils.getUrlParam("show-notice")){var e="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",t=Module.Utils.getUrlParam("notice"),i=t&&"undefined"!==optinVars.messages[t]?optinVars.messages[t]:Module.Utils.getUrlParam("notice-message");void 0!==i&&i.length&&Module.Notification.open(e,i)}},previewModule:function(t){t.preventDefault();var i=e(t.currentTarget);this.getPreviewView().open(i.data("id"),i.data("type"),i,{module_name:i.data("name")})},getPreviewView:function(){if(!this.previewView){var e=Hustle.get("Modals.Preview");this.previewView=new e}return this.previewView},showUpgradeModal:function(t){void 0!==t&&t.preventDefault(),e("#wph-upgrade-modal").addClass("wpmudev-modal-active")},openDeleteModal:function(t){t.preventDefault();var i=e(t.currentTarget),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description")};Module.deleteModal.open(n,i[0])},addLoadingIconToActionsButton:function(t){e(t.currentTarget).closest(".sui-dropdown").find(".sui-dropdown-anchor").addClass("sui-button-onload")},openWelcomeDialog:function(){Hustle.get("Modals.Welcome")},openMigrateDialog:function(){Hustle.get("Modals.Migration")},openReleaseHighlightDialog:function(){Hustle.get("Modals.ReleaseHighlight")},handleSingleModuleAction:function(e){Module.handleActions.initAction(e,"dashboard",this)}}))}),Hustle.define("Integrations.View",function(e){"use strict";var t="_page_hustle_integrations";t===pagenow.substr(pagenow.length-t.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .connect-integration":"connectIntegration","keypress .connect-integration":"preventEnterKeyFromDoingThings"},initialize:function(){this.stopListening(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.listenTo(Hustle.Events,"hustle:providers:reload",this.renderProvidersTables),this.render()},render:function(){var e=this.$el.find("#hustle-not-connected-providers-section"),t=this.$el.find("#hustle-connected-providers-section");0<e.length&&0<t.length&&this.renderProvidersTables(),optinVars.integration_redirect&&this.handleIntegrationRedirect()},renderProvidersTables:function(){var t=this,i={};this.$el.find(".hustle-integrations-display").html('<div class="sui-notice hustle-integration-loading-notice">\n\t\t\t\t\t\t<div class="sui-notice-content">\n\t\t\t\t\t\t\t<div class="sui-notice-message">\n\n\t\t\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-loader sui-loading sui-md" aria-hidden="true"></span>\n\t\t\t\t\t\t\t\t<p>'.concat(optinVars.fetching_list,"</p>\n\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")),i.action="hustle_provider_get_providers",i._ajax_nonce=optinVars.providers_action_nonce,i.data={},e.post({url:ajaxurl,type:"post",data:i}).done(function(e){e&&e.success&&(t.$el.find("#hustle-not-connected-providers-section").html(e.data.not_connected),t.$el.find("#hustle-connected-providers-section").html(e.data.connected))}).always(function(){t.$el.find(".hustle-integration-loading-notice").remove()})},preventEnterKeyFromDoingThings:function(e){13===e.which&&e.preventDefault()},connectIntegration:function(e){Module.integrationsModal.open(e)},handleIntegrationRedirect:function(){var e=optinVars.integration_redirect,t=optinVars.integrations_migrate;if(window.history.pushState({},document.title,optinVars.integrations_url),"notification"===e.action){var i="success"===e.status?"success":"error",n=e.delay?e.delay:1e4;Module.Notification.open(i,e.message,n)}if(t.hasOwnProperty("provider_modal")&&"aweber"===t.provider_modal&&Module.ProviderMigration.open(t.provider_modal,t.integration_id),t.hasOwnProperty("migration_notificaiton")){var s="success"===t.migration_notificaiton.status?"success":"error",a=t.migration_notificaiton.delay?t.migration_notificaiton.delay:1e4;Module.Notification.open(s,t.migration_notificaiton.message,a)}}}))}),Hustle.define("Entries.View",function(e){"use strict";var t="_page_hustle_entries";t===pagenow.substr(pagenow.length-t.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .sui-pagination-wrap .hustle-open-inline-filter":"openFilterInline","click .sui-pagination-wrap .hustle-open-dialog-filter":"openFilterModal","click .hustle-delete-entry-button":"openDeleteModal","click .sui-active-filter-remove":"removeFilter","change input[name=search_email]":"toggleClearButton","change input[name=date_range]":"toggleClearButton","apply.daterangepicker input[name=date_range]":"toggleClearButton","click .hustle-entries-clear-filter":"clearFilter"},initialize:function(){this.initializeDaterangepicker();var t=e(".hui-entries-alert");t.length&&(t.attr("colspan",t.closest(".sui-table").find("> thead tr th").length),t.find("i").hide(),t.find("span").removeClass("sui-screen-reader-text")),e("input[name=search_email]").trigger("change")},initializeDaterangepicker:function(){var t=this.$(".hui-box-actions input.hustle-entries-filter-date"),i=this.$("#hustle-dialog--filter-entries input.hustle-entries-filter-date"),n=function(t,i){e(this).val(i.startDate.format("MM/DD/YYYY")+" - "+i.endDate.format("MM/DD/YYYY"))},s={autoUpdateInput:!1,autoApply:!0,alwaysShowCalendars:!0,locale:optinVars.daterangepicker,ranges:this.getDaterangepickerRanges()};t.daterangepicker(s),t.on("apply.daterangepicker",n);var a=Object.assign({parentEl:"#hustle-dialog--filter-entries .sui-box-body"},s);i.daterangepicker(a),i.on("apply.daterangepicker",n)},getDaterangepickerRanges:function(){var e={},t=optinVars.daterangepicker.ranges,i={today:[moment(),moment()],yesterday:[moment().subtract(1,"days"),moment().subtract(1,"days")],last_seven_days:[moment().subtract(6,"days"),moment()],last_thirty_days:[moment().subtract(29,"days"),moment()],this_month:[moment().startOf("month"),moment().endOf("month")],last_month:[moment().subtract(1,"month").startOf("month"),moment().subtract(1,"month").endOf("month")]};for(var n in i){var s=t[n],a=i[n];e[s]=a}return e},openFilterInline:function(e){var t=this.$(e.target),i=t.closest(".sui-pagination-wrap").find(".sui-button-icon"),n=t.closest(".hui-actions-bar").next(".sui-pagination-filter");i.toggleClass("sui-active"),n.toggleClass("sui-open"),e.preventDefault(),e.stopPropagation()},openFilterModal:function(t){t.preventDefault(),SUI.openModal("hustle-dialog--filter-entries",e(t.currentTarget)[0],this.$("#hustle-dialog--filter-entries .hustle-modal-close")[0],!0)},removeFilter:function(e){var t=this.$(e.target).data("filter"),i=new RegExp("&"+t+"=[^&]*","i");-1!==["order_by","search_email","date_range"].indexOf(t)&&(location.href=location.href.replace(i,""))},openDeleteModal:function(t){t.preventDefault();var i=e(t.target),n={id:i.data("id"),nonce:i.data("nonce"),action:"delete",title:i.data("title"),description:i.data("description"),actionClass:""};Module.deleteModal.open(n,i[0])},toggleClearButton:function(t){var i=e(t.target).closest("form"),n=i.find(".hustle-entries-clear-filter");i.find("input[name=search_email]").val()||i.find("input[name=date_range]").val()?n.prop("disabled",!1):n.prop("disabled",!0)},clearFilter:function(e){e.preventDefault(),this.$("input[name=search_email]").val(""),this.$("input[name=date_range]").val(""),this.toggleClearButton(e)}}))}),Hustle.define("ProviderNotice.View",function(e){"use strict";new(Backbone.View.extend({el:".hustle-provider-notice",cookieKey:"",events:{"click .dismiss-provider-migration-notice":"HideProviderNotice"},initialize:function(){this.cookieKey="provider_migration_notice_",e(".hustle-provider-notice").length&&this.showProviderNotice()},HideProviderNotice:function(t){Optin.cookie.set(this.cookieKey+e(t.currentTarget).data("name"),1,7),location.reload()},showProviderNotice:function(){var t=e(".hustle-provider-notice").data("name");1!==Optin.cookie.get(this.cookieKey+t)&&e(".hustle_migration_notice__"+t).show()}}))}),Hustle.define("Settings.View",function(e,t,i){"use strict";var n="_page_hustle_settings";n===pagenow.substr(pagenow.length-n.length)&&new(Backbone.View.extend({el:".sui-wrap-hustle",events:{"click .sui-sidenav .sui-vertical-tab a":"sidenav","change select.sui-mobile-nav":"sidenavMobile","click .sui-pagination-wrap > button":"pagination","click .hustle-load-on-click":"addLoadingState","click .hustle-settings-save":"handleSave"},initialize:function(){var t=Hustle.get("Settings.reCaptcha_Settings"),n=Hustle.get("Settings.Top_Metrics_View"),s=Hustle.get("Settings.Privacy_Settings"),a=Hustle.get("Settings.Permissions_View"),o=Hustle.get("Settings.Data_Settings"),l=Hustle.get("Settings.Palettes");this.recaptchaView=new t,new n,new s,new a,new o,new l,e(i).off("popstate",e.proxy(this.tabUpdate,this)),e(i).on("popstate",e.proxy(this.tabUpdate,this)),Hustle.Events.trigger("view.rendered",this),this.doActionsBasedOnUrl()},doActionsBasedOnUrl:function(){if(Module.Utils.getUrlParam("show-notice")){var e="success"===Module.Utils.getUrlParam("show-notice")?"success":"error",t=Module.Utils.getUrlParam("notice"),i=t&&"undefined"!==optinVars.messages[t]?optinVars.messages[t]:Module.Utils.getUrlParam("notice-message");void 0!==i&&i.length&&Module.Notification.open(e,i)}else Module.Utils.getUrlParam("404-downgrade-modal")&&this.$("#hustle-dialog--404-downgrade").length&&SUI.openModal("hustle-dialog--404-downgrade","hustle-popup-number")},sidenav:function(t){var i=e(t.target).data("tab");i&&this.tabJump(i,!0),t.preventDefault()},sidenavMobile:function(t){var i=e(t.currentTarget).val();i&&this.tabJump(i,!0)},tabUpdate:function(e){var t=e.originalEvent.state;t&&this.tabJump(t.tabSelected)},tabJump:function(e,t){var i=this.$el.find('a[data-tab="'+e+'"]'),n=i.closest(".sui-vertical-tabs").find(".sui-vertical-tab"),s=this.$el.find(".sui-box[data-tab]"),a=this.$el.find('.sui-box[data-tab="'+e+'"]');t&&history.pushState({tabSelected:e},"Hustle Settings","admin.php?page=hustle_settings&section="+e),n.removeClass("current"),s.hide(),i.parent().addClass("current"),a.show()},pagination:function(e){var t=this.$(e.target).closest(".sui-pagination-wrap"),i=t.find(".sui-button-icon"),n=t.next(".sui-pagination-filter");i.toggleClass("sui-active"),n.toggleClass("sui-open"),e.preventDefault(),e.stopPropagation()},handleSave:function(t){t.preventDefault();var i=this,n=e(t.currentTarget),s=n.data("form-id"),a=n.data(),o=new FormData;if(tinyMCE.triggerSave(),void 0!==s){var l=e("#"+s);l.length&&(o=new FormData(l[0]),e.each(l.find("input[type=checkbox]"),function(){var t=e(this);t.is(":checked")||o.append(t.attr("name"),"0")}))}e.each(a,function(e,t){return o.append(e,t)}),o.append("_ajax_nonce",optinVars.current.save_settings_nonce),o.append("action","hustle_save_settings"),n.addClass("sui-button-onload"),n.prop("disabled",!0),e.ajax({url:ajaxurl,type:"POST",data:o,contentType:!1,processData:!1}).done(function(t){t.data?(t.data.callback&&"undefined"!==i[t.data.callback]&&i[t.data.callback](n,t.data,t.success),t.data.url?!0===t.data.url?location.reload():location.replace(t.data.url):t.data.notification&&Module.Notification.open(t.data.notification.status,t.data.notification.message,t.data.notification.delay),t.data.url||(e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1))):(t.success?Module.Notification.open("success",optinVars.messages.settings_saved):Module.Notification.open("error",optinVars.messages.something_went_wrong_reload),e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1))}).fail(function(){e(".sui-button-onload").removeClass("sui-button-onload"),n.prop("disabled",!1),Module.Notification.open("error",optinVars.messages.something_went_wrong)})},actionSaveRecaptcha:function(){this.recaptchaView.maybeRenderRecaptchas()},addLoadingState:function(t){e(t.currentTarget).addClass("sui-button-onload")}}))});
humans.txt CHANGED
@@ -5,5 +5,5 @@
5
  Front Developer: Leighton Sapir
6
  Location: Ecuador
7
 
8
- Designer: Victor Ivanov
9
- Location: Melbourne, Australia
5
  Front Developer: Leighton Sapir
6
  Location: Ecuador
7
 
8
+ Designer: Mukul Chawla
9
+ Location: India
inc/class-hustle-dashboard-admin.php CHANGED
@@ -13,7 +13,7 @@ class Hustle_Dashboard_Admin extends Hustle_Admin_Page_Abstract {
13
 
14
  const WELCOME_MODAL_NAME = 'welcome_modal';
15
  const MIGRATE_MODAL_NAME = 'migrate_modal';
16
- const HIGHLIGHT_MODAL_NAME = 'release_highlight_modal_435';
17
  const MIGRATE_NOTICE_NAME = 'migrate_notice';
18
 
19
  /**
13
 
14
  const WELCOME_MODAL_NAME = 'welcome_modal';
15
  const MIGRATE_MODAL_NAME = 'migrate_modal';
16
+ const HIGHLIGHT_MODAL_NAME = 'release_highlight_modal_440';
17
  const MIGRATE_NOTICE_NAME = 'migrate_notice';
18
 
19
  /**
inc/provider/class-hustle-provider-form-hooks-abstract.php CHANGED
@@ -72,7 +72,7 @@ abstract class Hustle_Provider_Form_Hooks_Abstract {
72
  * Details of the subscriber from api
73
  *
74
  * @since 4.0.2
75
- * @var Hustle_Provider_Form_Settings_Abstract|null
76
  */
77
  protected $_subscriber = array();
78
 
72
  * Details of the subscriber from api
73
  *
74
  * @since 4.0.2
75
+ * @var mixed
76
  */
77
  protected $_subscriber = array();
78
 
inc/provider/class-hustle-provider-form-settings-abstract.php CHANGED
@@ -62,6 +62,14 @@ abstract class Hustle_Provider_Form_Settings_Abstract {
62
  */
63
  protected $form_completion_options = array();
64
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Hustle_Provider_Form_Settings_Abstract
67
  *
@@ -79,6 +87,20 @@ abstract class Hustle_Provider_Form_Settings_Abstract {
79
  $this->addon_form_settings = $this->get_form_settings_values( false );
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * Get the settings value for this module.
84
  * Hooked with
@@ -652,4 +674,64 @@ abstract class Hustle_Provider_Form_Settings_Abstract {
652
  public function get_form_completion_options( $saved_form_settings ) {
653
  return $this->form_completion_options;
654
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  }
62
  */
63
  protected $form_completion_options = array();
64
 
65
+ /**
66
+ * Instance of Hustle_Layout_Helper
67
+ *
68
+ * @since 4.4.0
69
+ * @var Hustle_Layout_Helper
70
+ */
71
+ private $renderer;
72
+
73
  /**
74
  * Hustle_Provider_Form_Settings_Abstract
75
  *
87
  $this->addon_form_settings = $this->get_form_settings_values( false );
88
  }
89
 
90
+ /**
91
+ * Gets the instance of the renderer class.
92
+ *
93
+ * @since 4.4.0
94
+ *
95
+ * @return Hustle_Layout_Helper
96
+ */
97
+ final protected function get_renderer() {
98
+ if ( empty( $this->renderer ) ) {
99
+ $this->renderer = new Hustle_Layout_Helper();
100
+ }
101
+ return $this->renderer;
102
+ }
103
+
104
  /**
105
  * Get the settings value for this module.
106
  * Hooked with
674
  public function get_form_completion_options( $saved_form_settings ) {
675
  return $this->form_completion_options;
676
  }
677
+
678
+ /**
679
+ * Returns the module's fields to be used in the mapping step.
680
+ * This array is intended to be passed as the select's options argument.
681
+ *
682
+ * @since 4.4.0
683
+ *
684
+ * @param bool $required Whether to retrieve required fields only.
685
+ * @param bool|string $type Field type to filter fields. False if retrieving all fields.
686
+ * @return array
687
+ */
688
+ protected function get_form_fields_for_map_step( $required = false, $type = false ) {
689
+ $module = new Hustle_Module_Model( $this->module_id );
690
+
691
+ $module_fields = $module->get_form_fields();
692
+
693
+ /**
694
+ * Filters the fields used for mapping the data sent to the provider.
695
+ *
696
+ * @since 4.4.0
697
+ *
698
+ * @param int $module_id Current module ID.
699
+ * @param string $provider_slug Slug of the current provider.
700
+ */
701
+ $excluded_form_fields = apply_filters( 'hustle_fields_excluded_from_mapping', array( 'recaptcha', 'submit' ), $this->module_id, $this->provider->get_slug() );
702
+
703
+ $map_fields = array();
704
+ foreach ( $module_fields as $field ) {
705
+ if ( ! in_array( $field['type'], $excluded_form_fields, true ) ) {
706
+ // When retrieving required fields only.
707
+ if ( $required && 'false' === $field['required'] ) {
708
+ continue;
709
+ }
710
+
711
+ // When retrieving fields of a type only.
712
+ if ( $type && $type !== $field['type'] ) {
713
+ continue;
714
+ }
715
+ $map_fields[ $field['name'] ] = $field['label'] . ' | ' . $field['name'];
716
+ }
717
+ }
718
+
719
+ return $map_fields;
720
+ }
721
+
722
+ /**
723
+ * Gets the main email field for the mapping step.
724
+ *
725
+ * @since 4.4.0
726
+ *
727
+ * @return array
728
+ */
729
+ protected function get_main_email_field_for_map_step() {
730
+ $module = new Hustle_Module_Model( $this->module_id );
731
+ $module_fields = $module->get_form_fields();
732
+
733
+ return array(
734
+ 'email' => $module_fields['email']['label'] . ' | ' . $module_fields['email']['name'],
735
+ );
736
+ }
737
  }
inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailpoet's form hooks class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailpoet_Form_Hooks.
12
+ * Define the form hooks that are used by Mailpoet.
13
+ *
14
+ * @since 4.4.0
15
+ */
16
+ class Hustle_Mailpoet_Form_Hooks extends Hustle_Provider_Form_Hooks_Abstract {
17
+
18
+ /**
19
+ * Add the provider's data to the created entry.
20
+ *
21
+ * @since 4.4.0
22
+ *
23
+ * @param array $submitted_data The submitted data.
24
+ * @throws Exception When the data wasn't sent to the integration for some reason.
25
+ * @return array
26
+ */
27
+ public function add_entry_fields( $submitted_data ) {
28
+ /**
29
+ * Filter submitted form data to be processed
30
+ *
31
+ * @since 4.4.0
32
+ *
33
+ * @param array $submitted_data
34
+ * @param int $module_id current module_id
35
+ * @param Hustle_Mailpoet_Form_Settings $form_settings_instance
36
+ */
37
+ $submitted_data = apply_filters(
38
+ 'hustle_provider_mailpoet_form_submitted_data',
39
+ $submitted_data,
40
+ $this->module_id,
41
+ $this->form_settings_instance
42
+ );
43
+
44
+ try {
45
+ if ( empty( $submitted_data['email'] ) ) {
46
+ throw new Exception( __( 'Required Field "email" was not filled by the user.', 'hustle' ) );
47
+ }
48
+
49
+ $saved_settings = $this->form_settings_instance->get_form_settings_values();
50
+
51
+ /**
52
+ * Fires before adding subscriber
53
+ *
54
+ * @since 4.4.0
55
+ *
56
+ * @param int $module_id
57
+ * @param array $submitted_data
58
+ * @param object $form_settings_instance
59
+ */
60
+ do_action(
61
+ 'hustle_provider_mailpoet_before_add_subscriber',
62
+ $this->module_id,
63
+ $submitted_data,
64
+ $this->form_settings_instance
65
+ );
66
+
67
+ $subcription_data = $this->map_fields( $saved_settings, $submitted_data );
68
+
69
+ $subscriber = $this->get_subscriber( $this->addon->get_api(), $subcription_data['email'] );
70
+ if ( empty( $subscriber ) ) {
71
+ // Only new subscribers get the custom fields. This is a Mailpoet API's limitation.
72
+ $subscriber = $this->add_new_subscriber( $subcription_data, $saved_settings['list_id'] );
73
+ } else {
74
+ $subscriber = $this->add_existing_subscriber_to_list( $subscriber['id'], $saved_settings['list_id'] );
75
+ }
76
+
77
+ /**
78
+ * Fires after adding subscriber
79
+ *
80
+ * @since 4.4.0
81
+ *
82
+ * @param int $module_id
83
+ * @param array $subcription_data
84
+ * @param mixed $subscriber
85
+ * @param object $form_settings_instance
86
+ */
87
+ do_action(
88
+ 'hustle_provider_mailpoet_after_add_subscriber',
89
+ $this->module_id,
90
+ $subcription_data,
91
+ $subscriber,
92
+ $this->form_settings_instance
93
+ );
94
+
95
+ if ( is_array( $subscriber ) ) {
96
+ foreach ( $subscriber['subscriptions'] as $subscription ) {
97
+ if ( $saved_settings['list_id'] === $subscription['segment_id'] ) {
98
+ $subscription_status = $subscription['status'];
99
+ }
100
+ }
101
+
102
+ if ( ! empty( $subscription_status ) ) {
103
+ $entry_fields = array(
104
+ array(
105
+ 'name' => 'status',
106
+ 'value' => array(
107
+ 'is_sent' => true,
108
+ 'description' => __( 'Successfully added or updated member on Mailpoet list', 'hustle' ),
109
+ 'data_sent' => $subcription_data,
110
+ 'data_received' => array(),
111
+ 'member_status' => $subscription_status,
112
+ 'list_name' => $saved_settings['list_name'],
113
+ ),
114
+ ),
115
+ );
116
+ } else {
117
+ throw new Exception( 'Subscriber not added to the list.' );
118
+ }
119
+ } else {
120
+ throw new Exception( 'Invalid subscriber.' );
121
+ }
122
+ } catch ( Exception $e ) {
123
+ // Error codes for when the user was subscribed but the
124
+ // confirmation email (code 10) or the welcome email (code 17) failed to send.
125
+ $member_status = 10 === $e->getCode() || 17 === $e->getCode() ?
126
+ __( 'User added to the list but the emails could not be sent.', 'hustle' ) :
127
+ __( 'The user could not be subscribed.', 'hustle' );
128
+
129
+ $entry_fields = array(
130
+ array(
131
+ 'name' => 'status',
132
+ 'value' => array(
133
+ 'is_sent' => false,
134
+ 'description' => $e->getMessage(),
135
+ 'data_sent' => $subcription_data,
136
+ 'data_received' => array( 'Code: ' . $e->getCode() . ' - ' . $e->getMessage() ),
137
+ 'member_status' => $member_status,
138
+ 'list_name' => $saved_settings['list_name'],
139
+ ),
140
+ ),
141
+ );
142
+ }
143
+
144
+ $entry_fields = apply_filters(
145
+ 'hustle_provider_mailpoet_entry_fields',
146
+ $entry_fields,
147
+ $this->module_id,
148
+ $submitted_data,
149
+ $this->form_settings_instance
150
+ );
151
+ return $entry_fields;
152
+ }
153
+
154
+ /**
155
+ * Maps the submitted data to Mailpoet's fields.
156
+ *
157
+ * @since 4.4.0
158
+ *
159
+ * @param array $saved_settings The module's saved settings.
160
+ * @param array $submitted_data The data submitted.
161
+ * @return array
162
+ */
163
+ private function map_fields( $saved_settings, $submitted_data ) {
164
+ $subcription_data = array();
165
+
166
+ foreach ( $saved_settings['fields_map'] as $mailpoet_field => $hustle_field ) {
167
+ // Skip if hustle's fields changed but the provider's map wasn't updated.
168
+ if ( ! isset( $submitted_data[ $hustle_field ] ) ) {
169
+ continue;
170
+ }
171
+
172
+ $subscription_data[ $mailpoet_field ] = $submitted_data[ $hustle_field ];
173
+ }
174
+
175
+ return $subscription_data;
176
+ }
177
+
178
+ /**
179
+ * Check whether the email is already subscribed.
180
+ *
181
+ * @since 4.4.0
182
+ *
183
+ * @param array $submitted_data The submitted data.
184
+ * @param bool $allow_subscribed Whether to allow already subscribed users.
185
+ * @return bool
186
+ */
187
+ public function on_form_submit( $submitted_data, $allow_subscribed = true ) {
188
+ if ( empty( $submitted_data['email'] ) ) {
189
+ return __( 'Required Field "email" was not filled by the user.', 'hustle' );
190
+ }
191
+
192
+ $is_success = true;
193
+
194
+ if ( ! $allow_subscribed ) {
195
+
196
+ /**
197
+ * Filter submitted form data to be processed
198
+ *
199
+ * @since 4.4.0
200
+ *
201
+ * @param array $submitted_data
202
+ * @param int $module_id Current module_id
203
+ * @param Hustle_Mailpoet_Form_Settings $form_settings_instance
204
+ */
205
+ $submitted_data = apply_filters(
206
+ 'hustle_provider_mailpoet_form_submitted_data_before_validation',
207
+ $submitted_data,
208
+ $this->module_id,
209
+ $this->form_settings_instance
210
+ );
211
+
212
+ $subscriber = $this->get_subscriber( $this->addon->get_api(), $submitted_data['email'] );
213
+
214
+ if ( ! empty( $subscriber ) && ! empty( $subscriber['subscriptions'] ) ) {
215
+ $saved_settings = $this->form_settings_instance->get_form_settings_values();
216
+
217
+ // Check if the email is subscribed to the selected list, and that its status is 'subscribed'.
218
+ foreach ( $subscriber['subscriptions'] as $subscription ) {
219
+ if ( $saved_settings['list_id'] === $subscription['segment_id'] && 'subscribed' === $subscription['status'] ) {
220
+ $is_success = self::ALREADY_SUBSCRIBED_ERROR;
221
+ break;
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ /**
228
+ * Return `true` if success, or **(string) error message** on failure.
229
+ *
230
+ * @since 4.4.0
231
+ *
232
+ * @param bool $is_success
233
+ * @param int $module_id current module_id
234
+ * @param array $submitted_data
235
+ * @param Hustle_Mailpoet_Form_Settings $form_settings_instance
236
+ */
237
+ $is_success = apply_filters(
238
+ 'hustle_provider_mailpoet_form_submitted_data_after_validation',
239
+ $is_success,
240
+ $this->module_id,
241
+ $submitted_data,
242
+ $this->form_settings_instance
243
+ );
244
+
245
+ // Only update `_submit_form_error_message` when $is_success is not empty nor 'true'.
246
+ if ( true !== $is_success && ! empty( $is_success ) ) {
247
+ $this->_submit_form_error_message = (string) $is_success;
248
+ }
249
+
250
+ return $is_success;
251
+ }
252
+
253
+ /**
254
+ * Get the subscriber's data for the given email and selected list_id.
255
+ *
256
+ * @since 4.4.0
257
+ *
258
+ * @param \MailPoet\API\API $api Mailpoet API instance.
259
+ * @param string $email Email address trying to subscribe.
260
+ *
261
+ * @return array|null Array with the subscriber data if the subscriber is found. Null otherwise.
262
+ * @throws Exception When the subscriber is found.
263
+ */
264
+ protected function get_subscriber( $api, $email ) {
265
+ if ( empty( $this->_subscriber ) && ! is_null( $this->_subscriber ) ) {
266
+ try {
267
+ // This throws an Exception when no subscriber is found.
268
+ $this->_subscriber = $api->getSubscriber( $email );
269
+
270
+ } catch ( Exception $e ) {
271
+ $this->_subscriber = null;
272
+ }
273
+ }
274
+ return $this->_subscriber;
275
+ }
276
+
277
+ /**
278
+ * Adds an existing subscriber to a list.
279
+ *
280
+ * @since 4.4.0
281
+ *
282
+ * @see https://github.com/mailpoet/mailpoet/blob/master/doc/api_methods/AddSubscriber.md
283
+ *
284
+ * @param string $subscriber_id The existing subscriber ID.
285
+ * @param string $list_id ID of the list to subscribe to.
286
+ * @return bool
287
+ * @throws Exception When something goes wrong with subscribeToList().
288
+ */
289
+ private function add_existing_subscriber_to_list( $subscriber_id, $list_id ) {
290
+ // This could throw an exception that's caught by the method calling this.
291
+ $subscriber = $this->addon->get_api()->subscribeToList( $subscriber_id, $list_id );
292
+
293
+ return $subscriber;
294
+ }
295
+
296
+ /**
297
+ * Adds a new subscriber to Mailpoet.
298
+ * The subscriber is already added to the list by this method.
299
+ *
300
+ * @since 4.4.0
301
+ *
302
+ * @see https://github.com/mailpoet/mailpoet/blob/master/doc/api_methods/SubscribeToList.md
303
+ *
304
+ * @param array $subscription_data The submitted data already mapped to match Mailpoet's fields.
305
+ * @param string $list_id ID of the list to subscribe to.
306
+ * @return bool
307
+ * @throws Exception When something goes wrong with addSubscriber().
308
+ */
309
+ private function add_new_subscriber( $subscription_data, $list_id ) {
310
+ // This could throw an exception that's caught by the method calling this.
311
+ $subscriber = $this->addon->get_api()->addSubscriber( $subscription_data, array( $list_id ) );
312
+
313
+ return $subscriber;
314
+ }
315
+ }
inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailpoet's form settings class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailpoet_Form_Settings
12
+ *
13
+ * @since 4.4.0
14
+ */
15
+ class Hustle_Mailpoet_Form_Settings extends Hustle_Provider_Form_Settings_Abstract {
16
+
17
+ /**
18
+ * Options that must be set in order to consider the integration as "connected" to the form.
19
+ *
20
+ * @since 4.4.0
21
+ * @var array
22
+ */
23
+ protected $form_completion_options = array( 'list_id', 'list_name', 'fields_map' );
24
+
25
+ /**
26
+ * For settings Wizard steps
27
+ *
28
+ * @since 4.4.0
29
+ * @return array
30
+ */
31
+ public function form_settings_wizards() {
32
+ return array(
33
+ array(
34
+ 'callback' => array( $this, 'first_step_callback' ),
35
+ 'is_completed' => array( $this, 'first_step_is_completed' ),
36
+ ),
37
+ array(
38
+ 'callback' => array( $this, 'map_fields_step' ),
39
+ 'is_completed' => array( $this, 'map_fields_step_is_completed' ),
40
+ ),
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Check if step is completed
46
+ *
47
+ * @since 4.4.0
48
+ * @return bool
49
+ */
50
+ public function first_step_is_completed() {
51
+ $this->addon_form_settings = $this->get_form_settings_values();
52
+ if ( ! isset( $this->addon_form_settings['list_id'] ) ) {
53
+ $this->addon_form_settings['list_id'] = array();
54
+
55
+ return false;
56
+ }
57
+
58
+ if ( empty( $this->addon_form_settings['list_id'] ) ) {
59
+ return false;
60
+ }
61
+
62
+ return true;
63
+ }
64
+
65
+ /**
66
+ * Returns all settings and conditions for 1st step of e-Newsletter settings
67
+ *
68
+ * @since 4.4.0
69
+ *
70
+ * @param array $submitted_data The submitted data.
71
+ * @param bool $is_submit Whether the request is a submission.
72
+ *
73
+ * @return array
74
+ */
75
+ public function first_step_callback( $submitted_data, $is_submit ) {
76
+ $current_data = $this->get_current_data( array( 'list_id' => '' ), $submitted_data );
77
+ if ( $is_submit && empty( $submitted_data['list_id'] ) ) {
78
+ $error_message = __( 'The email list is required.', 'hustle' );
79
+ }
80
+
81
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
82
+ __( 'Mailpoet List', 'hustle' ),
83
+ __( "Choose the subscriber's list to which you want to send form data.", 'hustle' )
84
+ );
85
+
86
+ if ( ! empty( $error_message ) ) {
87
+ $step_html .= '<span class="sui-error-message">' . $error_message . '</span>';
88
+ }
89
+
90
+ $step_html .= $this->get_first_step_html( $current_data );
91
+
92
+ $is_connected = $this->provider->is_form_connected( $this->module_id );
93
+
94
+ $buttons = array();
95
+ if ( $is_connected ) {
96
+ $buttons['disconnect'] = array(
97
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
98
+ __( 'Disconnect', 'hustle' ),
99
+ 'sui-button-ghost',
100
+ 'disconnect_form',
101
+ true
102
+ ),
103
+ );
104
+ }
105
+
106
+ $buttons['continue'] = array(
107
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
108
+ __( 'Continue', 'hustle' ),
109
+ $is_connected ? '' : 'sui-button-right',
110
+ 'next',
111
+ true
112
+ ),
113
+ );
114
+
115
+ $response = array(
116
+ 'html' => $step_html,
117
+ 'buttons' => $buttons,
118
+ 'has_errors' => ! empty( $error_message ),
119
+ );
120
+
121
+ // Save only after the step has been validated and there are no errors.
122
+ if ( $is_submit && empty( $error_message ) ) {
123
+ $current_data['list_name'] = $this->_lists[ $current_data['list_id'] ];
124
+ $this->save_form_settings_values( $current_data );
125
+ }
126
+
127
+ return $response;
128
+ }
129
+
130
+ /**
131
+ * Return an array of options used to display the settings of the 1st step.
132
+ *
133
+ * @since 4.4.0
134
+ *
135
+ * @param array $submitted_data The data submitted.
136
+ *
137
+ * @return array
138
+ */
139
+ private function get_first_step_html( $submitted_data ) {
140
+ $lists = array();
141
+
142
+ $fetched_lists = $this->provider->get_api()->getLists();
143
+
144
+ if ( is_array( $fetched_lists ) && ! empty( $fetched_lists ) ) {
145
+ $lists = wp_list_pluck( $fetched_lists, 'name', 'id' );
146
+
147
+ $this->_lists = $lists;
148
+ }
149
+
150
+ $options = array(
151
+ array(
152
+ 'type' => 'wrapper',
153
+ 'elements' => array(
154
+ array(
155
+ 'type' => 'label',
156
+ 'value' => __( 'Email List', 'hustle' ),
157
+ ),
158
+ array(
159
+ 'type' => 'select',
160
+ 'name' => 'list_id',
161
+ 'id' => 'hustle-email-provider-lists',
162
+ 'selected' => $submitted_data['list_id'],
163
+ 'options' => $lists,
164
+ ),
165
+ ),
166
+ 'attributes' => array(
167
+ 'style' => 'margin-bottom: 0',
168
+ ),
169
+ ),
170
+ );
171
+
172
+ return Hustle_Provider_Utils::get_html_for_options( $options );
173
+ }
174
+
175
+ /**
176
+ * Checks whether the fields mapping step was completed.
177
+ *
178
+ * @since 4.4.0
179
+ *
180
+ * @return bool
181
+ */
182
+ public function map_fields_step_is_completed() {
183
+ return false;
184
+ }
185
+
186
+ /**
187
+ * Handles the step for mapping the fields.
188
+ *
189
+ * @since 4.4.0
190
+ *
191
+ * @param array $submitted_data Data sent in the form submission when the request was a form submission.
192
+ * @param bool $is_submit Whether the request was a form submission.
193
+ *
194
+ * @return array
195
+ */
196
+ public function map_fields_step( $submitted_data, $is_submit ) {
197
+ if ( $is_submit ) {
198
+ $error_message = $this->validate_map_fields_step( $submitted_data );
199
+
200
+ // Save only after the step has been validated and there are no errors.
201
+ if ( empty( $error_message ) ) {
202
+ $this->save_map_fields_step( $submitted_data );
203
+ }
204
+ }
205
+
206
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
207
+ __( 'Map Fields', 'hustle' ),
208
+ __( 'Map your Hustle fields to Mailpoet’s List fields below. Unmapped fields will be skipped.', 'hustle' )
209
+ );
210
+
211
+ if ( ! empty( $error_message ) ) {
212
+ $step_html .= '<span class="sui-error-message">' . $error_message . '</span>';
213
+ }
214
+
215
+ $step_html .= $this->get_map_fields_step_html();
216
+
217
+ $buttons = array(
218
+ 'back' => array(
219
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
220
+ __( 'Back', 'hustle' ),
221
+ 'sui-button-ghost',
222
+ 'prev',
223
+ true
224
+ ),
225
+ ),
226
+ 'save' => array(
227
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
228
+ __( 'Save', 'hustle' ),
229
+ '',
230
+ 'next',
231
+ true
232
+ ),
233
+ ),
234
+ );
235
+
236
+ return array(
237
+ 'html' => $step_html,
238
+ 'buttons' => $buttons,
239
+ 'has_errors' => ! empty( $error_message ),
240
+ 'size' => 'large',
241
+ );
242
+ }
243
+
244
+ /**
245
+ * Validates the submission for mapping the fields.
246
+ *
247
+ * @since 4.4.0
248
+ *
249
+ * @param array $submitted_data The data submitted.
250
+ * @return string|false
251
+ */
252
+ private function validate_map_fields_step( $submitted_data ) {
253
+ if ( empty( $submitted_data['fields_map'] ) ) {
254
+ return __( 'Mapping the fields is required.', 'hustle' );
255
+ }
256
+
257
+ $mailpoet_fields = $this->provider->get_api()->getSubscriberFields();
258
+
259
+ $missing_required_fields = array();
260
+ foreach ( $mailpoet_fields as $field ) {
261
+ if ( ! empty( $field['params']['required'] ) && empty( $submitted_data['fields_map'][ $field['id'] ] ) ) {
262
+ $missing_required_fields[] = $field['name'];
263
+ }
264
+ }
265
+
266
+ if ( ! empty( $missing_required_fields ) ) {
267
+ /* translators: Missing required fields separated by comma. */
268
+ return sprintf( __( 'The following fields are required: %s', 'hustle' ), implode( ', ', $missing_required_fields ) );
269
+ }
270
+
271
+ return false;
272
+ }
273
+
274
+ /**
275
+ * Saves the values from the step for mapping the fields.
276
+ *
277
+ * @since 4.4.0
278
+ *
279
+ * @param array $submitted_data The data submitted.
280
+ */
281
+ private function save_map_fields_step( $submitted_data ) {
282
+ $data_to_save = $this->get_form_settings_values();
283
+
284
+ $data_to_save['fields_map'] = array_filter( $submitted_data['fields_map'] );
285
+
286
+ $this->save_form_settings_values( $data_to_save );
287
+ }
288
+
289
+ /**
290
+ * Returns the markup for the step to map the fields.
291
+ *
292
+ * @since 4.4.0
293
+ *
294
+ * @return string
295
+ */
296
+ private function get_map_fields_step_html() {
297
+ $mailpoet_fields = $this->provider->get_api()->getSubscriberFields();
298
+
299
+ $saved_settings = $this->get_form_settings_values();
300
+
301
+ $module_fields = $this->get_form_fields_for_map_step();
302
+ $required_fields = $this->get_form_fields_for_map_step( true );
303
+
304
+ $html = '<table class="sui-table">';
305
+ $html .= '<thead><tr>
306
+ <th>' . esc_html__( 'Provider Field', 'hustle' ) . '</th>
307
+ <th>' . esc_html__( 'Hustle Field', 'hustle' ) . '</th>
308
+ </tr></thead>';
309
+ $html .= '<tbody>';
310
+
311
+ $selected = '';
312
+
313
+ foreach ( $mailpoet_fields as $field ) {
314
+
315
+ $selected = ! empty( $saved_settings['fields_map'][ $field['id'] ] ) ?
316
+ $saved_settings['fields_map'][ $field['id'] ] :
317
+ '';
318
+
319
+ $field_label = $field['name'];
320
+
321
+ if ( ! empty( $field['params']['required'] ) ) {
322
+ $field_label .= '<span class="integrations-required-field">*</span>';
323
+
324
+ // This is the subscriber's email field. Map it to the static one.
325
+ if ( 'email' === $field['id'] ) {
326
+ $fields_options = $this->get_main_email_field_for_map_step();
327
+ $selected = 'email';
328
+
329
+ } else {
330
+ $fields_options = $required_fields;
331
+ }
332
+ } else {
333
+ $fields_options = $module_fields;
334
+ }
335
+
336
+ $html .= '<tr>';
337
+ $html .= '<td>' . $field_label . '</td>';
338
+ $html .= '<td>' . $this->get_form_field_select( $field, $fields_options, $selected ) . '</td>';
339
+ $html .= '</tr>';
340
+ }
341
+ $html .= '</tbody></table>';
342
+
343
+ $message = sprintf(
344
+ /* translators: 1. opening 'b' tag, 2. closing 'b' tag, 3. closing and opening 'p' tag. */
345
+ esc_html__( "%1\$sImportant!%2\$s If you've just added new fields in your hustle module, you need to first save your changes for the fields to show up in the dropdown above.%3\$sAlso, when a field’s name is changed in hustle, its mapping will be lost, and you’ll need to re-map it in the integration." ),
346
+ '<b>',
347
+ '</b>',
348
+ '</p><p>'
349
+ );
350
+
351
+ $notice_options = array(
352
+ array(
353
+ 'type' => 'inline_notice',
354
+ 'value' => $message,
355
+ 'icon' => 'info',
356
+ 'class' => 'sui-notice-info',
357
+ ),
358
+ );
359
+
360
+ $html .= $this->get_renderer()->get_html_for_options( $notice_options, true );
361
+
362
+ return $html;
363
+ }
364
+
365
+ /**
366
+ * Gets the markup for the fields' select.
367
+ *
368
+ * @since 4.4.0
369
+ *
370
+ * @param array $mailpoet_field Mailpoet field to display the options for.
371
+ * @param array $module_fields List of the module's saved fields to choose from.
372
+ * @param string $selected Currently selected value.
373
+ *
374
+ * @return array
375
+ */
376
+ private function get_form_field_select( $mailpoet_field, $module_fields, $selected ) {
377
+ $options = array(
378
+ array(
379
+ 'type' => 'select',
380
+ 'name' => 'fields_map[' . $mailpoet_field['id'] . ']',
381
+ 'class' => 'sui-select',
382
+ 'placeholder' => ! empty( $mailpoet_field['params']['required'] ) ? false : __( 'None', 'hustle' ),
383
+ 'options' => $module_fields,
384
+ 'selected' => $selected,
385
+ 'id' => 'select-fields_map_' . $mailpoet_field['id'],
386
+ ),
387
+ );
388
+ return $this->get_renderer()->get_html_for_options( $options, true );
389
+ }
390
+ }
inc/providers/mailpoet/class-hustle-mailpoet.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailpoet v3 class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailpoet.
12
+ *
13
+ * @since 4.4.0
14
+ */
15
+ class Hustle_Mailpoet extends Hustle_Provider_Abstract {
16
+
17
+ /**
18
+ * Provider Instance
19
+ *
20
+ * @since 4.4.0
21
+ *
22
+ * @var self|null
23
+ */
24
+ protected static $_instance;
25
+
26
+ /**
27
+ * Provider slug.
28
+ *
29
+ * @since 4.4.0
30
+ *
31
+ * @var string
32
+ */
33
+ protected $_slug = 'mailpoet';
34
+
35
+ /**
36
+ * Provider version.
37
+ *
38
+ * @var string
39
+ */
40
+ protected $_version = '1.0.0';
41
+
42
+ /**
43
+ * Provider's name class name.
44
+ *
45
+ * @since 4.4.0
46
+ *
47
+ * @var string
48
+ */
49
+ protected $_class = __CLASS__;
50
+
51
+ /**
52
+ * Provider's title.
53
+ *
54
+ * @since 4.4.0
55
+ *
56
+ * @var string
57
+ */
58
+ protected $_title = 'Mailpoet';
59
+
60
+ /**
61
+ * Whether there can be multiple global instances.
62
+ *
63
+ * @since 4.4.0
64
+ *
65
+ * @var string
66
+ */
67
+ protected $is_multi_on_global = false;
68
+
69
+ /**
70
+ * Set of options that must be set in order to be connected.
71
+ *
72
+ * @since 4.4.0
73
+ *
74
+ * @var array
75
+ */
76
+ protected $_completion_options = array( 'active' );
77
+
78
+ /**
79
+ * Class name of form settings.
80
+ *
81
+ * @since 4.4.0
82
+ *
83
+ * @var string
84
+ */
85
+ protected $_form_settings = 'Hustle_Mailpoet_Form_Settings';
86
+
87
+ /**
88
+ * Class name of form hooks
89
+ *
90
+ * @since 4.4.0
91
+ * @var string
92
+ */
93
+ protected $_form_hooks = 'Hustle_Mailpoet_Form_Hooks';
94
+
95
+ /**
96
+ * Mailpoet API instance.
97
+ *
98
+ * @since 4.4.0
99
+ *
100
+ * @var null|\MailPoet\API\API
101
+ */
102
+ private $api;
103
+
104
+ /**
105
+ * Get Instance
106
+ *
107
+ * @return self|null
108
+ */
109
+ public static function get_instance() {
110
+ if ( is_null( self::$_instance ) ) {
111
+ self::$_instance = new self();
112
+ }
113
+
114
+ return self::$_instance;
115
+ }
116
+
117
+ /**
118
+ * Provider constructor.
119
+ */
120
+ public function __construct() {
121
+ $this->_icon_2x = plugin_dir_url( __FILE__ ) . 'images/icon.png';
122
+ $this->_logo_2x = plugin_dir_url( __FILE__ ) . 'images/logo.png';
123
+ }
124
+
125
+ /**
126
+ * Gets an instance of Mailpoet's API.
127
+ *
128
+ * @since 4.4.0
129
+ *
130
+ * @return \MailPoet\API\API
131
+ */
132
+ public function get_api() {
133
+ if ( is_null( $this->api ) ) {
134
+ $this->api = \MailPoet\API\API::MP( 'v1' );
135
+ }
136
+ return $this->api;
137
+ }
138
+
139
+ /**
140
+ * Checks whether Mailpoet v3 is active.
141
+ *
142
+ * @since 4.4.0
143
+ *
144
+ * @return boolean
145
+ */
146
+ private function is_plugin_active() {
147
+ return class_exists( \MailPoet\API\API::class );
148
+ }
149
+
150
+ /**
151
+ * Checks if the settings are completed.
152
+ *
153
+ * @since 4.4.0
154
+ *
155
+ * @param string $multi_id Multi-integration ID, if any.
156
+ * @return boolean
157
+ */
158
+ protected function settings_are_completed( $multi_id = '' ) {
159
+ return $this->is_plugin_active();
160
+ }
161
+
162
+ /**
163
+ * Get the wizard callbacks for the global settings.
164
+ *
165
+ * @since 4.4.0
166
+ *
167
+ * @return array
168
+ */
169
+ public function settings_wizards() {
170
+ return array(
171
+ array(
172
+ 'callback' => array( $this, 'configure' ),
173
+ 'is_completed' => array( $this, 'settings_are_completed' ),
174
+ ),
175
+ );
176
+ }
177
+
178
+ /**
179
+ * Configure the API key settings. Global settings.
180
+ *
181
+ * @since 4.4.0
182
+ *
183
+ * @param array $submitted_data The data submitted.
184
+ * @param bool $is_submit Whether the current request is a submission.
185
+ *
186
+ * @return array
187
+ */
188
+ public function configure( $submitted_data, $is_submit ) {
189
+ $has_errors = false;
190
+ $active = $this->is_connected();
191
+
192
+ if ( $is_submit ) {
193
+
194
+ $active = ! empty( $submitted_data['active'] );
195
+ // If not active, activate it.
196
+ if ( ! Hustle_Provider_Utils::is_provider_active( $this->_slug ) ) {
197
+
198
+ // TODO: Wrap this in a friendlier method.
199
+ $activated = Hustle_Providers::get_instance()->activate_addon( $this->_slug );
200
+ if ( ! $activated ) {
201
+ $error_message = esc_html( $this->provider_connection_falied() );
202
+ $has_errors = true;
203
+ } else {
204
+ $this->save_settings_values( array( 'active' => $active ) );
205
+ }
206
+ } else {
207
+ $this->save_settings_values( array( 'active' => $active ) );
208
+ }
209
+
210
+ if ( ! $has_errors ) {
211
+
212
+ return array(
213
+ 'html' => Hustle_Provider_Utils::get_integration_modal_title_markup( __( 'Mailpoet Added', 'hustle' ), __( 'You can now go to your pop-ups, slide-ins and embeds and assign them to this integration', 'hustle' ) ),
214
+ 'buttons' => array(
215
+ 'close' => array(
216
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup( __( 'Close', 'hustle' ), 'sui-button-ghost', 'close' ),
217
+ ),
218
+ ),
219
+ 'redirect' => false,
220
+ 'has_errors' => false,
221
+ 'notification' => array(
222
+ 'type' => 'success',
223
+ 'text' => '<strong>' . $this->get_title() . '</strong> ' . __( 'successfully connected', 'hustle' ),
224
+ ),
225
+ );
226
+
227
+ }
228
+ }
229
+
230
+ if ( ! $this->is_plugin_active() ) {
231
+ $has_errors = true;
232
+ $error_message = sprintf(
233
+ /* translators: 1. opening 'a' tag to the Mailpoet's wp page, 2. closing 'a' tag */
234
+ esc_html__( 'This integration requires the %1$sMailpoet 3%2$s. Install and activate it and try again.', 'hustle' ),
235
+ '<a href="https://wordpress.org/plugins/mailpoet/" target="_blank">',
236
+ '</a>'
237
+ );
238
+ }
239
+
240
+ $options = array(
241
+ array(
242
+ 'type' => 'hidden',
243
+ 'name' => 'active',
244
+ 'value' => 1,
245
+ ),
246
+ );
247
+
248
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
249
+ __( 'Connect Mailpoet 3', 'hustle' ),
250
+ __( 'Mailpoet lets you send beautiful emails that reach inboxes every time and create loyal subscribers.', 'hustle' )
251
+ );
252
+
253
+ if ( $has_errors ) {
254
+ $error_notice = array(
255
+ 'type' => 'notice',
256
+ 'icon' => 'info',
257
+ 'class' => 'sui-notice-error',
258
+ 'value' => $error_message,
259
+ );
260
+ array_unshift( $options, $error_notice );
261
+
262
+ }
263
+
264
+ $step_html .= Hustle_Provider_Utils::get_html_for_options( $options );
265
+
266
+ $is_edit = $this->is_connected() ? true : false;
267
+
268
+ if ( ! $this->is_plugin_active() ) {
269
+ $buttons = array(
270
+ 'close' => array(
271
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup( __( 'Close', 'hustle' ), 'sui-button-ghost sui-button-center', 'close' ),
272
+ ),
273
+ );
274
+ } elseif ( $is_edit ) {
275
+ $buttons = array(
276
+ 'disconnect' => array(
277
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
278
+ __( 'Disconnect', 'hustle' ),
279
+ 'sui-button-ghost sui-button-center',
280
+ 'disconnect',
281
+ true
282
+ ),
283
+ ),
284
+ );
285
+ } else {
286
+ $buttons = array(
287
+ 'connect' => array(
288
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
289
+ __( 'Activate', 'hustle' ),
290
+ 'sui-button-center',
291
+ 'connect',
292
+ true
293
+ ),
294
+ ),
295
+ );
296
+
297
+ }
298
+
299
+ $response = array(
300
+ 'html' => $step_html,
301
+ 'buttons' => $buttons,
302
+ 'has_errors' => $has_errors,
303
+ );
304
+
305
+ return $response;
306
+ }
307
+ }
inc/providers/mailpoet/images/icon.png ADDED
Binary file
inc/providers/mailpoet/images/logo.png ADDED
Binary file
inc/providers/mailpoet/mailpoet.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailpoet direct load.
4
+ *
5
+ * @package hustle
6
+ */
7
+
8
+ require_once dirname( __FILE__ ) . '/class-hustle-mailpoet.php';
9
+ require_once dirname( __FILE__ ) . '/class-hustle-mailpoet-form-settings.php';
10
+ require_once dirname( __FILE__ ) . '/class-hustle-mailpoet-form-hooks.php';
11
+ Hustle_Providers::get_instance()->register( 'Hustle_Mailpoet' );
inc/providers/mailster/class-hustle-mailster-form-hooks.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailster's form hooks class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailster_Form_Hooks.
12
+ * Define the form hooks that are used by Mailster.
13
+ *
14
+ * @since 4.4.0
15
+ */
16
+ class Hustle_Mailster_Form_Hooks extends Hustle_Provider_Form_Hooks_Abstract {
17
+
18
+ /**
19
+ * Check whether the email is already subscribed.
20
+ *
21
+ * @since 4.4.0
22
+ *
23
+ * @param array $submitted_data The submitted data.
24
+ * @param bool $allow_subscribed Whether to allow already subscribed users.
25
+ * @return bool
26
+ */
27
+ public function on_form_submit( $submitted_data, $allow_subscribed = true ) {
28
+ if ( empty( $submitted_data['email'] ) ) {
29
+ return __( 'Required Field "email" was not filled by the user.', 'hustle' );
30
+ }
31
+
32
+ $is_success = true;
33
+
34
+ if ( ! $allow_subscribed ) {
35
+
36
+ /**
37
+ * Filter submitted form data to be processed
38
+ *
39
+ * @since 4.4.0
40
+ *
41
+ * @param array $submitted_data
42
+ * @param int $module_id Current module_id
43
+ * @param Hustle_Mailster_Form_Settings $form_settings_instance
44
+ */
45
+ $submitted_data = apply_filters(
46
+ 'hustle_provider_mailster_form_submitted_data_before_validation',
47
+ $submitted_data,
48
+ $this->module_id,
49
+ $this->form_settings_instance
50
+ );
51
+
52
+ if ( $this->is_subscribed( $submitted_data['email'] ) ) {
53
+ $is_success = self::ALREADY_SUBSCRIBED_ERROR;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Return `true` if success, or **(string) error message** on failure.
59
+ *
60
+ * @since 4.4.0
61
+ *
62
+ * @param bool $is_success
63
+ * @param int $module_id current module_id
64
+ * @param array $submitted_data
65
+ * @param Hustle_Mailster_Form_Settings $form_settings_instance
66
+ */
67
+ $is_success = apply_filters(
68
+ 'hustle_provider_mailster_form_submitted_data_after_validation',
69
+ $is_success,
70
+ $this->module_id,
71
+ $submitted_data,
72
+ $this->form_settings_instance
73
+ );
74
+
75
+ // Only update `_submit_form_error_message` when $is_success is not empty nor 'true'.
76
+ if ( true !== $is_success && ! empty( $is_success ) ) {
77
+ $this->_submit_form_error_message = (string) $is_success;
78
+ }
79
+
80
+ return $is_success;
81
+ }
82
+
83
+ /**
84
+ * Checks whether the email is already subscribed to the saved list.
85
+ *
86
+ * @since 4.4.0
87
+ *
88
+ * @param string $email Subscriber email.
89
+ * @return boolean
90
+ */
91
+ private function is_subscribed( $email ) {
92
+ $subscriber = $this->get_subscriber_by_email( $email );
93
+ if ( ! $subscriber ) {
94
+ return false;
95
+ }
96
+
97
+ $assigned_lists = mailster( 'subscribers' )->get_lists( $subscriber->ID, true );
98
+ $saved_settings = $this->form_settings_instance->get_form_settings_values();
99
+
100
+ return in_array( $saved_settings['list_id'], $assigned_lists, true );
101
+ }
102
+
103
+ /**
104
+ * Returns the subscriber by the email.
105
+ *
106
+ * @since 4.4.0
107
+ *
108
+ * @param string $email Subscriber email to look for.
109
+ *
110
+ * @return false|object False when the subscriber doesn't exist. The subscriber data otherwise.
111
+ */
112
+ private function get_subscriber_by_email( $email ) {
113
+ return mailster( 'subscribers' )->get_by_mail( $email );
114
+ }
115
+
116
+
117
+ /**
118
+ * Add the provider's data to the created entry.
119
+ *
120
+ * @since 4.4.0
121
+ *
122
+ * @param array $submitted_data The submitted data.
123
+ * @throws Exception When the data wasn't sent to the integration for some reason.
124
+ * @return array
125
+ */
126
+ public function add_entry_fields( $submitted_data ) {
127
+ /**
128
+ * Filter submitted form data to be processed
129
+ *
130
+ * @since 4.4.0
131
+ *
132
+ * @param array $submitted_data
133
+ * @param int $module_id current module_id
134
+ * @param Hustle_Mailster_Form_Settings $form_settings_instance
135
+ */
136
+ $submitted_data = apply_filters(
137
+ 'hustle_provider_mailster_form_submitted_data',
138
+ $submitted_data,
139
+ $this->module_id,
140
+ $this->form_settings_instance
141
+ );
142
+
143
+ try {
144
+ if ( empty( $submitted_data['email'] ) ) {
145
+ throw new Exception( __( 'Required Field "email" was not filled by the user.', 'hustle' ) );
146
+ }
147
+
148
+ $saved_settings = $this->form_settings_instance->get_form_settings_values();
149
+
150
+ $existing_subscriber = $this->get_subscriber_by_email( $submitted_data['email'] );
151
+
152
+ // Keep the subscriber's status if it exists.
153
+ $status_code = $saved_settings['single_optin'];
154
+ if ( $existing_subscriber ) {
155
+ $status_code = $existing_subscriber->status;
156
+ }
157
+
158
+ /**
159
+ * Fires before adding subscriber
160
+ *
161
+ * @since 4.4.0
162
+ *
163
+ * @param int $module_id
164
+ * @param array $submitted_data
165
+ * @param object $form_settings_instance
166
+ */
167
+ do_action(
168
+ 'hustle_provider_mailster_before_add_subscriber',
169
+ $this->module_id,
170
+ $submitted_data,
171
+ $this->form_settings_instance
172
+ );
173
+
174
+ $subscription_data = $this->map_fields( $saved_settings, $submitted_data );
175
+
176
+ $subscription_data['status'] = $status_code;
177
+
178
+ // Add a subscriber, overwrite its fields if it exists.
179
+ $subscriber_id = mailster( 'subscribers' )->add( $subscription_data, true, true );
180
+
181
+ if ( is_wp_error( $subscriber_id ) ) {
182
+ throw new Exception( 'The subscriber could not be created. ' . $subscriber_id->get_error_message(), $subscriber_id->get_error_code() );
183
+ }
184
+
185
+ // The subscriber was successfully added. Now assign it to a list.
186
+ $list_id = array( $saved_settings['list_id'] );
187
+ mailster( 'subscribers' )->assign_lists( $subscriber_id, $list_id );
188
+
189
+ /**
190
+ * Fires after adding subscriber
191
+ *
192
+ * @since 4.4.0
193
+ *
194
+ * @param int $module_id
195
+ * @param array $subcription_data
196
+ * @param mixed $subscriber
197
+ * @param object $form_settings_instance
198
+ */
199
+ do_action(
200
+ 'hustle_provider_mailster_after_add_subscriber',
201
+ $this->module_id,
202
+ $subcription_data,
203
+ $subscriber,
204
+ $this->form_settings_instance
205
+ );
206
+
207
+ $successful_subscription_message = empty( $existing_subscriber ) ?
208
+ __( 'User successfully added', 'hustle' ) :
209
+ __( 'User successfully updated', 'hustle' );
210
+
211
+ $entry_fields = array(
212
+ array(
213
+ 'name' => 'status',
214
+ 'value' => array(
215
+ 'is_sent' => true,
216
+ 'description' => $successful_subscription_message,
217
+ 'data_sent' => $subcription_data,
218
+ 'data_received' => array(),
219
+ 'member_status' => mailster( 'subscribers' )->get_status( $status_code, true ),
220
+ 'list_name' => $saved_settings['list_name'] . ' (' . $saved_settings['list_id'] . ')',
221
+ ),
222
+ ),
223
+ );
224
+
225
+ } catch ( Exception $e ) {
226
+ $entry_fields = array(
227
+ array(
228
+ 'name' => 'status',
229
+ 'value' => array(
230
+ 'is_sent' => false,
231
+ 'description' => $e->getMessage(),
232
+ 'data_sent' => $subcription_data,
233
+ 'data_received' => array( 'Code: ' . $e->getCode() . ' - ' . $e->getMessage() ),
234
+ 'member_status' => __( 'Member could not be subscribed.', 'hustle' ),
235
+ 'list_name' => $saved_settings['list_name'] . ' (' . $saved_settings['list_id'] . ')',
236
+ ),
237
+ ),
238
+ );
239
+ }
240
+
241
+ $entry_fields = apply_filters(
242
+ 'hustle_provider_mailster_entry_fields',
243
+ $entry_fields,
244
+ $this->module_id,
245
+ $submitted_data,
246
+ $this->form_settings_instance
247
+ );
248
+ return $entry_fields;
249
+ }
250
+
251
+ /**
252
+ * Maps Mailster's fields with Hustle's fields.
253
+ *
254
+ * @since 4.4.0
255
+ *
256
+ * @param array $saved_settings The integration's configs for the module.
257
+ * @param array $submitted_data The submitted data.
258
+ * @return array
259
+ */
260
+ private function map_fields( $saved_settings, $submitted_data ) {
261
+ $subcription_data = array();
262
+
263
+ foreach ( $saved_settings['fields_map'] as $mailster_field => $hustle_field ) {
264
+ // Skip if hustle's fields changed but the provider's map wasn't updated.
265
+ if ( ! isset( $submitted_data[ $hustle_field ] ) ) {
266
+ continue;
267
+ }
268
+
269
+ $subscription_data[ $mailster_field ] = $submitted_data[ $hustle_field ];
270
+ }
271
+
272
+ return $subscription_data;
273
+ }
274
+ }
inc/providers/mailster/class-hustle-mailster-form-settings.php ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailster's form settings class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailster_Form_Settings
12
+ *
13
+ * @since 4.4.0
14
+ */
15
+ class Hustle_Mailster_Form_Settings extends Hustle_Provider_Form_Settings_Abstract {
16
+
17
+ /**
18
+ * Options that must be set in order to consider the integration as "connected" to the form.
19
+ *
20
+ * @since 4.4.0
21
+ * @var array
22
+ */
23
+ protected $form_completion_options = array( 'list_id', 'list_name', 'fields_map' );
24
+
25
+ /**
26
+ * For settings Wizard steps
27
+ *
28
+ * @since 4.4.0
29
+ * @return array
30
+ */
31
+ public function form_settings_wizards() {
32
+ return array(
33
+ array(
34
+ 'callback' => array( $this, 'first_step_callback' ),
35
+ 'is_completed' => array( $this, 'first_step_is_completed' ),
36
+ ),
37
+ array(
38
+ 'callback' => array( $this, 'map_fields_step' ),
39
+ 'is_completed' => array( $this, 'map_fields_step_is_completed' ),
40
+ ),
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Check if the first step is completed.
46
+ *
47
+ * @since 4.4.0
48
+ *
49
+ * @param array $submitted_data The submitted data.
50
+ * @return bool
51
+ */
52
+ public function first_step_is_completed( $submitted_data ) {
53
+ $saved_settings = $this->get_form_settings_values();
54
+ return empty( $this->validate_first_step( $saved_settings ) );
55
+ }
56
+
57
+ /**
58
+ * Returns all settings and conditions for 1st step of e-Newsletter settings
59
+ *
60
+ * @since 4.4.0
61
+ *
62
+ * @param array $submitted_data The submitted data.
63
+ * @param bool $is_submit Whether the request is a submission.
64
+ *
65
+ * @return array
66
+ */
67
+ public function first_step_callback( $submitted_data, $is_submit ) {
68
+ $defaults = array(
69
+ 'list_id' => '',
70
+ 'single_optin' => '0',
71
+ );
72
+
73
+ $this->addon_form_settings = $this->get_current_data( $defaults, $submitted_data );
74
+
75
+ $is_connected = $this->provider->is_form_connected( $this->module_id );
76
+
77
+ // Save only after the step has been validated and there are no errors.
78
+ if ( $is_submit ) {
79
+ $error_message = $this->validate_first_step( $submitted_data );
80
+ }
81
+
82
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
83
+ __( 'Mailster List', 'hustle' ),
84
+ __( "Choose the subscriber's list to which you want to send form data.", 'hustle' )
85
+ );
86
+
87
+ if ( ! empty( $error_message ) ) {
88
+ $step_html .= '<span class="sui-error-message">' . $error_message . '</span>';
89
+ }
90
+
91
+ $step_html .= $this->get_first_step_html( $submitted_data );
92
+
93
+ $buttons = array();
94
+ if ( $is_connected ) {
95
+ $buttons['disconnect'] = array(
96
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
97
+ __( 'Disconnect', 'hustle' ),
98
+ 'sui-button-ghost',
99
+ 'disconnect_form',
100
+ true
101
+ ),
102
+ );
103
+ }
104
+
105
+ $buttons['continue'] = array(
106
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
107
+ __( 'Continue', 'hustle' ),
108
+ $is_connected ? '' : 'sui-button-right',
109
+ 'next',
110
+ true
111
+ ),
112
+ );
113
+
114
+ if ( $is_submit && empty( $error_message ) ) {
115
+ $this->save_first_step_data( $submitted_data );
116
+ }
117
+
118
+ $response = array(
119
+ 'html' => $step_html,
120
+ 'buttons' => $buttons,
121
+ 'has_errors' => ! empty( $error_message ),
122
+ );
123
+
124
+ return $response;
125
+ }
126
+
127
+ /**
128
+ * Return an array of options used to display the settings of the 1st step.
129
+ *
130
+ * @since 4.4.0
131
+ *
132
+ * @param array $submitted_data The data submitted.
133
+ *
134
+ * @return array
135
+ */
136
+ private function get_first_step_html( $submitted_data ) {
137
+ $lists = array();
138
+
139
+ $fetched_lists = mailster( 'lists' )->get();
140
+
141
+ if ( is_array( $fetched_lists ) && ! empty( $fetched_lists ) ) {
142
+ $lists = wp_list_pluck( $fetched_lists, 'name', 'ID' );
143
+ }
144
+
145
+ $options = array(
146
+ array(
147
+ 'type' => 'wrapper',
148
+ 'elements' => array(
149
+ array(
150
+ 'type' => 'label',
151
+ 'value' => __( 'Email List', 'hustle' ),
152
+ 'for' => 'hustle-email-provider-lists',
153
+ ),
154
+ array(
155
+ 'type' => 'select',
156
+ 'name' => 'list_id',
157
+ 'id' => 'hustle-email-provider-lists',
158
+ 'selected' => $this->addon_form_settings['list_id'],
159
+ 'options' => $lists,
160
+ ),
161
+ ),
162
+ ),
163
+ array(
164
+ 'type' => 'wrapper',
165
+ 'style' => 'margin-bottom: 0;',
166
+ 'elements' => array(
167
+ 'label' => array(
168
+ 'type' => 'label',
169
+ 'value' => __( 'Extra Options', 'hustle' ),
170
+ ),
171
+ 'new_users' => array(
172
+ 'type' => 'checkbox',
173
+ 'name' => 'single_optin',
174
+ 'value' => '1',
175
+ 'id' => 'single_optin',
176
+ 'class' => 'sui-checkbox-sm sui-checkbox-stacked',
177
+ 'attributes' => array(
178
+ 'checked' => '1' === $this->addon_form_settings['single_optin'],
179
+ ),
180
+ 'label' => __( 'Automatically opt-in new users to the mailing list', 'hustle' ),
181
+ ),
182
+ ),
183
+ ),
184
+ );
185
+
186
+ return Hustle_Provider_Utils::get_html_for_options( $options );
187
+ }
188
+
189
+ /**
190
+ * Validates the data submitted on the first step.
191
+ *
192
+ * @since 4.4.0
193
+ *
194
+ * @param array $submitted_data The submitted data.
195
+ * @return string|false Error message on failed validation. False on success.
196
+ */
197
+ private function validate_first_step( $submitted_data ) {
198
+ if ( ! isset( $submitted_data['list_id'] ) ) {
199
+ return __( 'The email list is required.', 'hustle' );
200
+ }
201
+
202
+ return false;
203
+ }
204
+
205
+ /**
206
+ * Saves the data of the first step.
207
+ *
208
+ * @since 4.4.0
209
+ *
210
+ * @param array $submitted_data Submitted data.
211
+ */
212
+ private function save_first_step_data( $submitted_data ) {
213
+ $selected_list = mailster( 'lists' )->get( $submitted_data['list_id'] );
214
+
215
+ $this->addon_form_settings['list_id'] = $submitted_data['list_id'];
216
+ $this->addon_form_settings['list_name'] = $selected_list->name;
217
+
218
+ $this->save_form_settings_values( $this->addon_form_settings );
219
+ }
220
+
221
+ /**
222
+ * Checks whether the fields mapping step was completed.
223
+ *
224
+ * @since 4.4.0
225
+ *
226
+ * @param array $submitted_data The submitted data.
227
+ *
228
+ * @return bool
229
+ */
230
+ public function map_fields_step_is_completed( $submitted_data ) {
231
+ return empty( $this->validate_map_fields_step( $submitted_data ) );
232
+ }
233
+
234
+ /**
235
+ * Handles the step for mapping the fields.
236
+ *
237
+ * @since 4.4.0
238
+ *
239
+ * @param array $submitted_data Data sent in the form submission when the request was a form submission.
240
+ * @param bool $is_submit Whether the request was a form submission.
241
+ *
242
+ * @return array
243
+ */
244
+ public function map_fields_step( $submitted_data, $is_submit ) {
245
+ if ( $is_submit ) {
246
+ $error_message = $this->validate_map_fields_step( $submitted_data );
247
+
248
+ // Save only after the step has been validated and there are no errors.
249
+ if ( empty( $error_message ) ) {
250
+ $this->save_map_fields_step( $submitted_data );
251
+ }
252
+ }
253
+
254
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
255
+ __( 'Map Fields', 'hustle' ),
256
+ __( 'Map your Hustle fields to Mailster’s List fields below. Unmapped fields will be skipped.', 'hustle' )
257
+ );
258
+
259
+ if ( ! empty( $error_message ) ) {
260
+ $step_html .= '<span class="sui-error-message">' . $error_message . '</span>';
261
+ }
262
+
263
+ $step_html .= $this->get_map_fields_step_html();
264
+
265
+ $buttons = array(
266
+ 'back' => array(
267
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
268
+ __( 'Back', 'hustle' ),
269
+ 'sui-button-ghost',
270
+ 'prev',
271
+ true
272
+ ),
273
+ ),
274
+ 'save' => array(
275
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
276
+ __( 'Save', 'hustle' ),
277
+ '',
278
+ 'next',
279
+ true
280
+ ),
281
+ ),
282
+ );
283
+
284
+ return array(
285
+ 'html' => $step_html,
286
+ 'buttons' => $buttons,
287
+ 'has_errors' => ! empty( $error_message ),
288
+ 'size' => 'large',
289
+ );
290
+ }
291
+
292
+ /**
293
+ * Validates the submission for mapping the fields.
294
+ *
295
+ * @since 4.4.0
296
+ *
297
+ * @param array $submitted_data The data submitted.
298
+ * @return string|false
299
+ */
300
+ private function validate_map_fields_step( $submitted_data ) {
301
+ if ( empty( $submitted_data['fields_map'] ) ) {
302
+ return __( 'Mapping the fields is required.', 'hustle' );
303
+ }
304
+
305
+ // This is the only required field in Mailster.
306
+ if ( empty( $submitted_data['fields_map']['email'] ) ) {
307
+ return __( 'The following fields are required: Email', 'hustle' );
308
+ }
309
+
310
+ return false;
311
+ }
312
+
313
+ /**
314
+ * Saves the values from the step for mapping the fields.
315
+ *
316
+ * @since 4.4.0
317
+ *
318
+ * @param array $submitted_data The data submitted.
319
+ */
320
+ private function save_map_fields_step( $submitted_data ) {
321
+ $data_to_save = $this->get_form_settings_values();
322
+
323
+ $data_to_save['fields_map'] = array_filter( $submitted_data['fields_map'] );
324
+
325
+ $this->save_form_settings_values( $data_to_save );
326
+ }
327
+
328
+ /**
329
+ * Returns the markup for the step to map the fields.
330
+ *
331
+ * @since 4.4.0
332
+ *
333
+ * @return string
334
+ */
335
+ private function get_map_fields_step_html() {
336
+ // Base Mailster's fields. Couldn't find a method to retrieve them. Thus, they're hardcoded.
337
+ $base_fields = array(
338
+ 'email' => array(
339
+ 'type' => 'textfield',
340
+ 'name' => __( 'Email', 'hustle' ),
341
+ ),
342
+ 'firstname' => array(
343
+ 'type' => 'textfield',
344
+ 'name' => __( 'First name', 'hustle' ),
345
+ ),
346
+ 'lastname' => array(
347
+ 'type' => 'textfield',
348
+ 'name' => __( 'Last name', 'hustle' ),
349
+ ),
350
+ );
351
+
352
+ $mailster_fields = $base_fields + mailster()->get_custom_fields();
353
+
354
+ $saved_settings = $this->get_form_settings_values();
355
+ $module_fields = $this->get_form_fields_for_map_step();
356
+
357
+ $html = '<table class="sui-table">';
358
+ $html .= '<thead><tr>
359
+ <th>' . esc_html__( 'Provider Field', 'hustle' ) . '</th>
360
+ <th>' . esc_html__( 'Hustle Field', 'hustle' ) . '</th>
361
+ </tr></thead>';
362
+ $html .= '<tbody>';
363
+
364
+ $selected = '';
365
+
366
+ foreach ( $mailster_fields as $field_id => $field ) {
367
+
368
+ $selected = ! empty( $saved_settings['fields_map'][ $field_id ] ) ?
369
+ $saved_settings['fields_map'][ $field_id ] :
370
+ '';
371
+
372
+ $field_label = $field['name'];
373
+
374
+ // This is the subscriber's email field. Map it to the static one.
375
+ if ( 'email' === $field_id ) {
376
+ $field_label .= '<span class="integrations-required-field">*</span>';
377
+ $fields_options = $this->get_main_email_field_for_map_step();
378
+ $selected = 'email';
379
+
380
+ } else {
381
+ $fields_options = $module_fields;
382
+ }
383
+
384
+ $field['id'] = $field_id;
385
+
386
+ $html .= '<tr>';
387
+ $html .= '<td>' . $field_label . '</td>';
388
+ $html .= '<td>' . $this->get_form_field_select( $field, $fields_options, $selected ) . '</td>';
389
+ $html .= '</tr>';
390
+ }
391
+ $html .= '</tbody></table>';
392
+
393
+ $message = sprintf(
394
+ /* translators: 1. opening 'b' tag, 2. closing 'b' tag, 3. closing and opening 'p' tag. */
395
+ esc_html__( "%1\$sImportant!%2\$s If you've just added new fields in your hustle module, you need to first save your changes for the fields to show up in the dropdown above.%3\$sAlso, when a field’s name is changed in hustle, its mapping will be lost, and you’ll need to re-map it in the integration." ),
396
+ '<b>',
397
+ '</b>',
398
+ '</p><p>'
399
+ );
400
+
401
+ $notice_options = array(
402
+ array(
403
+ 'type' => 'inline_notice',
404
+ 'value' => $message,
405
+ 'icon' => 'info',
406
+ 'class' => 'sui-notice-info',
407
+ ),
408
+ );
409
+
410
+ $html .= $this->get_renderer()->get_html_for_options( $notice_options, true );
411
+
412
+ return $html;
413
+ }
414
+
415
+ /**
416
+ * Gets the markup for the fields' select.
417
+ *
418
+ * @since 4.4.0
419
+ *
420
+ * @param array $mailster_field Mailster field to display the options for.
421
+ * @param array $module_fields List of the module's saved fields to choose from.
422
+ * @param string $selected Currently selected value.
423
+ *
424
+ * @return array
425
+ */
426
+ private function get_form_field_select( $mailster_field, $module_fields, $selected ) {
427
+ $options = array(
428
+ array(
429
+ 'type' => 'select',
430
+ 'name' => 'fields_map[' . $mailster_field['id'] . ']',
431
+ 'class' => 'sui-select',
432
+ 'placeholder' => 'email' !== $mailster_field['id'] ? __( 'None', 'hustle' ) : false,
433
+ 'options' => $module_fields,
434
+ 'selected' => $selected,
435
+ 'id' => 'select-fields_map_' . $mailster_field['id'],
436
+ ),
437
+ );
438
+ return $this->get_renderer()->get_html_for_options( $options, true );
439
+ }
440
+ }
inc/providers/mailster/class-hustle-mailster.php ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Hustle_Mailster class.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Class Hustle_Mailster.
12
+ *
13
+ * @since 4.4.0
14
+ */
15
+ class Hustle_Mailster extends Hustle_Provider_Abstract {
16
+
17
+ /**
18
+ * Provider Instance
19
+ *
20
+ * @since 4.4.0
21
+ *
22
+ * @var self|null
23
+ */
24
+ protected static $_instance;
25
+
26
+ /**
27
+ * Provider slug.
28
+ *
29
+ * @since 4.4.0
30
+ *
31
+ * @var string
32
+ */
33
+ protected $_slug = 'mailster';
34
+
35
+ /**
36
+ * Provider version.
37
+ *
38
+ * @var string
39
+ */
40
+ protected $_version = '1.0.0';
41
+
42
+ /**
43
+ * Provider's name class name.
44
+ *
45
+ * @since 4.4.0
46
+ *
47
+ * @var string
48
+ */
49
+ protected $_class = __CLASS__;
50
+
51
+ /**
52
+ * Provider's title.
53
+ *
54
+ * @since 4.4.0
55
+ *
56
+ * @var string
57
+ */
58
+ protected $_title = 'Mailster';
59
+
60
+ /**
61
+ * Whether there can be multiple global instances.
62
+ *
63
+ * @since 4.4.0
64
+ *
65
+ * @var string
66
+ */
67
+ protected $is_multi_on_global = false;
68
+
69
+ /**
70
+ * Set of options that must be set in order to be connected.
71
+ *
72
+ * @since 4.4.0
73
+ *
74
+ * @var array
75
+ */
76
+ protected $_completion_options = array( 'active' );
77
+
78
+ /**
79
+ * Class name of form settings.
80
+ *
81
+ * @since 4.4.0
82
+ *
83
+ * @var string
84
+ */
85
+ protected $_form_settings = 'Hustle_Mailster_Form_Settings';
86
+
87
+ /**
88
+ * Class name of form hooks
89
+ *
90
+ * @since 4.4.0
91
+ * @var string
92
+ */
93
+ protected $_form_hooks = 'Hustle_Mailster_Form_Hooks';
94
+
95
+ /**
96
+ * Get Instance
97
+ *
98
+ * @return self|null
99
+ */
100
+ public static function get_instance() {
101
+ if ( is_null( self::$_instance ) ) {
102
+ self::$_instance = new self();
103
+ }
104
+
105
+ return self::$_instance;
106
+ }
107
+
108
+ /**
109
+ * Provider constructor.
110
+ */
111
+ public function __construct() {
112
+ $this->_icon_2x = plugin_dir_url( __FILE__ ) . 'images/icon.png';
113
+ $this->_logo_2x = plugin_dir_url( __FILE__ ) . 'images/logo.png';
114
+ }
115
+
116
+ /**
117
+ * Checks whether Mailster is active.
118
+ *
119
+ * @since 4.4.0
120
+ *
121
+ * @return boolean
122
+ */
123
+ private function is_plugin_active() {
124
+ return function_exists( 'mailster' );
125
+ }
126
+
127
+ /**
128
+ * Checks if the settings are completed.
129
+ *
130
+ * @since 4.4.0
131
+ *
132
+ * @param string $multi_id Multi-integration ID, if any.
133
+ * @return boolean
134
+ */
135
+ protected function settings_are_completed( $multi_id = '' ) {
136
+ return $this->is_plugin_active();
137
+ }
138
+
139
+ /**
140
+ * Get the wizard callbacks for the global settings.
141
+ *
142
+ * @since 4.4.0
143
+ *
144
+ * @return array
145
+ */
146
+ public function settings_wizards() {
147
+ return array(
148
+ array(
149
+ 'callback' => array( $this, 'configure' ),
150
+ 'is_completed' => array( $this, 'settings_are_completed' ),
151
+ ),
152
+ );
153
+ }
154
+
155
+ /**
156
+ * Configure the API key settings. Global settings.
157
+ *
158
+ * @since 4.4.0
159
+ *
160
+ * @param array $submitted_data The data submitted.
161
+ * @param bool $is_submit Whether the current request is a submission.
162
+ *
163
+ * @return array
164
+ */
165
+ public function configure( $submitted_data, $is_submit ) {
166
+ $has_errors = false;
167
+ $active = $this->is_connected();
168
+
169
+ if ( $is_submit ) {
170
+
171
+ $active = ! empty( $submitted_data['active'] );
172
+ // If not active, activate it.
173
+ if ( ! Hustle_Provider_Utils::is_provider_active( $this->_slug ) ) {
174
+
175
+ // TODO: Wrap this in a friendlier method.
176
+ $activated = Hustle_Providers::get_instance()->activate_addon( $this->_slug );
177
+ if ( ! $activated ) {
178
+ $error_message = esc_html( $this->provider_connection_falied() );
179
+ $has_errors = true;
180
+ } else {
181
+ $this->save_settings_values( array( 'active' => $active ) );
182
+ }
183
+ } else {
184
+ $this->save_settings_values( array( 'active' => $active ) );
185
+ }
186
+
187
+ if ( ! $has_errors ) {
188
+
189
+ return array(
190
+ 'html' => Hustle_Provider_Utils::get_integration_modal_title_markup( __( 'Mailster Added', 'hustle' ), __( 'You can now go to your pop-ups, slide-ins and embeds and assign them to this integration', 'hustle' ) ),
191
+ 'buttons' => array(
192
+ 'close' => array(
193
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup( __( 'Close', 'hustle' ), 'sui-button-ghost sui-button-center', 'close' ),
194
+ ),
195
+ ),
196
+ 'redirect' => false,
197
+ 'has_errors' => false,
198
+ 'notification' => array(
199
+ 'type' => 'success',
200
+ 'text' => '<strong>' . $this->get_title() . '</strong> ' . __( 'successfully connected', 'hustle' ),
201
+ ),
202
+ );
203
+
204
+ }
205
+ }
206
+
207
+ $options = array(
208
+ array(
209
+ 'type' => 'hidden',
210
+ 'name' => 'active',
211
+ 'value' => 1,
212
+ ),
213
+ );
214
+
215
+ $step_html = Hustle_Provider_Utils::get_integration_modal_title_markup(
216
+ __( 'Connect Mailster', 'hustle' ),
217
+ __( 'Mailster lets you create, manage, and send email newsletter campaings from within your WordPress site.', 'hustle' )
218
+ );
219
+
220
+ if ( ! $this->is_plugin_active() ) {
221
+ $has_errors = true;
222
+ $error_message = sprintf(
223
+ /* translators: 1. opening 'a' tag to the Mailster's wp page, 2. closing 'a' tag, 3. opening 'b' tag, 4. closing 'b' tag */
224
+ esc_html__( 'This integration requires the %1$sMailster Newsletter Plugin%2$s, %3$sversion 2.2%4$s or newer. Install and activate it and try again.', 'hustle' ),
225
+ '<a href="https://mailster.co/" target="_blank">',
226
+ '</a>',
227
+ '<b>',
228
+ '</b>'
229
+ );
230
+
231
+ $error_notice = array(
232
+ 'type' => 'notice',
233
+ 'icon' => 'info',
234
+ 'class' => 'sui-notice-error',
235
+ 'value' => $error_message,
236
+ );
237
+ array_unshift( $options, $error_notice );
238
+ }
239
+
240
+ $step_html .= Hustle_Provider_Utils::get_html_for_options( $options );
241
+
242
+ if ( ! $this->is_plugin_active() ) {
243
+ $buttons = array(
244
+ 'close' => array(
245
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup( __( 'Close', 'hustle' ), 'sui-button-ghost sui-button-center', 'close' ),
246
+ ),
247
+ );
248
+ } elseif ( $this->is_connected() ) {
249
+ $buttons = array(
250
+ 'disconnect' => array(
251
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
252
+ __( 'Disconnect', 'hustle' ),
253
+ 'sui-button-ghost sui-button-center',
254
+ 'disconnect',
255
+ true
256
+ ),
257
+ ),
258
+ );
259
+ } else {
260
+ $buttons = array(
261
+ 'connect' => array(
262
+ 'markup' => Hustle_Provider_Utils::get_provider_button_markup(
263
+ __( 'Activate', 'hustle' ),
264
+ 'sui-button-center',
265
+ 'connect',
266
+ true
267
+ ),
268
+ ),
269
+ );
270
+
271
+ }
272
+
273
+ $response = array(
274
+ 'html' => $step_html,
275
+ 'buttons' => $buttons,
276
+ 'has_errors' => $has_errors,
277
+ );
278
+
279
+ return $response;
280
+ }
281
+ }
inc/providers/mailster/images/icon.png ADDED
Binary file
inc/providers/mailster/images/logo.png ADDED
Binary file
inc/providers/mailster/mailster.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Mailster direct load.
4
+ *
5
+ * @package hustle
6
+ *
7
+ * @since 4.4.0
8
+ */
9
+
10
+ /**
11
+ * Loads the classes required for mailster and registers the integrations in Hustle.
12
+ */
13
+ require_once dirname( __FILE__ ) . '/class-hustle-mailster.php';
14
+ require_once dirname( __FILE__ ) . '/class-hustle-mailster-form-settings.php';
15
+ require_once dirname( __FILE__ ) . '/class-hustle-mailster-form-hooks.php';
16
+ Hustle_Providers::get_instance()->register( 'Hustle_Mailster' );
languages/wordpress-popup-en_US.po CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2020 Hustle 4.3.5
2
- # This file is distributed under the same license as the Hustle 4.3.5 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Hustle 4.3.5\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
@@ -50,7 +50,7 @@ msgstr ""
50
  msgid "Draft"
51
  msgstr ""
52
 
53
- #: inc/class-hustle-admin-page-abstract.php:251, inc/class-hustle-notifications.php:573, inc/class-hustle-notifications.php:630, inc/class-hustle-notifications.php:766
54
  msgid "Dismiss"
55
  msgstr ""
56
 
@@ -106,7 +106,7 @@ msgstr ""
106
  msgid "Total Modules"
107
  msgstr ""
108
 
109
- #: inc/class-hustle-dashboard-admin.php:265, inc/class-hustle-dashboard-admin.php:301, inc/class-hustle-module-page-abstract.php:820, views/admin/commons/sui-wizard/elements/image-fitting.php:35, views/admin/commons/sui-wizard/tab-appearance/row-typography/advanced/text-decoration.php:12, views/admin/commons/sui-wizard/tab-appearance/row-typography/advanced/text-transform.php:12, views/admin/commons/sui-wizard/tab-visibility/conditions.php:1375, views/admin/integrations-page/summary.php:33
110
  msgid "None"
111
  msgstr ""
112
 
@@ -126,12 +126,12 @@ msgstr ""
126
  msgid "Renew Membership"
127
  msgstr ""
128
 
129
- #: inc/class-hustle-module-admin.php:141, inc/class-hustle-notifications.php:468
130
  msgid "Upgrade"
131
  msgstr ""
132
 
133
- #: inc/class-hustle-module-admin.php:138
134
- msgid "Upgrade *60% OFF Sale*"
135
  msgstr ""
136
 
137
  #: inc/class-hustle-module-admin.php:176
@@ -684,129 +684,93 @@ msgstr ""
684
  msgid "Sorry, you are not allowed to access this page."
685
  msgstr ""
686
 
687
- #: inc/class-hustle-notifications.php:254, inc/class-hustle-notifications.php:630, views/admin/dashboard/dialogs/migrate-data.php:99
688
  msgid "Migrate Data"
689
  msgstr ""
690
 
691
- #: inc/class-hustle-notifications.php:254
692
  msgid "Remind me later"
693
  msgstr ""
694
 
695
  #. translators: user's name
696
- #: inc/class-hustle-notifications.php:270
697
  msgid "Hey %s, we have updated our Constant Contact integration to support the latest v3.0 API. Since you are connected to the old API version, we recommend you to migrate your integration to the latest API version as we'll cease to support the deprecated API at some point."
698
  msgstr ""
699
 
700
  #. translators: user's name
701
- #: inc/class-hustle-notifications.php:274
702
  msgid "Hey %s, we have updated our InfusionSoft integration to support the latest REST API. Since you are connected to the old API version, we recommend you to migrate your integration to the latest API version as we'll cease to support the deprecated API at some point."
703
  msgstr ""
704
 
705
  #. translators: 1. user's name,
706
- #: inc/class-hustle-notifications.php:278
707
  msgid "Hey %1$s, we have updated our AWeber integration to support the oAuth 2.0. Since you are connected via oAuth 1.0, we recommend you to migrate your %2$s integration to the latest authorization method as we'll cease to support the deprecated oAuth method at some point."
708
  msgstr ""
709
 
710
- #: inc/class-hustle-notifications.php:335
711
  msgid "Sign Me Up"
712
  msgstr ""
713
 
714
- #: inc/class-hustle-notifications.php:380
715
  msgid "Heads up!"
716
  msgstr ""
717
 
718
  #. translators: current version
719
- #: inc/class-hustle-notifications.php:382
720
  msgid "We’ve fixed visibility conditions in Hustle %1$s which may affect the visibility behavior of your pop-ups and other modules."
721
  msgstr ""
722
 
723
  #. translators: current version
724
- #: inc/class-hustle-notifications.php:384
725
  msgid "Prior to Hustle %1$s, the visibility engine would require you to set rules for every post type your theme used, not just the ones you specified to make it appear on correct pages. We’ve updated this behavior to only display modules based on the post types explicitly defined in your conditions. For Example, if you add a “Pages” condition to show your module on 1 page only, you’d no longer have to add other post type conditions to hide your module on them. After updating, we recommend double-checking your Hustle modules’ visibility conditions are working as expected."
726
  msgstr ""
727
 
728
- #: inc/class-hustle-notifications.php:433
729
  msgid "Congratulations! You have activated Hustle Pro! We have automatically deactivated the free version."
730
  msgstr ""
731
 
732
- #: inc/class-hustle-notifications.php:441
733
  msgid "You already have Hustle Pro activated. If you really wish to go back to the free version of Hustle, please deactivate the Pro version first"
734
  msgstr ""
735
 
736
- #: inc/class-hustle-notifications.php:476
737
  msgid "Hey"
738
  msgstr ""
739
 
740
  #. translators: user's name
741
- #: inc/class-hustle-notifications.php:480
742
  msgid "%s, it appears you have an active WPMU DEV membership but haven't upgraded Hustle to the pro version. You won't lose an any settings upgrading, go for it!"
743
  msgstr ""
744
 
745
- #: inc/class-hustle-notifications.php:511
746
- msgid "60% OFF"
747
- msgstr ""
748
-
749
- #: inc/class-hustle-notifications.php:513
750
- msgid "Black Friday 60% OFF Hustle Pro!"
751
- msgstr ""
752
-
753
- #: inc/class-hustle-notifications.php:518
754
- msgid "Limited Black Friday offer!"
755
- msgstr ""
756
-
757
- #: inc/class-hustle-notifications.php:524
758
- msgid "Days"
759
- msgstr ""
760
-
761
- #: inc/class-hustle-notifications.php:534
762
- msgid "Hours"
763
- msgstr ""
764
-
765
- #: inc/class-hustle-notifications.php:544
766
- msgid "Minutes"
767
- msgstr ""
768
-
769
- #: inc/class-hustle-notifications.php:562
770
- msgid "Get Hustle Pro for the lowest price you will ever see and create UNLIMITED Popups, Optins, Slide-ins, and Embeds!"
771
- msgstr ""
772
-
773
- #: inc/class-hustle-notifications.php:564
774
- msgid "*Only admin users can see this message"
775
- msgstr ""
776
-
777
- #: inc/class-hustle-notifications.php:569
778
- msgid "Get 60% OFF Hustle Pro"
779
- msgstr ""
780
-
781
  #. translators: user's name
782
- #: inc/class-hustle-notifications.php:628
783
  msgid "Hey %s, nice work on updating the Hustle! However, you need to migrate the data of your existing modules such as tracking data and email list manually."
784
  msgstr ""
785
 
786
  #. translators: user's name
787
- #: inc/class-hustle-notifications.php:652
788
  msgid "Hey %s, we have improved Hustle’s front-end code in this update, which included modifying some CSS classes. Any custom CSS you were using may have been affected. We recommend reviewing the modules (which were using custom CSS) to ensure they don't need any adjustments."
789
  msgstr ""
790
 
791
  #. translators: 1. user's name, 2. opening 'a' tag to sendgrid link, 3. closing 'a' tag, 4. opening 'b' tag, 5. closing 'b' tag
792
- #: inc/class-hustle-notifications.php:688
793
  msgid "Hey %1$s, we have updated our %4$sSendGrid%5$s integration to support the %2$snew Marketing Campaigns%3$s. You need to review your existing SendGrid integration(s) and select the Marketing Campaigns version (new or legacy) you are using to avoid failed API calls."
794
  msgstr ""
795
 
796
- #: inc/class-hustle-notifications.php:696
797
  msgid "Review Integrations"
798
  msgstr ""
799
 
800
- #: inc/class-hustle-notifications.php:744
801
  msgid "Check conditions"
802
  msgstr ""
803
 
804
- #: inc/class-hustle-notifications.php:756
805
  msgid "Hustle - Module visibility behaviour update"
806
  msgstr ""
807
 
808
  #. translators: 4.1 version pro or free
809
- #: inc/class-hustle-notifications.php:761
810
  msgid "Hustle %s fixes a visibility bug which may affect the visibility behavior of your popups and other modules. Please review the visibility conditions of each of your modules to ensure they will appear as you expect."
811
  msgstr ""
812
 
@@ -995,103 +959,111 @@ msgstr ""
995
  msgid "Midnight"
996
  msgstr ""
997
 
998
- #: inc/helpers/class-hustle-templates-helper.php:61, inc/helpers/class-hustle-templates-helper.php:184
 
 
 
 
 
 
 
 
999
  msgid "Christmas"
1000
  msgstr ""
1001
 
1002
- #: inc/helpers/class-hustle-templates-helper.php:62, inc/helpers/class-hustle-templates-helper.php:185
1003
  msgid "Encourage your visitors to purchase discounted items as part of a Christmas special."
1004
  msgstr ""
1005
 
1006
- #: inc/helpers/class-hustle-templates-helper.php:70, inc/helpers/class-hustle-templates-helper.php:193
1007
  msgid "Happy Holidays"
1008
  msgstr ""
1009
 
1010
- #: inc/helpers/class-hustle-templates-helper.php:71, inc/helpers/class-hustle-templates-helper.php:194
1011
  msgid "Encourage your visitors to purchase discounted items as part of a holiday special."
1012
  msgstr ""
1013
 
1014
- #: inc/helpers/class-hustle-templates-helper.php:79, inc/helpers/class-hustle-templates-helper.php:202
1015
  msgid "Minimalist"
1016
  msgstr ""
1017
 
1018
- #: inc/helpers/class-hustle-templates-helper.php:80, inc/helpers/class-hustle-templates-helper.php:89, inc/helpers/class-hustle-templates-helper.php:203, inc/helpers/class-hustle-templates-helper.php:212
1019
  msgid "Tailored to promote your seasonal offers in a modern layout."
1020
  msgstr ""
1021
 
1022
- #: inc/helpers/class-hustle-templates-helper.php:88, inc/helpers/class-hustle-templates-helper.php:211
1023
  msgid "Spring Sale"
1024
  msgstr ""
1025
 
1026
- #: inc/helpers/class-hustle-templates-helper.php:97
1027
  msgid "Stay - Exit Intent"
1028
  msgstr ""
1029
 
1030
- #: inc/helpers/class-hustle-templates-helper.php:98
1031
  msgid "Capture your visitors' attention when they are about to leave with an exclusive offer."
1032
  msgstr ""
1033
 
1034
- #: inc/helpers/class-hustle-templates-helper.php:106, inc/helpers/class-hustle-templates-helper.php:220
1035
  msgid "Foodie"
1036
  msgstr ""
1037
 
1038
- #: inc/helpers/class-hustle-templates-helper.php:107, inc/helpers/class-hustle-templates-helper.php:221
1039
  msgid "Put your products front and center with a background image and bold typography."
1040
  msgstr ""
1041
 
1042
- #: inc/helpers/class-hustle-templates-helper.php:115, inc/helpers/class-hustle-templates-helper.php:229
1043
  msgid "Tech"
1044
  msgstr ""
1045
 
1046
- #: inc/helpers/class-hustle-templates-helper.php:116, inc/helpers/class-hustle-templates-helper.php:230
1047
  msgid "A perfect template to showcase your latest app and grab visitors' interest."
1048
  msgstr ""
1049
 
1050
- #: inc/helpers/class-hustle-templates-helper.php:124, inc/helpers/class-hustle-templates-helper.php:238
1051
  msgid "Black Friday"
1052
  msgstr ""
1053
 
1054
- #: inc/helpers/class-hustle-templates-helper.php:125, inc/helpers/class-hustle-templates-helper.php:239
1055
  msgid "Promote your Black Friday deals in a dark theme."
1056
  msgstr ""
1057
 
1058
- #: inc/helpers/class-hustle-templates-helper.php:133
1059
  msgid "Newsletter Signup"
1060
  msgstr ""
1061
 
1062
- #: inc/helpers/class-hustle-templates-helper.php:134
1063
  msgid "A classic opt-in to increase your newsletter signups."
1064
  msgstr ""
1065
 
1066
- #: inc/helpers/class-hustle-templates-helper.php:142
1067
  msgid "Spin the Wheel"
1068
  msgstr ""
1069
 
1070
- #: inc/helpers/class-hustle-templates-helper.php:143
1071
  msgid "Encourage your visitors to signup with the wheel of fortune."
1072
  msgstr ""
1073
 
1074
- #: inc/helpers/class-hustle-templates-helper.php:151, inc/helpers/class-hustle-templates-helper.php:256
1075
  msgid "Give Away"
1076
  msgstr ""
1077
 
1078
- #: inc/helpers/class-hustle-templates-helper.php:152, inc/helpers/class-hustle-templates-helper.php:257
1079
  msgid "A simple yet effective template to announce your giveaways."
1080
  msgstr ""
1081
 
1082
- #: inc/helpers/class-hustle-templates-helper.php:160, inc/helpers/class-hustle-templates-helper.php:265
1083
  msgid "Pandemic"
1084
  msgstr ""
1085
 
1086
- #: inc/helpers/class-hustle-templates-helper.php:161, inc/helpers/class-hustle-templates-helper.php:266
1087
  msgid "Tailored for quickly setting up Covid-19 alerts/updates for your visitors."
1088
  msgstr ""
1089
 
1090
- #: inc/helpers/class-hustle-templates-helper.php:247
1091
  msgid "Ad-Block"
1092
  msgstr ""
1093
 
1094
- #: inc/helpers/class-hustle-templates-helper.php:248
1095
  msgid "Don't let them access your content if they have an ad-blocking extension on."
1096
  msgstr ""
1097
 
@@ -1375,7 +1347,7 @@ msgstr ""
1375
  msgid "Active Integrations"
1376
  msgstr ""
1377
 
1378
- #: inc/hustle-entries-admin.php:793, inc/hustle-sshare-model.php:275, inc/providers/icontact/hustle-icontact.php:224, inc/providers/madmimi/hustle-mad-mimi.php:202, views/admin/commons/sui-wizard/dialogs/optin-fields.php:16
1379
  msgid "Email"
1380
  msgstr ""
1381
 
@@ -3188,11 +3160,11 @@ msgstr ""
3188
  msgid "Unexpected error occurred."
3189
  msgstr ""
3190
 
3191
- #: inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:52, inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:221, inc/providers/aweber/hustle-aweber-form-hooks.php:48, inc/providers/aweber/hustle-aweber-form-hooks.php:277, inc/providers/campaignmonitor/hustle-campaignmonitor-form-hooks.php:51, inc/providers/campaignmonitor/hustle-campaignmonitor-form-hooks.php:208, inc/providers/constantcontact/hustle-constantcontact-form-hooks.php:47, inc/providers/constantcontact/hustle-constantcontact-form-hooks.php:182, inc/providers/convertkit/hustle-convertkit-form-hooks.php:55, inc/providers/convertkit/hustle-convertkit-form-hooks.php:225, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:47, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:181, inc/providers/getresponse/hustle-get-response-form-hooks.php:55, inc/providers/getresponse/hustle-get-response-form-hooks.php:255, inc/providers/hubspot/hustle-hubspot-form-hooks.php:47, inc/providers/hubspot/hustle-hubspot-form-hooks.php:225, inc/providers/icontact/hustle-icontact-form-hooks.php:47, inc/providers/icontact/hustle-icontact-form-hooks.php:250, inc/providers/infusionsoft/hustle-infusion-soft-form-hooks.php:63, inc/providers/infusionsoft/hustle-infusion-soft-form-hooks.php:248, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:45, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:214, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:72, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:392, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:46, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:208, inc/providers/mautic/hustle-mautic-form-hooks.php:47, inc/providers/mautic/hustle-mautic-form-hooks.php:222, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:46, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:198, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:45, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:226, inc/providers/sendy/hustle-sendy-form-hooks.php:40, inc/providers/sendy/hustle-sendy-form-hooks.php:140
3192
  msgid "Required Field \"email\" was not filled by the user."
3193
  msgstr ""
3194
 
3195
- #: inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:160, inc/providers/aweber/hustle-aweber-form-hooks.php:122, inc/providers/convertkit/hustle-convertkit-form-hooks.php:68, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:144, inc/providers/getresponse/hustle-get-response-form-hooks.php:95, inc/providers/hubspot/hustle-hubspot-form-hooks.php:55, inc/providers/icontact/hustle-icontact-form-hooks.php:62, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:59, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:286, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:102, inc/providers/mautic/hustle-mautic-form-hooks.php:71, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:58, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:57
3196
  msgid "Member could not be subscribed."
3197
  msgstr ""
3198
 
@@ -3204,11 +3176,11 @@ msgstr ""
3204
  msgid "ActiveCampaign Forms or Lists"
3205
  msgstr ""
3206
 
3207
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:121, inc/providers/activecampaign/hustle-activecampaign.php:306, inc/providers/aweber/hustle-aweber-form-settings.php:94, inc/providers/aweber/hustle-aweber.php:477, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:92, inc/providers/campaignmonitor/hustle-campaignmonitor.php:328, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:113, inc/providers/constantcontact/hustle-constantcontact.php:178, inc/providers/convertkit/hustle-convertkit-form-settings.php:94, inc/providers/convertkit/hustle-convertkit.php:288, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:90, inc/providers/e_newsletter/hustle-e-newsletter.php:238, inc/providers/getresponse/hustle-get-response-form-settings.php:94, inc/providers/getresponse/hustle-get-response.php:270, inc/providers/hubspot/hustle-hubspot-form-settings.php:97, inc/providers/hubspot/hustle-hubspot.php:169, inc/providers/icontact/hustle-icontact-form-settings.php:98, inc/providers/icontact/hustle-icontact.php:341, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:96, inc/providers/infusionsoft/hustle-infusion-soft.php:311, inc/providers/local-list/hustle-local-list-form-settings.php:101, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:99, inc/providers/madmimi/hustle-mad-mimi.php:293, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:185, inc/providers/mailchimp/hustle-mailchimp.php:369, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:97, inc/providers/mailerlite/hustle-mailerlite.php:242, inc/providers/mautic/hustle-mautic-form-settings.php:94, inc/providers/mautic/hustle-mautic.php:328, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:94, inc/providers/sendgrid/hustle-sendgrid.php:272, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:94, inc/providers/sendinblue/hustle-sendinblue.php:268, inc/providers/sendy/hustle-sendy-form-settings.php:53, inc/providers/sendy/hustle-sendy.php:317, inc/providers/zapier/hustle-zapier-form-settings.php:109, inc/providers/zapier/hustle-zapier.php:200
3208
  msgid "Disconnect"
3209
  msgstr ""
3210
 
3211
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:129, inc/providers/icontact/hustle-icontact-form-settings.php:101, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:193, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:333, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:497, inc/provider/class-hustle-provider-form-settings-abstract.php:602, views/admin/dashboard/dialogs/migrate-data.php:201, views/admin/dialogs/final-integration-form-delete.php:32
3212
  msgid "Continue"
3213
  msgstr ""
3214
 
@@ -3224,7 +3196,7 @@ msgstr ""
3224
  msgid "The form is required."
3225
  msgstr ""
3226
 
3227
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:220, inc/providers/aweber/hustle-aweber-form-settings.php:76, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:74, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:78, inc/providers/convertkit/hustle-convertkit-form-settings.php:76, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:68, inc/providers/getresponse/hustle-get-response-form-settings.php:76, inc/providers/hubspot/hustle-hubspot-form-settings.php:77, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:76, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:77, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:165, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:76, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:76, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:76
3228
  msgid "The email list is required."
3229
  msgstr ""
3230
 
@@ -3244,15 +3216,15 @@ msgstr ""
3244
  msgid "Choose the list you want to send form data to."
3245
  msgstr ""
3246
 
3247
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:240, inc/providers/icontact/hustle-icontact-form-settings.php:290, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:330, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:386, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:494
3248
  msgid "Back"
3249
  msgstr ""
3250
 
3251
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:248, inc/providers/activecampaign/hustle-activecampaign.php:314, inc/providers/aweber/hustle-aweber-form-settings.php:102, inc/providers/aweber/hustle-aweber.php:485, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:100, inc/providers/campaignmonitor/hustle-campaignmonitor.php:336, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:123, inc/providers/convertkit/hustle-convertkit-form-settings.php:102, inc/providers/convertkit/hustle-convertkit.php:296, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:98, inc/providers/e_newsletter/hustle-e-newsletter.php:246, inc/providers/getresponse/hustle-get-response-form-settings.php:102, inc/providers/getresponse/hustle-get-response.php:278, inc/providers/hubspot/hustle-hubspot-form-settings.php:107, inc/providers/icontact/hustle-icontact-form-settings.php:298, inc/providers/icontact/hustle-icontact.php:349, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:99, inc/providers/infusionsoft/hustle-infusion-soft.php:319, inc/providers/local-list/hustle-local-list-form-settings.php:104, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:107, inc/providers/madmimi/hustle-mad-mimi.php:301, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:389, inc/providers/mailchimp/hustle-mailchimp.php:373, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:105, inc/providers/mailerlite/hustle-mailerlite.php:250, inc/providers/mautic/hustle-mautic-form-settings.php:102, inc/providers/mautic/hustle-mautic.php:336, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:102, inc/providers/sendgrid/hustle-sendgrid.php:280, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:102, inc/providers/sendinblue/hustle-sendinblue.php:276, inc/providers/sendy/hustle-sendy.php:325, inc/providers/zapier/hustle-zapier-form-settings.php:119, inc/providers/zapier/hustle-zapier.php:208
3252
  msgid "Save"
3253
  msgstr ""
3254
 
3255
- #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:352, inc/providers/aweber/hustle-aweber-form-settings.php:197, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:171, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:192, inc/providers/convertkit/hustle-convertkit-form-settings.php:170, inc/providers/getresponse/hustle-get-response-form-settings.php:171, inc/providers/icontact/hustle-icontact-form-settings.php:190, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:166, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:191, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:599, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:183, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:172, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:194
3256
  msgid "Email List"
3257
  msgstr ""
3258
 
@@ -3280,11 +3252,11 @@ msgstr ""
3280
  msgid "Activecampaign Added"
3281
  msgstr ""
3282
 
3283
- #: inc/providers/activecampaign/hustle-activecampaign.php:189, inc/providers/aweber/hustle-aweber.php:389, inc/providers/campaignmonitor/hustle-campaignmonitor.php:204, inc/providers/convertkit/hustle-convertkit.php:172, inc/providers/e_newsletter/hustle-e-newsletter.php:171, inc/providers/getresponse/hustle-get-response.php:175, inc/providers/icontact/hustle-icontact.php:199, inc/providers/infusionsoft/hustle-infusion-soft.php:192, inc/providers/madmimi/hustle-mad-mimi.php:177, inc/providers/mailchimp/hustle-mailchimp.php:272, inc/providers/mailerlite/hustle-mailerlite.php:149, inc/providers/mautic/hustle-mautic.php:187, inc/providers/sendgrid/hustle-sendgrid.php:163, inc/providers/sendinblue/hustle-sendinblue.php:173, inc/providers/sendy/hustle-sendy.php:181, inc/providers/zapier/hustle-zapier.php:163
3284
  msgid "You can now go to your pop-ups, slide-ins and embeds and assign them to this integration"
3285
  msgstr ""
3286
 
3287
- #: inc/providers/activecampaign/hustle-activecampaign.php:192, inc/providers/aweber/hustle-aweber.php:392, inc/providers/campaignmonitor/hustle-campaignmonitor.php:207, inc/providers/convertkit/hustle-convertkit.php:175, inc/providers/e_newsletter/hustle-e-newsletter.php:174, inc/providers/getresponse/hustle-get-response.php:178, inc/providers/icontact/hustle-icontact.php:202, inc/providers/infusionsoft/hustle-infusion-soft.php:195, inc/providers/madmimi/hustle-mad-mimi.php:180, inc/providers/mailchimp/hustle-mailchimp.php:275, inc/providers/mailerlite/hustle-mailerlite.php:152, inc/providers/mautic/hustle-mautic.php:190, inc/providers/sendgrid/hustle-sendgrid.php:166, inc/providers/sendinblue/hustle-sendinblue.php:176, inc/providers/sendy/hustle-sendy-form-settings.php:60, inc/providers/sendy/hustle-sendy.php:184, inc/providers/zapier/hustle-zapier.php:166, inc/provider/class-hustle-provider-abstract.php:1318, views/admin/dialogs/modal-preview.php:30
3288
  msgid "Close"
3289
  msgstr ""
3290
 
@@ -3649,7 +3621,7 @@ msgstr ""
3649
  msgid "Install e-Newsletter"
3650
  msgstr ""
3651
 
3652
- #: inc/providers/e_newsletter/hustle-e-newsletter.php:256, inc/providers/zapier/hustle-zapier.php:218, views/admin/settings/tab-analytics.php:91
3653
  msgid "Activate"
3654
  msgstr ""
3655
 
@@ -4137,7 +4109,7 @@ msgstr ""
4137
  msgid "There was an error fetching the lists. Please make sure the %1$sselected account settings%2$s are correct."
4138
  msgstr ""
4139
 
4140
- #: inc/providers/mailchimp/hustle-mailchimp-form-settings.php:629
4141
  msgid "Extra Options"
4142
  msgstr ""
4143
 
@@ -4223,6 +4195,127 @@ msgstr ""
4223
  msgid "Invalid MailerLite API key."
4224
  msgstr ""
4225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4226
  #: inc/providers/mautic/hustle-mautic-form-hooks.php:154, inc/providers/mautic/hustle-mautic-form-hooks.php:143
4227
  msgid "Successfully updated member on Mautic list"
4228
  msgstr ""
@@ -4638,23 +4731,23 @@ msgstr ""
4638
  msgid "Confirmation message"
4639
  msgstr ""
4640
 
4641
- #: inc/provider/class-hustle-provider-form-settings-abstract.php:174
4642
  msgid "No options to select from."
4643
  msgstr ""
4644
 
4645
- #: inc/provider/class-hustle-provider-form-settings-abstract.php:563
4646
  msgid "Choose Account"
4647
  msgstr ""
4648
 
4649
- #: inc/provider/class-hustle-provider-form-settings-abstract.php:576
4650
  msgid "Connect Account"
4651
  msgstr ""
4652
 
4653
- #: inc/provider/class-hustle-provider-form-settings-abstract.php:577
4654
  msgid "Select the integration account you want to connect your module to."
4655
  msgstr ""
4656
 
4657
- #: inc/provider/class-hustle-provider-form-settings-abstract.php:591
4658
  msgid "Please select an account."
4659
  msgstr ""
4660
 
@@ -4674,7 +4767,7 @@ msgstr ""
4674
  msgid "The 4.0.x visibility metas couldn't be restored."
4675
  msgstr ""
4676
 
4677
- #: views/admin/commons/modal-template.php:73, views/admin/commons/sui-listing/dialogs/create-module/create-non-sshare.php:23, views/admin/commons/sui-listing/dialogs/create-module/create-sshare.php:16, views/admin/commons/sui-listing/dialogs/create-module/non-sshare-templates-step.php:17, views/admin/commons/sui-listing/dialogs/delete-module.php:33, views/admin/commons/sui-wizard/dialogs/add-schedule.php:55, views/admin/commons/sui-wizard/dialogs/add-schedule.php:68, views/admin/dashboard/dialogs/fresh-install.php:52, views/admin/dashboard/dialogs/fresh-install.php:106, views/admin/dashboard/dialogs/release-highlight.php:31, views/admin/dashboard/dialogs/review-conditions.php:34, views/admin/dialogs/black-friday.php:31, views/admin/dialogs/modal-integration.php:32, views/admin/dialogs/modal-migrate-aweber.php:29, views/admin/dialogs/modal-migrate-ctct.php:31, views/admin/dialogs/modal-preview.php:34, views/admin/dialogs/remove-active-integration.php:27
4678
  msgid "Close this dialog window"
4679
  msgstr ""
4680
 
@@ -8377,11 +8470,11 @@ msgstr ""
8377
 
8378
  #. translators: current user's name
8379
  #: views/admin/dashboard/dialogs/release-highlight.php:39
8380
- msgid "New! Holiday Templates"
8381
  msgstr ""
8382
 
8383
  #: views/admin/dashboard/dialogs/release-highlight.php:42
8384
- msgid "Weve added new festive templates to our collection. So whether you want to advertise discounts or deals over the festive season, you can use our Christmas or Holiday templates to drive more conversion on your website."
8385
  msgstr ""
8386
 
8387
  #: views/admin/dashboard/dialogs/release-highlight.php:50
@@ -8459,54 +8552,6 @@ msgstr ""
8459
  msgid "Total Shares"
8460
  msgstr ""
8461
 
8462
- #: views/admin/dialogs/black-friday.php:48
8463
- msgid "Hustle Pro 60% OFF"
8464
- msgstr ""
8465
-
8466
- #: views/admin/dialogs/black-friday.php:50
8467
- msgid "For all your popup and optin needs."
8468
- msgstr ""
8469
-
8470
- #: views/admin/dialogs/black-friday.php:52
8471
- msgid "Before $60 per year, now $24 per year. A total of 8 months free!"
8472
- msgstr ""
8473
-
8474
- #: views/admin/dialogs/black-friday.php:59
8475
- msgid "year"
8476
- msgstr ""
8477
-
8478
- #: views/admin/dialogs/black-friday.php:62
8479
- msgid "Total of 8 months free!"
8480
- msgstr ""
8481
-
8482
- #: views/admin/dialogs/black-friday.php:72
8483
- msgid "Get 60% Off Hustle Pro"
8484
- msgstr ""
8485
-
8486
- #: views/admin/dialogs/black-friday.php:76
8487
- msgid "Hustle Pro Benefits"
8488
- msgstr ""
8489
-
8490
- #: views/admin/dialogs/black-friday.php:82
8491
- msgid "Unlimited Popups"
8492
- msgstr ""
8493
-
8494
- #: views/admin/dialogs/black-friday.php:87
8495
- msgid "Unlimited Optins"
8496
- msgstr ""
8497
-
8498
- #: views/admin/dialogs/black-friday.php:92
8499
- msgid "Unlimited Slide-ins"
8500
- msgstr ""
8501
-
8502
- #: views/admin/dialogs/black-friday.php:97
8503
- msgid "24/7 Support"
8504
- msgstr ""
8505
-
8506
- #: views/admin/dialogs/black-friday.php:114
8507
- msgid "Check All Plans"
8508
- msgstr ""
8509
-
8510
  #: views/admin/dialogs/final-integration-form-delete.php:16
8511
  msgid "Integration Required!"
8512
  msgstr ""
@@ -10010,10 +10055,6 @@ msgstr ""
10010
  msgid "social share"
10011
  msgstr ""
10012
 
10013
- #: views/admin/upsell.php:17
10014
- msgid "Upgrade to Hustle Pro"
10015
- msgstr ""
10016
-
10017
  #. translators: 1. opening 'strong' tag, 2. closing 'strong' tag
10018
  #: views/admin/upsell.php:19
10019
  msgid "Build %1$sunlimited%2$s pop-ups, slide-ins, embeds, and social sharing modules with Hustle Pro. No limits on your marketing efforts = more leads and increased sales. Nice!"
1
+ # Copyright (C) 2020 Hustle 4.4.0
2
+ # This file is distributed under the same license as the Hustle 4.4.0 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Hustle 4.4.0\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
50
  msgid "Draft"
51
  msgstr ""
52
 
53
+ #: inc/class-hustle-admin-page-abstract.php:251, inc/class-hustle-notifications.php:509, inc/class-hustle-notifications.php:645
54
  msgid "Dismiss"
55
  msgstr ""
56
 
106
  msgid "Total Modules"
107
  msgstr ""
108
 
109
+ #: inc/class-hustle-dashboard-admin.php:265, inc/class-hustle-dashboard-admin.php:301, inc/class-hustle-module-page-abstract.php:820, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:382, inc/providers/mailster/class-hustle-mailster-form-settings.php:432, views/admin/commons/sui-wizard/elements/image-fitting.php:35, views/admin/commons/sui-wizard/tab-appearance/row-typography/advanced/text-decoration.php:12, views/admin/commons/sui-wizard/tab-appearance/row-typography/advanced/text-transform.php:12, views/admin/commons/sui-wizard/tab-visibility/conditions.php:1375, views/admin/integrations-page/summary.php:33
110
  msgid "None"
111
  msgstr ""
112
 
126
  msgid "Renew Membership"
127
  msgstr ""
128
 
129
+ #: inc/class-hustle-module-admin.php:141, inc/class-hustle-notifications.php:462
130
  msgid "Upgrade"
131
  msgstr ""
132
 
133
+ #: inc/class-hustle-module-admin.php:138, views/admin/upsell.php:17
134
+ msgid "Upgrade to Hustle Pro"
135
  msgstr ""
136
 
137
  #: inc/class-hustle-module-admin.php:176
684
  msgid "Sorry, you are not allowed to access this page."
685
  msgstr ""
686
 
687
+ #: inc/class-hustle-notifications.php:249, inc/class-hustle-notifications.php:509, views/admin/dashboard/dialogs/migrate-data.php:99
688
  msgid "Migrate Data"
689
  msgstr ""
690
 
691
+ #: inc/class-hustle-notifications.php:249
692
  msgid "Remind me later"
693
  msgstr ""
694
 
695
  #. translators: user's name
696
+ #: inc/class-hustle-notifications.php:265
697
  msgid "Hey %s, we have updated our Constant Contact integration to support the latest v3.0 API. Since you are connected to the old API version, we recommend you to migrate your integration to the latest API version as we'll cease to support the deprecated API at some point."
698
  msgstr ""
699
 
700
  #. translators: user's name
701
+ #: inc/class-hustle-notifications.php:269
702
  msgid "Hey %s, we have updated our InfusionSoft integration to support the latest REST API. Since you are connected to the old API version, we recommend you to migrate your integration to the latest API version as we'll cease to support the deprecated API at some point."
703
  msgstr ""
704
 
705
  #. translators: 1. user's name,
706
+ #: inc/class-hustle-notifications.php:273
707
  msgid "Hey %1$s, we have updated our AWeber integration to support the oAuth 2.0. Since you are connected via oAuth 1.0, we recommend you to migrate your %2$s integration to the latest authorization method as we'll cease to support the deprecated oAuth method at some point."
708
  msgstr ""
709
 
710
+ #: inc/class-hustle-notifications.php:330
711
  msgid "Sign Me Up"
712
  msgstr ""
713
 
714
+ #: inc/class-hustle-notifications.php:375
715
  msgid "Heads up!"
716
  msgstr ""
717
 
718
  #. translators: current version
719
+ #: inc/class-hustle-notifications.php:377
720
  msgid "We’ve fixed visibility conditions in Hustle %1$s which may affect the visibility behavior of your pop-ups and other modules."
721
  msgstr ""
722
 
723
  #. translators: current version
724
+ #: inc/class-hustle-notifications.php:379
725
  msgid "Prior to Hustle %1$s, the visibility engine would require you to set rules for every post type your theme used, not just the ones you specified to make it appear on correct pages. We’ve updated this behavior to only display modules based on the post types explicitly defined in your conditions. For Example, if you add a “Pages” condition to show your module on 1 page only, you’d no longer have to add other post type conditions to hide your module on them. After updating, we recommend double-checking your Hustle modules’ visibility conditions are working as expected."
726
  msgstr ""
727
 
728
+ #: inc/class-hustle-notifications.php:427
729
  msgid "Congratulations! You have activated Hustle Pro! We have automatically deactivated the free version."
730
  msgstr ""
731
 
732
+ #: inc/class-hustle-notifications.php:435
733
  msgid "You already have Hustle Pro activated. If you really wish to go back to the free version of Hustle, please deactivate the Pro version first"
734
  msgstr ""
735
 
736
+ #: inc/class-hustle-notifications.php:470
737
  msgid "Hey"
738
  msgstr ""
739
 
740
  #. translators: user's name
741
+ #: inc/class-hustle-notifications.php:474
742
  msgid "%s, it appears you have an active WPMU DEV membership but haven't upgraded Hustle to the pro version. You won't lose an any settings upgrading, go for it!"
743
  msgstr ""
744
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745
  #. translators: user's name
746
+ #: inc/class-hustle-notifications.php:507
747
  msgid "Hey %s, nice work on updating the Hustle! However, you need to migrate the data of your existing modules such as tracking data and email list manually."
748
  msgstr ""
749
 
750
  #. translators: user's name
751
+ #: inc/class-hustle-notifications.php:531
752
  msgid "Hey %s, we have improved Hustle’s front-end code in this update, which included modifying some CSS classes. Any custom CSS you were using may have been affected. We recommend reviewing the modules (which were using custom CSS) to ensure they don't need any adjustments."
753
  msgstr ""
754
 
755
  #. translators: 1. user's name, 2. opening 'a' tag to sendgrid link, 3. closing 'a' tag, 4. opening 'b' tag, 5. closing 'b' tag
756
+ #: inc/class-hustle-notifications.php:567
757
  msgid "Hey %1$s, we have updated our %4$sSendGrid%5$s integration to support the %2$snew Marketing Campaigns%3$s. You need to review your existing SendGrid integration(s) and select the Marketing Campaigns version (new or legacy) you are using to avoid failed API calls."
758
  msgstr ""
759
 
760
+ #: inc/class-hustle-notifications.php:575
761
  msgid "Review Integrations"
762
  msgstr ""
763
 
764
+ #: inc/class-hustle-notifications.php:623
765
  msgid "Check conditions"
766
  msgstr ""
767
 
768
+ #: inc/class-hustle-notifications.php:635
769
  msgid "Hustle - Module visibility behaviour update"
770
  msgstr ""
771
 
772
  #. translators: 4.1 version pro or free
773
+ #: inc/class-hustle-notifications.php:640
774
  msgid "Hustle %s fixes a visibility bug which may affect the visibility behavior of your popups and other modules. Please review the visibility conditions of each of your modules to ensure they will appear as you expect."
775
  msgstr ""
776
 
959
  msgid "Midnight"
960
  msgstr ""
961
 
962
+ #: inc/helpers/class-hustle-templates-helper.php:61, inc/helpers/class-hustle-templates-helper.php:193
963
+ msgid "New Year"
964
+ msgstr ""
965
+
966
+ #: inc/helpers/class-hustle-templates-helper.php:62, inc/helpers/class-hustle-templates-helper.php:194
967
+ msgid "Engage your clients right from the start of the year with a New Year special."
968
+ msgstr ""
969
+
970
+ #: inc/helpers/class-hustle-templates-helper.php:70, inc/helpers/class-hustle-templates-helper.php:202
971
  msgid "Christmas"
972
  msgstr ""
973
 
974
+ #: inc/helpers/class-hustle-templates-helper.php:71, inc/helpers/class-hustle-templates-helper.php:203
975
  msgid "Encourage your visitors to purchase discounted items as part of a Christmas special."
976
  msgstr ""
977
 
978
+ #: inc/helpers/class-hustle-templates-helper.php:79, inc/helpers/class-hustle-templates-helper.php:211
979
  msgid "Happy Holidays"
980
  msgstr ""
981
 
982
+ #: inc/helpers/class-hustle-templates-helper.php:80, inc/helpers/class-hustle-templates-helper.php:212
983
  msgid "Encourage your visitors to purchase discounted items as part of a holiday special."
984
  msgstr ""
985
 
986
+ #: inc/helpers/class-hustle-templates-helper.php:88, inc/helpers/class-hustle-templates-helper.php:220
987
  msgid "Minimalist"
988
  msgstr ""
989
 
990
+ #: inc/helpers/class-hustle-templates-helper.php:89, inc/helpers/class-hustle-templates-helper.php:98, inc/helpers/class-hustle-templates-helper.php:221, inc/helpers/class-hustle-templates-helper.php:230
991
  msgid "Tailored to promote your seasonal offers in a modern layout."
992
  msgstr ""
993
 
994
+ #: inc/helpers/class-hustle-templates-helper.php:97, inc/helpers/class-hustle-templates-helper.php:229
995
  msgid "Spring Sale"
996
  msgstr ""
997
 
998
+ #: inc/helpers/class-hustle-templates-helper.php:106
999
  msgid "Stay - Exit Intent"
1000
  msgstr ""
1001
 
1002
+ #: inc/helpers/class-hustle-templates-helper.php:107
1003
  msgid "Capture your visitors' attention when they are about to leave with an exclusive offer."
1004
  msgstr ""
1005
 
1006
+ #: inc/helpers/class-hustle-templates-helper.php:115, inc/helpers/class-hustle-templates-helper.php:238
1007
  msgid "Foodie"
1008
  msgstr ""
1009
 
1010
+ #: inc/helpers/class-hustle-templates-helper.php:116, inc/helpers/class-hustle-templates-helper.php:239
1011
  msgid "Put your products front and center with a background image and bold typography."
1012
  msgstr ""
1013
 
1014
+ #: inc/helpers/class-hustle-templates-helper.php:124, inc/helpers/class-hustle-templates-helper.php:247
1015
  msgid "Tech"
1016
  msgstr ""
1017
 
1018
+ #: inc/helpers/class-hustle-templates-helper.php:125, inc/helpers/class-hustle-templates-helper.php:248
1019
  msgid "A perfect template to showcase your latest app and grab visitors' interest."
1020
  msgstr ""
1021
 
1022
+ #: inc/helpers/class-hustle-templates-helper.php:133, inc/helpers/class-hustle-templates-helper.php:256
1023
  msgid "Black Friday"
1024
  msgstr ""
1025
 
1026
+ #: inc/helpers/class-hustle-templates-helper.php:134, inc/helpers/class-hustle-templates-helper.php:257
1027
  msgid "Promote your Black Friday deals in a dark theme."
1028
  msgstr ""
1029
 
1030
+ #: inc/helpers/class-hustle-templates-helper.php:142
1031
  msgid "Newsletter Signup"
1032
  msgstr ""
1033
 
1034
+ #: inc/helpers/class-hustle-templates-helper.php:143
1035
  msgid "A classic opt-in to increase your newsletter signups."
1036
  msgstr ""
1037
 
1038
+ #: inc/helpers/class-hustle-templates-helper.php:151
1039
  msgid "Spin the Wheel"
1040
  msgstr ""
1041
 
1042
+ #: inc/helpers/class-hustle-templates-helper.php:152
1043
  msgid "Encourage your visitors to signup with the wheel of fortune."
1044
  msgstr ""
1045
 
1046
+ #: inc/helpers/class-hustle-templates-helper.php:160, inc/helpers/class-hustle-templates-helper.php:274
1047
  msgid "Give Away"
1048
  msgstr ""
1049
 
1050
+ #: inc/helpers/class-hustle-templates-helper.php:161, inc/helpers/class-hustle-templates-helper.php:275
1051
  msgid "A simple yet effective template to announce your giveaways."
1052
  msgstr ""
1053
 
1054
+ #: inc/helpers/class-hustle-templates-helper.php:169, inc/helpers/class-hustle-templates-helper.php:283
1055
  msgid "Pandemic"
1056
  msgstr ""
1057
 
1058
+ #: inc/helpers/class-hustle-templates-helper.php:170, inc/helpers/class-hustle-templates-helper.php:284
1059
  msgid "Tailored for quickly setting up Covid-19 alerts/updates for your visitors."
1060
  msgstr ""
1061
 
1062
+ #: inc/helpers/class-hustle-templates-helper.php:265
1063
  msgid "Ad-Block"
1064
  msgstr ""
1065
 
1066
+ #: inc/helpers/class-hustle-templates-helper.php:266
1067
  msgid "Don't let them access your content if they have an ad-blocking extension on."
1068
  msgstr ""
1069
 
1347
  msgid "Active Integrations"
1348
  msgstr ""
1349
 
1350
+ #: inc/hustle-entries-admin.php:793, inc/hustle-sshare-model.php:275, inc/providers/icontact/hustle-icontact.php:224, inc/providers/madmimi/hustle-mad-mimi.php:202, inc/providers/mailster/class-hustle-mailster-form-settings.php:340, views/admin/commons/sui-wizard/dialogs/optin-fields.php:16
1351
  msgid "Email"
1352
  msgstr ""
1353
 
3160
  msgid "Unexpected error occurred."
3161
  msgstr ""
3162
 
3163
+ #: inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:52, inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:221, inc/providers/aweber/hustle-aweber-form-hooks.php:48, inc/providers/aweber/hustle-aweber-form-hooks.php:277, inc/providers/campaignmonitor/hustle-campaignmonitor-form-hooks.php:51, inc/providers/campaignmonitor/hustle-campaignmonitor-form-hooks.php:208, inc/providers/constantcontact/hustle-constantcontact-form-hooks.php:47, inc/providers/constantcontact/hustle-constantcontact-form-hooks.php:182, inc/providers/convertkit/hustle-convertkit-form-hooks.php:55, inc/providers/convertkit/hustle-convertkit-form-hooks.php:225, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:47, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:181, inc/providers/getresponse/hustle-get-response-form-hooks.php:55, inc/providers/getresponse/hustle-get-response-form-hooks.php:255, inc/providers/hubspot/hustle-hubspot-form-hooks.php:47, inc/providers/hubspot/hustle-hubspot-form-hooks.php:225, inc/providers/icontact/hustle-icontact-form-hooks.php:47, inc/providers/icontact/hustle-icontact-form-hooks.php:250, inc/providers/infusionsoft/hustle-infusion-soft-form-hooks.php:63, inc/providers/infusionsoft/hustle-infusion-soft-form-hooks.php:248, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:45, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:214, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:72, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:392, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:46, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:208, inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php:46, inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php:189, inc/providers/mailster/class-hustle-mailster-form-hooks.php:29, inc/providers/mailster/class-hustle-mailster-form-hooks.php:145, inc/providers/mautic/hustle-mautic-form-hooks.php:47, inc/providers/mautic/hustle-mautic-form-hooks.php:222, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:46, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:198, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:45, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:226, inc/providers/sendy/hustle-sendy-form-hooks.php:40, inc/providers/sendy/hustle-sendy-form-hooks.php:140
3164
  msgid "Required Field \"email\" was not filled by the user."
3165
  msgstr ""
3166
 
3167
+ #: inc/providers/activecampaign/hustle-activecampaign-form-hooks.php:160, inc/providers/aweber/hustle-aweber-form-hooks.php:122, inc/providers/convertkit/hustle-convertkit-form-hooks.php:68, inc/providers/e_newsletter/hustle-e-newsletter-form-hooks.php:144, inc/providers/getresponse/hustle-get-response-form-hooks.php:95, inc/providers/hubspot/hustle-hubspot-form-hooks.php:55, inc/providers/icontact/hustle-icontact-form-hooks.php:62, inc/providers/madmimi/hustle-mad-mimi-form-hooks.php:59, inc/providers/mailchimp/hustle-mailchimp-form-hooks.php:286, inc/providers/mailerlite/hustle-mailerlite-form-hooks.php:102, inc/providers/mailster/class-hustle-mailster-form-hooks.php:234, inc/providers/mautic/hustle-mautic-form-hooks.php:71, inc/providers/sendgrid/hustle-sendgrid-form-hooks.php:58, inc/providers/sendinblue/hustle-sendinblue-form-hooks.php:57
3168
  msgid "Member could not be subscribed."
3169
  msgstr ""
3170
 
3176
  msgid "ActiveCampaign Forms or Lists"
3177
  msgstr ""
3178
 
3179
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:121, inc/providers/activecampaign/hustle-activecampaign.php:306, inc/providers/aweber/hustle-aweber-form-settings.php:94, inc/providers/aweber/hustle-aweber.php:477, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:92, inc/providers/campaignmonitor/hustle-campaignmonitor.php:328, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:113, inc/providers/constantcontact/hustle-constantcontact.php:178, inc/providers/convertkit/hustle-convertkit-form-settings.php:94, inc/providers/convertkit/hustle-convertkit.php:288, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:90, inc/providers/e_newsletter/hustle-e-newsletter.php:238, inc/providers/getresponse/hustle-get-response-form-settings.php:94, inc/providers/getresponse/hustle-get-response.php:270, inc/providers/hubspot/hustle-hubspot-form-settings.php:97, inc/providers/hubspot/hustle-hubspot.php:169, inc/providers/icontact/hustle-icontact-form-settings.php:98, inc/providers/icontact/hustle-icontact.php:341, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:96, inc/providers/infusionsoft/hustle-infusion-soft.php:311, inc/providers/local-list/hustle-local-list-form-settings.php:101, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:99, inc/providers/madmimi/hustle-mad-mimi.php:293, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:185, inc/providers/mailchimp/hustle-mailchimp.php:369, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:97, inc/providers/mailerlite/hustle-mailerlite.php:242, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:98, inc/providers/mailpoet/class-hustle-mailpoet.php:278, inc/providers/mailster/class-hustle-mailster-form-settings.php:97, inc/providers/mailster/class-hustle-mailster.php:252, inc/providers/mautic/hustle-mautic-form-settings.php:94, inc/providers/mautic/hustle-mautic.php:328, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:94, inc/providers/sendgrid/hustle-sendgrid.php:272, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:94, inc/providers/sendinblue/hustle-sendinblue.php:268, inc/providers/sendy/hustle-sendy-form-settings.php:53, inc/providers/sendy/hustle-sendy.php:317, inc/providers/zapier/hustle-zapier-form-settings.php:109, inc/providers/zapier/hustle-zapier.php:200
3180
  msgid "Disconnect"
3181
  msgstr ""
3182
 
3183
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:129, inc/providers/icontact/hustle-icontact-form-settings.php:101, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:193, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:333, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:497, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:108, inc/providers/mailster/class-hustle-mailster-form-settings.php:107, inc/provider/class-hustle-provider-form-settings-abstract.php:624, views/admin/dashboard/dialogs/migrate-data.php:201, views/admin/dialogs/final-integration-form-delete.php:32
3184
  msgid "Continue"
3185
  msgstr ""
3186
 
3196
  msgid "The form is required."
3197
  msgstr ""
3198
 
3199
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:220, inc/providers/aweber/hustle-aweber-form-settings.php:76, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:74, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:78, inc/providers/convertkit/hustle-convertkit-form-settings.php:76, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:68, inc/providers/getresponse/hustle-get-response-form-settings.php:76, inc/providers/hubspot/hustle-hubspot-form-settings.php:77, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:76, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:77, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:165, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:76, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:78, inc/providers/mailster/class-hustle-mailster-form-settings.php:199, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:76, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:76
3200
  msgid "The email list is required."
3201
  msgstr ""
3202
 
3216
  msgid "Choose the list you want to send form data to."
3217
  msgstr ""
3218
 
3219
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:240, inc/providers/icontact/hustle-icontact-form-settings.php:290, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:330, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:386, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:494, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:220, inc/providers/mailster/class-hustle-mailster-form-settings.php:268
3220
  msgid "Back"
3221
  msgstr ""
3222
 
3223
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:248, inc/providers/activecampaign/hustle-activecampaign.php:314, inc/providers/aweber/hustle-aweber-form-settings.php:102, inc/providers/aweber/hustle-aweber.php:485, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:100, inc/providers/campaignmonitor/hustle-campaignmonitor.php:336, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:123, inc/providers/convertkit/hustle-convertkit-form-settings.php:102, inc/providers/convertkit/hustle-convertkit.php:296, inc/providers/e_newsletter/hustle-e-newsletter-form-settings.php:98, inc/providers/e_newsletter/hustle-e-newsletter.php:246, inc/providers/getresponse/hustle-get-response-form-settings.php:102, inc/providers/getresponse/hustle-get-response.php:278, inc/providers/hubspot/hustle-hubspot-form-settings.php:107, inc/providers/icontact/hustle-icontact-form-settings.php:298, inc/providers/icontact/hustle-icontact.php:349, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:99, inc/providers/infusionsoft/hustle-infusion-soft.php:319, inc/providers/local-list/hustle-local-list-form-settings.php:104, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:107, inc/providers/madmimi/hustle-mad-mimi.php:301, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:389, inc/providers/mailchimp/hustle-mailchimp.php:373, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:105, inc/providers/mailerlite/hustle-mailerlite.php:250, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:228, inc/providers/mailster/class-hustle-mailster-form-settings.php:276, inc/providers/mautic/hustle-mautic-form-settings.php:102, inc/providers/mautic/hustle-mautic.php:336, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:102, inc/providers/sendgrid/hustle-sendgrid.php:280, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:102, inc/providers/sendinblue/hustle-sendinblue.php:276, inc/providers/sendy/hustle-sendy.php:325, inc/providers/zapier/hustle-zapier-form-settings.php:119, inc/providers/zapier/hustle-zapier.php:208
3224
  msgid "Save"
3225
  msgstr ""
3226
 
3227
+ #: inc/providers/activecampaign/hustle-activecampaign-form-settings.php:352, inc/providers/aweber/hustle-aweber-form-settings.php:197, inc/providers/campaignmonitor/hustle-campaignmonitor-form-settings.php:171, inc/providers/constantcontact/hustle-constantcontact-form-settings.php:192, inc/providers/convertkit/hustle-convertkit-form-settings.php:170, inc/providers/getresponse/hustle-get-response-form-settings.php:171, inc/providers/icontact/hustle-icontact-form-settings.php:190, inc/providers/infusionsoft/hustle-infusion-soft-form-settings.php:166, inc/providers/madmimi/hustle-mad-mimi-form-settings.php:191, inc/providers/mailchimp/hustle-mailchimp-form-settings.php:599, inc/providers/mailerlite/hustle-mailerlite-form-settings.php:183, inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:156, inc/providers/mailster/class-hustle-mailster-form-settings.php:151, inc/providers/sendgrid/hustle-sendgrid-form-settings.php:172, inc/providers/sendinblue/hustle-sendinblue-form-settings.php:194
3228
  msgid "Email List"
3229
  msgstr ""
3230
 
3252
  msgid "Activecampaign Added"
3253
  msgstr ""
3254
 
3255
+ #: inc/providers/activecampaign/hustle-activecampaign.php:189, inc/providers/aweber/hustle-aweber.php:389, inc/providers/campaignmonitor/hustle-campaignmonitor.php:204, inc/providers/convertkit/hustle-convertkit.php:172, inc/providers/e_newsletter/hustle-e-newsletter.php:171, inc/providers/getresponse/hustle-get-response.php:175, inc/providers/icontact/hustle-icontact.php:199, inc/providers/infusionsoft/hustle-infusion-soft.php:192, inc/providers/madmimi/hustle-mad-mimi.php:177, inc/providers/mailchimp/hustle-mailchimp.php:272, inc/providers/mailerlite/hustle-mailerlite.php:149, inc/providers/mailpoet/class-hustle-mailpoet.php:213, inc/providers/mailster/class-hustle-mailster.php:190, inc/providers/mautic/hustle-mautic.php:187, inc/providers/sendgrid/hustle-sendgrid.php:163, inc/providers/sendinblue/hustle-sendinblue.php:173, inc/providers/sendy/hustle-sendy.php:181, inc/providers/zapier/hustle-zapier.php:163
3256
  msgid "You can now go to your pop-ups, slide-ins and embeds and assign them to this integration"
3257
  msgstr ""
3258
 
3259
+ #: inc/providers/activecampaign/hustle-activecampaign.php:192, inc/providers/aweber/hustle-aweber.php:392, inc/providers/campaignmonitor/hustle-campaignmonitor.php:207, inc/providers/convertkit/hustle-convertkit.php:175, inc/providers/e_newsletter/hustle-e-newsletter.php:174, inc/providers/getresponse/hustle-get-response.php:178, inc/providers/icontact/hustle-icontact.php:202, inc/providers/infusionsoft/hustle-infusion-soft.php:195, inc/providers/madmimi/hustle-mad-mimi.php:180, inc/providers/mailchimp/hustle-mailchimp.php:275, inc/providers/mailerlite/hustle-mailerlite.php:152, inc/providers/mailpoet/class-hustle-mailpoet.php:216, inc/providers/mailpoet/class-hustle-mailpoet.php:271, inc/providers/mailster/class-hustle-mailster.php:193, inc/providers/mailster/class-hustle-mailster.php:245, inc/providers/mautic/hustle-mautic.php:190, inc/providers/sendgrid/hustle-sendgrid.php:166, inc/providers/sendinblue/hustle-sendinblue.php:176, inc/providers/sendy/hustle-sendy-form-settings.php:60, inc/providers/sendy/hustle-sendy.php:184, inc/providers/zapier/hustle-zapier.php:166, inc/provider/class-hustle-provider-abstract.php:1318, views/admin/dialogs/modal-preview.php:30
3260
  msgid "Close"
3261
  msgstr ""
3262
 
3621
  msgid "Install e-Newsletter"
3622
  msgstr ""
3623
 
3624
+ #: inc/providers/e_newsletter/hustle-e-newsletter.php:256, inc/providers/mailpoet/class-hustle-mailpoet.php:289, inc/providers/mailster/class-hustle-mailster.php:263, inc/providers/zapier/hustle-zapier.php:218, views/admin/settings/tab-analytics.php:91
3625
  msgid "Activate"
3626
  msgstr ""
3627
 
4109
  msgid "There was an error fetching the lists. Please make sure the %1$sselected account settings%2$s are correct."
4110
  msgstr ""
4111
 
4112
+ #: inc/providers/mailchimp/hustle-mailchimp-form-settings.php:629, inc/providers/mailster/class-hustle-mailster-form-settings.php:169
4113
  msgid "Extra Options"
4114
  msgstr ""
4115
 
4195
  msgid "Invalid MailerLite API key."
4196
  msgstr ""
4197
 
4198
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php:108
4199
+ msgid "Successfully added or updated member on Mailpoet list"
4200
+ msgstr ""
4201
+
4202
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php:126
4203
+ msgid "User added to the list but the emails could not be sent."
4204
+ msgstr ""
4205
+
4206
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php:127
4207
+ msgid "The user could not be subscribed."
4208
+ msgstr ""
4209
+
4210
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:82
4211
+ msgid "Mailpoet List"
4212
+ msgstr ""
4213
+
4214
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:83, inc/providers/mailster/class-hustle-mailster-form-settings.php:84
4215
+ msgid "Choose the subscriber's list to which you want to send form data."
4216
+ msgstr ""
4217
+
4218
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:207, inc/providers/mailster/class-hustle-mailster-form-settings.php:255
4219
+ msgid "Map Fields"
4220
+ msgstr ""
4221
+
4222
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:208
4223
+ msgid "Map your Hustle fields to Mailpoet’s List fields below. Unmapped fields will be skipped."
4224
+ msgstr ""
4225
+
4226
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:254, inc/providers/mailster/class-hustle-mailster-form-settings.php:302
4227
+ msgid "Mapping the fields is required."
4228
+ msgstr ""
4229
+
4230
+ #. translators: Missing required fields separated by comma.
4231
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:268
4232
+ msgid "The following fields are required: %s"
4233
+ msgstr ""
4234
+
4235
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:306, inc/providers/mailster/class-hustle-mailster-form-settings.php:359
4236
+ msgid "Provider Field"
4237
+ msgstr ""
4238
+
4239
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:307, inc/providers/mailster/class-hustle-mailster-form-settings.php:360
4240
+ msgid "Hustle Field"
4241
+ msgstr ""
4242
+
4243
+ #. translators: 1. opening 'b' tag, 2. closing 'b' tag, 3. closing and opening 'p' tag.
4244
+ #. translators: 1. opening 'b' tag, 2. closing 'b' tag, 3. closing and opening 'p' tag.
4245
+ #: inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php:345, inc/providers/mailster/class-hustle-mailster-form-settings.php:395
4246
+ msgid "%1$sImportant!%2$s If you've just added new fields in your hustle module, you need to first save your changes for the fields to show up in the dropdown above.%3$sAlso, when a field’s name is changed in hustle, its mapping will be lost, and you’ll need to re-map it in the integration."
4247
+ msgstr ""
4248
+
4249
+ #: inc/providers/mailpoet/class-hustle-mailpoet.php:213
4250
+ msgid "Mailpoet Added"
4251
+ msgstr ""
4252
+
4253
+ #: inc/providers/mailpoet/class-hustle-mailpoet.php:223, inc/providers/mailster/class-hustle-mailster.php:200
4254
+ msgid "successfully connected"
4255
+ msgstr ""
4256
+
4257
+ #. translators: 1. opening 'a' tag to the Mailpoet's wp page, 2. closing 'a' tag
4258
+ #: inc/providers/mailpoet/class-hustle-mailpoet.php:234
4259
+ msgid "This integration requires the %1$sMailpoet 3%2$s. Install and activate it and try again."
4260
+ msgstr ""
4261
+
4262
+ #: inc/providers/mailpoet/class-hustle-mailpoet.php:249
4263
+ msgid "Connect Mailpoet 3"
4264
+ msgstr ""
4265
+
4266
+ #: inc/providers/mailpoet/class-hustle-mailpoet.php:250
4267
+ msgid "Mailpoet lets you send beautiful emails that reach inboxes every time and create loyal subscribers."
4268
+ msgstr ""
4269
+
4270
+ #: inc/providers/mailster/class-hustle-mailster-form-hooks.php:208
4271
+ msgid "User successfully added"
4272
+ msgstr ""
4273
+
4274
+ #: inc/providers/mailster/class-hustle-mailster-form-hooks.php:209
4275
+ msgid "User successfully updated"
4276
+ msgstr ""
4277
+
4278
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:83
4279
+ msgid "Mailster List"
4280
+ msgstr ""
4281
+
4282
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:180
4283
+ msgid "Automatically opt-in new users to the mailing list"
4284
+ msgstr ""
4285
+
4286
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:256
4287
+ msgid "Map your Hustle fields to Mailster’s List fields below. Unmapped fields will be skipped."
4288
+ msgstr ""
4289
+
4290
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:307
4291
+ msgid "The following fields are required: Email"
4292
+ msgstr ""
4293
+
4294
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:344
4295
+ msgid "First name"
4296
+ msgstr ""
4297
+
4298
+ #: inc/providers/mailster/class-hustle-mailster-form-settings.php:348
4299
+ msgid "Last name"
4300
+ msgstr ""
4301
+
4302
+ #: inc/providers/mailster/class-hustle-mailster.php:190
4303
+ msgid "Mailster Added"
4304
+ msgstr ""
4305
+
4306
+ #: inc/providers/mailster/class-hustle-mailster.php:216
4307
+ msgid "Connect Mailster"
4308
+ msgstr ""
4309
+
4310
+ #: inc/providers/mailster/class-hustle-mailster.php:217
4311
+ msgid "Mailster lets you create, manage, and send email newsletter campaings from within your WordPress site."
4312
+ msgstr ""
4313
+
4314
+ #. translators: 1. opening 'a' tag to the Mailster's wp page, 2. closing 'a' tag, 3. opening 'b' tag, 4. closing 'b' tag
4315
+ #: inc/providers/mailster/class-hustle-mailster.php:224
4316
+ msgid "This integration requires the %1$sMailster Newsletter Plugin%2$s, %3$sversion 2.2%4$s or newer. Install and activate it and try again."
4317
+ msgstr ""
4318
+
4319
  #: inc/providers/mautic/hustle-mautic-form-hooks.php:154, inc/providers/mautic/hustle-mautic-form-hooks.php:143
4320
  msgid "Successfully updated member on Mautic list"
4321
  msgstr ""
4731
  msgid "Confirmation message"
4732
  msgstr ""
4733
 
4734
+ #: inc/provider/class-hustle-provider-form-settings-abstract.php:196
4735
  msgid "No options to select from."
4736
  msgstr ""
4737
 
4738
+ #: inc/provider/class-hustle-provider-form-settings-abstract.php:585
4739
  msgid "Choose Account"
4740
  msgstr ""
4741
 
4742
+ #: inc/provider/class-hustle-provider-form-settings-abstract.php:598
4743
  msgid "Connect Account"
4744
  msgstr ""
4745
 
4746
+ #: inc/provider/class-hustle-provider-form-settings-abstract.php:599
4747
  msgid "Select the integration account you want to connect your module to."
4748
  msgstr ""
4749
 
4750
+ #: inc/provider/class-hustle-provider-form-settings-abstract.php:613
4751
  msgid "Please select an account."
4752
  msgstr ""
4753
 
4767
  msgid "The 4.0.x visibility metas couldn't be restored."
4768
  msgstr ""
4769
 
4770
+ #: views/admin/commons/modal-template.php:73, views/admin/commons/sui-listing/dialogs/create-module/create-non-sshare.php:23, views/admin/commons/sui-listing/dialogs/create-module/create-sshare.php:16, views/admin/commons/sui-listing/dialogs/create-module/non-sshare-templates-step.php:17, views/admin/commons/sui-listing/dialogs/delete-module.php:33, views/admin/commons/sui-wizard/dialogs/add-schedule.php:55, views/admin/commons/sui-wizard/dialogs/add-schedule.php:68, views/admin/dashboard/dialogs/fresh-install.php:52, views/admin/dashboard/dialogs/fresh-install.php:106, views/admin/dashboard/dialogs/release-highlight.php:31, views/admin/dashboard/dialogs/review-conditions.php:34, views/admin/dialogs/modal-integration.php:32, views/admin/dialogs/modal-migrate-aweber.php:29, views/admin/dialogs/modal-migrate-ctct.php:31, views/admin/dialogs/modal-preview.php:34, views/admin/dialogs/remove-active-integration.php:27
4771
  msgid "Close this dialog window"
4772
  msgstr ""
4773
 
8470
 
8471
  #. translators: current user's name
8472
  #: views/admin/dashboard/dialogs/release-highlight.php:39
8473
+ msgid "New! Mailster and Mailpoet Integration"
8474
  msgstr ""
8475
 
8476
  #: views/admin/dashboard/dialogs/release-highlight.php:42
8477
+ msgid "We are happy to let you know that we've added Mailster and Mailpoet to our integrations. If you use either of these services for sending email campaigns or managing your mailing contacts, you can now build your mailing list using Hustle opt-in forms."
8478
  msgstr ""
8479
 
8480
  #: views/admin/dashboard/dialogs/release-highlight.php:50
8552
  msgid "Total Shares"
8553
  msgstr ""
8554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8555
  #: views/admin/dialogs/final-integration-form-delete.php:16
8556
  msgid "Integration Required!"
8557
  msgstr ""
10055
  msgid "social share"
10056
  msgstr ""
10057
 
 
 
 
 
10058
  #. translators: 1. opening 'strong' tag, 2. closing 'strong' tag
10059
  #: views/admin/upsell.php:19
10060
  msgid "Build %1$sunlimited%2$s pop-ups, slide-ins, embeds, and social sharing modules with Hustle Pro. No limits on your marketing efforts = more leads and increased sales. Nice!"
popover.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Hustle
11
  * Plugin URI: https://wordpress.org/plugins/wordpress-popup/
12
  * Description: Start collecting email addresses and quickly grow your mailing list with big bold pop-ups, slide-ins, widgets, or in post opt-in forms.
13
- * Version: 7.3.7
14
  * Author: WPMU DEV
15
  * Author URI: https://premium.wpmudev.org
16
  * Text Domain: hustle
@@ -83,7 +83,7 @@ if ( ! class_exists( 'Opt_In' ) ) {
83
  */
84
  class Opt_In {
85
 
86
- const VERSION = '4.3.7';
87
 
88
  const VIEWS_FOLDER = 'views';
89
 
10
  * Plugin Name: Hustle
11
  * Plugin URI: https://wordpress.org/plugins/wordpress-popup/
12
  * Description: Start collecting email addresses and quickly grow your mailing list with big bold pop-ups, slide-ins, widgets, or in post opt-in forms.
13
+ * Version: 7.4.0
14
  * Author: WPMU DEV
15
  * Author URI: https://premium.wpmudev.org
16
  * Text Domain: hustle
83
  */
84
  class Opt_In {
85
 
86
+ const VERSION = '4.4.0';
87
 
88
  const VIEWS_FOLDER = 'views';
89
 
readme.txt CHANGED
@@ -3,23 +3,23 @@ Plugin Name: Hustle - Email Marketing, Lead Generation, Opt-ins, Popups
3
  Author: WPMU DEV
4
  Author URI: https://premium.wpmudev.org/
5
  Contributors: WPMUDEV, WebFactory
6
- Tags: marketing, popup, optin, newsletter, subscription form, email, advertise, signup, mailing list, wordpress popup plugin, popup maker, pop-up, opt-in, black friday
7
  Requires at least: 4.6
8
  Tested up to: 5.6
9
- Stable tag: 7.3.6
10
 
11
  Setup email optin forms, popups, newsletter forms & subscription forms to generate email leads with the best marketing popup builder
12
 
13
 
14
  == Description ==
15
 
16
- *Hustle is the ultimate marketing plugin for building a mailing list and converting site traffic. Promoting your offers, sales, and giveaways (e.g. Black Friday, Christmas, Halloween) just got easier with simple to set up optin forms, targeted marketing popups, and designer-made templates. Build a social following while you’re at it with Hustle’s diverse social sharing capabilities. From the award winning developers of [Smush](https://wordpress.org/plugins/wp-smushit/) image optimization and [Forminator](https://wordpress.org/plugins/forminator/) form builder at WPMU DEV.*
17
 
18
  Hustle lets you easily grow your mailing list or display targeted ads across your site with popups, optins, slide-ins, widgets, and shortcodes.
19
 
20
  [youtube https://www.youtube.com/watch?v=oKgRSUdjcNg&feature=youtu.be]
21
 
22
- ### Instant Templates For Every Kind Of Offer (Black Friday, Christmas, One-Time)
23
 
24
  Hustle makes the process of creating popups, slide-ins, and embeds easier with a range of pre-designed templates. The templates available represent a number of different use cases (e.g. Black Friday, giveaway, COVID notice, newsletter signup), meaning you can get started with a module that aligns with your campaign goals. See them in action below:
25
 
@@ -79,12 +79,14 @@ Hustle integrates with all the popular email services. Just connect your account
79
  - Constant Contact
80
  - ConvertKit
81
  - GetResponse
 
82
  - Hubspot
83
  - Sendy
84
  - Mad Mimi
85
  - Mautic
86
  - Infusionsoft
87
  - SendinBlue
 
88
  - MailerLite
89
  - iContact
90
  - Zapier
@@ -181,7 +183,12 @@ No! Hustle gives you all the same settings and options as Hustle Pro. The only d
181
 
182
  == Changelog ==
183
 
184
- = 7.3.7 ( 2020-12-14 ) =
 
 
 
 
 
185
 
186
  - New: New Year template
187
  - Enhance: Compatibility with PHP 8
@@ -231,17 +238,6 @@ No! Hustle gives you all the same settings and options as Hustle Pro. The only d
231
  - New: Reset button for the appearance Typography and Advanced settings
232
  - Enhance: Allow displaying the analytics widget without a title
233
 
234
- = 7.3.0 ( 2020-08-20 ) =
235
-
236
- - Add pre-built templates to choose from when creating a module
237
- - Add settings for changing the typography properties of the modules' elements
238
- - Add settings for adjusting the border, spacing, and shadow of the modules' elements
239
- - Add settings for adjusting the module layout
240
- - Add settings for handling the module appearance in mobiles
241
- - Fix Campaign Monitor not updating a subscribed user's details
242
- - Fix emails list export not working on Flywheel
243
- - Fix minor UI and UX issues
244
-
245
  [Changelog for previous versions](https://premium.wpmudev.org/project/hustle/#view-changelog).
246
 
247
  == About Us ==
3
  Author: WPMU DEV
4
  Author URI: https://premium.wpmudev.org/
5
  Contributors: WPMUDEV, WebFactory
6
+ Tags: marketing, popup, optin, newsletter, subscription form, email, advertise, signup, mailing list, wordpress popup plugin, popup maker, pop-up, opt-in
7
  Requires at least: 4.6
8
  Tested up to: 5.6
9
+ Stable tag: 7.3.7
10
 
11
  Setup email optin forms, popups, newsletter forms & subscription forms to generate email leads with the best marketing popup builder
12
 
13
 
14
  == Description ==
15
 
16
+ *Hustle is the ultimate marketing plugin for building a mailing list and converting site traffic. Lead generation just got easier with simple set up optin forms, targeted marketing popups, and designer-made templates. Build a social following while you’re at it with Hustle’s diverse social sharing capabilities. From the award winning developers of [Smush](https://wordpress.org/plugins/wp-smushit/) image optimization and [Forminator](https://wordpress.org/plugins/forminator/) form builder at WPMU DEV.*
17
 
18
  Hustle lets you easily grow your mailing list or display targeted ads across your site with popups, optins, slide-ins, widgets, and shortcodes.
19
 
20
  [youtube https://www.youtube.com/watch?v=oKgRSUdjcNg&feature=youtu.be]
21
 
22
+ ### Instant Templates For Every Kind Of Offer
23
 
24
  Hustle makes the process of creating popups, slide-ins, and embeds easier with a range of pre-designed templates. The templates available represent a number of different use cases (e.g. Black Friday, giveaway, COVID notice, newsletter signup), meaning you can get started with a module that aligns with your campaign goals. See them in action below:
25
 
79
  - Constant Contact
80
  - ConvertKit
81
  - GetResponse
82
+ - Mailster
83
  - Hubspot
84
  - Sendy
85
  - Mad Mimi
86
  - Mautic
87
  - Infusionsoft
88
  - SendinBlue
89
+ - MailPoet
90
  - MailerLite
91
  - iContact
92
  - Zapier
183
 
184
  == Changelog ==
185
 
186
+ = 7.4.0 ( 2021-01-11 ) =
187
+
188
+ - New: Mailpoet 3 integration
189
+ - New: Mailster integration
190
+
191
+ = 7.3.7 ( 2020-12-21 ) =
192
 
193
  - New: New Year template
194
  - Enhance: Compatibility with PHP 8
238
  - New: Reset button for the appearance Typography and Advanced settings
239
  - Enhance: Allow displaying the analytics widget without a title
240
 
 
 
 
 
 
 
 
 
 
 
 
241
  [Changelog for previous versions](https://premium.wpmudev.org/project/hustle/#view-changelog).
242
 
243
  == About Us ==
vendor/composer/autoload_classmap.php CHANGED
@@ -147,6 +147,12 @@ return array(
147
  'Hustle_MailerLite_Api' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-api.php',
148
  'Hustle_MailerLite_Form_Hooks' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-form-hooks.php',
149
  'Hustle_MailerLite_Form_Settings' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-form-settings.php',
 
 
 
 
 
 
150
  'Hustle_Mautic' => $baseDir . '/inc/providers/mautic/hustle-mautic.php',
151
  'Hustle_Mautic_Api' => $baseDir . '/inc/providers/mautic/hustle-mautic-api.php',
152
  'Hustle_Mautic_Form_Hooks' => $baseDir . '/inc/providers/mautic/hustle-mautic-form-hooks.php',
147
  'Hustle_MailerLite_Api' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-api.php',
148
  'Hustle_MailerLite_Form_Hooks' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-form-hooks.php',
149
  'Hustle_MailerLite_Form_Settings' => $baseDir . '/inc/providers/mailerlite/hustle-mailerlite-form-settings.php',
150
+ 'Hustle_Mailpoet' => $baseDir . '/inc/providers/mailpoet/class-hustle-mailpoet.php',
151
+ 'Hustle_Mailpoet_Form_Hooks' => $baseDir . '/inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php',
152
+ 'Hustle_Mailpoet_Form_Settings' => $baseDir . '/inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php',
153
+ 'Hustle_Mailster' => $baseDir . '/inc/providers/mailster/class-hustle-mailster.php',
154
+ 'Hustle_Mailster_Form_Hooks' => $baseDir . '/inc/providers/mailster/class-hustle-mailster-form-hooks.php',
155
+ 'Hustle_Mailster_Form_Settings' => $baseDir . '/inc/providers/mailster/class-hustle-mailster-form-settings.php',
156
  'Hustle_Mautic' => $baseDir . '/inc/providers/mautic/hustle-mautic.php',
157
  'Hustle_Mautic_Api' => $baseDir . '/inc/providers/mautic/hustle-mautic-api.php',
158
  'Hustle_Mautic_Form_Hooks' => $baseDir . '/inc/providers/mautic/hustle-mautic-form-hooks.php',
vendor/composer/autoload_static.php CHANGED
@@ -152,6 +152,12 @@ class ComposerStaticInitda98371940d11703c56dee923bbb392f
152
  'Hustle_MailerLite_Api' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-api.php',
153
  'Hustle_MailerLite_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-form-hooks.php',
154
  'Hustle_MailerLite_Form_Settings' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-form-settings.php',
 
 
 
 
 
 
155
  'Hustle_Mautic' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic.php',
156
  'Hustle_Mautic_Api' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic-api.php',
157
  'Hustle_Mautic_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic-form-hooks.php',
152
  'Hustle_MailerLite_Api' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-api.php',
153
  'Hustle_MailerLite_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-form-hooks.php',
154
  'Hustle_MailerLite_Form_Settings' => __DIR__ . '/../..' . '/inc/providers/mailerlite/hustle-mailerlite-form-settings.php',
155
+ 'Hustle_Mailpoet' => __DIR__ . '/../..' . '/inc/providers/mailpoet/class-hustle-mailpoet.php',
156
+ 'Hustle_Mailpoet_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mailpoet/class-hustle-mailpoet-form-hooks.php',
157
+ 'Hustle_Mailpoet_Form_Settings' => __DIR__ . '/../..' . '/inc/providers/mailpoet/class-hustle-mailpoet-form-settings.php',
158
+ 'Hustle_Mailster' => __DIR__ . '/../..' . '/inc/providers/mailster/class-hustle-mailster.php',
159
+ 'Hustle_Mailster_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mailster/class-hustle-mailster-form-hooks.php',
160
+ 'Hustle_Mailster_Form_Settings' => __DIR__ . '/../..' . '/inc/providers/mailster/class-hustle-mailster-form-settings.php',
161
  'Hustle_Mautic' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic.php',
162
  'Hustle_Mautic_Api' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic-api.php',
163
  'Hustle_Mautic_Form_Hooks' => __DIR__ . '/../..' . '/inc/providers/mautic/hustle-mautic-form-hooks.php',
views/admin/commons/options.php CHANGED
@@ -83,12 +83,17 @@ switch ( $type ) :
83
  id="<?php echo empty( $id ) ? 'hustle-select-' . esc_attr( $name ) : esc_attr( $id ); ?>"
84
  name="<?php echo esc_attr( $name ); ?>"
85
  <?php echo empty( $class ) ? '' : 'class="' . esc_attr( $class ) . '"'; ?>
 
86
  <?php $this->render_attributes( $attributes ); ?>
87
  tabindex="-1"
88
  aria-hidden="true"
89
  >
90
 
91
- <?php
 
 
 
 
92
  // Fully server's side rendered field.
93
  if ( ! $is_template ) :
94
 
83
  id="<?php echo empty( $id ) ? 'hustle-select-' . esc_attr( $name ) : esc_attr( $id ); ?>"
84
  name="<?php echo esc_attr( $name ); ?>"
85
  <?php echo empty( $class ) ? '' : 'class="' . esc_attr( $class ) . '"'; ?>
86
+ <?php echo empty( $placeholder ) ? '' : 'data-placeholder="' . esc_attr( $placeholder ) . '"'; ?>
87
  <?php $this->render_attributes( $attributes ); ?>
88
  tabindex="-1"
89
  aria-hidden="true"
90
  >
91
 
92
+ <?php if ( ! empty( $placeholder ) ) : ?>
93
+ <option></option>
94
+ <?php
95
+ endif;
96
+
97
  // Fully server's side rendered field.
98
  if ( ! $is_template ) :
99
 
views/admin/dashboard/dialogs/release-highlight.php CHANGED
@@ -36,10 +36,10 @@ $banner_img_2x = self::$plugin_url . 'assets/images/release-highlight-header@2x.
36
  </figure>
37
 
38
  <?php /* translators: current user's name */ ?>
39
- <h3 id="hustle-dialog--release-highlight-title" class="sui-box-title sui-lg"><?php esc_html_e( 'New! Holiday Templates', 'hustle' ); ?></h3>
40
 
41
  <p id="hustle-dialog--release-highlight-description" class="sui-description">
42
- <?php esc_html_e( 'We’ve added new festive templates to our collection. So whether you want to advertise discounts or deals over the festive season, you can use our Christmas or Holiday templates to drive more conversion on your website.', 'hustle' ); ?>
43
  </p>
44
 
45
  </div>
36
  </figure>
37
 
38
  <?php /* translators: current user's name */ ?>
39
+ <h3 id="hustle-dialog--release-highlight-title" class="sui-box-title sui-lg"><?php esc_html_e( 'New! Mailster and Mailpoet Integration', 'hustle' ); ?></h3>
40
 
41
  <p id="hustle-dialog--release-highlight-description" class="sui-description">
42
+ <?php esc_html_e( "We are happy to let you know that we've added Mailster and Mailpoet to our integrations. If you use either of these services for sending email campaigns or managing your mailing contacts, you can now build your mailing list using Hustle opt-in forms.", 'hustle' ); ?>
43
  </p>
44
 
45
  </div>