PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
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 / setup-wizard / components / Wizard.vue

Wizard.vue in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at admin/modules/setup-wizard/components/Wizard.vue

357 lines 11.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div class="wpfnl wpfnl-setup-wizard">
3 <div class="wpfnl-setup-wizard__wrapper">
4 <ul class="wpfnl-setup-wizard__nav">
5 <li v-for="(step,index) in steps" :key="index" :class="[{ active: step.isActive, completed: step.completed }, step.slug] ">
6 <span class="step-icon">
7 <img alt="Step Icon" v-if="!step.isActive && !step.completed" :src="step.icon" />
8 <img alt="Step Icon" v-if="step.isActive" :src="step.iconActive" />
9 <img alt="Step Icon" v-if="step.completed" :src="step.iconCompleted" />
10 </span>
11 <span class="step-name">{{step.name}}</span>
12 </li>
13 </ul>
14
15 <FunnelType
16 v-if="step==='type'"
17 :wizard-slug="wizardSlug"
18 :setUpType="setUpType"
19 :showLoader="showLoader"
20 :isLmsInstalled="isLmsInstalled"
21 :funnelType="funnelType"
22 :isWCInstalled="isWCInstalled"
23 :isWCActive="isWCActive"
24 :isCLInstalled="isCLInstalled"
25 :isCLActive="isCLActive"
26 @setPluginSlug="setPluginSlug"
27 @changeSetUpType="changeSetUpType"
28 @changeFunnelType="changeFunnelType"
29 @processSettings="processSettings"
30 />
31 <Automation
32 v-if="step==='automation'"
33 :wizardSlug="wizardSlug"
34 :setUpType="setUpType"
35 :showLoader="showLoader"
36 :prevStepLink="prevStepLink"
37 :isMrmInstalled="isMrmInstalled"
38 :isMrmActive="isMrmActive"
39 @setPluginSlug="setPluginSlug"
40 @changeSetUpType="changeSetUpType"
41 @changeFunnelType="changeFunnelType"
42 @processSettings="processSettings"
43 />
44 <Builder
45 v-if="step==='builder'"
46 :wizard-slug="wizardSlug"
47 :setUpType="setUpType"
48 :showLoader="showLoader"
49 :prevStepLink="prevStepLink"
50 @setPluginSlug="setPluginSlug"
51 @processSettings="processSettings"
52 />
53 <Permalink
54 v-if="step==='permalink'"
55 :setUpType="setUpType"
56 :showLoader="showLoader"
57 :prevStepLink="prevStepLink"
58 @changeSetUpType="changeSetUpType"
59 @saveFunnelPermalinks="saveFunnelPermalinks"
60 />
61 <Thankyou
62 v-if="step==='thankyou'"
63 :dashboardUrl="dashboardUrl"
64 :wizard-slug="wizardSlug"
65 />
66
67 <div class="skip-wizard" v-if="step !=='thankyou'">
68 <a :href="skipLink">skip setup wizard</a>
69 </div>
70 </div>
71 </div>
72 </template>
73
74 <script>
75 import FunnelType from './FunnelType.vue'
76 import Automation from './Automation.vue'
77 import Builder from './Builder.vue'
78 import Permalink from './Permalink.vue'
79 import Thankyou from './Thankyou.vue'
80 import apiFetch from '@wordpress/api-fetch'
81 var j = jQuery.noConflict()
82 const nonce = window.setup_wizard_obj.nonce
83 apiFetch.use(apiFetch.createNonceMiddleware(nonce))
84
85 export default {
86 name: 'Wizard',
87 components: {
88 FunnelType,
89 Automation,
90 Builder,
91 Permalink,
92 Thankyou
93 },
94 data: function () {
95 return {
96 skipLink: window.setup_wizard_obj.settings_url,
97 step: window.setup_wizard_obj.current_step,
98 pluginSlug: 'woocommerce',
99 steps: window.setup_wizard_obj.steps,
100 wizardSlug: window.setup_wizard_obj.wizard_url,
101 currentStep: window.setup_wizard_obj.current_step,
102 redirectLink: window.setup_wizard_obj.wizard_url + '&step=' + window.setup_wizard_obj.current_step,
103 nextStepLink: window.setup_wizard_obj.next_step_link,
104 prevStepLink: window.setup_wizard_obj.prev_step_link,
105 isWCInstalled: window.setup_wizard_obj.is_woo_installed,
106 isMrmInstalled: window.setup_wizard_obj.is_mrm_installed,
107 isElmInstalled: window.setup_wizard_obj.is_elementor_installed,
108 isFFInstalled: window.setup_wizard_obj.is_ff_installed,
109 isCLInstalled: window.setup_wizard_obj.is_cl_installed,
110 isQBInstalled: window.setup_wizard_obj.is_qb_installed,
111 isLmsInstalled: window.setup_wizard_obj.is_lms_installed === 'yes' ? true :false,
112 isWCActive: window.setup_wizard_obj.is_woo_active,
113 isElmActive: window.setup_wizard_obj.is_elementor_active,
114 isMrmActive: window.setup_wizard_obj.is_mrm_active,
115 isFFActive: window.setup_wizard_obj.is_ff_active,
116 isCLActive: window.setup_wizard_obj.is_cl_active,
117 isQBActive: window.setup_wizard_obj.is_qb_active,
118 dashboardUrl: window.setup_wizard_obj.dashboard_url,
119 funnelType: window.setup_wizard_obj.funnel_type,
120 funnelType: window.setup_wizard_obj.funnel_type,
121 setUpType: 'plugin',
122 isMailMint: false,
123 showLoader: false,
124 isPermitted: false,
125 isLmsPermitted: false,
126
127 }
128 },
129 mounted() {
130 // eslint-disable-next-line no-undef
131 j(document).on('wp-plugin-install-success', this.installSuccess)
132 j(document).on('wp-plugin-install-error', this.installError)
133 // setPluginSlug(this.pluginSlug, isPermitted)
134
135 },
136 methods: {
137 setPluginSlug: function (slug, isPermitted) {
138 if( 'learndash' === slug ){
139 this.isLmsPermitted = isPermitted
140 }else{
141 this.pluginSlug = slug
142 this.isPermitted = isPermitted
143 }
144 },
145 changeSetUpType: function (type) {
146 this.setUpType = type
147 },
148 changeFunnelType: function (type) {
149 this.funnelType = type
150 },
151 processSettings: function (e) {
152 this.showLoader = true;
153 console.log(this.pluginSlug)
154 if( this.pluginSlug === 'woocommerce' ) {
155 this.updateFunnelType();
156 if( this.pluginSlug === 'woocommerce' ){
157 if (this.isWCInstalled === 'yes') {
158
159 this.activateWCPlugins( 'yes', this.isPermitted, this.isLmsPermitted )
160 }
161 if (this.isWCInstalled === 'no') {
162 this.installPlugin('woocommerce')
163 }
164 if (this.isCLInstalled === 'no' && this.isPermitted === true) {
165 this.installPlugin('cart-lift')
166 }
167 }
168 }else if (this.pluginSlug === 'elementor') {
169 this.updateBuilderType('elementor');
170 if (this.isElmInstalled === 'yes') {
171 this.saveFunnelBuilder()
172 } else if (this.isElmActive === 'no') {
173 this.installPlugin('elementor')
174 }
175
176 }else if (this.pluginSlug === 'mail-mint') {
177 if (this.isMrmInstalled === 'yes') {
178 let plugins = [
179 'mail-mint'
180 ];
181 this.activatePlugins(plugins)
182 } else if (this.isMrmActive === 'no') {
183 this.installPlugin('mail-mint')
184 }
185
186 }else if (this.pluginSlug === 'gutenberg') {
187 this.updateBuilderType('gutenberg');
188 if (this.isQBInstalled === 'yes') {
189 this.saveFunnelBuilder()
190 } else if (this.isQBActive === 'no' && this.isPermitted == true) {
191 this.installPlugin('qubely')
192 }else{
193 this.saveFunnelBuilder();
194 window.location.href = this.nextStepLink
195 }
196
197 }else if (this.pluginSlug === 'divi-builder') {
198 this.updateBuilderType('divi-builder');
199 }else if (this.pluginSlug === 'oxygen') {
200 this.updateBuilderType('oxygen');
201 }else {
202 if( this.isLmsPermitted ){
203 this.activateWCPlugins( 'no', false, this.isLmsPermitted )
204 }else{
205 window.location.href = this.nextStepLink
206 }
207 }
208 },
209 activateWCPlugins: function(isWc,permission,islms) {
210 apiFetch({
211 path: `${window.setup_wizard_obj.rest_api_url}wpfunnels/v1/settings/activate_wc_plugins`,
212 method: 'POST',
213 data: {
214 'isWc' : isWc,
215 'permission' : permission,
216 'islms' : islms,
217 },
218 }).then(response => {
219 if(response.success) {
220 this.saveFunnelType()
221 }
222
223 }, error => {
224
225 })
226 },
227 activatePlugins: function(plugins) {
228 this.showLoader = true;
229 apiFetch({
230 path: `${window.setup_wizard_obj.rest_api_url}wpfunnels/v1/settings/activate_mrm_plugins`,
231 method: 'POST',
232 data : { plugins : plugins }
233 }).then(response => {
234 if(response.success) {
235 this.showLoader = false;
236 window.location.href = this.nextStepLink
237 }
238
239 }, error => {
240
241 })
242 },
243 installPlugin: function (pluginSlug) {
244 if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
245 wp.updates.requestFilesystemCredentials(event)
246 $document.on('credential-modal-cancel', function () {
247 var $message = $('.install-now.updating-message')
248 $message
249 .removeClass('updating-message')
250 .text(wp.updates.l10n.installNow)
251 wp.a11y.speak(wp.updates.l10n.updateCancel, 'polite')
252 })
253 }
254 wp.updates.installPlugin({
255 slug: pluginSlug
256 })
257 },
258 installSuccess: function (event, args) {
259 event.preventDefault()
260 let plugin_slug = args.slug
261 if (plugin_slug === 'woocommerce' || plugin_slug === 'cart-lift') {
262 this.activateWCPlugins( 'yes', this.isPermitted, this.isLmsPermitted)
263 } else if (plugin_slug === 'mail-mint' ) {
264 let plugins = [
265 'mail-mint'
266 ];
267 this.activatePlugins( plugins )
268 } else if ( plugin_slug === 'elementor' ) {
269 this.saveFunnelBuilder()
270 } else if (plugin_slug === 'qubely') {
271 this.saveFunnelBuilder()
272 } else if (this.currentStep === 'permalink') {
273 this.saveFunnelPermalinks()
274 }
275
276 },
277 installError: function (event, args) {
278 event.preventDefault()
279 },
280 saveFunnelType: function () {
281 var that = this
282 apiFetch({
283 path: window.setup_wizard_obj.rest_api_url + 'wpfunnels/v1/settings/_wpfunnels_general_settings/funnel_type/',
284 method: 'POST',
285 data: { value: this.pluginSlug, type: 'ignore_activation', slug: this.pluginSlug }
286 }).then(response => {
287 window.location.href = that.nextStepLink
288 }, error => {
289
290 })
291 },
292 updateFunnelType: function () {
293 var that = this
294 apiFetch({
295 path: window.setup_wizard_obj.rest_api_url + 'wpfunnels/v1/settings/update-funnel-type/',
296 method: 'POST',
297 data: { type: this.funnelType }
298 }).then(response => {
299 console.log(response)
300 }, error => {
301
302 })
303 },
304
305 updateBuilderType: function ( builder ) {
306 var that = this
307 apiFetch({
308 path: window.setup_wizard_obj.rest_api_url + 'wpfunnels/v1/settings/update-builder-type/',
309 method: 'POST',
310 data: { builder: builder }
311 }).then(response => {
312 if( this.pluginSlug === 'divi-builder' || this.pluginSlug === 'oxygen' ){
313 window.location.href = that.nextStepLink
314 }
315
316 }, error => {
317
318 })
319 },
320 saveFunnelBuilder: function () {
321 var type = 'plugin_active';
322 apiFetch({
323 path: window.setup_wizard_obj.rest_api_url + 'wpfunnels/v1/settings/_wpfunnels_general_settings/builder/',
324 method: 'POST',
325 data: {
326 value: this.pluginSlug,
327 type: type,
328 slug: this.pluginSlug,
329 permission: this.isPermitted
330 }
331 }).then(response => {
332 window.location.href = this.nextStepLink
333 }, error => {
334 console.log(error)
335 });
336 },
337 saveFunnelPermalinks: function (permalink) {
338 this.showLoader = true;
339 apiFetch({
340 path: window.setup_wizard_obj.rest_api_url + 'wpfunnels/v1/settings/_wpfunnels_permalink_settings/permalink/',
341 method: 'POST',
342 data: {
343 'funnelBase': permalink.funnelBase,
344 'stepBase': permalink.stepBase,
345 'settings': permalink.settings
346 }
347 }).then(response => {
348 window.location.href = this.nextStepLink;
349 this.showLoader = false;
350 }, error => {
351
352 })
353 }
354 }
355 }
356 </script>
357