| 1 |
<template> |
| 2 |
<div class="wpfnl-wizard-welcome"> |
| 3 |
<!-- Heading Section --> |
| 4 |
<div class="wpfnl-wizard-welcome-content"> |
| 5 |
<h2 class="wpfnl-wizard-welcome-title"> |
| 6 |
Let’s boost your WooCommerce revenue |
| 7 |
</h2> |
| 8 |
<p class="wpfnl-wizard-welcome-subtitle"> |
| 9 |
We’ll help you set up your first revenue-boosting funnel in just a few steps. No coding required. |
| 10 |
</p> |
| 11 |
|
| 12 |
<!-- Buttons --> |
| 13 |
<div class="wpfnl-mm-choose-goal-buttons"> |
| 14 |
<div class="wpfnl-mm-btn-group"> |
| 15 |
<button |
| 16 |
class="wpfnl-mm-btn wpfnl-mm-btn-primary" |
| 17 |
@click="handleContinue" |
| 18 |
> |
| 19 |
Start setup |
| 20 |
<svg width="17" height="12" viewBox="0 0 17 12" fill="none" xmlns="http://www.w3.org/2000/svg">> |
| 21 |
<path d="M1 6H16M16 6L11 1M16 6L11 11" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> |
| 22 |
</svg> |
| 23 |
</button> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
|
| 27 |
<!-- Consent Checkbox --> |
| 28 |
<div class="wpfnl-mm-choose-goal-consent"> |
| 29 |
<label class="wpfnl-mm-checkbox"> |
| 30 |
<input type="checkbox" id="consent-checkbox" v-model="agreeToShare" /> |
| 31 |
<span class="wpfnl-mm-checkbox-checkmark"></span> |
| 32 |
<span class="wpfnl-mm-checkbox-label"> |
| 33 |
I agree to share usage data to personalize my experience and improve this product. |
| 34 |
</span> |
| 35 |
</label> |
| 36 |
</div> |
| 37 |
|
| 38 |
<figure class="welcome-image"> |
| 39 |
<img :src="welcomeImage" alt="WPFunnels Setup" width="725" height="388" /> |
| 40 |
</figure> |
| 41 |
</div> |
| 42 |
|
| 43 |
</div> |
| 44 |
</template> |
| 45 |
|
| 46 |
<script> |
| 47 |
import apiFetch from '@wordpress/api-fetch'; |
| 48 |
import Sales from './Icons/Sales.vue'; |
| 49 |
import Leads from './Icons/Leads.vue'; |
| 50 |
export default { |
| 51 |
name: 'Welcome', |
| 52 |
components: { |
| 53 |
Sales, |
| 54 |
Leads, |
| 55 |
}, |
| 56 |
data() { |
| 57 |
return { |
| 58 |
selectedGoal: 'sales', // Default to sales funnel as shown in design |
| 59 |
agreeToShare: true, // Default to checked as shown in design |
| 60 |
welcomeImage: window.setup_wizard_obj.welcome_image, |
| 61 |
contactRequestInFlight: false, |
| 62 |
contactCreated: false, |
| 63 |
} |
| 64 |
}, |
| 65 |
methods: { |
| 66 |
maybeCreateContact() { |
| 67 |
if (!this.agreeToShare || this.contactCreated || this.contactRequestInFlight) { |
| 68 |
return; |
| 69 |
} |
| 70 |
|
| 71 |
const wizardObj = window.setup_wizard_obj || {}; |
| 72 |
const restApiUrl = wizardObj.rest_api_url; |
| 73 |
if (!restApiUrl) { |
| 74 |
return; |
| 75 |
} |
| 76 |
|
| 77 |
const payload = { |
| 78 |
email: wizardObj.admin_email, |
| 79 |
name: wizardObj.admin_name |
| 80 |
}; |
| 81 |
|
| 82 |
this.contactRequestInFlight = true; |
| 83 |
apiFetch({ |
| 84 |
path: `${restApiUrl}wpfunnels/v1/settings/create-contact/`, |
| 85 |
method: 'POST', |
| 86 |
data: payload |
| 87 |
}) |
| 88 |
.then(() => { |
| 89 |
this.contactCreated = true; |
| 90 |
}) |
| 91 |
.catch(error => { |
| 92 |
console.error('Error creating contact:', error); |
| 93 |
}) |
| 94 |
.finally(() => { |
| 95 |
this.contactRequestInFlight = false; |
| 96 |
}); |
| 97 |
}, |
| 98 |
selectGoal(goal) { |
| 99 |
this.selectedGoal = goal; |
| 100 |
}, |
| 101 |
goBack() { |
| 102 |
this.$emit('prev-step'); |
| 103 |
}, |
| 104 |
handleContinue() { |
| 105 |
if (!this.selectedGoal) { |
| 106 |
return; |
| 107 |
} |
| 108 |
|
| 109 |
this.maybeCreateContact(); |
| 110 |
this.proceedToNextStep(); |
| 111 |
}, |
| 112 |
proceedToNextStep() { |
| 113 |
// Emit event or navigate to next step |
| 114 |
this.$emit('next-step', { |
| 115 |
goal: this.selectedGoal, |
| 116 |
agreeToShare: this.agreeToShare |
| 117 |
}); |
| 118 |
}, |
| 119 |
showHelp() { |
| 120 |
// Handle help action |
| 121 |
window.open('https://getwpfunnels.com/docs/', '_blank'); |
| 122 |
} |
| 123 |
} |
| 124 |
} |
| 125 |
</script> |
| 126 |
|