@nuxt/scripts 0.1.12 → 0.3.0
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.
- package/README.md +10 -200
- package/dist/client/200.html +63 -54
- package/dist/client/404.html +63 -54
- package/dist/client/_nuxt/8T3kBMJO.js +31 -0
- package/dist/client/_nuxt/B5NHDIr7.js +353 -0
- package/dist/client/_nuxt/{Bz4xi2rU.js → B6ZnTe72.js} +1 -1
- package/dist/client/_nuxt/{B6nY7VDA.js → B6bHXiXE.js} +1 -1
- package/dist/client/_nuxt/BAMIS8DD.js +1 -0
- package/dist/client/_nuxt/{A1WiD9SJ.js → BGq4KZyx.js} +1 -1
- package/dist/client/_nuxt/BVGdgKAv.js +1 -0
- package/dist/client/_nuxt/{wORFcijT.js → BXR915QZ.js} +1 -1
- package/dist/client/_nuxt/{DCj4DH6i.js → BYdKNJ10.js} +1 -1
- package/dist/client/_nuxt/BZfs-ost.js +1 -0
- package/dist/client/_nuxt/{DCdPDLy4.js → BacI6-DX.js} +1 -1
- package/dist/client/_nuxt/{DCk2z-Tu.js → BdfWgkoX.js} +1 -1
- package/dist/client/_nuxt/BscxmKrE.js +8 -0
- package/dist/client/_nuxt/C3qJFuQy.js +3 -0
- package/dist/client/_nuxt/C6XIsc4F.js +1 -0
- package/dist/client/_nuxt/C9UBdavN.js +1 -0
- package/dist/client/_nuxt/CA9nliXM.js +1 -0
- package/dist/client/_nuxt/CDJL3WWm.js +1 -0
- package/dist/client/_nuxt/{BsfQk1vf.js → CEfge3mM.js} +1 -1
- package/dist/client/_nuxt/{CQTpvb7m.js → CHCTrc3a.js} +1 -1
- package/dist/client/_nuxt/{DZ3fVoEH.js → CSPeAESR.js} +1 -1
- package/dist/client/_nuxt/CX2EUjC8.js +301 -0
- package/dist/client/_nuxt/{DCAtC51B.js → CarfVElc.js} +1 -1
- package/dist/client/_nuxt/{BgBwMnrY.js → CcYwH0AH.js} +1 -1
- package/dist/client/_nuxt/Cgl53LJQ.js +1 -0
- package/dist/client/_nuxt/{RgJsN3zu.js → ChMCFiS0.js} +1 -1
- package/dist/client/_nuxt/{CW3w6uup.js → CovTDKFE.js} +1 -1
- package/dist/client/_nuxt/{DfUNg_8t.js → CqYeW6XZ.js} +1 -1
- package/dist/client/_nuxt/{CL7Ixq1B.js → CrgTADc5.js} +1 -1
- package/dist/client/_nuxt/CuJfdYLG.js +1 -0
- package/dist/client/_nuxt/CudBhkk3.js +1 -0
- package/dist/client/_nuxt/D71BffLY.js +1 -0
- package/dist/client/_nuxt/{7fd6vGzb.js → DBeuZS66.js} +1 -1
- package/dist/client/_nuxt/{Bd7iooY8.js → DGDuLtS6.js} +1 -1
- package/dist/client/_nuxt/{j8KhMG0x.js → DGxQkqYo.js} +1 -1
- package/dist/client/_nuxt/DIt5FBMJ.js +1 -0
- package/dist/client/_nuxt/DOakR0z3.js +1 -0
- package/dist/client/_nuxt/{CUVblut_.js → DR5YgmI2.js} +1 -1
- package/dist/client/_nuxt/DS9ZWoKD.js +1 -0
- package/dist/client/_nuxt/{D-pQtGOP.js → DVLwECkk.js} +1 -1
- package/dist/client/_nuxt/DZLoTQm4.js +1 -0
- package/dist/client/_nuxt/{ZQC2c-5V.js → D_T9yQUo.js} +3 -3
- package/dist/client/_nuxt/Db2-y2xY.js +1 -0
- package/dist/client/_nuxt/{CRWwmX0L.js → Di3qjVs2.js} +1 -1
- package/dist/client/_nuxt/{DXpYegZJ.js → Djqq6n-7.js} +1 -1
- package/dist/client/_nuxt/Dkb1Nx48.js +1 -0
- package/dist/client/_nuxt/{BBv1LFm6.js → DtT2Dbx_.js} +1 -1
- package/dist/client/_nuxt/{DywwDckn.js → Du6_OKDb.js} +1 -1
- package/dist/client/_nuxt/{IHMnEr_d.js → G-Jz5hiA.js} +1 -1
- package/dist/client/_nuxt/HrnDn_2Q.js +1 -0
- package/dist/client/_nuxt/{CPHkTjfH.js → JgH_6NEN.js} +1 -1
- package/dist/client/_nuxt/Ksn5IXup.js +1 -0
- package/dist/client/_nuxt/{wPLeKH6q.js → Lpdzc9s2.js} +1 -1
- package/dist/client/_nuxt/{DggdVF2v.js → V_y36BGi.js} +1 -1
- package/dist/client/_nuxt/{BILqrcpa.js → YdT6Gj0u.js} +1 -1
- package/dist/client/_nuxt/alpzPJ78.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/ccc94de9-89fa-400b-88f2-8fc2599e191f.json +1 -0
- package/dist/client/_nuxt/{Bdb36Id5.js → dIHJ9UdL.js} +1 -1
- package/dist/client/_nuxt/error-404.BRldFSII.css +1 -0
- package/dist/client/_nuxt/error-500.D8yw_IbC.css +1 -0
- package/dist/client/_nuxt/o5b8QYQO.js +3 -0
- package/dist/client/_nuxt/{doGI2cFk.js → wKgfcFVx.js} +1 -1
- package/dist/client/index.html +63 -54
- package/dist/module.d.mts +2 -6
- package/dist/module.d.ts +2 -6
- package/dist/module.json +6 -2
- package/dist/module.mjs +68 -137
- package/dist/registry.d.mts +13 -0
- package/dist/registry.d.ts +13 -0
- package/dist/registry.mjs +214 -0
- package/dist/runtime/components/GoogleMaps.vue +130 -0
- package/dist/runtime/components/LemonSqueezyButton.vue +28 -0
- package/dist/runtime/components/StripePricingTableEmbed.vue +33 -0
- package/dist/runtime/components/VimeoEmbed.vue +161 -0
- package/dist/runtime/components/YouTubeEmbed.vue +79 -0
- package/dist/runtime/composables/createConsentScriptTrigger.d.ts +6 -0
- package/dist/runtime/composables/{createScriptConsentTrigger.mjs → createConsentScriptTrigger.mjs} +1 -1
- package/dist/runtime/composables/useAnalyticsPageEvent.d.ts +4 -1
- package/dist/runtime/composables/useElementScriptTrigger.d.ts +3 -0
- package/dist/runtime/composables/useElementScriptTrigger.mjs +9 -0
- package/dist/runtime/composables/useScript.d.ts +2 -2
- package/dist/runtime/composables/useScript.mjs +1 -2
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +11 -7
- package/dist/runtime/registry/cloudflare-web-analytics.mjs +16 -18
- package/dist/runtime/registry/facebook-pixel.d.ts +6 -5
- package/dist/runtime/registry/facebook-pixel.mjs +15 -17
- package/dist/runtime/registry/fathom-analytics.d.ts +39 -14
- package/dist/runtime/registry/fathom-analytics.mjs +40 -21
- package/dist/runtime/registry/google-analytics.d.ts +21 -1
- package/dist/runtime/registry/google-analytics.mjs +30 -3
- package/dist/runtime/registry/google-maps.d.ts +23 -1
- package/dist/runtime/registry/google-maps.mjs +40 -3
- package/dist/runtime/registry/google-tag-manager.d.ts +21 -1
- package/dist/runtime/registry/google-tag-manager.mjs +29 -3
- package/dist/runtime/registry/hotjar.d.ts +5 -3
- package/dist/runtime/registry/hotjar.mjs +14 -18
- package/dist/runtime/registry/intercom.d.ts +5 -3
- package/dist/runtime/registry/intercom.mjs +19 -16
- package/dist/runtime/registry/lemon-squeezy.d.ts +68 -0
- package/dist/runtime/registry/lemon-squeezy.mjs +21 -0
- package/dist/runtime/registry/matomo-analytics.d.ts +24 -0
- package/dist/runtime/registry/matomo-analytics.mjs +33 -0
- package/dist/runtime/registry/npm.d.ts +7 -3
- package/dist/runtime/registry/npm.mjs +10 -11
- package/dist/runtime/registry/plausible-analytics.d.ts +22 -0
- package/dist/runtime/registry/plausible-analytics.mjs +35 -0
- package/dist/runtime/registry/segment.d.ts +5 -3
- package/dist/runtime/registry/segment.mjs +34 -34
- package/dist/runtime/registry/stripe.d.ts +18 -0
- package/dist/runtime/registry/stripe.mjs +27 -0
- package/dist/runtime/registry/vimeo-player.d.ts +15 -0
- package/dist/runtime/registry/vimeo-player.mjs +45 -0
- package/dist/runtime/registry/x-pixel.d.ts +41 -0
- package/dist/runtime/registry/x-pixel.mjs +28 -0
- package/dist/runtime/registry/youtube-iframe.d.ts +15 -0
- package/dist/runtime/registry/youtube-iframe.mjs +54 -0
- package/dist/runtime/types.d.ts +31 -17
- package/dist/runtime/utils.d.ts +16 -1
- package/dist/runtime/utils.mjs +30 -1
- package/package.json +40 -25
- package/dist/client/_nuxt/BG_OyJVq.js +0 -1
- package/dist/client/_nuxt/BIMuYTWL.js +0 -3
- package/dist/client/_nuxt/BSyl5yf0.js +0 -1
- package/dist/client/_nuxt/BswfO-CF.js +0 -1
- package/dist/client/_nuxt/C3YqBJkQ.js +0 -1
- package/dist/client/_nuxt/CGQbO34C.js +0 -1
- package/dist/client/_nuxt/CKtB_0Vj.js +0 -36
- package/dist/client/_nuxt/CrjQeCwm.js +0 -1
- package/dist/client/_nuxt/D4LhxNOI.js +0 -1
- package/dist/client/_nuxt/D4k753MY.js +0 -1
- package/dist/client/_nuxt/D75a3hZQ.js +0 -1
- package/dist/client/_nuxt/DnhXxWz-.js +0 -1
- package/dist/client/_nuxt/DzPyIVdT.js +0 -9
- package/dist/client/_nuxt/TQ9oWRfF.js +0 -1
- package/dist/client/_nuxt/WoBtJUue.js +0 -1
- package/dist/client/_nuxt/bmJ2objS.js +0 -1
- package/dist/client/_nuxt/builds/meta/7bb27f9d-e4a9-494c-83a3-01bc2df7d17d.json +0 -1
- package/dist/client/_nuxt/error-404.ORekjfyJ.css +0 -1
- package/dist/client/_nuxt/error-500.BIuFL0tW.css +0 -1
- package/dist/client/_nuxt/yr0V4Txy.js +0 -1
- package/dist/runtime/composables/createScriptConsentTrigger.d.ts +0 -6
- package/dist/runtime/composables/validateScriptInputSchema.d.ts +0 -2
- package/dist/runtime/composables/validateScriptInputSchema.mjs +0 -14
- package/dist/runtime/registry/cloudflare-turnstile.d.ts +0 -1
- package/dist/runtime/registry/cloudflare-turnstile.mjs +0 -4
- package/dist/runtime/registry/confetti.d.ts +0 -23
- package/dist/runtime/registry/confetti.mjs +0 -15
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import type YT from 'youtube'
|
|
4
|
+
import type { ElementScriptTrigger } from '../composables/useElementScriptTrigger'
|
|
5
|
+
import { useElementScriptTrigger, useScriptYouTubeIframe } from '#imports'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<{
|
|
8
|
+
trigger?: ElementScriptTrigger
|
|
9
|
+
videoId: string
|
|
10
|
+
playerVars?: YT.PlayerVars
|
|
11
|
+
width?: number
|
|
12
|
+
height?: number
|
|
13
|
+
}>(), {
|
|
14
|
+
playerVars: { autoplay: 1, playsinline: 1 },
|
|
15
|
+
width: 640,
|
|
16
|
+
height: 480,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const emits = defineEmits<{
|
|
20
|
+
onReady: [e: YT.PlayerEvent]
|
|
21
|
+
onStateChange: [e: YT.PlayerEvent]
|
|
22
|
+
onPlaybackQualityChange: [e: YT.PlayerEvent]
|
|
23
|
+
onPlaybackRateChange: [e: YT.PlayerEvent]
|
|
24
|
+
onError: [e: YT.PlayerEvent]
|
|
25
|
+
onApiChange: [e: YT.PlayerEvent]
|
|
26
|
+
}>()
|
|
27
|
+
const events: (keyof YT.Events)[] = [
|
|
28
|
+
'onReady',
|
|
29
|
+
'onStateChange',
|
|
30
|
+
'onPlaybackQualityChange',
|
|
31
|
+
'onPlaybackRateChange',
|
|
32
|
+
'onError',
|
|
33
|
+
'onApiChange',
|
|
34
|
+
]
|
|
35
|
+
const elYoutube = ref()
|
|
36
|
+
|
|
37
|
+
const ready = ref(false)
|
|
38
|
+
const { $script } = useScriptYouTubeIframe({
|
|
39
|
+
scriptOptions: {
|
|
40
|
+
trigger: useElementScriptTrigger(props.trigger, elYoutube.value),
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
let player: YT.Player
|
|
45
|
+
$script.then(async (instance) => {
|
|
46
|
+
const YT = await instance.YT
|
|
47
|
+
await new Promise<void>((resolve) => {
|
|
48
|
+
if (typeof YT.Player === 'undefined')
|
|
49
|
+
YT.ready(resolve)
|
|
50
|
+
else
|
|
51
|
+
resolve()
|
|
52
|
+
})
|
|
53
|
+
player = new YT.Player(elYoutube.value, {
|
|
54
|
+
...props,
|
|
55
|
+
events: Object.fromEntries(events.map(event => [event, (e: any) => {
|
|
56
|
+
// @ts-expect-error untyped
|
|
57
|
+
emits(event, e)
|
|
58
|
+
}])),
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
defineExpose({
|
|
63
|
+
player,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
watch(() => props.videoId, () => {
|
|
67
|
+
player?.loadVideoById(props.videoId)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const poster = computed(() => `https://i.ytimg.com/vi_webp/${props.videoId}/sddefault.webp`)
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<div ref="elYoutube" :style="{ width: `${width}px`, height: `${height}px`, position: 'relative' }">
|
|
75
|
+
<slot :poster="poster">
|
|
76
|
+
<img v-if="!ready" :src="poster" title="" :width="width" :height="height">
|
|
77
|
+
</slot>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
package/dist/runtime/composables/{createScriptConsentTrigger.mjs → createConsentScriptTrigger.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isRef, onNuxtReady, ref, requestIdleCallback, toValue, tryUseNuxtApp, watch } from "#imports";
|
|
2
|
-
export function
|
|
2
|
+
export function createConsentScriptTrigger(options) {
|
|
3
3
|
if (import.meta.server)
|
|
4
4
|
return new Promise(() => {
|
|
5
5
|
});
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { TrackedPage } from '#nuxt-scripts';
|
|
2
|
-
export declare function useAnalyticsPageEvent(onChange?: (payload: TrackedPage) => void):
|
|
2
|
+
export declare function useAnalyticsPageEvent(onChange?: (payload: TrackedPage) => void): import("#imports").Ref<{
|
|
3
|
+
title?: string | undefined;
|
|
4
|
+
path: string;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useElementHover, useElementVisibility, watchOnce } from "@vueuse/core";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
export function useElementScriptTrigger(trigger, el) {
|
|
4
|
+
if (import.meta.server || !el)
|
|
5
|
+
return new Promise(() => {
|
|
6
|
+
});
|
|
7
|
+
const activeRef = trigger ? trigger === "mouseover" ? useElementHover(el) : useElementVisibility(el) : ref(false);
|
|
8
|
+
return trigger ? new Promise((resolve) => watchOnce([activeRef], () => resolve())) : Promise.resolve();
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type UseScriptInput, type VueScriptInstance } from '@unhead/vue';
|
|
2
2
|
import type { NuxtUseScriptOptions } from '#nuxt-scripts';
|
|
3
|
-
export declare function useScript<T
|
|
4
|
-
$script: VueScriptInstance<T>;
|
|
3
|
+
export declare function useScript<T extends Record<string | symbol, any>>(input: UseScriptInput, options?: NuxtUseScriptOptions): T & {
|
|
4
|
+
$script: VueScriptInstance<T> & Promise<T>;
|
|
5
5
|
};
|
|
@@ -6,11 +6,10 @@ export function useScript(input, options) {
|
|
|
6
6
|
input = typeof input === "string" ? { src: input } : input;
|
|
7
7
|
options = defu(options, useRuntimeConfig().public["nuxt-scripts"]?.defaultScriptOptions);
|
|
8
8
|
if (options.trigger === "onNuxtReady")
|
|
9
|
-
options.trigger =
|
|
9
|
+
options.trigger = onNuxtReady;
|
|
10
10
|
const nuxtApp = useNuxtApp();
|
|
11
11
|
const id = input.key || input.src || hashCode(typeof input.innerHTML === "string" ? input.innerHTML : "");
|
|
12
12
|
if (!nuxtApp.scripts?.[id]) {
|
|
13
|
-
options.beforeInit?.();
|
|
14
13
|
if (import.meta.client) {
|
|
15
14
|
performance?.mark?.("mark_feature_usage", {
|
|
16
15
|
detail: {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
|
+
/**
|
|
3
|
+
* Sample:
|
|
4
|
+
* <!-- Cloudflare Web Analytics -->
|
|
5
|
+
* <script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "12ee46bf598b45c2868bbc07a3073f58"}'></script>
|
|
6
|
+
* <!-- End Cloudflare Web Analytics -->
|
|
7
|
+
*/
|
|
3
8
|
export interface CloudflareWebAnalyticsApi {
|
|
4
9
|
__cfBeacon: {
|
|
5
10
|
load: 'single';
|
|
6
11
|
spa: boolean;
|
|
7
12
|
token: string;
|
|
8
13
|
};
|
|
9
|
-
__cfRl?: unknown;
|
|
10
14
|
}
|
|
11
15
|
declare global {
|
|
12
16
|
interface Window extends CloudflareWebAnalyticsApi {
|
|
@@ -15,8 +19,6 @@ declare global {
|
|
|
15
19
|
export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
16
20
|
/**
|
|
17
21
|
* The Cloudflare Web Analytics token.
|
|
18
|
-
*
|
|
19
|
-
* Required when used for the first time.
|
|
20
22
|
*/
|
|
21
23
|
token: import("valibot").StringSchema<string>;
|
|
22
24
|
/**
|
|
@@ -30,5 +32,7 @@ export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSche
|
|
|
30
32
|
token: string;
|
|
31
33
|
spa?: boolean | undefined;
|
|
32
34
|
}>;
|
|
33
|
-
export type CloudflareWebAnalyticsInput =
|
|
34
|
-
export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(
|
|
35
|
+
export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>;
|
|
36
|
+
export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): T & {
|
|
37
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
38
|
+
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { boolean, minLength, object, optional, string } from "valibot";
|
|
2
2
|
import { defu } from "defu";
|
|
3
|
-
import {
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
4
|
export const CloudflareWebAnalyticsOptions = object({
|
|
5
5
|
/**
|
|
6
6
|
* The Cloudflare Web Analytics token.
|
|
7
|
-
*
|
|
8
|
-
* Required when used for the first time.
|
|
9
7
|
*/
|
|
10
|
-
token: string([minLength(
|
|
8
|
+
token: string([minLength(32)]),
|
|
11
9
|
/**
|
|
12
10
|
* Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
|
|
13
11
|
* and listening to the onpopstate. Hash-based router is not supported.
|
|
@@ -16,19 +14,19 @@ export const CloudflareWebAnalyticsOptions = object({
|
|
|
16
14
|
*/
|
|
17
15
|
spa: optional(boolean())
|
|
18
16
|
});
|
|
19
|
-
export function useScriptCloudflareWebAnalytics(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
export function useScriptCloudflareWebAnalytics(_options) {
|
|
18
|
+
return registryScript("cloudflareWebAnalytics", (options) => ({
|
|
19
|
+
scriptInput: {
|
|
20
|
+
"src": "https://static.cloudflareinsights.com/beacon.min.js",
|
|
21
|
+
"data-cf-beacon": JSON.stringify(defu(options, { spa: true }))
|
|
22
|
+
},
|
|
23
|
+
schema: import.meta.dev ? CloudflareWebAnalyticsOptions : void 0,
|
|
24
|
+
scriptOptions: {
|
|
25
|
+
// we want to load earlier so that the web vitals reports are correct
|
|
26
|
+
trigger: "client",
|
|
27
|
+
use() {
|
|
28
|
+
return { __cfBeacon: window.__cfBeacon };
|
|
29
|
+
}
|
|
32
30
|
}
|
|
33
|
-
});
|
|
31
|
+
}), _options);
|
|
34
32
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { NuxtUseScriptIntegrationOptions } from '#nuxt-scripts';
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
2
|
type StandardEvents = 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent';
|
|
4
3
|
interface EventObjectProperties {
|
|
5
4
|
content_category?: string;
|
|
@@ -34,10 +33,12 @@ declare global {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
export declare const FacebookPixelOptions: import("valibot").ObjectSchema<{
|
|
37
|
-
id: import("valibot").UnionSchema<(import("valibot").
|
|
36
|
+
id: import("valibot").UnionSchema<(import("valibot").NumberSchema<number> | import("valibot").StringSchema<string>)[], string | number>;
|
|
38
37
|
}, undefined, {
|
|
39
38
|
id: string | number;
|
|
40
39
|
}>;
|
|
41
|
-
export type FacebookPixelInput =
|
|
42
|
-
export declare function useScriptFacebookPixel<T extends FacebookPixelApi>(
|
|
40
|
+
export type FacebookPixelInput = RegistryScriptInput<typeof FacebookPixelOptions>;
|
|
41
|
+
export declare function useScriptFacebookPixel<T extends FacebookPixelApi>(_options?: FacebookPixelInput): T & {
|
|
42
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
43
|
+
};
|
|
43
44
|
export {};
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { number, object, string, union } from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
|
+
import { FacebookPixelScriptResolver } from "../../registry";
|
|
3
4
|
export const FacebookPixelOptions = object({
|
|
4
5
|
id: union([string(), number()])
|
|
5
6
|
});
|
|
6
|
-
export function useScriptFacebookPixel(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export function useScriptFacebookPixel(_options) {
|
|
8
|
+
return registryScript("facebookPixel", (options) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
src: FacebookPixelScriptResolver()
|
|
11
|
+
},
|
|
12
|
+
schema: FacebookPixelOptions,
|
|
13
|
+
scriptOptions: {
|
|
14
|
+
use() {
|
|
15
|
+
return { fbq: window.fbq };
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
11
19
|
const fbq = window.fbq = function(...params) {
|
|
12
20
|
fbq.callMethod ? fbq.callMethod(...params) : fbq.queue.push(params);
|
|
13
21
|
};
|
|
@@ -20,15 +28,5 @@ export function useScriptFacebookPixel(options, _scriptOptions) {
|
|
|
20
28
|
fbq("init", options?.id);
|
|
21
29
|
fbq("track", "PageView");
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
return useScript({
|
|
26
|
-
key: "facebookPixel",
|
|
27
|
-
src: "https://connect.facebook.net/en_US/fbevents.js"
|
|
28
|
-
}, {
|
|
29
|
-
...scriptOptions,
|
|
30
|
-
use() {
|
|
31
|
-
return { fbq: window.fbq };
|
|
32
|
-
}
|
|
33
|
-
});
|
|
31
|
+
}), _options);
|
|
34
32
|
}
|
|
@@ -1,26 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { NuxtUseScriptIntegrationOptions } from '#nuxt-scripts';
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
2
|
export declare const FathomAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
/**
|
|
4
|
+
* The Fathom Analytics site ID.
|
|
5
|
+
*/
|
|
4
6
|
site: import("valibot").StringSchema<string>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The Fathom Analytics tracking mode.
|
|
9
|
+
*/
|
|
10
|
+
spa: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"hash", "hash"> | import("valibot").LiteralSchema<"auto", "auto"> | import("valibot").LiteralSchema<"history", "history">)[], "auto" | "hash" | "history">, undefined, "auto" | "hash" | "history" | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Automatically track page views.
|
|
13
|
+
*/
|
|
14
|
+
auto: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Enable canonical URL tracking.
|
|
17
|
+
*/
|
|
18
|
+
canonical: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Honor Do Not Track requests.
|
|
21
|
+
*/
|
|
22
|
+
honorDnt: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
10
23
|
}, undefined, {
|
|
11
24
|
site: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'data-honor-dnt'?: boolean | undefined;
|
|
25
|
+
auto?: boolean | undefined;
|
|
26
|
+
spa?: "auto" | "hash" | "history" | undefined;
|
|
27
|
+
canonical?: boolean | undefined;
|
|
28
|
+
honorDnt?: boolean | undefined;
|
|
17
29
|
}>;
|
|
18
|
-
export type FathomAnalyticsInput =
|
|
30
|
+
export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false>;
|
|
19
31
|
export interface FathomAnalyticsApi {
|
|
32
|
+
beacon: (ctx: {
|
|
33
|
+
url: string;
|
|
34
|
+
referrer?: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
blockTrackingForMe: () => void;
|
|
37
|
+
enableTrackingForMe: () => void;
|
|
38
|
+
isTrackingEnabled: () => boolean;
|
|
39
|
+
send: (type: string, data: unknown) => void;
|
|
40
|
+
setSite: (siteId: string) => void;
|
|
41
|
+
sideId: string;
|
|
20
42
|
trackPageview: (ctx?: {
|
|
21
43
|
url: string;
|
|
22
44
|
referrer?: string;
|
|
23
45
|
}) => void;
|
|
46
|
+
trackGoal: (goalId: string, cents: number) => void;
|
|
24
47
|
trackEvent: (eventName: string, value: {
|
|
25
48
|
_value: number;
|
|
26
49
|
}) => void;
|
|
@@ -30,4 +53,6 @@ declare global {
|
|
|
30
53
|
fathom: FathomAnalyticsApi;
|
|
31
54
|
}
|
|
32
55
|
}
|
|
33
|
-
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(
|
|
56
|
+
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?: FathomAnalyticsInput): T & {
|
|
57
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
58
|
+
};
|
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
import { boolean, literal, object, optional, string, union } from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
3
|
export const FathomAnalyticsOptions = object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The Fathom Analytics site ID.
|
|
6
|
+
*/
|
|
7
|
+
site: string(),
|
|
8
|
+
/**
|
|
9
|
+
* The Fathom Analytics tracking mode.
|
|
10
|
+
*/
|
|
11
|
+
spa: optional(union([literal("auto"), literal("history"), literal("hash")])),
|
|
12
|
+
/**
|
|
13
|
+
* Automatically track page views.
|
|
14
|
+
*/
|
|
15
|
+
auto: optional(boolean()),
|
|
16
|
+
/**
|
|
17
|
+
* Enable canonical URL tracking.
|
|
18
|
+
*/
|
|
19
|
+
canonical: optional(boolean()),
|
|
20
|
+
/**
|
|
21
|
+
* Honor Do Not Track requests.
|
|
22
|
+
*/
|
|
23
|
+
honorDnt: optional(boolean())
|
|
11
24
|
});
|
|
12
|
-
export function useScriptFathomAnalytics(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
export function useScriptFathomAnalytics(_options) {
|
|
26
|
+
return registryScript("fathomAnalytics", (options) => ({
|
|
27
|
+
scriptInput: {
|
|
28
|
+
src: "https://cdn.usefathom.com/script.js",
|
|
29
|
+
// can't be bundled
|
|
30
|
+
// append the data attr's
|
|
31
|
+
...Object.entries(options).filter(([key]) => ["site", "spa", "auto", "canonical", "honorDnt"].includes(key)).reduce((acc, [_key, value]) => {
|
|
32
|
+
const key = _key === "honourDnt" ? "honor-dnt" : _key;
|
|
33
|
+
acc[`data-${key}`] = value;
|
|
34
|
+
return acc;
|
|
35
|
+
}, {})
|
|
36
|
+
},
|
|
37
|
+
schema: import.meta.dev ? FathomAnalyticsOptions : void 0,
|
|
38
|
+
scriptOptions: {
|
|
39
|
+
use() {
|
|
40
|
+
return window.fathom;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}), _options);
|
|
25
44
|
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GoogleAnalyticsApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
declare const GoogleAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
id: import("valibot").StringSchema<string>;
|
|
5
|
+
}, undefined, {
|
|
6
|
+
id: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type GoogleAnalyticsInput = RegistryScriptInput<typeof GoogleAnalyticsOptions>;
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window extends GoogleAnalyticsApi {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* useScriptGoogleAnalytics
|
|
15
|
+
*
|
|
16
|
+
* A 3P wrapper for Google Analytics that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useScriptGoogleAnalytics<T extends GoogleAnalyticsApi>(_options?: GoogleAnalyticsInput): T & {
|
|
19
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { object, string } from "valibot";
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
|
+
import { GoogleAnalyticsScriptResolver } from "../../registry";
|
|
4
|
+
const GoogleAnalyticsOptions = object({
|
|
5
|
+
id: string()
|
|
6
|
+
});
|
|
7
|
+
export function useScriptGoogleAnalytics(_options) {
|
|
8
|
+
return registryScript("googleAnalytics", (options) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
src: GoogleAnalyticsScriptResolver(options)
|
|
11
|
+
},
|
|
12
|
+
schema: GoogleAnalyticsOptions,
|
|
13
|
+
scriptOptions: {
|
|
14
|
+
use() {
|
|
15
|
+
return { dataLayer: window.dataLayer, gtag: window.gtag };
|
|
16
|
+
},
|
|
17
|
+
// allow dataLayer to be accessed on the server
|
|
18
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
19
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
window.gtag = function gtag(...p) {
|
|
25
|
+
window.dataLayer.push(p);
|
|
26
|
+
};
|
|
27
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
28
|
+
window.gtag("config", options?.id);
|
|
29
|
+
}
|
|
30
|
+
}), _options);
|
|
4
31
|
}
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import type google from 'google.maps';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
export declare const GoogleMapsOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
apiKey: import("valibot").StringSchema<string>;
|
|
5
|
+
libraries: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, undefined, string[] | undefined>;
|
|
6
|
+
v: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"weekly", "weekly"> | import("valibot").LiteralSchema<"beta", "beta"> | import("valibot").LiteralSchema<"alpha", "alpha">)[], "weekly" | "beta" | "alpha">, undefined, "weekly" | "beta" | "alpha" | undefined>;
|
|
7
|
+
}, undefined, {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
libraries?: string[] | undefined;
|
|
10
|
+
v?: "weekly" | "beta" | "alpha" | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>;
|
|
13
|
+
export interface GoogleMapsApi {
|
|
14
|
+
maps: google.maps;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface Window {
|
|
18
|
+
google: typeof google;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMapsInput): T & {
|
|
22
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
23
|
+
};
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { array, literal, object, optional, string, union } from "valibot";
|
|
2
|
+
import { withQuery } from "ufo";
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
|
+
export const GoogleMapsOptions = object({
|
|
5
|
+
apiKey: string(),
|
|
6
|
+
libraries: optional(array(string())),
|
|
7
|
+
v: optional(union([literal("weekly"), literal("beta"), literal("alpha")]))
|
|
8
|
+
});
|
|
9
|
+
export function useScriptGoogleMaps(_options) {
|
|
10
|
+
let readyPromise = Promise.resolve();
|
|
11
|
+
return registryScript("googleMaps", (options) => {
|
|
12
|
+
const libraries = options?.libraries || ["places"];
|
|
13
|
+
return {
|
|
14
|
+
scriptInput: {
|
|
15
|
+
src: withQuery(`https://maps.googleapis.com/maps/api/js`, {
|
|
16
|
+
libraries: libraries.join(","),
|
|
17
|
+
key: options?.apiKey,
|
|
18
|
+
loading: "async",
|
|
19
|
+
callback: "google.maps.__ib__"
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.google = window.google || {};
|
|
24
|
+
window.google.maps = window.google.maps || {};
|
|
25
|
+
readyPromise = new Promise((resolve) => {
|
|
26
|
+
window.google.maps.__ib__ = resolve;
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
schema: GoogleMapsOptions,
|
|
30
|
+
scriptOptions: {
|
|
31
|
+
use() {
|
|
32
|
+
return {
|
|
33
|
+
maps: readyPromise.then(() => {
|
|
34
|
+
return window.google.maps;
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, _options);
|
|
4
41
|
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GoogleTagManagerApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
declare const GoogleTagManagerOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
id: import("valibot").StringSchema<string>;
|
|
5
|
+
}, undefined, {
|
|
6
|
+
id: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type GoogleTagManagerInput = RegistryScriptInput<typeof GoogleTagManagerOptions>;
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window extends GoogleTagManagerApi {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* useScriptGoogleTagManager
|
|
15
|
+
*
|
|
16
|
+
* A 3P wrapper for Google Tag Manager that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useScriptGoogleTagManager<T extends GoogleTagManagerApi>(options?: GoogleTagManagerInput): T & {
|
|
19
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { object, string } from "valibot";
|
|
2
|
+
import { withQuery } from "ufo";
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
|
+
const GoogleTagManagerOptions = object({
|
|
5
|
+
id: string()
|
|
6
|
+
});
|
|
7
|
+
export function useScriptGoogleTagManager(options) {
|
|
8
|
+
return registryScript("googleTagManager", (options2) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
async: true,
|
|
11
|
+
src: withQuery("https://www.googletagmanager.com/gtm.js", {
|
|
12
|
+
id: options2?.id
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
schema: GoogleTagManagerOptions,
|
|
16
|
+
scriptOptions: {
|
|
17
|
+
use() {
|
|
18
|
+
return { dataLayer: window.dataLayer, google_tag_manager: window.google_tag_manager };
|
|
19
|
+
},
|
|
20
|
+
// allow dataLayer to be accessed on the server
|
|
21
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
22
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
26
|
+
window.dataLayer = window.dataLayer || [];
|
|
27
|
+
window.dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), "event": "gtm.js" });
|
|
28
|
+
}
|
|
29
|
+
}), options);
|
|
4
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
2
|
export interface HotjarApi {
|
|
3
3
|
hj: ((event: 'identify', userId: string, attributes?: Record<string, any>) => void) & ((event: 'stateChange', path: string) => void) & ((event: 'event', eventName: string) => void) & ((event: string, arg?: string) => void) & ((...params: any[]) => void) & {
|
|
4
4
|
q: any[];
|
|
@@ -19,5 +19,7 @@ export declare const HotjarOptions: import("valibot").ObjectSchema<{
|
|
|
19
19
|
id: number;
|
|
20
20
|
sv?: number | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
export type HotjarInput =
|
|
23
|
-
export declare function useScriptHotjar<T extends HotjarApi>(
|
|
22
|
+
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions>;
|
|
23
|
+
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): T & {
|
|
24
|
+
$script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
|
|
25
|
+
};
|