@nuxtify/pages 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +200 -203
  2. package/dist/module.json +4 -4
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/EmailSubscribeForm.vue +133 -156
  5. package/dist/runtime/components/EmailSubscribeForm.vue.d.ts +94 -0
  6. package/dist/runtime/components/FooterCallToAction.vue +32 -34
  7. package/dist/runtime/components/FooterCallToAction.vue.d.ts +2 -0
  8. package/dist/runtime/components/app/AppAnnouncementBar.vue +31 -35
  9. package/dist/runtime/components/app/AppAnnouncementBar.vue.d.ts +2 -0
  10. package/dist/runtime/components/app/AppBar.vue +116 -120
  11. package/dist/runtime/components/app/AppBar.vue.d.ts +2 -0
  12. package/dist/runtime/components/app/AppDialog.vue +34 -36
  13. package/dist/runtime/components/app/AppDialog.vue.d.ts +2 -0
  14. package/dist/runtime/components/app/AppFooter.vue +136 -142
  15. package/dist/runtime/components/app/AppFooter.vue.d.ts +2 -0
  16. package/dist/runtime/components/app/AppLoading.vue +10 -10
  17. package/dist/runtime/components/app/AppLoading.vue.d.ts +2 -0
  18. package/dist/runtime/components/app/AppLogo.vue +26 -40
  19. package/dist/runtime/components/app/AppLogo.vue.d.ts +23 -0
  20. package/dist/runtime/components/app/AppNavigationDrawer.vue +93 -97
  21. package/dist/runtime/components/app/AppNavigationDrawer.vue.d.ts +2 -0
  22. package/dist/runtime/components/app/AppToast.vue +12 -14
  23. package/dist/runtime/components/app/AppToast.vue.d.ts +2 -0
  24. package/dist/runtime/layouts/DefaultLayout.vue +27 -29
  25. package/dist/runtime/layouts/DefaultLayout.vue.d.ts +12 -0
  26. package/dist/runtime/pages/DynamicSlug.vue +17 -19
  27. package/dist/runtime/pages/DynamicSlug.vue.d.ts +2 -0
  28. package/dist/runtime/pages/IndexPage.vue +14 -18
  29. package/dist/runtime/pages/IndexPage.vue.d.ts +2 -0
  30. package/dist/runtime/server/tsconfig.json +3 -3
  31. package/dist/runtime/utils/formRules.d.ts +1 -0
  32. package/dist/runtime/utils/formRules.js +1 -0
  33. package/dist/types.d.mts +2 -2
  34. package/package.json +65 -60
  35. package/dist/module.cjs +0 -5
  36. package/dist/module.d.ts +0 -139
  37. package/dist/types.d.ts +0 -7
@@ -1,213 +1,190 @@
1
- <script setup lang="ts">
2
- // Types
3
- import type { VForm } from 'vuetify/lib/components/VForm/index.mjs'
4
-
5
- import { useId, navigateTo, useDisplay, ref, useNuxtifyConfig, getUtmParams, getBaseUrl, submitFormData, formRules, isExternalUrl,
6
- } from '#imports'
7
-
8
- // Props
1
+ <script setup>
2
+ import {
3
+ useId,
4
+ navigateTo,
5
+ useDisplay,
6
+ ref,
7
+ useNuxtifyConfig,
8
+ getUtmParams,
9
+ getBaseUrl,
10
+ submitFormData,
11
+ formRules,
12
+ isExternalUrl
13
+ } from "#imports";
9
14
  const props = defineProps({
10
15
  submitUrl: {
11
16
  type: String,
12
- required: true,
17
+ required: true
13
18
  },
14
19
  buttonText: {
15
20
  type: String,
16
- default: 'Subscribe',
21
+ default: "Subscribe"
17
22
  },
18
23
  emailPlaceholder: {
19
24
  type: String,
20
- default: 'Enter your best email',
25
+ default: "Enter your best email"
21
26
  },
22
27
  marketingConsentText: {
23
28
  type: String,
24
- default: 'Unsubscribe any time.',
29
+ default: "Unsubscribe any time."
25
30
  },
26
31
  showPrivacy: {
27
32
  type: Boolean,
28
- default: false,
33
+ default: false
29
34
  },
30
35
  redirectUrl: {
31
36
  type: String,
32
- default: '',
37
+ default: ""
33
38
  },
34
39
  thankYouMessage: {
35
40
  type: String,
36
- default: 'Thanks for signing up!',
41
+ default: "Thanks for signing up!"
37
42
  },
38
43
  dark: {
39
44
  type: Boolean,
40
- default: false,
45
+ default: false
41
46
  },
42
47
  appendButtonIcon: {
43
48
  type: String,
44
- default: '',
49
+ default: ""
45
50
  },
46
51
  prependButtonIcon: {
47
52
  type: String,
48
- default: '',
49
- },
50
- })
51
-
52
- // App state
53
- const id = useId()
54
- const nuxtifyConfig = useNuxtifyConfig()
55
- const { xs } = useDisplay()
56
-
57
- // Form state
58
- const form = ref<VForm>()
59
- const isSubmitted = ref(false)
60
- const isError = ref(false)
61
- const errorMessage = ref('')
62
- const loading = ref(false)
53
+ default: ""
54
+ }
55
+ });
56
+ const id = useId();
57
+ const nuxtifyConfig = useNuxtifyConfig();
58
+ const { xs } = useDisplay();
59
+ const form = ref();
60
+ const isSubmitted = ref(false);
61
+ const isError = ref(false);
62
+ const errorMessage = ref("");
63
+ const loading = ref(false);
63
64
  const formInput = ref({
64
- email: '',
65
- })
66
-
67
- // Button style
65
+ email: ""
66
+ });
68
67
  const rounded = () => {
69
68
  if (nuxtifyConfig.style?.btn?.rounded) {
70
- return xs.value ? 'lg' : '0 e-lg'
71
- }
72
- else {
73
- return 0
69
+ return xs.value ? "lg" : "0 e-lg";
70
+ } else {
71
+ return 0;
74
72
  }
75
- }
76
-
73
+ };
77
74
  async function handleSubmit() {
78
- loading.value = true
79
- const res = await form.value?.validate()
75
+ loading.value = true;
76
+ const res = await form.value?.validate();
80
77
  if (res?.valid) {
81
- const formData = new FormData()
82
-
83
- // Get UTM params
84
- const { utmSource, utmMedium, utmCampaign, utmTerm, utmContent }
85
- = getUtmParams(window.location.href)
86
-
87
- // Set form field keys
88
- // Default
89
- let fieldPrepend = ''
90
- let fieldAppend = ''
91
-
92
- // Mailerlite
93
- if (props.submitUrl.includes('mailerlite')) {
94
- fieldPrepend = 'fields['
95
- fieldAppend = ']'
78
+ const formData = new FormData();
79
+ const { utmSource, utmMedium, utmCampaign, utmTerm, utmContent } = getUtmParams(window.location.href);
80
+ let fieldPrepend = "";
81
+ let fieldAppend = "";
82
+ if (props.submitUrl.includes("mailerlite")) {
83
+ fieldPrepend = "fields[";
84
+ fieldAppend = "]";
96
85
  }
97
-
98
- // Set form field values
99
86
  formData.append(
100
87
  `${fieldPrepend}email${fieldAppend}`,
101
- formInput.value.email,
102
- )
88
+ formInput.value.email
89
+ );
103
90
  formData.append(
104
91
  `${fieldPrepend}referrer${fieldAppend}`,
105
- getBaseUrl(window.location.href),
106
- )
107
-
92
+ getBaseUrl(window.location.href)
93
+ );
108
94
  if (utmSource)
109
- formData.append(`${fieldPrepend}utm_source${fieldAppend}`, utmSource)
95
+ formData.append(`${fieldPrepend}utm_source${fieldAppend}`, utmSource);
110
96
  if (utmMedium)
111
- formData.append(`${fieldPrepend}utm_medium${fieldAppend}`, utmMedium)
97
+ formData.append(`${fieldPrepend}utm_medium${fieldAppend}`, utmMedium);
112
98
  if (utmCampaign)
113
- formData.append(`${fieldPrepend}utm_campaign${fieldAppend}`, utmCampaign)
99
+ formData.append(`${fieldPrepend}utm_campaign${fieldAppend}`, utmCampaign);
114
100
  if (utmTerm)
115
- formData.append(`${fieldPrepend}utm_term${fieldAppend}`, utmTerm)
101
+ formData.append(`${fieldPrepend}utm_term${fieldAppend}`, utmTerm);
116
102
  if (utmContent)
117
- formData.append(`${fieldPrepend}utm_content${fieldAppend}`, utmContent)
118
-
119
- // Send to email provider
120
- const providerResponse = await submitFormData(props.submitUrl, formData)
121
- isError.value = providerResponse.isError
122
- errorMessage.value = providerResponse.errorMessage
123
-
124
- // Redirect
103
+ formData.append(`${fieldPrepend}utm_content${fieldAppend}`, utmContent);
104
+ const providerResponse = await submitFormData(props.submitUrl, formData);
105
+ isError.value = providerResponse.isError;
106
+ errorMessage.value = providerResponse.errorMessage;
125
107
  if (!isError.value && props.redirectUrl) {
126
108
  await navigateTo(props.redirectUrl, {
127
- external: isExternalUrl(props.redirectUrl, nuxtifyConfig.brand?.domain ?? ''),
128
- })
129
- }
130
- else {
131
- isSubmitted.value = providerResponse.isSubmitted
109
+ external: isExternalUrl(props.redirectUrl, nuxtifyConfig.brand?.domain ?? "")
110
+ });
111
+ } else {
112
+ isSubmitted.value = providerResponse.isSubmitted;
132
113
  }
133
114
  }
134
- loading.value = false
115
+ loading.value = false;
135
116
  }
136
117
  </script>
137
118
 
138
119
  <template>
139
- <!-- Form -->
140
- <v-form
141
- v-if="!isSubmitted"
142
- ref="form"
143
- validate-on="submit"
144
- @submit.prevent="handleSubmit"
145
- >
146
- <div class="d-sm-flex justify-center">
147
- <!-- Using useId prevents hydration mismatch warnings issue with Vuetify -->
148
- <!-- See: https://github.com/vuetifyjs/vuetify/issues/19696 -->
149
- <!-- Once the issue is resolved (and it's used internally in Vuetify), remove use of useId -->
150
- <v-text-field
151
- :id
152
- v-model="formInput.email"
153
- type="email"
154
- color="secondary"
155
- :placeholder="emailPlaceholder"
156
- :rules="[formRules.required, formRules.validEmail]"
157
- :rounded="xs ? 't-lg' : '0 ts-lg'"
158
- hide-details="auto"
159
- class="text-start"
160
- >
161
- <template #message="{ message }">
162
- <span :class="dark ? 'text-red-lighten-3' : ''">{{ message }}</span>
163
- </template>
164
- </v-text-field>
165
- <v-btn
166
- type="submit"
167
- variant="flat"
168
- color="secondary"
169
- size="x-large"
170
- class="d-flex align-center py-7 mt-2 mt-sm-0"
171
- :loading
172
- :rounded="rounded()"
173
- :append-icon="appendButtonIcon"
174
- :prepend-icon="prependButtonIcon"
175
- :block="xs"
176
- >
177
- {{ buttonText }}
178
- </v-btn>
179
- </div>
180
-
181
- <!-- Supporting Text -->
182
- <div
183
- v-if="showPrivacy || marketingConsentText"
184
- :class="`text-body-2 ${
185
- dark ? 'text-grey-lighten-2' : 'text-medium-emphasis'
186
- } mt-2`"
187
- >
188
- <span v-if="marketingConsentText">
189
- {{ marketingConsentText }}
190
- </span>
191
- <span v-if="showPrivacy">
192
- By signing up you agree to the
193
- <NuxtLink
194
- :to="nuxtifyConfig.pages?.policies?.privacyUrl"
195
- :class="`text-decoration-none ${
196
- dark ? 'text-grey-lighten-2' : 'text-medium-emphasis'
197
- }`"
198
- >
199
- Privacy Policy</NuxtLink>.
200
- </span>
201
- </div>
202
- </v-form>
203
-
204
- <!-- Thank You -->
205
- <div
206
- v-else
207
- class="text-body-1"
208
- >
209
- {{ thankYouMessage }}
210
- </div>
120
+ <!-- Form -->
121
+ <v-form
122
+ v-if="!isSubmitted"
123
+ ref="form"
124
+ validate-on="submit"
125
+ @submit.prevent="handleSubmit"
126
+ >
127
+ <div class="d-sm-flex justify-center">
128
+ <!-- Using useId prevents hydration mismatch warnings issue with Vuetify -->
129
+ <!-- See: https://github.com/vuetifyjs/vuetify/issues/19696 -->
130
+ <!-- Once the issue is resolved (and it's used internally in Vuetify), remove use of useId -->
131
+ <v-text-field
132
+ :id
133
+ v-model="formInput.email"
134
+ type="email"
135
+ color="secondary"
136
+ :placeholder="emailPlaceholder"
137
+ :rules="[formRules.required, formRules.validEmail]"
138
+ :rounded="xs ? 't-lg' : '0 ts-lg'"
139
+ hide-details="auto"
140
+ class="text-start"
141
+ >
142
+ <template #message="{ message }">
143
+ <span :class="dark ? 'text-red-lighten-3' : ''">{{ message }}</span>
144
+ </template>
145
+ </v-text-field>
146
+ <v-btn
147
+ type="submit"
148
+ variant="flat"
149
+ color="secondary"
150
+ size="x-large"
151
+ class="d-flex align-center py-7 mt-2 mt-sm-0"
152
+ :loading
153
+ :rounded="rounded()"
154
+ :append-icon="appendButtonIcon"
155
+ :prepend-icon="prependButtonIcon"
156
+ :block="xs"
157
+ >
158
+ {{ buttonText }}
159
+ </v-btn>
160
+ </div>
161
+
162
+ <!-- Supporting Text -->
163
+ <div
164
+ v-if="showPrivacy || marketingConsentText"
165
+ :class="`text-body-2 ${dark ? 'text-grey-lighten-2' : 'text-medium-emphasis'} mt-2`"
166
+ >
167
+ <span v-if="marketingConsentText">
168
+ {{ marketingConsentText }}
169
+ </span>
170
+ <span v-if="showPrivacy">
171
+ By signing up you agree to the
172
+ <NuxtLink
173
+ :to="nuxtifyConfig.pages?.policies?.privacyUrl"
174
+ :class="`text-decoration-none ${dark ? 'text-grey-lighten-2' : 'text-medium-emphasis'}`"
175
+ >
176
+ Privacy Policy</NuxtLink>.
177
+ </span>
178
+ </div>
179
+ </v-form>
180
+
181
+ <!-- Thank You -->
182
+ <div
183
+ v-else
184
+ class="text-body-1"
185
+ >
186
+ {{ thankYouMessage }}
187
+ </div>
211
188
  </template>
212
189
 
213
190
  <style scoped>
@@ -0,0 +1,94 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ submitUrl: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ buttonText: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ emailPlaceholder: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ marketingConsentText: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ showPrivacy: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ redirectUrl: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ thankYouMessage: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ dark: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ appendButtonIcon: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ prependButtonIcon: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
43
+ submitUrl: {
44
+ type: StringConstructor;
45
+ required: true;
46
+ };
47
+ buttonText: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
51
+ emailPlaceholder: {
52
+ type: StringConstructor;
53
+ default: string;
54
+ };
55
+ marketingConsentText: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ };
59
+ showPrivacy: {
60
+ type: BooleanConstructor;
61
+ default: boolean;
62
+ };
63
+ redirectUrl: {
64
+ type: StringConstructor;
65
+ default: string;
66
+ };
67
+ thankYouMessage: {
68
+ type: StringConstructor;
69
+ default: string;
70
+ };
71
+ dark: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ appendButtonIcon: {
76
+ type: StringConstructor;
77
+ default: string;
78
+ };
79
+ prependButtonIcon: {
80
+ type: StringConstructor;
81
+ default: string;
82
+ };
83
+ }>> & Readonly<{}>, {
84
+ buttonText: string;
85
+ emailPlaceholder: string;
86
+ marketingConsentText: string;
87
+ showPrivacy: boolean;
88
+ redirectUrl: string;
89
+ thankYouMessage: string;
90
+ dark: boolean;
91
+ appendButtonIcon: string;
92
+ prependButtonIcon: string;
93
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
94
+ export default _default;
@@ -1,38 +1,36 @@
1
- <script setup lang="ts">
2
- import { useNuxtifyConfig } from '#imports'
3
-
4
- // App state
5
- const nuxtifyConfig = useNuxtifyConfig()
1
+ <script setup>
2
+ import { useNuxtifyConfig } from "#imports";
3
+ const nuxtifyConfig = useNuxtifyConfig();
6
4
  </script>
7
5
 
8
6
  <template>
9
- <v-row
10
- justify="center"
11
- class="text-center my-4"
12
- >
13
- <v-col
14
- cols="12"
15
- md="7"
16
- lg="6"
17
- xl="4"
18
- >
19
- <div
20
- v-if="nuxtifyConfig.footer?.cta?.title"
21
- :class="`text-h5 text-${nuxtifyConfig.footer.cta.color}-lighten-4`"
22
- >
23
- {{ nuxtifyConfig.footer.cta.title }}
24
- </div>
25
- <div
26
- v-if="nuxtifyConfig.footer?.cta?.subtitle"
27
- :class="`text-subtitle-1 text-${nuxtifyConfig.footer.cta.color}-lighten-3 mb-4`"
28
- >
29
- {{ nuxtifyConfig.footer.cta.subtitle }}
30
- </div>
31
- <EmailSubscribeForm
32
- v-if="nuxtifyConfig.email?.provider?.defaultSubmitUrl"
33
- :submit-url="nuxtifyConfig.email.provider.defaultSubmitUrl"
34
- dark
35
- />
36
- </v-col>
37
- </v-row>
7
+ <v-row
8
+ justify="center"
9
+ class="text-center my-4"
10
+ >
11
+ <v-col
12
+ cols="12"
13
+ md="7"
14
+ lg="6"
15
+ xl="4"
16
+ >
17
+ <div
18
+ v-if="nuxtifyConfig.footer?.cta?.title"
19
+ :class="`text-h5 text-${nuxtifyConfig.footer.cta.color}-lighten-4`"
20
+ >
21
+ {{ nuxtifyConfig.footer.cta.title }}
22
+ </div>
23
+ <div
24
+ v-if="nuxtifyConfig.footer?.cta?.subtitle"
25
+ :class="`text-subtitle-1 text-${nuxtifyConfig.footer.cta.color}-lighten-3 mb-4`"
26
+ >
27
+ {{ nuxtifyConfig.footer.cta.subtitle }}
28
+ </div>
29
+ <EmailSubscribeForm
30
+ v-if="nuxtifyConfig.email?.provider?.defaultSubmitUrl"
31
+ :submit-url="nuxtifyConfig.email.provider.defaultSubmitUrl"
32
+ dark
33
+ />
34
+ </v-col>
35
+ </v-row>
38
36
  </template>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,40 +1,36 @@
1
- <script setup lang="ts">
2
- import { useDisplay, computed, useNuxtifyConfig, isExternalUrl } from '#imports'
3
-
4
- // App state
5
- const nuxtifyConfig = useNuxtifyConfig()
6
- const { xs } = useDisplay()
7
-
8
- // Component state
9
- const isExternalLink = computed(() =>
10
- isExternalUrl(nuxtifyConfig.announcement?.buttonUrl ?? '', nuxtifyConfig.brand?.domain ?? ''),
11
- )
1
+ <script setup>
2
+ import { useDisplay, computed, useNuxtifyConfig, isExternalUrl } from "#imports";
3
+ const nuxtifyConfig = useNuxtifyConfig();
4
+ const { xs } = useDisplay();
5
+ const isExternalLink = computed(
6
+ () => isExternalUrl(nuxtifyConfig.announcement?.buttonUrl ?? "", nuxtifyConfig.brand?.domain ?? "")
7
+ );
12
8
  </script>
13
9
 
14
10
  <template>
15
- <v-system-bar
16
- :height="xs ? 60 : 40"
17
- :order="-100"
18
- color="primary"
19
- class="justify-center text-start"
20
- >
21
- <div
22
- v-if="nuxtifyConfig.announcement?.message"
23
- :class="`${xs ? 'text-subtitle-2' : 'text-subtitle-1'} mr-4`"
24
- >
25
- {{ nuxtifyConfig.announcement.message }}
26
- </div>
27
- <v-btn
11
+ <v-system-bar
12
+ :height="xs ? 60 : 40"
13
+ :order="-100"
14
+ color="primary"
15
+ class="justify-center text-start"
16
+ >
17
+ <div
18
+ v-if="nuxtifyConfig.announcement?.message"
19
+ :class="`${xs ? 'text-subtitle-2' : 'text-subtitle-1'} mr-4`"
20
+ >
21
+ {{ nuxtifyConfig.announcement.message }}
22
+ </div>
23
+ <v-btn
28
24
  v-if="
29
- nuxtifyConfig.announcement?.buttonText && nuxtifyConfig.announcement.buttonUrl
30
- "
31
- :to="!isExternalLink ? nuxtifyConfig.announcement.buttonUrl : undefined"
32
- :href="isExternalLink ? nuxtifyConfig.announcement.buttonUrl : undefined"
33
- size="small"
34
- variant="flat"
35
- color="secondary"
36
- >
37
- {{ nuxtifyConfig.announcement.buttonText }}
38
- </v-btn>
39
- </v-system-bar>
25
+ nuxtifyConfig.announcement?.buttonText && nuxtifyConfig.announcement.buttonUrl
26
+ "
27
+ :to="!isExternalLink ? nuxtifyConfig.announcement.buttonUrl : void 0"
28
+ :href="isExternalLink ? nuxtifyConfig.announcement.buttonUrl : void 0"
29
+ size="small"
30
+ variant="flat"
31
+ color="secondary"
32
+ >
33
+ {{ nuxtifyConfig.announcement.buttonText }}
34
+ </v-btn>
35
+ </v-system-bar>
40
36
  </template>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;