| 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 && !isTemplatePage"> |
| 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 && !isTemplatePage) || ( '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 |
isTemplatePage: window.template_library_object.isTemplatePage, |
| 534 |
image_path: window.template_library_object.image_path, |
| 535 |
globalImportProgress: '', |
| 536 |
supportedSteps : window.template_library_object.supported_steps, |
| 537 |
disabled: false, |
| 538 |
templateNewName: '', |
| 539 |
funnelName: '', |
| 540 |
isPro : window.template_library_object.is_pro, |
| 541 |
createFunnelTitle: window.template_library_object.isStoreCheckout ? 'Create Store Checkout' : 'Create Funnel', |
| 542 |
totalFunnels: window.WPFunnelVars.totalFunnels, |
| 543 |
countActiveFunnels: window.WPFunnelVars.count_active_funnels, |
| 544 |
totalAllowedFunnels: window.WPFunnelVars.totalAllowedFunnels, |
| 545 |
totalStoreCheckouts: window.WPFunnelVars.totalStoreCheckouts || 0, |
| 546 |
totalAllowedStoreCheckouts: window.WPFunnelVars.totalAllowedStoreCheckouts || 3, |
| 547 |
dependencyPlugins: window.WPFunnelVars.dependencyPlugins, |
| 548 |
isAnyPluginMissing: window.WPFunnelVars.isAnyPluginMissing, |
| 549 |
isProActivated: window.WPFunnelVars.isProActivated, |
| 550 |
isWcActivated: window.WPFunnelVars.is_wc_installed, |
| 551 |
isLmsActivated: window.WPFunnelVars.isLmsActivated, |
| 552 |
builder: window.WPFunnelVars.builder, |
| 553 |
pluginInstallLoader: false, |
| 554 |
pluginInstallationErrorMessage: '', |
| 555 |
type: 'wc', |
| 556 |
selectedType: 'wc', |
| 557 |
tempalateTypes : [], |
| 558 |
template_type : window.template_library_object.template_type, |
| 559 |
activeTab : 'templates', |
| 560 |
layouts : [ |
| 561 |
{ |
| 562 |
name : 'Layout 1', |
| 563 |
value:'layout1', |
| 564 |
steps : [ |
| 565 |
{ |
| 566 |
name : 'Landing', |
| 567 |
value:'landing', |
| 568 |
pos_x: 156, |
| 569 |
pos_y: 258 |
| 570 |
}, |
| 571 |
{ |
| 572 |
name : 'Thank You', |
| 573 |
value:'thankyou', |
| 574 |
pos_x: 399, |
| 575 |
pos_y: 258 |
| 576 |
} |
| 577 |
] |
| 578 |
}, |
| 579 |
{ |
| 580 |
name : 'Layout 2', |
| 581 |
value:'layout2', |
| 582 |
steps : [ |
| 583 |
{ |
| 584 |
name : 'Landing', |
| 585 |
value:'landing', |
| 586 |
pos_x: 156, |
| 587 |
pos_y: 258 |
| 588 |
}, |
| 589 |
{ |
| 590 |
name : 'Checkout', |
| 591 |
value:'checkout', |
| 592 |
pos_x: 399, |
| 593 |
pos_y: 258 |
| 594 |
}, |
| 595 |
{ |
| 596 |
name : 'Thank You', |
| 597 |
value:'thankyou', |
| 598 |
pos_x: 658, |
| 599 |
pos_y: 258 |
| 600 |
} |
| 601 |
] |
| 602 |
}, |
| 603 |
{ |
| 604 |
name : 'Layout 3', |
| 605 |
value:'layout3', |
| 606 |
steps : [ |
| 607 |
{ |
| 608 |
name : 'Landing', |
| 609 |
value:'landing', |
| 610 |
pos_x: 156, |
| 611 |
pos_y: 258 |
| 612 |
}, |
| 613 |
{ |
| 614 |
name : 'Checkout', |
| 615 |
value:'checkout', |
| 616 |
pos_x: 399, |
| 617 |
pos_y: 258 |
| 618 |
}, |
| 619 |
{ |
| 620 |
name : 'Upsell', |
| 621 |
value:'upsell', |
| 622 |
pos_x: 658, |
| 623 |
pos_y: 258 |
| 624 |
}, |
| 625 |
{ |
| 626 |
name : 'Downsell', |
| 627 |
value:'downsell', |
| 628 |
pos_x: 917, |
| 629 |
pos_y: 258 |
| 630 |
}, |
| 631 |
{ |
| 632 |
name : 'Thank You', |
| 633 |
value:'thankyou', |
| 634 |
pos_x: 1175, |
| 635 |
pos_y: 258 |
| 636 |
} |
| 637 |
] |
| 638 |
}, |
| 639 |
{ |
| 640 |
name : 'Layout 4', |
| 641 |
value:'layout4', |
| 642 |
steps : [ |
| 643 |
{ |
| 644 |
name : 'Landing', |
| 645 |
value:'landing', |
| 646 |
pos_x: 156, |
| 647 |
pos_y: 258 |
| 648 |
}, |
| 649 |
{ |
| 650 |
name : 'Checkout', |
| 651 |
value:'checkout', |
| 652 |
pos_x: 399, |
| 653 |
pos_y: 258 |
| 654 |
}, |
| 655 |
{ |
| 656 |
name : 'Upsell', |
| 657 |
value:'upsell', |
| 658 |
pos_x: 658, |
| 659 |
pos_y: 258, |
| 660 |
isCondition : true, |
| 661 |
trueCondition : [ |
| 662 |
{ |
| 663 |
name : 'Thank You', |
| 664 |
value:'thankyou', |
| 665 |
pos_x: 1059, |
| 666 |
pos_y: 111, |
| 667 |
} |
| 668 |
], |
| 669 |
falseCondition : [ |
| 670 |
{ |
| 671 |
name : 'Downsell', |
| 672 |
value:'downsell', |
| 673 |
pos_x: 1059, |
| 674 |
pos_y: 447, |
| 675 |
}, |
| 676 |
{ |
| 677 |
name : 'Thank You', |
| 678 |
value:'thankyou', |
| 679 |
pos_x: 1317, |
| 680 |
pos_y: 447, |
| 681 |
} |
| 682 |
] |
| 683 |
} |
| 684 |
|
| 685 |
] |
| 686 |
}, |
| 687 |
{ |
| 688 |
name : 'Layout 5', |
| 689 |
value:'layout5', |
| 690 |
steps : [ |
| 691 |
{ |
| 692 |
name : 'Landing', |
| 693 |
value:'landing', |
| 694 |
pos_x: 156, |
| 695 |
pos_y: 258 |
| 696 |
}, |
| 697 |
{ |
| 698 |
name : 'Checkout', |
| 699 |
value:'checkout', |
| 700 |
isCondition : true, |
| 701 |
pos_x: 399, |
| 702 |
pos_y: 258, |
| 703 |
trueCondition : [ |
| 704 |
{ |
| 705 |
name : 'Upsell', |
| 706 |
value: 'upsell', |
| 707 |
pos_x: 800, |
| 708 |
pos_y: 111, |
| 709 |
}, |
| 710 |
{ |
| 711 |
name : 'Thank You', |
| 712 |
value:'thankyou', |
| 713 |
pos_x: 1059, |
| 714 |
pos_y: 111, |
| 715 |
} |
| 716 |
], |
| 717 |
falseCondition : [ |
| 718 |
{ |
| 719 |
name : 'Downsell', |
| 720 |
value:'downsell', |
| 721 |
pos_x: 800, |
| 722 |
pos_y: 447, |
| 723 |
}, |
| 724 |
{ |
| 725 |
name : 'Thank You', |
| 726 |
value:'thankyou', |
| 727 |
pos_x: 1059, |
| 728 |
pos_y: 447, |
| 729 |
} |
| 730 |
] |
| 731 |
} |
| 732 |
] |
| 733 |
}, |
| 734 |
{ |
| 735 |
name : 'Layout 6', |
| 736 |
value:'layout6', |
| 737 |
steps : [ |
| 738 |
{ |
| 739 |
name : 'Landing', |
| 740 |
value:'landing', |
| 741 |
pos_x: 156, |
| 742 |
pos_y: 258, |
| 743 |
isCondition : true, |
| 744 |
trueCondition : [ |
| 745 |
{ |
| 746 |
name : 'Thank You', |
| 747 |
value:'thankyou', |
| 748 |
pos_x: 556, |
| 749 |
pos_y: 111 |
| 750 |
} |
| 751 |
], |
| 752 |
falseCondition : [ |
| 753 |
{ |
| 754 |
name : 'Custom', |
| 755 |
value:'custom', |
| 756 |
pos_x: 556, |
| 757 |
pos_y: 447 |
| 758 |
}, |
| 759 |
{ |
| 760 |
name : 'Thank You', |
| 761 |
value:'thankyou', |
| 762 |
pos_x: 814, |
| 763 |
pos_y: 447 |
| 764 |
} |
| 765 |
] |
| 766 |
}, |
| 767 |
|
| 768 |
|
| 769 |
] |
| 770 |
}, |
| 771 |
], |
| 772 |
selectedFunnelLayout : {}, |
| 773 |
responsiveView: 'desktop', |
| 774 |
syncingLibrary: false, |
| 775 |
} |
| 776 |
|
| 777 |
}, |
| 778 |
|
| 779 |
computed: { |
| 780 |
isAddNewFunnelButtonDisabled: function () { |
| 781 |
if (!this.isProActivated) { |
| 782 |
if (this.isStoreCheckout) { |
| 783 |
return parseInt(this.totalStoreCheckouts) >= parseInt(this.totalAllowedStoreCheckouts); |
| 784 |
} |
| 785 |
if (parseInt(this.countActiveFunnels) >= parseInt(this.totalAllowedFunnels)) { |
| 786 |
return true |
| 787 |
} |
| 788 |
} |
| 789 |
return false |
| 790 |
} |
| 791 |
}, |
| 792 |
mounted() { |
| 793 |
j(document).on( |
| 794 |
'wp-plugin-install-success', |
| 795 |
this.pluginInstalledSuccess |
| 796 |
); |
| 797 |
|
| 798 |
j(document).on( |
| 799 |
'wp-plugin-install-error', |
| 800 |
this.pluginInstalledError |
| 801 |
); |
| 802 |
if(!this.isRemoteFunnel) { |
| 803 |
this.getTemplate(); |
| 804 |
} else { |
| 805 |
this.loader = false |
| 806 |
} |
| 807 |
|
| 808 |
}, |
| 809 |
|
| 810 |
methods: { |
| 811 |
methods: { |
| 812 |
isOnStoreCheckoutPage() { |
| 813 |
console.log(isStoreCheckout); |
| 814 |
} |
| 815 |
}, |
| 816 |
selectFunnelLayout: function (index, value) { |
| 817 |
if(this.isPro || index === 0 || index === 1 ){ |
| 818 |
if( this.selectedFunnelLayout == value){ |
| 819 |
this.selectedFunnelLayout = {}; |
| 820 |
}else { |
| 821 |
if('lead' == this.selectedType ){ |
| 822 |
if( (index === 0 && !this.isPro) || ((index === 0 || index === 5) && this.isPro) ){ |
| 823 |
this.selectedFunnelLayout = value; |
| 824 |
}else{ |
| 825 |
this.isShowAlert = true; |
| 826 |
this.alertClass = 'wpfnl-error'; |
| 827 |
this.alertMessage = 'This is only for sales funnel'; |
| 828 |
|
| 829 |
setTimeout(() => { |
| 830 |
this.isShowAlert = false |
| 831 |
}, 3000); |
| 832 |
this.selectedFunnelLayout = {}; |
| 833 |
return; |
| 834 |
} |
| 835 |
}else{ |
| 836 |
this.isShowAlert = false; |
| 837 |
this.alertMessage = ''; |
| 838 |
this.alertClass = ''; |
| 839 |
this.selectedFunnelLayout = value; |
| 840 |
} |
| 841 |
} |
| 842 |
} |
| 843 |
}, |
| 844 |
|
| 845 |
getTemplate: function (){ |
| 846 |
if( this.selectedType ){ |
| 847 |
apiFetch({ |
| 848 |
path: addQueryArgs( `${window.template_library_object.rest_api_url}wpfunnels/v1/templates/get_templates`, { |
| 849 |
type: this.selectedType, |
| 850 |
store_checkout: this.isStoreCheckout ? 'yes' : 'no', |
| 851 |
} ), |
| 852 |
method: 'GET' |
| 853 |
}).then(response => { |
| 854 |
if (response.success) { |
| 855 |
let templates = response.templates |
| 856 |
let steps = response.steps |
| 857 |
|
| 858 |
// Filter for Store Checkout - only show templates with checkout and thankyou |
| 859 |
if (this.isStoreCheckout) { |
| 860 |
templates = templates.filter(template => { |
| 861 |
if (!template.steps) return false; |
| 862 |
let hasCheckout = template.steps.some(step => step.step_type === 'checkout'); |
| 863 |
let hasThankyou = template.steps.some(step => step.step_type === 'thankyou'); |
| 864 |
return hasCheckout && hasThankyou; |
| 865 |
}); |
| 866 |
|
| 867 |
steps = steps.filter(step => { |
| 868 |
return step.step_type === 'checkout' || step.step_type === 'thankyou'; |
| 869 |
}); |
| 870 |
} |
| 871 |
|
| 872 |
if (this.isStoreCheckout) { |
| 873 |
templates = templates.sort((a, b) => a.ID - b.ID); |
| 874 |
} |
| 875 |
this.templates = templates |
| 876 |
this.allTemplates = templates |
| 877 |
this.steps = steps |
| 878 |
this.allSteps = steps |
| 879 |
this.templatesType = 'all' |
| 880 |
this.activeCategory = 'all' |
| 881 |
this.categories = response.categories |
| 882 |
this.stepCategories = response.categories |
| 883 |
this.loader = false |
| 884 |
this.templateCatFilterLoader = false; |
| 885 |
if (response.templates) { |
| 886 |
this.totalTemplates = this.isAnyPluginMissing === 'yes' ? 0 : templates.length |
| 887 |
} |
| 888 |
|
| 889 |
} |
| 890 |
|
| 891 |
}) |
| 892 |
} |
| 893 |
|
| 894 |
}, |
| 895 |
|
| 896 |
syncLibrary: function () { |
| 897 |
this.syncingLibrary = true; |
| 898 |
wpAjaxHelperRequest('clear-templates', {}) |
| 899 |
.success(() => { |
| 900 |
this.getTemplate(); |
| 901 |
this.syncingLibrary = false; |
| 902 |
}) |
| 903 |
.error(() => { |
| 904 |
this.syncingLibrary = false; |
| 905 |
}); |
| 906 |
}, |
| 907 |
|
| 908 |
createFunnel: function (e) { |
| 909 |
e.preventDefault(); |
| 910 |
if( !this.isStoreCheckout && !this.funnelName ){ |
| 911 |
this.isShowAlert = true; |
| 912 |
this.alertClass = 'wpfnl-error'; |
| 913 |
this.alertMessage = 'Please enter funnel name'; |
| 914 |
|
| 915 |
setTimeout(() => { |
| 916 |
this.isShowAlert = false |
| 917 |
}, 2500); |
| 918 |
|
| 919 |
return; |
| 920 |
} |
| 921 |
|
| 922 |
if( this.isStoreCheckout && !this.funnelName ){ |
| 923 |
this.funnelName = 'Store Checkout'; |
| 924 |
} |
| 925 |
|
| 926 |
this.disabled = true; |
| 927 |
this.loader = true; |
| 928 |
this.createFunnelTitle = this.isStoreCheckout |
| 929 |
? WPFunnelVars.getText?.creating_store_checkout |
| 930 |
: WPFunnelVars.getText?.creating_funnel; |
| 931 |
var payload = { |
| 932 |
funnelName: this.funnelName, |
| 933 |
type : this.type, |
| 934 |
selectedFunnelLayout : this.selectedFunnelLayout, |
| 935 |
is_store_checkout: this.isStoreCheckout ? true : false, |
| 936 |
}; |
| 937 |
wpAjaxHelperRequest("create-funnel", payload) |
| 938 |
.success(function (response) { |
| 939 |
window.location.href = response.redirectUrl; |
| 940 |
this.disabled = false; |
| 941 |
}) |
| 942 |
.error(function (response) { |
| 943 |
|
| 944 |
}); |
| 945 |
}, |
| 946 |
|
| 947 |
createFunnelWithSingleStep: function () { |
| 948 |
|
| 949 |
this.disabled = true; |
| 950 |
this.createFunnelTitle = "Creating Funnel..." |
| 951 |
var payload = { |
| 952 |
funnelName: this.funnelName, |
| 953 |
type : this.type, |
| 954 |
}; |
| 955 |
wpAjaxHelperRequest("create-funnel", payload) |
| 956 |
.success(function (response) { |
| 957 |
window.location.href = response.redirectUrl; |
| 958 |
this.disabled = false; |
| 959 |
}) |
| 960 |
.error(function (response) { |
| 961 |
|
| 962 |
}); |
| 963 |
}, |
| 964 |
|
| 965 |
showFunnelNameModal: function (e) { |
| 966 |
e.preventDefault() |
| 967 |
|
| 968 |
j('.wpfnl-create-funnel__templates-wrapper .not-clickable-overlay').fadeIn(); |
| 969 |
j('.wpfnl-create-funnel__templates-wrapper .create-funnel-name-modal').addClass('show'); |
| 970 |
}, |
| 971 |
|
| 972 |
closeFunnelNameModal: function (e) { |
| 973 |
e.preventDefault() |
| 974 |
j('.wpfnl-create-funnel__templates-wrapper .not-clickable-overlay').fadeOut(); |
| 975 |
j('.wpfnl-create-funnel__templates-wrapper .create-funnel-name-modal').removeClass('show'); |
| 976 |
this.selectedFunnelLayout = {}; |
| 977 |
}, |
| 978 |
|
| 979 |
startImportTemplate: function (e) { |
| 980 |
e.preventDefault(); |
| 981 |
if (this.isAddNewFunnelButtonDisabled) return false; |
| 982 |
|
| 983 |
this.disabled = true; |
| 984 |
|
| 985 |
let data = { |
| 986 |
action : 'wpfunnel_import_funnel', |
| 987 |
steps : this.steps, |
| 988 |
name : j('.import-funnel-name input').val() ? j('.import-funnel-name input').val() : this.activeTemplate.title, |
| 989 |
source : 'remote', |
| 990 |
remoteID: this.activeTemplate.ID, |
| 991 |
type : this.type, |
| 992 |
is_store_checkout: this.isStoreCheckout ? true : false, |
| 993 |
}, |
| 994 |
that = this, |
| 995 |
_steps = this.filterSteps(this.steps); |
| 996 |
|
| 997 |
that.loaderMessage = 'Please Wait...', |
| 998 |
this.activeTemplate.title = data.name; |
| 999 |
|
| 1000 |
wpAjaxHelperRequest("wpfunnel-import-funnel", data) |
| 1001 |
.success(function (response) { |
| 1002 |
let looper = j.Deferred().resolve(), |
| 1003 |
first_step_id = 0, |
| 1004 |
importedSteps = []; |
| 1005 |
j.when.apply(j, j.map(_steps, function (step, index) { |
| 1006 |
if (that.shouldImportStep(step.step_type)) { |
| 1007 |
looper = looper.then(function () { |
| 1008 |
return that.createStep(step, response.funnelID, index, that).then(function(stepResponse) { |
| 1009 |
importedSteps.push(stepResponse.stepID); |
| 1010 |
}); |
| 1011 |
}); |
| 1012 |
} |
| 1013 |
return looper; |
| 1014 |
})).then(function () { |
| 1015 |
that.afterFunnelCreationRedirect(response.funnelID, importedSteps); |
| 1016 |
}); |
| 1017 |
}) |
| 1018 |
.error(function (response) { |
| 1019 |
console.log("Uh, oh!"); |
| 1020 |
console.log(response.statusText); |
| 1021 |
}); |
| 1022 |
}, |
| 1023 |
|
| 1024 |
createStep: function (step, funnelID, index, that, funnelData) { |
| 1025 |
let deferred = j.Deferred(), |
| 1026 |
payload = { |
| 1027 |
'step' : step, |
| 1028 |
'funnelID' : funnelID, |
| 1029 |
'source' : 'remote', |
| 1030 |
'funnelData': JSON.stringify(funnelData), |
| 1031 |
'importType': 'templates', |
| 1032 |
}; |
| 1033 |
apiFetch({ |
| 1034 |
path: `${window.WPFunnelVars.rest_api_url}wpfunnels/v1/steps/wpfunnel-import-step`, |
| 1035 |
method: 'POST', |
| 1036 |
data: payload |
| 1037 |
}) |
| 1038 |
.then(function(response) { |
| 1039 |
that.loaderMessage = `Importing Step: ` + (parseInt(index) + 1) |
| 1040 |
deferred.resolve(response) |
| 1041 |
}) |
| 1042 |
.catch(function(error) { |
| 1043 |
deferred.reject(response) |
| 1044 |
}) |
| 1045 |
return deferred.promise(); |
| 1046 |
}, |
| 1047 |
|
| 1048 |
afterFunnelCreationRedirect: function (funnelId, importedSteps) { |
| 1049 |
var payload = { |
| 1050 |
'funnelID': funnelId, |
| 1051 |
'source': 'remote', |
| 1052 |
'importedSteps': importedSteps || [], |
| 1053 |
'is_store_checkout': this.isStoreCheckout ? true : false, |
| 1054 |
}; |
| 1055 |
wpAjaxHelperRequest("wpfunnel-after-funnel-creation", payload) |
| 1056 |
.success(function (response) { |
| 1057 |
window.location = response.redirectLink |
| 1058 |
}) |
| 1059 |
.error(function (response) { |
| 1060 |
console.log(response) |
| 1061 |
}); |
| 1062 |
}, |
| 1063 |
|
| 1064 |
doCatFilter: function (value) { |
| 1065 |
this.activeCategory = value === '' ? 'all' : value |
| 1066 |
|
| 1067 |
if (value !== '') { |
| 1068 |
this.templates = this.allTemplates.filter(function (template) { |
| 1069 |
if( null !== template.wpf_funnel_industry ) { |
| 1070 |
if( 'slug' in template.wpf_funnel_industry ){ |
| 1071 |
if( 'all' === value ){ |
| 1072 |
return true; |
| 1073 |
}else{ |
| 1074 |
return template.wpf_funnel_industry.slug === value; |
| 1075 |
} |
| 1076 |
} |
| 1077 |
} |
| 1078 |
|
| 1079 |
}); |
| 1080 |
}else { |
| 1081 |
this.templates = this.allTemplates |
| 1082 |
} |
| 1083 |
|
| 1084 |
// Apply Store Checkout filter if on Store Checkout page |
| 1085 |
if (this.isStoreCheckout) { |
| 1086 |
this.templates = this.templates.filter(template => { |
| 1087 |
if (!template.steps) return false; |
| 1088 |
let hasCheckout = template.steps.some(step => step.step_type === 'checkout'); |
| 1089 |
let hasThankyou = template.steps.some(step => step.step_type === 'thankyou'); |
| 1090 |
return hasCheckout && hasThankyou; |
| 1091 |
}); |
| 1092 |
} |
| 1093 |
|
| 1094 |
this.totalTemplates = this.templates.length |
| 1095 |
}, |
| 1096 |
|
| 1097 |
doStepCatFilter: function (value) { |
| 1098 |
this.activeStepCategory = value === '' ? 'all' : value |
| 1099 |
let activeStep = this.activeStep |
| 1100 |
let isStoreCheckout = this.isStoreCheckout |
| 1101 |
if (value !== '') { |
| 1102 |
this.steps = this.allSteps.filter(function (step) { |
| 1103 |
let matchesCategory = step.industry.slug === value && step.step_type === activeStep; |
| 1104 |
// Apply Store Checkout filter |
| 1105 |
if (isStoreCheckout) { |
| 1106 |
matchesCategory = matchesCategory && (step.step_type === 'checkout' || step.step_type === 'thankyou'); |
| 1107 |
} |
| 1108 |
return matchesCategory; |
| 1109 |
}); |
| 1110 |
} else { |
| 1111 |
this.steps = this.allSteps; |
| 1112 |
// Apply Store Checkout filter |
| 1113 |
if (isStoreCheckout) { |
| 1114 |
this.steps = this.steps.filter(step => { |
| 1115 |
return step.step_type === 'checkout' || step.step_type === 'thankyou'; |
| 1116 |
}); |
| 1117 |
} |
| 1118 |
} |
| 1119 |
}, |
| 1120 |
|
| 1121 |
setActiveStep: function (value) { |
| 1122 |
this.activeStep = value; |
| 1123 |
}, |
| 1124 |
|
| 1125 |
doStepFilter: function (value) { |
| 1126 |
this.activeStep = value |
| 1127 |
// this.steps = this.allSteps.filter(function (step) { |
| 1128 |
// return step.step_type === value; |
| 1129 |
// }); |
| 1130 |
}, |
| 1131 |
|
| 1132 |
doStepFreeProFilter: function (value) { |
| 1133 |
this.stepTemplateType = value |
| 1134 |
let isStoreCheckout = this.isStoreCheckout |
| 1135 |
this.steps = this.allSteps.filter(function (step) { |
| 1136 |
let matchesType = value === 'pro' ? step.is_pro : !step.is_pro; |
| 1137 |
// Apply Store Checkout filter |
| 1138 |
if (isStoreCheckout) { |
| 1139 |
matchesType = matchesType && (step.step_type === 'checkout' || step.step_type === 'thankyou'); |
| 1140 |
} |
| 1141 |
return matchesType; |
| 1142 |
}); |
| 1143 |
}, |
| 1144 |
|
| 1145 |
doFreeProFilter: function (value) { |
| 1146 |
this.templatesType = value |
| 1147 |
let activeCategory = this.activeCategory |
| 1148 |
let isStoreCheckout = this.isStoreCheckout |
| 1149 |
this.templates = this.allTemplates.filter(function (template) { |
| 1150 |
let matchesCategory = (activeCategory === 'all' || template.wpf_funnel_industry?.slug === activeCategory); |
| 1151 |
let matchesType = ( |
| 1152 |
value === 'all' || |
| 1153 |
(value === 'pro' && 'pro' === template.templateType) || |
| 1154 |
(value === 'free' && 'free' === template.templateType) || |
| 1155 |
(value === 'freemium' && 'freemium' === template.templateType ) |
| 1156 |
); |
| 1157 |
let matchesStoreCheckout = true; |
| 1158 |
|
| 1159 |
// Apply Store Checkout filter |
| 1160 |
if (isStoreCheckout && template.steps) { |
| 1161 |
let hasCheckout = template.steps.some(step => step.step_type === 'checkout'); |
| 1162 |
let hasThankyou = template.steps.some(step => step.step_type === 'thankyou'); |
| 1163 |
matchesStoreCheckout = hasCheckout && hasThankyou; |
| 1164 |
} |
| 1165 |
|
| 1166 |
return matchesCategory && matchesType && matchesStoreCheckout; |
| 1167 |
}); |
| 1168 |
this.totalTemplates = this.templates.length |
| 1169 |
}, |
| 1170 |
|
| 1171 |
doTemplateCatFilter: function (e) { |
| 1172 |
this.templateCatFilterLoader = true; |
| 1173 |
|
| 1174 |
this.selectedType = this.type |
| 1175 |
// this.doCatFilter('') |
| 1176 |
if(!this.isRemoteFunnel) { |
| 1177 |
this.getTemplate(); |
| 1178 |
}else{ |
| 1179 |
this.templateCatFilterLoader = false; |
| 1180 |
} |
| 1181 |
|
| 1182 |
}, |
| 1183 |
|
| 1184 |
toggleLoader: function (e) { |
| 1185 |
this.loader = !this.loader |
| 1186 |
}, |
| 1187 |
|
| 1188 |
showLoaderMessage: function (e, message) { |
| 1189 |
this.message = message |
| 1190 |
}, |
| 1191 |
|
| 1192 |
getBackBtnValue: function (params) { |
| 1193 |
this.showBackBtn = params; |
| 1194 |
}, |
| 1195 |
|
| 1196 |
hideProFilter: function () { |
| 1197 |
this.showProFilter = !this.showProFilter |
| 1198 |
}, |
| 1199 |
|
| 1200 |
toggleStepsPreview: function () { |
| 1201 |
this.showStepsPreview = !this.showStepsPreview; |
| 1202 |
}, |
| 1203 |
|
| 1204 |
initSteps: function (steps) { |
| 1205 |
// Filter steps for Store Checkout to only show one checkout and one thankyou |
| 1206 |
if (this.isStoreCheckout && steps) { |
| 1207 |
let filtered = []; |
| 1208 |
let hasCheckout = false; |
| 1209 |
let hasThankyou = false; |
| 1210 |
|
| 1211 |
steps.forEach(step => { |
| 1212 |
if (step.step_type === 'checkout' && !hasCheckout) { |
| 1213 |
filtered.push(step); |
| 1214 |
hasCheckout = true; |
| 1215 |
} else if (step.step_type === 'thankyou' && !hasThankyou) { |
| 1216 |
filtered.push(step); |
| 1217 |
hasThankyou = true; |
| 1218 |
} |
| 1219 |
}); |
| 1220 |
|
| 1221 |
this.steps = filtered; |
| 1222 |
} else { |
| 1223 |
this.steps = steps; |
| 1224 |
} |
| 1225 |
}, |
| 1226 |
|
| 1227 |
backToTemplates: function (e) { |
| 1228 |
this.showStepsPreview = false |
| 1229 |
}, |
| 1230 |
|
| 1231 |
funnelNewName: function (data) { |
| 1232 |
this.templateNewName = j('.import-funnel-name input').val(); |
| 1233 |
}, |
| 1234 |
|
| 1235 |
setActiveTemplate: function (data) { |
| 1236 |
this.activeTemplate = data; |
| 1237 |
// if(data.is_pro && this.isProActivated) { |
| 1238 |
// this.isProTemplateSelected = true; |
| 1239 |
// } else if(!data.isPro) { |
| 1240 |
// this.isProTemplateSelected = true; |
| 1241 |
// }else { |
| 1242 |
// this.isProTemplateSelected = false; |
| 1243 |
// } |
| 1244 |
}, |
| 1245 |
|
| 1246 |
activatePlugin: function (payload, that) { |
| 1247 |
wpAjaxHelperRequest("wpfunnels-activate-plugin", payload) |
| 1248 |
.success(function (response) { |
| 1249 |
that.isAnyPluginMissing = 'no' |
| 1250 |
}) |
| 1251 |
.error(function (response) { |
| 1252 |
|
| 1253 |
}); |
| 1254 |
}, |
| 1255 |
|
| 1256 |
pluginInstallationAction: function (e) { |
| 1257 |
e.preventDefault(); |
| 1258 |
|
| 1259 |
this.pluginInstallLoader = true; |
| 1260 |
|
| 1261 |
var plugin = this.dependencyPlugins[this.builder], |
| 1262 |
pluginFile = plugin.plugin_file, |
| 1263 |
payload = { |
| 1264 |
pluginFile: pluginFile |
| 1265 |
}, |
| 1266 |
action = this.dependencyPlugins[this.builder].action, |
| 1267 |
that = this; |
| 1268 |
if (action == 'activate') { |
| 1269 |
this.activatePlugin(payload, that); |
| 1270 |
} else { |
| 1271 |
wp.updates.queue.push({ |
| 1272 |
action: 'install-plugin', |
| 1273 |
data: { |
| 1274 |
slug: plugin.slug, |
| 1275 |
}, |
| 1276 |
}); |
| 1277 |
wp.updates.queueChecker(); |
| 1278 |
} |
| 1279 |
|
| 1280 |
}, |
| 1281 |
|
| 1282 |
pluginInstalledSuccess: function (e, response) { |
| 1283 |
e.preventDefault(); |
| 1284 |
var plugin = this.dependencyPlugins[this.builder], |
| 1285 |
pluginFile = plugin.plugin_file, |
| 1286 |
payload = { |
| 1287 |
pluginFile: pluginFile |
| 1288 |
}, |
| 1289 |
that = this; |
| 1290 |
this.activatePlugin(payload, that); |
| 1291 |
}, |
| 1292 |
|
| 1293 |
pluginInstalledError: function (e, response) { |
| 1294 |
e.preventDefault(); |
| 1295 |
this.pluginInstallLoader = false; |
| 1296 |
this.pluginInstallationErrorMessage = response.errorMessage |
| 1297 |
}, |
| 1298 |
|
| 1299 |
onActivateTab(tabId) { |
| 1300 |
this.activeTab = tabId; |
| 1301 |
}, |
| 1302 |
setResponsiveView(view) { |
| 1303 |
this.responsiveView = view; |
| 1304 |
}, |
| 1305 |
|
| 1306 |
filterSteps: function(steps) { |
| 1307 |
let isProActivated = window.WPFunnelVars.isProActivated == 1; |
| 1308 |
|
| 1309 |
// Filter for Store Checkout - only checkout and thankyou (one of each) |
| 1310 |
if (this.isStoreCheckout) { |
| 1311 |
let filtered = []; |
| 1312 |
let hasCheckout = false; |
| 1313 |
let hasThankyou = false; |
| 1314 |
|
| 1315 |
steps.forEach(step => { |
| 1316 |
if (step.step_type === 'checkout' && !hasCheckout) { |
| 1317 |
filtered.push(step); |
| 1318 |
hasCheckout = true; |
| 1319 |
} else if (step.step_type === 'thankyou' && !hasThankyou) { |
| 1320 |
filtered.push(step); |
| 1321 |
hasThankyou = true; |
| 1322 |
} |
| 1323 |
}); |
| 1324 |
|
| 1325 |
return filtered; |
| 1326 |
} |
| 1327 |
|
| 1328 |
if (isProActivated) { |
| 1329 |
return steps; |
| 1330 |
} else { |
| 1331 |
return steps.filter((step, index, self) => { |
| 1332 |
return step.step_type !== 'downsell' && |
| 1333 |
index === self.findIndex(s => s.step_type === step.step_type); |
| 1334 |
}); |
| 1335 |
} |
| 1336 |
}, |
| 1337 |
|
| 1338 |
shouldImportStep: function(stepType) { |
| 1339 |
let isProActivated = window.WPFunnelVars.isProActivated == 1; |
| 1340 |
if (isProActivated) { |
| 1341 |
return true; |
| 1342 |
} |
| 1343 |
return !['downsell'].includes(stepType); |
| 1344 |
}, |
| 1345 |
|
| 1346 |
} |
| 1347 |
} |
| 1348 |
</script> |
| 1349 |
|