????
Current Path : /home/ncom/public_html/wp-content/plugins/optinmonster/vue/dist/js/ |
Current File : /home/ncom/public_html/wp-content/plugins/optinmonster/vue/dist/js/templates.52602afc.js.map |
{"version":3,"file":"js/templates.52602afc.js","mappings":"uNAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAQF,EAAII,qBAAsBF,EAAG,4BAA4BA,EAAG,YAAY,CAACG,MAAM,CAAC,QAAU,sBAAsB,CAACH,EAAG,qBAAqB,CAACG,MAAM,CAAC,QAAU,YAAY,KAAOL,EAAIM,QAAQJ,EAAG,KAAK,CAACF,EAAIO,GAAG,6BAA6BL,EAAG,gBAAgB,CAACG,MAAM,CAAC,OAASL,EAAIQ,UAAUN,EAAG,MAAM,CAACO,YAAY,qBAAqB,CAACP,EAAG,mBAAmBA,EAAG,MAAM,CAACO,YAAY,sBAAsB,CAACP,EAAG,2BAA2BA,EAAG,MAAM,CAACO,YAAY,oBAAoB,CAACP,EAAG,MAAM,CAACO,YAAY,yBAAyB,CAAET,EAAIU,UAAWR,EAAG,MAAM,CAACO,YAAY,yBAAyB,CAACP,EAAG,MAAM,CAACA,EAAG,eAAe,CAACO,YAAY,YAAY,KAAKP,EAAG,sBAAsB,GAAGA,EAAG,MAAM,CAACO,YAAY,0BAA0B,CAAET,EAAIW,aAAcT,EAAG,MAAM,CAACO,YAAY,+BAA+B,CAACP,EAAG,iBAAiB,CAACG,MAAM,CAAC,UAAYL,EAAIY,qBAAsBZ,EAAIU,UAAWR,EAAG,cAAc,CAACW,MAAO,CAAEC,OAAQ,YAAcd,EAAIe,MAAM,GAAIf,EAAIU,UAAWR,EAAG,MAAM,CAACO,YAAY,yBAAyB,CAACP,EAAG,MAAM,CAACA,EAAG,eAAe,CAACO,YAAY,YAAY,KAAKP,EAAG,MAAM,CAACO,YAAY,0BAA0B,CAAET,EAAIgB,WAAahB,EAAIiB,OAAQf,EAAG,gBAAgB,CAACG,MAAM,CAAC,g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CACd,8BACA,0BACA,0BACA,sBACA,2BACA,4BACA,oBACA,0BAEKC,EAAW,CAAC,uBAElB,IAAIC,EAAcH,EAAShB,KAAKoB,WAAW,gBAAkBH,EAAOI,SAASL,EAAShB,MACjFmB,IACJA,EAAcD,EAASG,SAASL,EAAShB,OAGtCmB,GACH5E,KAAK+E,kBACN,GAEF,EACA,aAAAC,IACC,SAAkB,IAClB,SAAgB,IAChB,SAAqB,IACrB,SAAqB,IACrB,SAAkB,EACnB,EACAlD,QAAS,CACR,eAAAwC,CAAgBW,EAAK,oBACpB,CAAC,cAAe,eAAgB,oBAAqB,oBAAoBC,SAASC,GACjFlC,SAASgC,GAAIE,EAAKnF,KAAKoF,eAEzB,EASA,YAAAA,GACCpF,KAAKsE,gBAAgB,uBACrBtE,KAAKuE,OAAOc,OAAO,yBACpB,EAMA,gBAAAN,IACC,UACA/E,KAAKuE,OAAOc,OAAO,8BAA+B,IAClDrF,KAAKuE,OAAOc,OAAO,0BAA2B,GAC/C,EAUA,aAAA1C,CAAcE,EAAUC,EAAWC,GAClC,OAAOJ,EAAc,KAAK2C,QAASzC,EAAUC,EAAWC,EACzD,G","sources":["webpack://optinmonster-wordpress-plugin-vue-app/./src/pages/Templates.vue","webpack://optinmonster-wordpress-plugin-vue-app/src/pages/Templates.vue","webpack://optinmonster-wordpress-plugin-vue-app/./src/pages/Templates.vue?b742","webpack://optinmonster-wordpress-plugin-vue-app/./src/pages/Templates.vue?7e80","webpack://optinmonster-wordpress-plugin-vue-app/./src/components/mixins/creation.js","webpack://optinmonster-wordpress-plugin-vue-app/./node_modules/optinmonster-js-library/src/utils/apiJsScript.js","webpack://optinmonster-wordpress-plugin-vue-app/./node_modules/optinmonster-js-library/src/vue/templates/mixins/templatePreviewsSetup.js"],"sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return (_vm.reachedCampaignLimit)?_c('templates-limit-exceeded'):_c('core-page',{attrs:{\"classes\":\"templates-wrapper\"}},[_c('common-page-tabnav',{attrs:{\"current\":\"templates\",\"tabs\":_vm.tabs}}),_c('h1',[_vm._v(\"Select a Campaign Type:\")]),_c('common-alerts',{attrs:{\"alerts\":_vm.alerts}}),_c('div',{staticClass:\"templates-content\"},[_c('templates-types'),_c('div',{staticClass:\"omapi-content-area\"},[_c('templates-upsell-alerts'),_c('div',{staticClass:\"template-content\"},[_c('div',{staticClass:\"template-content-left\"},[(_vm.isLoading)?_c('div',{staticClass:\"archie-loader-wrapper\"},[_c('div',[_c('core-loading',{staticClass:\"loader\"})],1)]):_c('templates-filters')],1),_c('div',{staticClass:\"template-content-right\"},[(_vm.hasTemplates)?_c('div',{staticClass:\"omapi-template-listing-wrap\"},[_c('templates-grid',{attrs:{\"templates\":_vm.selectedTemplates}}),(_vm.isLoading)?_c('svg-loading',{style:({ margin: '0 auto' })}):_vm._e()],1):(_vm.isLoading)?_c('div',{staticClass:\"archie-loader-wrapper\"},[_c('div',[_c('core-loading',{staticClass:\"loader\"})],1)]):_c('div',{staticClass:\"no-templates-available\"},[(_vm.validType && _vm.search)?_c('core-feedback',{attrs:{\"feedback-type\":\"templates\"}},[_c('em',[_vm._v(\" Looks like we don't have that template yet. Tell us more about the template you're looking for below and we'll consider adding it to our library. \")]),_c('em',[_vm._v(\" Or, if you need it right away, \"),_c('a',{attrs:{\"href\":\"https://optinmonster.com/vip-service/?utm_source=plugin&utm_medium=template_search\",\"target\":\"_blank\",\"rel\":\"noopener noreferrer\"}},[_vm._v(\" purchase a VIP Campaign \")]),_vm._v(\" and we'll do it for you within two business days. \")])]):_c('core-alert',{attrs:{\"type\":_vm.validType ? 'info' : 'warn'}},[_c('div',{staticClass:\"alert-message\"},[_vm._v(\" \"+_vm._s(_vm.noTemplatesMessage)+\" \")])])],1)])])],1)],1),_c('campaigns-modal-create-campaign'),_c('templates-modal-not-connected'),_c('templates-modal-no-access')],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n\t<templates-limit-exceeded v-if=\"reachedCampaignLimit\" />\n\t<core-page v-else classes=\"templates-wrapper\">\n\t\t<common-page-tabnav current=\"templates\" :tabs=\"tabs\" />\n\t\t<h1>Select a Campaign Type:</h1>\n\t\t<common-alerts :alerts=\"alerts\" />\n\t\t<div class=\"templates-content\">\n\t\t\t<templates-types />\n\n\t\t\t<div class=\"omapi-content-area\">\n\t\t\t\t<templates-upsell-alerts />\n\n\t\t\t\t<div class=\"template-content\">\n\t\t\t\t\t<div class=\"template-content-left\">\n\t\t\t\t\t\t<div v-if=\"isLoading\" class=\"archie-loader-wrapper\">\n\t\t\t\t\t\t\t<div><core-loading class=\"loader\" /></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<templates-filters v-else />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"template-content-right\">\n\t\t\t\t\t\t<div v-if=\"hasTemplates\" class=\"omapi-template-listing-wrap\">\n\t\t\t\t\t\t\t<templates-grid :templates=\"selectedTemplates\" />\n\t\t\t\t\t\t\t<svg-loading v-if=\"isLoading\" :style=\"{ margin: '0 auto' }\" />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div v-else-if=\"isLoading\" class=\"archie-loader-wrapper\">\n\t\t\t\t\t\t\t<div><core-loading class=\"loader\" /></div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div v-else class=\"no-templates-available\">\n\t\t\t\t\t\t\t<core-feedback v-if=\"validType && search\" feedback-type=\"templates\">\n\t\t\t\t\t\t\t\t<em>\n\t\t\t\t\t\t\t\t\tLooks like we don't have that template yet. Tell us more about the template you're\n\t\t\t\t\t\t\t\t\tlooking for below and we'll consider adding it to our library.\n\t\t\t\t\t\t\t\t</em>\n\t\t\t\t\t\t\t\t<em>\n\t\t\t\t\t\t\t\t\tOr, if you need it right away,\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\thref=\"https://optinmonster.com/vip-service/?utm_source=plugin&utm_medium=template_search\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tpurchase a VIP Campaign\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\tand we'll do it for you within two business days.\n\t\t\t\t\t\t\t\t</em>\n\t\t\t\t\t\t\t</core-feedback>\n\t\t\t\t\t\t\t<core-alert v-else :type=\"validType ? 'info' : 'warn'\">\n\t\t\t\t\t\t\t\t<div class=\"alert-message\">\n\t\t\t\t\t\t\t\t\t{{ noTemplatesMessage }}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</core-alert>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<campaigns-modal-create-campaign />\n\t\t<templates-modal-not-connected />\n\t\t<templates-modal-no-access />\n\t</core-page>\n</template>\n\n<script lang=\"js\">\nimport orderBy from 'lodash/orderBy'\nimport upperFirst from 'lodash/upperFirst'\nimport { mapActions, mapState, mapGetters } from 'vuex'\nimport { templatePreviewsSetup } from 'optinmonster-js-library/src/vue/templates/mixins/templatePreviewsSetup'\nimport { creation } from '@/components/mixins/creation'\n\nexport default {\n\tmixins : [ templatePreviewsSetup, creation ],\n\tcomputed : {\n\t\t...mapState('templates', [\n\t\t\t'activeType',\n\t\t\t'search',\n\t\t\t'sort',\n\t\t\t'popular',\n\t\t\t'templates',\n\t\t]),\n\t\t...mapGetters([ 'reachedCampaignLimit' ]),\n\t\t...mapGetters('templates', [ 'typePermitted', 'featured', 'filters', 'filterGamified', 'validType' ]),\n\t\talerts () {\n\t\t\treturn this.$get('$store.state.alerts', [])\n\t\t},\n\t\tisLoading () {\n\t\t\treturn this.$store.getters.isLoading('templates')\n\t\t},\n\t\tpopularTemplates () {\n\t\t\tconst popular = this.popular[this.activeType]\n\n\t\t\treturn popular && popular.length ? this.order(popular) : []\n\t\t},\n\t\tfeaturedTemplates () {\n\t\t\tconst featured = this.featured[this.activeType]\n\n\t\t\treturn featured && featured.length ? this.order(featured) : []\n\t\t},\n\t\tshowableTemplates () {\n\t\t\tconst filterPasses = (key, value) => {\n\t\t\t\treturn this.filters[key].length\n\t\t\t\t\t? !this.filters[key].find(f => !value.includes(f))\n\t\t\t\t\t: true\n\t\t\t}\n\n\t\t\tconst prop = [ 'popular', 'featured' ].includes(this.sort) ? `${this.sort}Templates` : 'templates'\n\t\t\tconst templates = this[ prop ]\n\t\t\t\t.filter((template) => {\n\t\t\t\t\tif ('' === this.search) {\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\n\t\t\t\t\tconst term = this.search.toLowerCase()\n\t\t\t\t\tconst nameMatch = template.name.toLowerCase().includes(term)\n\t\t\t\t\tconst keywordMatch = template.keywords.some((k) => k.toLowerCase().includes(term))\n\t\t\t\t\tconst categoryMatch = template.categories.some((c) => c.name.toLowerCase().includes(term))\n\t\t\t\t\tconst featuresMatch = template.features.some((f) => f.name.toLowerCase().includes(term))\n\t\t\t\t\tconst seasonsMatch = template.seasons.some((s) => s.name.toLowerCase().includes(term))\n\n\t\t\t\t\treturn nameMatch || keywordMatch || categoryMatch || featuresMatch || seasonsMatch\n\t\t\t\t}).filter((template) => {\n\t\t\t\t\tconst device = 'mobile' === this.filters.device\n\t\t\t\t\t\t? template.mobile\n\t\t\t\t\t\t: !template.mobile\n\n\t\t\t\t\tif (!device) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\n\t\t\t\t\tconst taxonomies = [ 'goals', 'categories', 'tags', 'seasons', 'features' ]\n\n\t\t\t\t\treturn !taxonomies.find(t => {\n\t\t\t\t\t\treturn !filterPasses(t, template[t].map(term => term.id))\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\treturn this.order(templates)\n\t\t},\n\t\tselectedTemplates () {\n\t\t\treturn this.showableTemplates.filter(template => {\n\t\t\t\treturn this.filterGamified\n\t\t\t\t\t? template.tags.find(tag => 1 === tag.id)\n\t\t\t\t\t: template.type === this.activeType\n\t\t\t})\n\t\t},\n\t\thasTemplates () {\n\t\t\treturn this.selectedTemplates.length\n\t\t},\n\t\tshouldShowUpsells () {\n\t\t\treturn this.$store.getters.connected\n\t\t\t\t? !this.typePermitted(this.activeType)\n\t\t\t\t: false\n\t\t},\n\t\tnoTemplatesMessage () {\n\t\t\treturn this.validType\n\t\t\t\t? 'No templates available for your current selection.'\n\t\t\t\t: `${upperFirst(this.activeType)} is not a valid type. Please select one of the options above.`\n\t\t},\n\t},\n\tcreated () {\n\t\tthis.$store.dispatch('campaigns/fetchDashboard').catch(() => {})\n\n\t\tthis.loadApiScript('omwpapi-templates-apijs', this.$constants.TEMPLATES_PREVIEW_ACCOUNT, this.$constants.TEMPLATES_PREVIEW_USER)\n\t},\n\tmounted () {\n\t\tthis.fetchTemplateData().catch(() => {})\n\t\tthis.$bus.$emit('dashboard-view-mounted', 'templates')\n\t},\n\tmethods : {\n\t\t...mapActions('templates', [ 'fetchTemplateData' ]),\n\t\tapplyFilters (filters) {\n\t\t\tthis.$bus.$emit('applied-bulk-filter')\n\t\t\tthis.$store.commit('templates/appliedFilters', filters)\n\t\t},\n\t\torder(templates) {\n\t\t\treturn orderBy(\n\t\t\t\ttemplates,\n\t\t\t\t[\n\t\t\t\t\t// featured badge\n\t\t\t\t\t(template) => (template.tags.find(tag => 2 === tag.id) ? 1 : 0),\n\n\t\t\t\t\t// new badge (created within the last 3 months)\n\t\t\t\t\t(template) => Number(this.$moment(template.created_at).isAfter(this.$moment().subtract(3, 'months'))),\n\n\t\t\t\t\t// order number\n\t\t\t\t\t(template) => template.order,\n\n\t\t\t\t\t// creation date\n\t\t\t\t\t(template) => this.$moment(template.created_at).valueOf(),\n\n\t\t\t\t\t// name\n\t\t\t\t\t(template) => template.name.toLowerCase(),\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\t'desc',\n\t\t\t\t\t'desc',\n\t\t\t\t\t'asc',\n\t\t\t\t\t'desc',\n\t\t\t\t\t'asc',\n\t\t\t\t]\n\t\t\t);\n\t\t},\n\t},\n\n};\n</script>\n<style lang=\"scss\">\n@import '../assets/scss/variables';\n@import '../assets/scss/pages/templates';\n</style>\n","import mod from \"-!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./Templates.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./Templates.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Templates.vue?vue&type=template&id=679bbbf4&\"\nimport script from \"./Templates.vue?vue&type=script&lang=js&\"\nexport * from \"./Templates.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Templates.vue?vue&type=style&index=0&id=679bbbf4&prod&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","export const creation = {\n\tdata() {\n\t\treturn {\n\t\t\ttabs: {\n\t\t\t\ttemplates: {\n\t\t\t\t\tname: 'Templates',\n\t\t\t\t\troute: {\n\t\t\t\t\t\tpath: 'templates',\n\t\t\t\t\t\tparams: { tab: 'popup' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaybooks: {\n\t\t\t\t\tname: 'Playbooks',\n\t\t\t\t\troute: {\n\t\t\t\t\t\tpath: 'playbooks',\n\t\t\t\t\t\tparams: {},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t},\n};\n","import { isProduction, isDevelopment, currentEnv } from './env';\n\nexport const loadApiScript = (apiJsUrl, scriptId, accountid, userId) => {\n\tlet script = document.getElementById(scriptId);\n\tif (script) {\n\t\treturn script;\n\t}\n\n\tif (!apiJsUrl) {\n\t\tconsole.error('apiJsUrl not provided to loadApiScript');\n\t\treturn;\n\t}\n\n\tconst head = document.getElementsByTagName('head')[0] || document.documentElement;\n\tscript = document.createElement('script');\n\tscript.type = 'text/javascript';\n\tscript.id = scriptId;\n\tscript.src = apiJsUrl;\n\tscript.async = true;\n\tscript.dataset.account = accountid;\n\tscript.dataset.user = userId;\n\tif (!isProduction()) {\n\t\tscript.dataset.env = isDevelopment() ? 'dev' : currentEnv;\n\t}\n\n\thead.appendChild(script);\n\n\treturn script;\n};\n","import {\n\tcloseCampaigns,\n\tinitCampaignsDemo,\n\tinitCampaignsWp,\n\tinitCampaignsPreview,\n\tinitCampaignsBgClick,\n\tinitMobilePreview,\n} from 'optinmonster-js-library/src/utils/omapi';\nimport { urls } from 'optinmonster-js-library/src/vue/utils';\nimport { loadApiScript } from 'optinmonster-js-library/src/utils/apiJsScript';\n\nexport const templatePreviewsSetup = {\n\tcreated() {\n\t\tthis.listenApiLoaded();\n\n\t\t// Ensure campaigns are flagged as demos.\n\t\tinitCampaignsDemo();\n\t\t// Ensure campaigns are flagged as wp.\n\t\tinitCampaignsWp();\n\t\t// Make previews closeable by clicking background.\n\t\tinitCampaignsBgClick();\n\t\t// Disable form fields\n\t\tinitCampaignsPreview();\n\t\t// Handle mobile template previews\n\t\tinitMobilePreview();\n\n\t\tthis.$store.subscribe((mutation) => {\n\t\t\tconst ignore = [\n\t\t\t\t'templates/setLoadingPreview',\n\t\t\t\t'templates/setPreviewing',\n\t\t\t\t'templates/filterOptions',\n\t\t\t\t'templates/templates',\n\t\t\t\t'templates/permittedTypes',\n\t\t\t\t'templates/recentTemplates',\n\t\t\t\t'templates/popular',\n\t\t\t\t'templates/setApiLoaded',\n\t\t\t];\n\t\t\tconst triggers = ['route/ROUTE_CHANGED'];\n\n\t\t\tlet shouldClose = mutation.type.startsWith('templates/') && !ignore.includes(mutation.type);\n\t\t\tif (!shouldClose) {\n\t\t\t\tshouldClose = triggers.includes(mutation.type);\n\t\t\t}\n\n\t\t\tif (shouldClose) {\n\t\t\t\tthis.closeAllPreviews();\n\t\t\t}\n\t\t});\n\t},\n\tbeforeDestroy() {\n\t\tinitCampaignsDemo(false);\n\t\tinitCampaignsWp(false);\n\t\tinitCampaignsPreview(false);\n\t\tinitCampaignsBgClick(false);\n\t\tinitMobilePreview(false);\n\t},\n\tmethods: {\n\t\tlistenApiLoaded(cb = 'addEventListener') {\n\t\t\t['om.Api.init', 'om.Main.init', 'om.Campaigns.init', 'om.Campaign.init'].forEach((evt) =>\n\t\t\t\tdocument[cb](evt, this.setApiLoaded)\n\t\t\t);\n\t\t},\n\t\t/**\n\t\t * Handle finishing the API load.\n\t\t *\n\t\t * Remove the apiLoaded event listener and set the\n\t\t * apiLoaded flag to true once the api has loaded.\n\t\t *\n\t\t * @returns {void}\n\t\t */\n\t\tsetApiLoaded() {\n\t\t\tthis.listenApiLoaded('removeEventListener');\n\t\t\tthis.$store.commit('templates/setApiLoaded');\n\t\t},\n\t\t/**\n\t\t * Handles closing all open campaigns and resetting preview state.\n\t\t *\n\t\t * @returns {void}\n\t\t */\n\t\tcloseAllPreviews() {\n\t\t\tcloseCampaigns();\n\t\t\tthis.$store.commit('templates/setLoadingPreview', '');\n\t\t\tthis.$store.commit('templates/setPreviewing', '');\n\t\t},\n\t\t/**\n\t\t * Handles generating our api script tag.\n\t\t *\n\t\t * @param {string} scriptId The script id.\n\t\t * @param {int} accountid The account id.\n\t\t * @param {int} userId The user id.\n\t\t *\n\t\t * @returns {string} The script tag\n\t\t */\n\t\tloadApiScript(scriptId, accountid, userId) {\n\t\t\treturn loadApiScript(urls.apiJs(), scriptId, accountid, userId);\n\t\t},\n\t},\n};\n"],"names":["render","_vm","this","_c","_self","reachedCampaignLimit","attrs","tabs","_v","alerts","staticClass","isLoading","hasTemplates","selectedTemplates","style","margin","_e","validType","search","_s","noTemplatesMessage","staticRenderFns","mixins","computed","popularTemplates","featuredTemplates","showableTemplates","filter","template","shouldShowUpsells","created","mounted","methods","applyFilters","order","templates","component","creation","data","name","route","path","params","tab","playbooks","loadApiScript","apiJsUrl","scriptId","accountid","userId","script","document","getElementById","console","error","head","getElementsByTagName","documentElement","createElement","type","id","src","async","dataset","account","user","isProduction","env","isDevelopment","currentEnv","appendChild","templatePreviewsSetup","listenApiLoaded","$store","subscribe","mutation","ignore","triggers","shouldClose","startsWith","includes","closeAllPreviews","beforeDestroy","cb","forEach","evt","setApiLoaded","commit","apiJs"],"sourceRoot":""}