PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / admin / modules / template-library / Components / TemplatesLibrary.vue

TemplatesLibrary.vue in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at admin/modules/template-library/Components/TemplatesLibrary.vue

1,348 lines 66.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div>
3 <div class="create-funnel-loader-overlay create-funnel-shimmer-overlay" id="create-funnel-loader" v-if="loader">
4 <!-- shimmer header -->
5 <div class="wpfnl-tpl-shimmer-header-bar">
6 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-title"></div>
7 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-btn"></div>
8 </div>
9 <!-- shimmer body: sidebar + content -->
10 <div class="wpfnl-tpl-shimmer-body">
11 <div class="wpfnl-tpl-shimmer-sidebar">
12 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-sidebar-title"></div>
13 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-sidebar-item" v-for="n in 8" :key="'s'+n"></div>
14 </div>
15 <div class="wpfnl-tpl-shimmer-content">
16 <div class="wpfnl-tpl-shimmer-grid">
17 <div class="wpfnl-tpl-shimmer-card" v-for="n in 8" :key="n">
18 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-img"></div>
19 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-text"></div>
20 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-badge"></div>
21 </div>
22 </div>
23 </div>
24 </div>
25 </div>
26
27 <div id="template-library-modal" class="template-library-modal fff" style="display: none">
28 <div id="wpfnl-create-funnel__inner-content" class="wpfnl-create-funnel__inner-content">
29
30 <div id="wpfnl-create-funnel__template-wrapper" class="wpfnl-create-funnel__templates-wrapper">
31 <div class="funnel-templates-header">
32 <div class="template-library-filter-wrapper" :class="{ 'is-store-checkout': isStoreCheckout }">
33 <span class="back-form-modal wpfnl-modal-close" :title="isStoreCheckout ? 'Back to Store Checkout List' : 'Back to Funnel list'" v-show="!showStepsPreview">
34 <DoubleAngleLeft/>
35 </span>
36
37 <h1 class="header-title" v-if="!showStepsPreview">{{ isStoreCheckout ? 'Choose a Store Checkout Template' : 'Choose a Funnel Template' }}</h1>
38 <button class="sync-library-btn" v-if="!showStepsPreview" @click="syncLibrary" :disabled="syncingLibrary">
39 <svg :class="{ 'spinning': syncingLibrary }" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>
40 <span>{{ syncingLibrary ? 'Syncing...' : 'Sync Templates' }}</span>
41 </button>
42 <div v-else class="wpfnl-template-header-title-wrapper">
43 <span class="back-form-modal back-to-templates" title="Back to Template" v-show="showStepsPreview" @click="backToTemplates">
44 <DoubleAngleLeft/>
45 </span>
46 <h1 class="header-title">{{activeTemplate.title}}</h1>
47 </div>
48
49 <ResponsiveSwitcher v-if="showStepsPreview" :setResponsiveView="setResponsiveView"/>
50
51 <select class="template-type-filter" v-if="template_type.length" v-show="!showStepsPreview && !isStoreCheckout" v-model="type" @change="doTemplateCatFilter">
52 <option data-filter="woocommerce" v-for="(tempalateType, index) in template_type" :key="index" :value="tempalateType.slug" :selected="tempalateType.slug == type">
53 {{tempalateType.label}}
54 </option>
55 </select>
56
57 <ul class="pro-free__filter" v-if="template_type.length > 0 && showProFilter" v-show="!showStepsPreview">
58 <li data-filter="all" :class="templatesType == 'all' ? 'active' : '' " @click="doFreeProFilter('all')">
59 all
60 </li>
61
62 <li data-filter="free" :class="templatesType == 'free' ? 'active' : '' " @click="doFreeProFilter('free')">
63 free
64 </li>
65
66 <li data-filter="pro" :class="templatesType == 'freemium' ? 'active' : '' " @click="doFreeProFilter('freemium')">
67 <svg width="20" height="14" fill="none" viewBox="0 0 20 14" xmlns="http://www.w3.org/2000/svg">><path fill-rule="evenodd" stroke="#7A8B9A" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10 1l4 6 5-4-2 10H3L1 3l5 4 4-6z" clip-rule="evenodd"/></svg>
68 Freemium
69 </li>
70 </ul>
71
72 <!-- <div class="import-funnel-name" v-show="showStepsPreview" v-if="!isAddNewFunnelButtonDisabled">
73 <input type="text" name="import-funnel-name" :value="this.activeTemplate ? this.activeTemplate.title : '' " placeholder="Write Funnel Name">
74 </div> -->
75
76 <div class="funnel-global-import" v-show="showStepsPreview">
77 <a
78 href="#"
79 class="btn-default"
80 id="funnel-global-import"
81 @click="startImportTemplate"
82 v-bind:style='{"pointer-events" : (disabled? "none" : "" )}'
83 v-if="!isAddNewFunnelButtonDisabled"
84 v-show="(isProActivated && activeTemplate.is_pro) || !activeTemplate.is_pro"
85 >
86 <span class="global-import-progress"
87 v-bind:style="{ width: globalImportProgress }"></span>
88 <span class="btn-text">{{loaderMessage}}</span>
89 </a>
90
91 <a
92 href="https://getwpfunnels.com/pricing/"
93 target="_blank"
94 class="btn-default update-to-pro"
95 v-show="(!isProActivated && activeTemplate.is_pro)"
96 >
97 Upgrade to Pro
98 </a>
99 </div>
100 </div>
101 </div>
102 <!-- /.funnel-templates-header -->
103
104 <div class="funnel-templates-body" :class="showStepsPreview || isStoreCheckout ? 'no-sidebar': '' ">
105 <div class="funnel-templates-sidebar" v-if="!showStepsPreview && !isStoreCheckout">
106 <div class="sidebar-tab-nav">
107 <span class="funnel-templates" :class="{ active: activeTab === 'templates' }" @click="onActivateTab('templates')">Templates</span>
108 </div>
109
110 <div class="sidebar-tab-content templates-content" v-if="activeTab === 'templates'">
111 <CategoryNav v-if="template_type.length > 0 && !showStepsPreview" :categories="categories" :activeCategory="activeCategory" @doCatFilter="doCatFilter"/>
112 </div>
113
114 </div>
115 <!-- /.funnel-templates-sidebar -->
116
117 <div class="funnel-templates-content">
118 <div class="wpfnl-tpl-filter-shimmer" v-if="syncingLibrary || templateCatFilterLoader">
119 <div class="wpfnl-tpl-shimmer-grid">
120 <div class="wpfnl-tpl-shimmer-card" v-for="n in 8" :key="'filter-shimmer-' + n">
121 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-img"></div>
122 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-text"></div>
123 <div class="wpfnl-tpl-shimmer-block wpfnl-tpl-shimmer-card-badge"></div>
124 </div>
125 </div>
126 </div>
127 <div v-else-if="activeTab === 'templates'">
128 <div class="not-clickable-overlay"></div>
129
130 <!-- funnel name modal. this modal will show when create from scratch -->
131 <div class="create-funnel-name-modal wpfnl-create-funnel-layout" :class="{ 'store-checkout-layout': isStoreCheckout }">
132 <span class="close" @click="closeFunnelNameModal" role="button">
133 <svg width="14" height="14" fill="none" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg">><path stroke="#7A8B9A" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12.5 1.5l-11 11m0-11l11 11"/></svg>
134 </span>
135
136 <!-- Store Checkout confirmation modal -->
137 <template v-if="isStoreCheckout">
138 <div class="modal-body store-checkout-confirm-body">
139 <h2 class="store-checkout-modal-title">Create Store Checkout</h2>
140 <p class="store-checkout-modal-subtitle">Set up a Store Checkout in just one click:</p>
141
142 <ul class="store-checkout-feature-list">
143 <li>
144 <svg width="15" height="15" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">>
145 <circle cx="11" cy="11" r="10.25" stroke="#6E42D3" stroke-width="1.5"/>
146 <path d="M7 11.5L9.5 14L15 8.5" stroke="#6E42D3" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
147 </svg>
148 <span>Checkout Page</span>
149 </li>
150 <li>
151 <svg width="15" height="15" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">>
152 <circle cx="11" cy="11" r="10.25" stroke="#6E42D3" stroke-width="1.5"/>
153 <path d="M7 11.5L9.5 14L15 8.5" stroke="#6E42D3" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
154 </svg>
155 <span>Thank You Page</span>
156 </li>
157 </ul>
158
159 <p class="store-checkout-modal-desc">Use ready-made templates from the WPFunnels Library, our custom widget, or shortcodes on each page to set this up easily—no coding needed!</p>
160
161 <div class="button-area">
162 <span class="wpfnl-alert box" style="display: inline-block;" :class="alertClass" v-if="isShowAlert">{{ this.alertMessage }}</span>
163 <div class="store-checkout-modal-actions">
164 <button type="button" class="btn-cancel" @click="closeFunnelNameModal">Cancel</button>
165 <button type="button" class="btn-default btn-create-store-checkout" @click="createFunnel" :disabled="disabled">
166 {{ createFunnelTitle }}
167 </button>
168 </div>
169 </div>
170 </div>
171 </template>
172
173 <!-- Regular funnel name + layout modal -->
174 <template v-else>
175 <div class="modal-body">
176 <form action="">
177 <div class="wpfnl-form-group">
178 <label for="funnel-name">Name of your funnel</label>
179 <input
180 type="text"
181 name="funnel-name"
182 placeholder="Enter your funnel name"
183 v-model="funnelName"
184 />
185 </div>
186
187 <p class="layout-title">Select Funnel layout</p>
188
189 <div class="funnels-layout-wrapper">
190 <div
191 v-for="(layout, index) in layouts"
192 :class="[
193 selectedFunnelLayout?.value === layout.value ? 'active' : '',
194 layout.value,
195 ]"
196 class="single-layout layout1"
197 @click="selectFunnelLayout(index, layout)"
198 :key="index"
199 >
200 <a href="https://getwpfunnels.com/pricing/" target="_blank" v-if="!isPro && 0 !==index && 1 !==index "><span class="pro-tag"><svg fill="none" width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">><circle cx="11" cy="11" r="11" fill="#2FCF5C"/><path fill="#fff" d="M15.209 9.236l-1.587.396-1.983-2.471a.926.926 0 00-1.445 0L8.21 9.63l-1.618-.395a.933.933 0 00-1.124 1.124l1.093 3.842a.618.618 0 00.617.451h7.412a.618.618 0 00.618-.45l1.1-3.843a.932.932 0 00-1.1-1.124zM5.172 8.57a.772.772 0 100-1.545.772.772 0 000 1.544zm11.427 0a.772.772 0 100-1.545.772.772 0 000 1.544zm-5.714-2.626a.772.772 0 100-1.544.772.772 0 000 1.544zm3.706 10.964H7.18a.618.618 0 010-1.236h7.411a.618.618 0 110 1.236z"/></svg></span></a>
201 <span class="single-layout-inner" :class="{ 'is-pro': !isPro && 0!==index && 1!==index }">
202 <span class="inner-box">
203 <FunnelLayout1 v-if="'layout1' == layout.value" />
204 <FunnelLayout2 v-if="'layout2' == layout.value" />
205 <FunnelLayout3 v-if="'layout3' == layout.value" />
206 <FunnelLayout4 v-if="'layout4' == layout.value" />
207 <FunnelLayout5 v-if="'layout5' == layout.value" />
208 <FunnelLayout6 v-if="'layout6' == layout.value" />
209 </span>
210 </span>
211 </div>
212 </div>
213
214 <div class="button-area">
215 <span class="wpfnl-alert box" style="display: inline-block;" :class="alertClass" v-if="isShowAlert">{{
216 this.alertMessage
217 }}</span>
218 <button type="submit" @click="createFunnel" :disabled='disabled'>
219 {{createFunnelTitle}}
220 </button>
221 </div>
222 </form>
223 </div>
224 </template>
225 </div>
226
227 <div class="templates-title-wrapper" v-if="!showStepsPreview && 'other' !== builder">
228 <h2 class="title">{{ isStoreCheckout ? 'Store Checkout Templates' : (totalTemplates > 1 ? totalTemplates + ' Templates' : totalTemplates + ' Template') }}</h2>
229 </div>
230
231 <div class="wpfnl-create-funnel__templates">
232
233 <div class="create-funnel__single-template create__from-scratch"
234 v-if="(showProFilter && !showStepsPreview) || ( 'other' === builder )">
235 <a id="wpfnl-create-funnel" href="#" class="btn-default" @click="showFunnelNameModal"
236 v-if="!isAddNewFunnelButtonDisabled"> <PlusIcon /> Start From scratch </a>
237
238 <div class="funnel-limit-notice" v-if="isAddNewFunnelButtonDisabled && !isStoreCheckout">
239 <p><b>You have reached your limit and built 3/3 funnels!</b><br/><br/>
240 To create unlimited funnels, please upgrade to Pro.
241 </p>
242 </div>
243
244 <div class="funnel-limit-notice" v-if="isAddNewFunnelButtonDisabled && isStoreCheckout">
245 <p><b>You have reached your limit of 3/3 store checkouts!</b><br/><br/>
246 To create unlimited store checkouts, please upgrade to Pro.
247 </p>
248 </div>
249
250 <div class="wpfnl-single-remote-wrapper">
251 <div class="wpfnl-single-remote-template">
252 <div class="template-image-wrapper"></div>
253 </div>
254 <div class="funnel-template-info">
255 <span class="title">title</span>
256 </div>
257 </div>
258 </div>
259
260 <template v-if="isAnyPluginMissing == 'no'">
261 <SingleTemplate
262 v-for="(data, index) in templates"
263 :templatedata="data"
264 :active-category="activeCategory"
265 :templateType="data.templateType"
266 :isPro="data.is_pro"
267 :type="type"
268 :key="index"
269 :isAddNewFunnelButtonDisabled="isAddNewFunnelButtonDisabled"
270 @toggleStepsPreview="toggleStepsPreview"
271 @initSteps="initSteps"
272 @setActiveTemplate="setActiveTemplate"
273 v-if="!showStepsPreview"
274 />
275 </template>
276
277 <div class="create-funnel__single-template wpfnl-missing-plugin-notice" v-else>
278 <div v-if="builder === 'gutenberg'">
279 <h4 class="wpfnl-notice-title">Oops! It looks like {{dependencyPlugins[builder].name}} is inactive.</h4>
280 <div class="wpfnl-notice-notice-body">
281 <p>
282 It seems like you have selected {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} as your preferred page builder, but you
283 do not have {{dependencyPlugins[builder].name}} activated on your site. You see, we create funnel templates for
284 {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} using {{dependencyPlugins[builder].name}}.
285 <br>Please install and activate {{dependencyPlugins[builder].name}} to import funnel templates for {{ builder.charAt(0).toUpperCase() + builder.slice(1) }}
286 <a href="#" @click="pluginInstallationAction">
287 Click here to install & activate {{dependencyPlugins[builder].name}}
288 <span class="dot-wrapper" v-if="pluginInstallLoader">
289 <span class="dot-one">.</span>
290 <span class="dot-two">.</span>
291 <span class="dot-three">.</span>
292 </span>
293 </a>
294 </p>
295 <p>If you want to create & design funnel pages without using {{dependencyPlugins[builder].name}}, then don't worry.
296 <b>You can go ahead and create funnels from scratch using any page builder/editor. It will work just fine.</b></p>
297
298 <span class="wpfnl-plugin-installation-error"
299 v-html="pluginInstallationErrorMessage"></span>
300 </div>
301 </div>
302
303 <div v-else-if="builder === 'elementor'">
304 <h4 class="wpfnl-notice-title">Oops! It looks like the page builder you selected is inactive.</h4>
305 <div class="wpfnl-notice-notice-body">
306 <p>
307 It seems like you have selected {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} as your preferred page builder, but you do not have
308 the plugin {{dependencyPlugins[builder].name}} activated on your site. <br>
309
310 Please install and activate {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} to import ready funnel templates.
311 <a href="#" @click="pluginInstallationAction">
312 Click here to install & activate {{ builder.charAt(0).toUpperCase() + builder.slice(1) }}
313 <span class="dot-wrapper" v-if="pluginInstallLoader">
314 <span class="dot-one">.</span>
315 <span class="dot-two">.</span>
316 <span class="dot-three">.</span>
317 </span>
318 </a>
319 </p>
320
321 <p>If you want to create & design funnel pages without using {{dependencyPlugins[builder].name}}, then
322 don't worry. <b>You can go ahead and create funnels from scratch using any page builder/editor. It will work just fine.</b></p>
323
324
325 <span class="wpfnl-plugin-installation-error"
326 v-html="pluginInstallationErrorMessage"></span>
327 </div>
328 </div>
329
330 <div v-else-if="builder === 'divi-builder'">
331 <h4 class="wpfnl-notice-title">Oops! It looks like the page builder you selected is inactive.</h4>
332 <div class="wpfnl-notice-notice-body">
333 <p>
334 It seems like you have selected {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} as your preferred page builder, but you do not have
335 the plugin {{dependencyPlugins[builder].name}} activated on your site. <br>
336
337 Please install and activate {{ builder.charAt(0).toUpperCase() + builder.slice(1) }} to import ready funnel templates.
338 </p>
339
340 <p>If you want to create & design funnel pages without using {{dependencyPlugins[builder].name}}, then
341 don't worry. <b>You can go ahead and create funnels from scratch using any page builder/editor. It will work just fine.</b></p>
342
343
344 <span class="wpfnl-plugin-installation-error"
345 v-html="pluginInstallationErrorMessage"></span>
346 </div>
347 </div>
348
349 <div v-else-if="builder === 'oxygen'">
350 <h4 class="wpfnl-notice-title">Oops! It looks like the page builder you selected is inactive.</h4>
351 <div class="wpfnl-notice-notice-body">
352 <p>
353 It seems like you have selected Oxygen builder as your preferred page builder, but you do not have
354 the plugin Oxygen builder activated on your site. <br>
355
356 Please install and activate Oxygen builder to import ready funnel templates.
357 </p>
358
359 <p>If you want to create & design funnel pages without using Oxygen builder, then
360 don't worry. <b>You can go ahead and create funnels from scratch using any page builder/editor. It will work just fine.</b></p>
361
362
363 <span class="wpfnl-plugin-installation-error"
364 v-html="pluginInstallationErrorMessage"></span>
365 </div>
366 </div>
367 <div v-else-if="builder === 'bricks'">
368 <h4 class="wpfnl-notice-title">Oops! It looks like the page builder you selected is inactive.</h4>
369 <div class="wpfnl-notice-notice-body">
370 <p>
371 It seems like you have selected Bricks builder as your preferred page builder, but you do not have
372 the Bricks theme activated on your site. <br>
373
374 Please install and activate Bricks theme to import ready funnel templates.
375 </p>
376
377 <p>If you want to create & design funnel pages without using Bricks theme, then
378 don't worry. <b>You can go ahead and create funnels from scratch using any page builder/editor. It will work just fine.</b></p>
379
380
381 <span class="wpfnl-plugin-installation-error"
382 v-html="pluginInstallationErrorMessage"></span>
383 </div>
384 </div>
385 </div>
386
387 <div class="create-funnel__single-template wpfnl-missing-plugin-notice" v-if="builder === 'other' ">
388 <div>
389
390 <h4 class="wpfnl-notice-title">Create your funnel with shortcodes!</h4>
391 <div class="wpfnl-notice-notice-body">
392 <p>
393 Hello there. We believe you are using a page builder other than Gutenberg, Elementor, Divi, Oxygen, or Bricks.
394 </p>
395 <p>
396 In this case, to make your funnel function, you should be using shortcodes on specific cases which include
397 </p>
398
399 <li>
400 The CTA buttons and opt-in form on the Landing page (or custom page)
401 </li>
402 <li>
403 The checkout form on the Checkout page
404 </li>
405 <li>
406 The order details on the Thank you page
407 </li>
408 <li>
409 Offer Accept/Reject button in the Upsell & Downsell pages.
410 </li>
411 <br>
412 <p>
413 And it's really simple.
414 </p>
415
416 <ol style="padding-left: 15px;">
417 <li>
418 Find the list of shortcodes
419 <a href="https://getwpfunnels.com/docs/wpfunnels-shortcodes/" target="_blank">
420 here
421 </a>
422 </li>
423 <li>
424 Choose the one you want to use and copy it.
425 </li>
426 <li>
427 Paste it where you want to place the element when editing a funnel page.
428 </li>
429 <li>
430 Save and preview to see it in action.
431 </li>
432 </ol>
433
434 <br>
435 <p>
436 You may utilize associated parameters to customize the elements.
437 </p>
438 </div>
439 </div>
440 </div>
441
442 <div class="steps-preview-wrapper" v-if="showStepsPreview">
443 <TemplatePreview :template="activeTemplate" :view="responsiveView"/>
444 </div>
445 </div>
446 </div>
447 </div>
448 <!-- /.funnel-templates-content -->
449 </div>
450 <!-- /.funnel-templates-body -->
451
452 </div>
453 </div>
454
455 </div>
456 </div>
457 </template>
458
459 <script>
460 import SingleTemplate from './SingleTemplate.vue'
461 import CategoryNav from './CategoryNav.vue'
462 import SingleStep from './SingleStep.vue'
463 import SingleStepPreview from './SingleStepPreview.vue'
464 import StepImporter from './StepImporter.vue'
465 import apiFetch from '@wordpress/api-fetch'
466 import {addQueryArgs} from "@wordpress/url";
467 import DoubleAngleLeft from '../../../src/components/icons/DoubleAngleLeft.vue'
468 import PlusIcon from '../../../src/components/icons/PlusIcon.vue'
469
470 import FunnelLayout1 from '../../../src/components/icons/FunnelLayout1.vue'
471 import FunnelLayout2 from '../../../src/components/icons/FunnelLayout2.vue'
472 import FunnelLayout3 from '../../../src/components/icons/FunnelLayout3.vue'
473 import FunnelLayout4 from '../../../src/components/icons/FunnelLayout4.vue'
474 import FunnelLayout5 from '../../../src/components/icons/FunnelLayout5.vue'
475 import FunnelLayout6 from '../../../src/components/icons/FunnelLayout6.vue'
476 import ResponsiveSwitcher from './ResponsiveSwitcher.vue'
477 import TemplatePreview from './TemplatePreview.vue'
478
479 var j = jQuery.noConflict()
480 const nonce = window.template_library_object.nonce
481 apiFetch.use(apiFetch.createNonceMiddleware(nonce))
482
483 export default {
484 name: 'TemplatesLibrary',
485 components: {
486 SingleTemplate,
487 CategoryNav,
488 StepImporter,
489 SingleStepPreview,
490 DoubleAngleLeft,
491 SingleStep,
492 PlusIcon,
493 FunnelLayout1,
494 FunnelLayout2,
495 FunnelLayout3,
496 FunnelLayout4,
497 FunnelLayout5,
498 FunnelLayout6,
499 ResponsiveSwitcher,
500 TemplatePreview
501 },
502 data: function () {
503 return {
504 showModal: j('#template-library-modal').attr('data-modal-visibility'),
505 proUrl: window.template_library_object.pro_url,
506 isRemoteFunnel : 'yes' === window.template_library_object.isRemote ? true : false,
507 isStoreCheckout: window.template_library_object.isStoreCheckout || false,
508 templates: [],
509 activeTemplate: '',
510 allTemplates: [],
511 categories: [],
512 stepCategories: [],
513 steps: [],
514 allSteps: [],
515 totalTemplates: 0,
516 loader: true,
517 templateCatFilterLoader: false,
518 message: '',
519 isProTemplateSelected: false,
520 loaderMessage: 'Import',
521 activeCategory: 'all',
522 activeStepCategory: 'all',
523 activeStep: 'landing',
524 templatesType: 'all',
525 alertClass : 'wpfnl-success',
526 isShowAlert : false,
527 alertMessage : '',
528 templatesCatType: 'woocommerce',
529 selectedStep: 'landing',
530 stepTemplateType: 'all',
531 showProFilter: true,
532 showStepsPreview: false,
533 image_path: window.template_library_object.image_path,
534 globalImportProgress: '',
535 supportedSteps : window.template_library_object.supported_steps,
536 disabled: false,
537 templateNewName: '',
538 funnelName: '',
539 isPro : window.template_library_object.is_pro,
540 createFunnelTitle: window.template_library_object.isStoreCheckout ? 'Create Store Checkout' : 'Create Funnel',
541 totalFunnels: window.WPFunnelVars.totalFunnels,
542 countActiveFunnels: window.WPFunnelVars.count_active_funnels,
543 totalAllowedFunnels: window.WPFunnelVars.totalAllowedFunnels,
544 totalStoreCheckouts: window.WPFunnelVars.totalStoreCheckouts || 0,
545 totalAllowedStoreCheckouts: window.WPFunnelVars.totalAllowedStoreCheckouts || 3,
546 dependencyPlugins: window.WPFunnelVars.dependencyPlugins,
547 isAnyPluginMissing: window.WPFunnelVars.isAnyPluginMissing,
548 isProActivated: window.WPFunnelVars.isProActivated,
549 isWcActivated: window.WPFunnelVars.is_wc_installed,
550 isLmsActivated: window.WPFunnelVars.isLmsActivated,
551 builder: window.WPFunnelVars.builder,
552 pluginInstallLoader: false,
553 pluginInstallationErrorMessage: '',
554 type: 'wc',
555 selectedType: 'wc',
556 tempalateTypes : [],
557 template_type : window.template_library_object.template_type,
558 activeTab : 'templates',
559 layouts : [
560 {
561 name : 'Layout 1',
562 value:'layout1',
563 steps : [
564 {
565 name : 'Landing',
566 value:'landing',
567 pos_x: 156,
568 pos_y: 258
569 },
570 {
571 name : 'Thank You',
572 value:'thankyou',
573 pos_x: 399,
574 pos_y: 258
575 }
576 ]
577 },
578 {
579 name : 'Layout 2',
580 value:'layout2',
581 steps : [
582 {
583 name : 'Landing',
584 value:'landing',
585 pos_x: 156,
586 pos_y: 258
587 },
588 {
589 name : 'Checkout',
590 value:'checkout',
591 pos_x: 399,
592 pos_y: 258
593 },
594 {
595 name : 'Thank You',
596 value:'thankyou',
597 pos_x: 658,
598 pos_y: 258
599 }
600 ]
601 },
602 {
603 name : 'Layout 3',
604 value:'layout3',
605 steps : [
606 {
607 name : 'Landing',
608 value:'landing',
609 pos_x: 156,
610 pos_y: 258
611 },
612 {
613 name : 'Checkout',
614 value:'checkout',
615 pos_x: 399,
616 pos_y: 258
617 },
618 {
619 name : 'Upsell',
620 value:'upsell',
621 pos_x: 658,
622 pos_y: 258
623 },
624 {
625 name : 'Downsell',
626 value:'downsell',
627 pos_x: 917,
628 pos_y: 258
629 },
630 {
631 name : 'Thank You',
632 value:'thankyou',
633 pos_x: 1175,
634 pos_y: 258
635 }
636 ]
637 },
638 {
639 name : 'Layout 4',
640 value:'layout4',
641 steps : [
642 {
643 name : 'Landing',
644 value:'landing',
645 pos_x: 156,
646 pos_y: 258
647 },
648 {
649 name : 'Checkout',
650 value:'checkout',
651 pos_x: 399,
652 pos_y: 258
653 },
654 {
655 name : 'Upsell',
656 value:'upsell',
657 pos_x: 658,
658 pos_y: 258,
659 isCondition : true,
660 trueCondition : [
661 {
662 name : 'Thank You',
663 value:'thankyou',
664 pos_x: 1059,
665 pos_y: 111,
666 }
667 ],
668 falseCondition : [
669 {
670 name : 'Downsell',
671 value:'downsell',
672 pos_x: 1059,
673 pos_y: 447,
674 },
675 {
676 name : 'Thank You',
677 value:'thankyou',
678 pos_x: 1317,
679 pos_y: 447,
680 }
681 ]
682 }
683
684 ]
685 },
686 {
687 name : 'Layout 5',
688 value:'layout5',
689 steps : [
690 {
691 name : 'Landing',
692 value:'landing',
693 pos_x: 156,
694 pos_y: 258
695 },
696 {
697 name : 'Checkout',
698 value:'checkout',
699 isCondition : true,
700 pos_x: 399,
701 pos_y: 258,
702 trueCondition : [
703 {
704 name : 'Upsell',
705 value: 'upsell',
706 pos_x: 800,
707 pos_y: 111,
708 },
709 {
710 name : 'Thank You',
711 value:'thankyou',
712 pos_x: 1059,
713 pos_y: 111,
714 }
715 ],
716 falseCondition : [
717 {
718 name : 'Downsell',
719 value:'downsell',
720 pos_x: 800,
721 pos_y: 447,
722 },
723 {
724 name : 'Thank You',
725 value:'thankyou',
726 pos_x: 1059,
727 pos_y: 447,
728 }
729 ]
730 }
731 ]
732 },
733 {
734 name : 'Layout 6',
735 value:'layout6',
736 steps : [
737 {
738 name : 'Landing',
739 value:'landing',
740 pos_x: 156,
741 pos_y: 258,
742 isCondition : true,
743 trueCondition : [
744 {
745 name : 'Thank You',
746 value:'thankyou',
747 pos_x: 556,
748 pos_y: 111
749 }
750 ],
751 falseCondition : [
752 {
753 name : 'Custom',
754 value:'custom',
755 pos_x: 556,
756 pos_y: 447
757 },
758 {
759 name : 'Thank You',
760 value:'thankyou',
761 pos_x: 814,
762 pos_y: 447
763 }
764 ]
765 },
766
767
768 ]
769 },
770 ],
771 selectedFunnelLayout : {},
772 responsiveView: 'desktop',
773 syncingLibrary: false,
774 }
775
776 },
777
778 computed: {
779 isAddNewFunnelButtonDisabled: function () {
780 if (!this.isProActivated) {
781 if (this.isStoreCheckout) {
782 return parseInt(this.totalStoreCheckouts) >= parseInt(this.totalAllowedStoreCheckouts);
783 }
784 if (parseInt(this.countActiveFunnels) >= parseInt(this.totalAllowedFunnels)) {
785 return true
786 }
787 }
788 return false
789 }
790 },
791 mounted() {
792 j(document).on(
793 'wp-plugin-install-success',
794 this.pluginInstalledSuccess
795 );
796
797 j(document).on(
798 'wp-plugin-install-error',
799 this.pluginInstalledError
800 );
801 if(!this.isRemoteFunnel) {
802 this.getTemplate();
803 } else {
804 this.loader = false
805 }
806
807 },
808
809 methods: {
810 methods: {
811 isOnStoreCheckoutPage() {
812 console.log(isStoreCheckout);
813 }
814 },
815 selectFunnelLayout: function (index, value) {
816 if(this.isPro || index === 0 || index === 1 ){
817 if( this.selectedFunnelLayout == value){
818 this.selectedFunnelLayout = {};
819 }else {
820 if('lead' == this.selectedType ){
821 if( (index === 0 && !this.isPro) || ((index === 0 || index === 5) && this.isPro) ){
822 this.selectedFunnelLayout = value;
823 }else{
824 this.isShowAlert = true;
825 this.alertClass = 'wpfnl-error';
826 this.alertMessage = 'This is only for sales funnel';
827
828 setTimeout(() => {
829 this.isShowAlert = false
830 }, 3000);
831 this.selectedFunnelLayout = {};
832 return;
833 }
834 }else{
835 this.isShowAlert = false;
836 this.alertMessage = '';
837 this.alertClass = '';
838 this.selectedFunnelLayout = value;
839 }
840 }
841 }
842 },
843
844 getTemplate: function (){
845 if( this.selectedType ){
846 apiFetch({
847 path: addQueryArgs( `${window.template_library_object.rest_api_url}wpfunnels/v1/templates/get_templates`, {
848 type: this.selectedType,
849 store_checkout: this.isStoreCheckout ? 'yes' : 'no',
850 } ),
851 method: 'GET'
852 }).then(response => {
853 if (response.success) {
854 let templates = response.templates
855 let steps = response.steps
856
857 // Filter for Store Checkout - only show templates with checkout and thankyou
858 if (this.isStoreCheckout) {
859 templates = templates.filter(template => {
860 if (!template.steps) return false;
861 let hasCheckout = template.steps.some(step => step.step_type === 'checkout');
862 let hasThankyou = template.steps.some(step => step.step_type === 'thankyou');
863 return hasCheckout && hasThankyou;
864 });
865
866 steps = steps.filter(step => {
867 return step.step_type === 'checkout' || step.step_type === 'thankyou';
868 });
869 }
870
871 if (this.isStoreCheckout) {
872 templates = templates.sort((a, b) => a.ID - b.ID);
873 }
874 this.templates = templates
875 this.allTemplates = templates
876 this.steps = steps
877 this.allSteps = steps
878 this.templatesType = 'all'
879 this.activeCategory = 'all'
880 this.categories = response.categories
881 this.stepCategories = response.categories
882 this.loader = false
883 this.templateCatFilterLoader = false;
884 if (response.templates) {
885 this.totalTemplates = this.isAnyPluginMissing === 'yes' ? 0 : templates.length
886 }
887
888 }
889
890 })
891 }
892
893 },
894
895 syncLibrary: function () {
896 this.syncingLibrary = true;
897 wpAjaxHelperRequest('clear-templates', {})
898 .success(() => {
899 this.getTemplate();
900 this.syncingLibrary = false;
901 })
902 .error(() => {
903 this.syncingLibrary = false;
904 });
905 },
906
907 createFunnel: function (e) {
908 e.preventDefault();
909 if( !this.isStoreCheckout && !this.funnelName ){
910 this.isShowAlert = true;
911 this.alertClass = 'wpfnl-error';
912 this.alertMessage = 'Please enter funnel name';
913
914 setTimeout(() => {
915 this.isShowAlert = false
916 }, 2500);
917
918 return;
919 }
920
921 if( this.isStoreCheckout && !this.funnelName ){
922 this.funnelName = 'Store Checkout';
923 }
924
925 this.disabled = true;
926 this.loader = true;
927 this.createFunnelTitle = this.isStoreCheckout
928 ? WPFunnelVars.getText?.creating_store_checkout
929 : WPFunnelVars.getText?.creating_funnel;
930 var payload = {
931 funnelName: this.funnelName,
932 type : this.type,
933 selectedFunnelLayout : this.selectedFunnelLayout,
934 is_store_checkout: this.isStoreCheckout ? true : false,
935 };
936 wpAjaxHelperRequest("create-funnel", payload)
937 .success(function (response) {
938 window.location.href = response.redirectUrl;
939 this.disabled = false;
940 })
941 .error(function (response) {
942
943 });
944 },
945
946 createFunnelWithSingleStep: function () {
947
948 this.disabled = true;
949 this.createFunnelTitle = "Creating Funnel..."
950 var payload = {
951 funnelName: this.funnelName,
952 type : this.type,
953 };
954 wpAjaxHelperRequest("create-funnel", payload)
955 .success(function (response) {
956 window.location.href = response.redirectUrl;
957 this.disabled = false;
958 })
959 .error(function (response) {
960
961 });
962 },
963
964 showFunnelNameModal: function (e) {
965 e.preventDefault()
966
967 j('.wpfnl-create-funnel__templates-wrapper .not-clickable-overlay').fadeIn();
968 j('.wpfnl-create-funnel__templates-wrapper .create-funnel-name-modal').addClass('show');
969 },
970
971 closeFunnelNameModal: function (e) {
972 e.preventDefault()
973 j('.wpfnl-create-funnel__templates-wrapper .not-clickable-overlay').fadeOut();
974 j('.wpfnl-create-funnel__templates-wrapper .create-funnel-name-modal').removeClass('show');
975 this.selectedFunnelLayout = {};
976 },
977
978 startImportTemplate: function (e) {
979 e.preventDefault();
980 if (this.isAddNewFunnelButtonDisabled) return false;
981
982 this.disabled = true;
983
984 let data = {
985 action : 'wpfunnel_import_funnel',
986 steps : this.steps,
987 name : j('.import-funnel-name input').val() ? j('.import-funnel-name input').val() : this.activeTemplate.title,
988 source : 'remote',
989 remoteID: this.activeTemplate.ID,
990 type : this.type,
991 is_store_checkout: this.isStoreCheckout ? true : false,
992 },
993 that = this,
994 _steps = this.filterSteps(this.steps);
995
996 that.loaderMessage = 'Please Wait...',
997 this.activeTemplate.title = data.name;
998
999 wpAjaxHelperRequest("wpfunnel-import-funnel", data)
1000 .success(function (response) {
1001 let looper = j.Deferred().resolve(),
1002 first_step_id = 0,
1003 importedSteps = [];
1004 j.when.apply(j, j.map(_steps, function (step, index) {
1005 if (that.shouldImportStep(step.step_type)) {
1006 looper = looper.then(function () {
1007 return that.createStep(step, response.funnelID, index, that).then(function(stepResponse) {
1008 importedSteps.push(stepResponse.stepID);
1009 });
1010 });
1011 }
1012 return looper;
1013 })).then(function () {
1014 that.afterFunnelCreationRedirect(response.funnelID, importedSteps);
1015 });
1016 })
1017 .error(function (response) {
1018 console.log("Uh, oh!");
1019 console.log(response.statusText);
1020 });
1021 },
1022
1023 createStep: function (step, funnelID, index, that, funnelData) {
1024 let deferred = j.Deferred(),
1025 payload = {
1026 'step' : step,
1027 'funnelID' : funnelID,
1028 'source' : 'remote',
1029 'funnelData': JSON.stringify(funnelData),
1030 'importType': 'templates',
1031 };
1032 apiFetch({
1033 path: `${window.WPFunnelVars.rest_api_url}wpfunnels/v1/steps/wpfunnel-import-step`,
1034 method: 'POST',
1035 data: payload
1036 })
1037 .then(function(response) {
1038 that.loaderMessage = `Importing Step: ` + (parseInt(index) + 1)
1039 deferred.resolve(response)
1040 })
1041 .catch(function(error) {
1042 deferred.reject(response)
1043 })
1044 return deferred.promise();
1045 },
1046
1047 afterFunnelCreationRedirect: function (funnelId, importedSteps) {
1048 var payload = {
1049 'funnelID': funnelId,
1050 'source': 'remote',
1051 'importedSteps': importedSteps || [],
1052 'is_store_checkout': this.isStoreCheckout ? true : false,
1053 };
1054 wpAjaxHelperRequest("wpfunnel-after-funnel-creation", payload)
1055 .success(function (response) {
1056 window.location = response.redirectLink
1057 })
1058 .error(function (response) {
1059 console.log(response)
1060 });
1061 },
1062
1063 doCatFilter: function (value) {
1064 this.activeCategory = value === '' ? 'all' : value
1065
1066 if (value !== '') {
1067 this.templates = this.allTemplates.filter(function (template) {
1068 if( null !== template.wpf_funnel_industry ) {
1069 if( 'slug' in template.wpf_funnel_industry ){
1070 if( 'all' === value ){
1071 return true;
1072 }else{
1073 return template.wpf_funnel_industry.slug === value;
1074 }
1075 }
1076 }
1077
1078 });
1079 }else {
1080 this.templates = this.allTemplates
1081 }
1082
1083 // Apply Store Checkout filter if on Store Checkout page
1084 if (this.isStoreCheckout) {
1085 this.templates = this.templates.filter(template => {
1086 if (!template.steps) return false;
1087 let hasCheckout = template.steps.some(step => step.step_type === 'checkout');
1088 let hasThankyou = template.steps.some(step => step.step_type === 'thankyou');
1089 return hasCheckout && hasThankyou;
1090 });
1091 }
1092
1093 this.totalTemplates = this.templates.length
1094 },
1095
1096 doStepCatFilter: function (value) {
1097 this.activeStepCategory = value === '' ? 'all' : value
1098 let activeStep = this.activeStep
1099 let isStoreCheckout = this.isStoreCheckout
1100 if (value !== '') {
1101 this.steps = this.allSteps.filter(function (step) {
1102 let matchesCategory = step.industry.slug === value && step.step_type === activeStep;
1103 // Apply Store Checkout filter
1104 if (isStoreCheckout) {
1105 matchesCategory = matchesCategory && (step.step_type === 'checkout' || step.step_type === 'thankyou');
1106 }
1107 return matchesCategory;
1108 });
1109 } else {
1110 this.steps = this.allSteps;
1111 // Apply Store Checkout filter
1112 if (isStoreCheckout) {
1113 this.steps = this.steps.filter(step => {
1114 return step.step_type === 'checkout' || step.step_type === 'thankyou';
1115 });
1116 }
1117 }
1118 },
1119
1120 setActiveStep: function (value) {
1121 this.activeStep = value;
1122 },
1123
1124 doStepFilter: function (value) {
1125 this.activeStep = value
1126 // this.steps = this.allSteps.filter(function (step) {
1127 // return step.step_type === value;
1128 // });
1129 },
1130
1131 doStepFreeProFilter: function (value) {
1132 this.stepTemplateType = value
1133 let isStoreCheckout = this.isStoreCheckout
1134 this.steps = this.allSteps.filter(function (step) {
1135 let matchesType = value === 'pro' ? step.is_pro : !step.is_pro;
1136 // Apply Store Checkout filter
1137 if (isStoreCheckout) {
1138 matchesType = matchesType && (step.step_type === 'checkout' || step.step_type === 'thankyou');
1139 }
1140 return matchesType;
1141 });
1142 },
1143
1144 doFreeProFilter: function (value) {
1145 this.templatesType = value
1146 let activeCategory = this.activeCategory
1147 let isStoreCheckout = this.isStoreCheckout
1148 this.templates = this.allTemplates.filter(function (template) {
1149 let matchesCategory = (activeCategory === 'all' || template.wpf_funnel_industry?.slug === activeCategory);
1150 let matchesType = (
1151 value === 'all' ||
1152 (value === 'pro' && 'pro' === template.templateType) ||
1153 (value === 'free' && 'free' === template.templateType) ||
1154 (value === 'freemium' && 'freemium' === template.templateType )
1155 );
1156 let matchesStoreCheckout = true;
1157
1158 // Apply Store Checkout filter
1159 if (isStoreCheckout && template.steps) {
1160 let hasCheckout = template.steps.some(step => step.step_type === 'checkout');
1161 let hasThankyou = template.steps.some(step => step.step_type === 'thankyou');
1162 matchesStoreCheckout = hasCheckout && hasThankyou;
1163 }
1164
1165 return matchesCategory && matchesType && matchesStoreCheckout;
1166 });
1167 this.totalTemplates = this.templates.length
1168 },
1169
1170 doTemplateCatFilter: function (e) {
1171 this.templateCatFilterLoader = true;
1172
1173 this.selectedType = this.type
1174 // this.doCatFilter('')
1175 if(!this.isRemoteFunnel) {
1176 this.getTemplate();
1177 }else{
1178 this.templateCatFilterLoader = false;
1179 }
1180
1181 },
1182
1183 toggleLoader: function (e) {
1184 this.loader = !this.loader
1185 },
1186
1187 showLoaderMessage: function (e, message) {
1188 this.message = message
1189 },
1190
1191 getBackBtnValue: function (params) {
1192 this.showBackBtn = params;
1193 },
1194
1195 hideProFilter: function () {
1196 this.showProFilter = !this.showProFilter
1197 },
1198
1199 toggleStepsPreview: function () {
1200 this.showStepsPreview = !this.showStepsPreview;
1201 },
1202
1203 initSteps: function (steps) {
1204 // Filter steps for Store Checkout to only show one checkout and one thankyou
1205 if (this.isStoreCheckout && steps) {
1206 let filtered = [];
1207 let hasCheckout = false;
1208 let hasThankyou = false;
1209
1210 steps.forEach(step => {
1211 if (step.step_type === 'checkout' && !hasCheckout) {
1212 filtered.push(step);
1213 hasCheckout = true;
1214 } else if (step.step_type === 'thankyou' && !hasThankyou) {
1215 filtered.push(step);
1216 hasThankyou = true;
1217 }
1218 });
1219
1220 this.steps = filtered;
1221 } else {
1222 this.steps = steps;
1223 }
1224 },
1225
1226 backToTemplates: function (e) {
1227 this.showStepsPreview = false
1228 },
1229
1230 funnelNewName: function (data) {
1231 this.templateNewName = j('.import-funnel-name input').val();
1232 },
1233
1234 setActiveTemplate: function (data) {
1235 this.activeTemplate = data;
1236 // if(data.is_pro && this.isProActivated) {
1237 // this.isProTemplateSelected = true;
1238 // } else if(!data.isPro) {
1239 // this.isProTemplateSelected = true;
1240 // }else {
1241 // this.isProTemplateSelected = false;
1242 // }
1243 },
1244
1245 activatePlugin: function (payload, that) {
1246 wpAjaxHelperRequest("wpfunnels-activate-plugin", payload)
1247 .success(function (response) {
1248 that.isAnyPluginMissing = 'no'
1249 })
1250 .error(function (response) {
1251
1252 });
1253 },
1254
1255 pluginInstallationAction: function (e) {
1256 e.preventDefault();
1257
1258 this.pluginInstallLoader = true;
1259
1260 var plugin = this.dependencyPlugins[this.builder],
1261 pluginFile = plugin.plugin_file,
1262 payload = {
1263 pluginFile: pluginFile
1264 },
1265 action = this.dependencyPlugins[this.builder].action,
1266 that = this;
1267 if (action == 'activate') {
1268 this.activatePlugin(payload, that);
1269 } else {
1270 wp.updates.queue.push({
1271 action: 'install-plugin',
1272 data: {
1273 slug: plugin.slug,
1274 },
1275 });
1276 wp.updates.queueChecker();
1277 }
1278
1279 },
1280
1281 pluginInstalledSuccess: function (e, response) {
1282 e.preventDefault();
1283 var plugin = this.dependencyPlugins[this.builder],
1284 pluginFile = plugin.plugin_file,
1285 payload = {
1286 pluginFile: pluginFile
1287 },
1288 that = this;
1289 this.activatePlugin(payload, that);
1290 },
1291
1292 pluginInstalledError: function (e, response) {
1293 e.preventDefault();
1294 this.pluginInstallLoader = false;
1295 this.pluginInstallationErrorMessage = response.errorMessage
1296 },
1297
1298 onActivateTab(tabId) {
1299 this.activeTab = tabId;
1300 },
1301 setResponsiveView(view) {
1302 this.responsiveView = view;
1303 },
1304
1305 filterSteps: function(steps) {
1306 let isProActivated = window.WPFunnelVars.isProActivated == 1;
1307
1308 // Filter for Store Checkout - only checkout and thankyou (one of each)
1309 if (this.isStoreCheckout) {
1310 let filtered = [];
1311 let hasCheckout = false;
1312 let hasThankyou = false;
1313
1314 steps.forEach(step => {
1315 if (step.step_type === 'checkout' && !hasCheckout) {
1316 filtered.push(step);
1317 hasCheckout = true;
1318 } else if (step.step_type === 'thankyou' && !hasThankyou) {
1319 filtered.push(step);
1320 hasThankyou = true;
1321 }
1322 });
1323
1324 return filtered;
1325 }
1326
1327 if (isProActivated) {
1328 return steps;
1329 } else {
1330 return steps.filter((step, index, self) => {
1331 return step.step_type !== 'downsell' &&
1332 index === self.findIndex(s => s.step_type === step.step_type);
1333 });
1334 }
1335 },
1336
1337 shouldImportStep: function(stepType) {
1338 let isProActivated = window.WPFunnelVars.isProActivated == 1;
1339 if (isProActivated) {
1340 return true;
1341 }
1342 return !['downsell'].includes(stepType);
1343 },
1344
1345 }
1346 }
1347 </script>
1348