PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.1
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.1
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / frontend / vue / views / WelcomeView.vue
hostinger-reach / frontend / vue / views Last commit date
OverviewView.vue 3 months ago WelcomeView.vue 1 month ago
WelcomeView.vue
92 lines
1 <script setup lang="ts">
2 import { onMounted, ref } from 'vue';
3
4 import FAQ from '@/components/FAQ.vue';
5 import Hero from '@/components/Hero.vue';
6 import { useModal } from '@/composables/useModal';
7 import { useToast } from '@/composables/useToast';
8 import { connectFaqData } from '@/data/faq';
9 import { reachRepo } from '@/data/repositories/reachRepo';
10 import { ModalName } from '@/types/enums/modalEnum';
11 import { translate } from '@/utils/translate';
12
13 const TRUSTED_AUTH_DOMAINS = /^https:\/\/auth\.hostinger\.(dev|com)/;
14
15 const { showError } = useToast();
16
17 const isConnectedToAnotherSite = ref(false);
18 const isButtonLoading = ref(false);
19 const { openModal } = useModal();
20 const domain = window.location.hostname;
21
22 const handleGetStarted = async () => {
23 isButtonLoading.value = true;
24
25 const [data, error] = await reachRepo.generateAuthUrl();
26
27 isButtonLoading.value = false;
28
29 if (error || !data) {
30 showError(error?.message || translate('hostinger_reach_error_message'));
31
32 return;
33 }
34
35 if (data.authUrl && TRUSTED_AUTH_DOMAINS.test(data.authUrl)) {
36 window.location.href = data.authUrl;
37 } else {
38 showError(translate('hostinger_reach_error_message'));
39 }
40 };
41
42 const openApiKeyModal = (apiKey: string = '') => {
43 openModal(ModalName.REACH_API_KEY_MODAL, { apiKey }, { hasCloseButton: true, isXL: true });
44 };
45
46 onMounted(() => {
47 const params = new URLSearchParams(window.location.search);
48 const key = params.get('api_key');
49
50 if (key !== null) {
51 openApiKeyModal();
52 }
53 });
54 </script>
55
56 <template>
57 <div class="welcome-view">
58 <Hero
59 :is-connected-to-another-site="isConnectedToAnotherSite"
60 :is-button-loading="isButtonLoading"
61 :domain="domain"
62 :on-get-started="handleGetStarted"
63 :on-manual-api-key-click="() => openApiKeyModal()"
64 />
65 <div class="faq-wrap">
66 <FAQ :faq-data="connectFaqData" />
67 </div>
68 </div>
69 </template>
70
71 <style scoped lang="scss">
72 .welcome-view {
73 min-height: 100vh;
74 padding: 0 16px;
75
76 @media (max-width: 480px) {
77 padding: 0 12px;
78 }
79 }
80
81 @media (max-width: 320px) {
82 .welcome-view {
83 padding: 0 8px;
84 }
85 }
86
87 .faq-wrap {
88 max-width: 780px;
89 margin: 24px auto;
90 }
91 </style>
92