"use strict";(self["webpackChunkoptinmonster_wordpress_plugin_vue_app"]=self["webpackChunkoptinmonster_wordpress_plugin_vue_app"]||[]).push([[938],{1439:function(e,t,s){s.r(t),s.d(t,{default:function(){return f}});var a=function(){var e=this,t=e._self._c;return e.reachedCampaignLimit?t("templates-limit-exceeded",{attrs:{"is-playbooks":!0}}):t("core-page",[t("div",{staticClass:"playbooks-page-wrapper dashboard-wrapper",class:{previewing:!1}},[t("common-page-tabnav",{attrs:{current:"playbooks",tabs:e.tabs}}),e.alerts.length?t("div",{staticClass:"container",staticStyle:{margin:"46px auto 40px"}},[t("core-alerts",{attrs:{alerts:e.alerts}})],1):e._e(),t("div",{staticClass:"playbooks-content"},[t("playbooks-intro"),e.isLoading?t("core-loading",{staticClass:"playbooks-loading"}):t("div",[e.hasRecommendations?t("playbooks-recommendations"):e._e(),t("playbooks-table")],1)],1),t("playbooks-upgrade-modal"),t("campaigns-modal-create-campaign",{attrs:{"from-playbook":!0}}),t("templates-modal-not-connected")],1)])},o=[],i=s(55916),n=s(86080),l=(s(57658),s(20629)),r=s(86430),p=s(591),c=s(30727),d=s(81566),m={mixins:[r.G,d.s,c.v,p.j],computed:(0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)((0,n.Z)({},(0,l.rn)(["alerts"])),(0,l.rn)("playbooks",["playbooks","previewing","filterOptions","selectedPlaybook"])),(0,l.Se)(["connected","reachedCampaignLimit"])),(0,l.Se)("playbooks",["hasRecommendations"])),{},{isLoading:function(){return this.$store.getters.isLoading(["playbooks","rules","filterOptions"])},unavailableRules:function(){var e=this;return this.selectedPlaybook.rules.filter((function(t){return!e.ruleAvailable(t)}))||[]}}),watch:{selectedPlaybook:function(e){e&&this.handleUsePlaybook()}},created:function(){var e=this;this.$store.dispatch("campaigns/fetchRulesetData").then((function(t){var s=t.rules;s.push.apply(s,(0,i.Z)(t.bigCommerceRules)),s.push.apply(s,(0,i.Z)(t.eddRules)),s.push.apply(s,(0,i.Z)(t.shopifyRules)),s.push.apply(s,(0,i.Z)(t.wooCommerceRules)),e.setRules(s)}))["catch"]((function(){})),this.filterOptions.length||this.$store.dispatch("templates/fetchFilterOptions").then((function(t){e.setFilterOptions(t)}))["catch"]((function(){})),this.playbooks.length||this.$store.dispatch("playbooks/fetchPlaybooksData").then((function(){e.$store.getters.connected&&e.$store.dispatch("playbooks/fetchRecommendationsData")["catch"]((function(){}))}))["catch"]((function(){})),this.setDismissedRecommendations(),this.loadApiScript("omwpapi-playbooks-apijs",this.$constants.PLAYBOOKS_PREVIEW_ACCOUNT,this.$constants.PLAYBOOKS_PREVIEW_USER)},methods:(0,n.Z)((0,n.Z)({},(0,l.OI)("playbooks",["setDismissedRecommendations","setRules","setFilterOptions","setUpgradeRule"])),{},{handleUsePlaybook:function(){var e=this;if(this.$store.commit("templates/setActiveTemplate",this.selectedPlaybook),!this.$store.getters.connected)return this.$modal.show("not-connected");if(this.unavailableRules.length){var t=["exit-intent","inactivity-time"].find((function(t){return e.unavailableRules.includes(t)}));return t&&this.setUpgradeRule(t),this.$modal.show("upgrade-modal")}this.$modal.show("create-campaign-modal")}})},u=m,h=s(1001),b=(0,h.Z)(u,a,o,!1,null,null,null),f=b.exports},30727:function(e,t,s){s.d(t,{v:function(){return a}});var a={data:function(){return{tabs:{templates:{name:"Templates",route:{path:"templates",params:{tab:"popup"}}},playbooks:{name:"Playbooks",route:{path:"playbooks",params:{}}}}}}}},81566:function(e,t,s){s.d(t,{s:function(){return l}});var a=s(73421),o=s(7977),i=s(35562);const n=(e,t,s)=>{let a=document.getElementById(e);if(a)return a;const n=document.getElementsByTagName("head")[0]||document.documentElement;return a=document.createElement("script"),a.type="text/javascript",a.id=e,a.src=i.Z.apiJs(),a.async=!0,a.dataset.account=t,a.dataset.user=s,(0,o.isProduction)()||(a.dataset.env=(0,o.isDevelopment)()?"dev":o.currentEnv),n.appendChild(a),a},l={created(){this.listenApiLoaded(),(0,a.of)(),(0,a.ge)(),(0,a.O0)(),(0,a.vY)(),(0,a.Kp)(),this.$store.subscribe((e=>{const t=["templates/setLoadingPreview","templates/setPreviewing","templates/filterOptions","templates/templates","templates/permittedTypes","templates/recentTemplates","templates/popular","templates/setApiLoaded"],s=["route/ROUTE_CHANGED"];let a=e.type.startsWith("templates/")&&!t.includes(e.type);a||(a=s.includes(e.type)),a&&this.closeAllPreviews()}))},beforeDestroy(){(0,a.of)(!1),(0,a.ge)(!1),(0,a.vY)(!1),(0,a.O0)(!1),(0,a.Kp)(!1)},methods:{listenApiLoaded(e="addEventListener"){["om.Api.init","om.Main.init","om.Campaigns.init","om.Campaign.init"].forEach((t=>document[e](t,this.setApiLoaded)))},setApiLoaded(){this.listenApiLoaded("removeEventListener"),this.$store.commit("templates/setApiLoaded")},closeAllPreviews(){(0,a.IC)(),this.$store.commit("templates/setLoadingPreview",""),this.$store.commit("templates/setPreviewing","")},loadApiScript(e,t,s){return n(e,t,s)}}}}}]);
//# sourceMappingURL=playbooks.a37aa32a.js.map