@nuxt/scripts 0.11.5 → 0.11.7
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 +1 -1
- package/dist/client/200.html +9 -9
- package/dist/client/404.html +9 -9
- package/dist/client/_nuxt/D3ZVEC_8.js +1 -0
- package/dist/client/_nuxt/DmiqYg4r.js +21 -0
- package/dist/client/_nuxt/_5UZfQdF.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/93bac187-07c5-4a76-83a2-cefcf05c0b88.json +1 -0
- package/dist/client/_nuxt/{entry.CJckMUzn.css → entry.DExDtQtx.css} +1 -1
- package/dist/client/_nuxt/error-404.CpID9NZX.css +1 -0
- package/dist/client/_nuxt/error-500.BzWA0Bp3.css +1 -0
- package/dist/client/_nuxt/{Bo1SWr6k.js → z8Iwlb2L.js} +1 -1
- package/dist/client/index.html +9 -9
- package/dist/module.json +3 -3
- package/dist/registry.mjs +27 -0
- package/dist/runtime/components/ScriptAriaLoadingIndicator.vue.d.ts +2 -0
- package/dist/runtime/components/ScriptCarbonAds.vue +41 -57
- package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +32 -0
- package/dist/runtime/components/ScriptCrisp.vue +43 -63
- package/dist/runtime/components/ScriptCrisp.vue.d.ts +44 -0
- package/dist/runtime/components/ScriptGoogleAdsense.vue +37 -60
- package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +37 -0
- package/dist/runtime/components/ScriptGoogleMaps.vue +220 -366
- package/dist/runtime/components/ScriptGoogleMaps.vue.d.ts +144 -0
- package/dist/runtime/components/ScriptIntercom.vue +48 -67
- package/dist/runtime/components/ScriptIntercom.vue.d.ts +45 -0
- package/dist/runtime/components/ScriptLemonSqueezy.vue +26 -37
- package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +24 -0
- package/dist/runtime/components/ScriptLoadingIndicator.vue +8 -13
- package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +9 -0
- package/dist/runtime/components/ScriptStripePricingTable.vue +41 -53
- package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +35 -0
- package/dist/runtime/components/ScriptVimeoPlayer.vue +121 -218
- package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +127 -0
- package/dist/runtime/components/ScriptYouTubePlayer.vue +105 -163
- package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +66 -0
- package/dist/runtime/registry/clarity.d.ts +1 -1
- package/dist/runtime/registry/clarity.js +7 -1
- package/dist/runtime/registry/rybbit-analytics.d.ts +20 -0
- package/dist/runtime/registry/rybbit-analytics.js +32 -0
- package/dist/runtime/registry/snapchat-pixel.js +1 -1
- package/dist/runtime/types.d.ts +2 -0
- package/dist/types.d.mts +2 -2
- package/package.json +53 -48
- package/dist/client/_nuxt/BojlM8av.js +0 -21
- package/dist/client/_nuxt/BwFnCI0m.js +0 -1
- package/dist/client/_nuxt/builds/meta/0bd5f801-ad22-4b04-821c-25f180195d78.json +0 -1
- package/dist/client/_nuxt/error-404.BiTeRF3j.css +0 -1
- package/dist/client/_nuxt/error-500.Be1AE5oK.css +0 -1
- package/dist/client/_nuxt/yRslIvSb.js +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -60
- package/dist/registry.d.ts +0 -6
- package/dist/types.d.ts +0 -7
|
@@ -1,202 +1,144 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
playerVars?: YT.PlayerVars
|
|
36
|
-
width?: number
|
|
37
|
-
height?: number
|
|
38
|
-
/**
|
|
39
|
-
* Whether to use youtube-nocookie.com for embedding.
|
|
40
|
-
*
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
cookies?: boolean
|
|
44
|
-
playerOptions?: YT.PlayerOptions
|
|
45
|
-
thumbnailSize?: YoutubeThumbnailSize
|
|
46
|
-
webp?: boolean
|
|
47
|
-
}>(), {
|
|
48
|
-
cookies: false,
|
|
49
|
-
trigger: 'mousedown',
|
|
50
|
-
thumbnailSize: 'hq720',
|
|
51
|
-
webp: true,
|
|
52
|
-
// @ts-expect-error untyped
|
|
53
|
-
playerVars: { autoplay: 0, playsinline: 1 },
|
|
54
|
-
width: 640,
|
|
55
|
-
height: 360,
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
const emits = defineEmits<{
|
|
59
|
-
'ready': [e: YT.PlayerEvent]
|
|
60
|
-
'state-change': [e: YT.OnStateChangeEvent, target: YT.Player]
|
|
61
|
-
'playback-quality-change': [e: YT.OnPlaybackQualityChangeEvent, target: YT.Player]
|
|
62
|
-
'playback-rate-change': [e: YT.OnPlaybackRateChangeEvent, target: YT.Player]
|
|
63
|
-
'error': [e: YT.OnErrorEvent, target: YT.Player]
|
|
64
|
-
}>()
|
|
65
|
-
const events: (keyof YT.Events)[] = [
|
|
66
|
-
'onReady',
|
|
67
|
-
'onStateChange',
|
|
68
|
-
'onPlaybackQualityChange',
|
|
69
|
-
'onPlaybackRateChange',
|
|
70
|
-
'onError',
|
|
71
|
-
'onApiChange',
|
|
72
|
-
]
|
|
73
|
-
const rootEl = ref()
|
|
74
|
-
const youtubeEl = ref()
|
|
75
|
-
const ready = ref(false)
|
|
76
|
-
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { useHead } from "nuxt/app";
|
|
5
|
+
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
6
|
+
import { useScriptYouTubePlayer } from "../registry/youtube-player";
|
|
7
|
+
import ScriptAriaLoadingIndicator from "./ScriptAriaLoadingIndicator.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
placeholderAttrs: { type: Object, required: false },
|
|
10
|
+
rootAttrs: { type: Object, required: false },
|
|
11
|
+
aboveTheFold: { type: Boolean, required: false },
|
|
12
|
+
trigger: { type: [String, Array, Boolean], required: false, default: "mousedown" },
|
|
13
|
+
videoId: { type: String, required: true },
|
|
14
|
+
playerVars: { type: null, required: false, default: { autoplay: 0, playsinline: 1 } },
|
|
15
|
+
width: { type: Number, required: false, default: 640 },
|
|
16
|
+
height: { type: Number, required: false, default: 360 },
|
|
17
|
+
cookies: { type: Boolean, required: false, default: false },
|
|
18
|
+
playerOptions: { type: null, required: false },
|
|
19
|
+
thumbnailSize: { type: String, required: false, default: "hq720" },
|
|
20
|
+
webp: { type: Boolean, required: false, default: true }
|
|
21
|
+
});
|
|
22
|
+
const emits = defineEmits(["ready", "state-change", "playback-quality-change", "playback-rate-change", "error"]);
|
|
23
|
+
const events = [
|
|
24
|
+
"onReady",
|
|
25
|
+
"onStateChange",
|
|
26
|
+
"onPlaybackQualityChange",
|
|
27
|
+
"onPlaybackRateChange",
|
|
28
|
+
"onError",
|
|
29
|
+
"onApiChange"
|
|
30
|
+
];
|
|
31
|
+
const rootEl = ref();
|
|
32
|
+
const youtubeEl = ref();
|
|
33
|
+
const ready = ref(false);
|
|
34
|
+
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
77
35
|
const script = useScriptYouTubePlayer({
|
|
78
36
|
scriptOptions: {
|
|
79
|
-
trigger
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
const { onLoaded, status } = script
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (props.trigger === 'mousedown' && trigger instanceof Promise) {
|
|
37
|
+
trigger
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const { onLoaded, status } = script;
|
|
41
|
+
const player = ref();
|
|
42
|
+
let clickTriggered = false;
|
|
43
|
+
if (props.trigger === "mousedown" && trigger instanceof Promise) {
|
|
87
44
|
trigger.then((triggered) => {
|
|
88
45
|
if (triggered) {
|
|
89
|
-
clickTriggered = true
|
|
46
|
+
clickTriggered = true;
|
|
90
47
|
}
|
|
91
|
-
})
|
|
48
|
+
});
|
|
92
49
|
}
|
|
93
50
|
onMounted(() => {
|
|
94
51
|
onLoaded(async (instance) => {
|
|
95
|
-
const YouTube = instance.YT instanceof Promise ? await instance.YT : instance.YT
|
|
96
|
-
await new Promise
|
|
97
|
-
if (typeof YT.Player ===
|
|
98
|
-
YouTube.ready(resolve)
|
|
52
|
+
const YouTube = instance.YT instanceof Promise ? await instance.YT : instance.YT;
|
|
53
|
+
await new Promise((resolve) => {
|
|
54
|
+
if (typeof YT.Player === "undefined")
|
|
55
|
+
YouTube.ready(resolve);
|
|
99
56
|
else
|
|
100
|
-
resolve()
|
|
101
|
-
})
|
|
57
|
+
resolve();
|
|
58
|
+
});
|
|
102
59
|
player.value = new YT.Player(youtubeEl.value, {
|
|
103
|
-
host: !props.cookies ?
|
|
60
|
+
host: !props.cookies ? "https://www.youtube-nocookie.com" : "https://www.youtube.com",
|
|
104
61
|
...props,
|
|
105
62
|
...props.playerOptions,
|
|
106
|
-
events: Object.fromEntries(events.map(event => [event, (e
|
|
107
|
-
const emitEventName = event.replace(/([A-Z])/g,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
ready.value = true
|
|
63
|
+
events: Object.fromEntries(events.map((event) => [event, (e) => {
|
|
64
|
+
const emitEventName = event.replace(/([A-Z])/g, "-$1").replace("on-", "").toLowerCase();
|
|
65
|
+
emits(emitEventName, e);
|
|
66
|
+
if (event === "onReady") {
|
|
67
|
+
ready.value = true;
|
|
112
68
|
if (clickTriggered) {
|
|
113
|
-
player.value?.playVideo()
|
|
114
|
-
clickTriggered = false
|
|
69
|
+
player.value?.playVideo();
|
|
70
|
+
clickTriggered = false;
|
|
115
71
|
}
|
|
116
72
|
watch(() => props.videoId, () => {
|
|
117
|
-
player.value?.loadVideoById(props.videoId)
|
|
118
|
-
})
|
|
73
|
+
player.value?.loadVideoById(props.videoId);
|
|
74
|
+
});
|
|
119
75
|
}
|
|
120
|
-
}]))
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
watch(status, (
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
emits('error')
|
|
76
|
+
}]))
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
watch(status, (status2) => {
|
|
80
|
+
if (status2 === "error") {
|
|
81
|
+
emits("error");
|
|
127
82
|
}
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
|
|
83
|
+
});
|
|
84
|
+
});
|
|
131
85
|
defineExpose({
|
|
132
|
-
player
|
|
133
|
-
})
|
|
134
|
-
|
|
86
|
+
player
|
|
87
|
+
});
|
|
135
88
|
const rootAttrs = computed(() => {
|
|
136
89
|
return defu(props.rootAttrs, {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
position: 'relative',
|
|
148
|
-
backgroundColor: 'black',
|
|
149
|
-
width: '100%',
|
|
150
|
-
aspectRatio: `${props.width}/${props.height}`,
|
|
90
|
+
"aria-busy": status.value === "loading",
|
|
91
|
+
"aria-label": status.value === "awaitingLoad" ? "YouTube Player - Placeholder" : status.value === "loading" ? "YouTube Player - Loading" : "YouTube Player - Loaded",
|
|
92
|
+
"aria-live": "polite",
|
|
93
|
+
"role": "application",
|
|
94
|
+
"style": {
|
|
95
|
+
cursor: "pointer",
|
|
96
|
+
position: "relative",
|
|
97
|
+
backgroundColor: "black",
|
|
98
|
+
width: "100%",
|
|
99
|
+
aspectRatio: `${props.width}/${props.height}`
|
|
151
100
|
},
|
|
152
|
-
...
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const isFallbackPlaceHolder = ref(false)
|
|
159
|
-
|
|
101
|
+
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
const fallbackPlaceHolder = computed(() => `https://i.ytimg.com/vi/${props.videoId}/hqdefault.jpg`);
|
|
105
|
+
const placeholder = computed(() => `https://i.ytimg.com/${props.webp ? "vi_webp" : "vi"}/${props.videoId}/${props.thumbnailSize}.${props.webp ? "webp" : "jpg"}`);
|
|
106
|
+
const isFallbackPlaceHolder = ref(false);
|
|
160
107
|
if (import.meta.server) {
|
|
161
|
-
// dns-prefetch https://i.vimeocdn.com
|
|
162
108
|
useHead({
|
|
163
109
|
link: [
|
|
164
110
|
{
|
|
165
111
|
key: `nuxt-script-youtube-img`,
|
|
166
|
-
rel: props.aboveTheFold ?
|
|
167
|
-
href:
|
|
112
|
+
rel: props.aboveTheFold ? "preconnect" : "dns-prefetch",
|
|
113
|
+
href: "https://i.ytimg.com"
|
|
168
114
|
},
|
|
169
|
-
props.aboveTheFold
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
: {},
|
|
178
|
-
],
|
|
179
|
-
})
|
|
115
|
+
props.aboveTheFold ? {
|
|
116
|
+
key: `nuxt-script-youtube-img`,
|
|
117
|
+
rel: "preload",
|
|
118
|
+
as: "image",
|
|
119
|
+
href: placeholder.value
|
|
120
|
+
} : {}
|
|
121
|
+
]
|
|
122
|
+
});
|
|
180
123
|
}
|
|
181
|
-
|
|
182
124
|
const placeholderAttrs = computed(() => {
|
|
183
125
|
return defu(props.placeholderAttrs, {
|
|
184
126
|
src: isFallbackPlaceHolder.value ? fallbackPlaceHolder.value : placeholder.value,
|
|
185
|
-
alt:
|
|
186
|
-
loading: props.aboveTheFold ?
|
|
127
|
+
alt: "",
|
|
128
|
+
loading: props.aboveTheFold ? "eager" : "lazy",
|
|
187
129
|
style: {
|
|
188
|
-
width:
|
|
189
|
-
objectFit:
|
|
190
|
-
height:
|
|
130
|
+
width: "100%",
|
|
131
|
+
objectFit: "contain",
|
|
132
|
+
height: "100%"
|
|
191
133
|
},
|
|
192
134
|
onLoad(payload) {
|
|
193
|
-
const img = payload.target
|
|
135
|
+
const img = payload.target;
|
|
194
136
|
if (img.naturalWidth === 120 && img.naturalHeight === 90) {
|
|
195
|
-
isFallbackPlaceHolder.value = true
|
|
137
|
+
isFallbackPlaceHolder.value = true;
|
|
196
138
|
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
})
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
200
142
|
</script>
|
|
201
143
|
|
|
202
144
|
<template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { HTMLAttributes, ImgHTMLAttributes, Ref } from 'vue';
|
|
2
|
+
import type { ElementScriptTrigger } from '../types.js';
|
|
3
|
+
export type YoutubeThumbnailSize = '1' | '2' | '3' | 'default' | 'mq1' | 'mq2' | 'mq3' | 'mqdefault' | '0' | 'hq1' | 'hq2' | 'hq3' | 'hqdefault' | 'sd1' | 'sd2' | 'sd3' | 'sddefault' | 'hq720' | 'maxresdefault';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
placeholderAttrs?: ImgHTMLAttributes;
|
|
6
|
+
rootAttrs?: HTMLAttributes;
|
|
7
|
+
aboveTheFold?: boolean;
|
|
8
|
+
trigger?: ElementScriptTrigger;
|
|
9
|
+
videoId: string;
|
|
10
|
+
playerVars?: YT.PlayerVars;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to use youtube-nocookie.com for embedding.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
cookies?: boolean;
|
|
19
|
+
playerOptions?: YT.PlayerOptions;
|
|
20
|
+
thumbnailSize?: YoutubeThumbnailSize;
|
|
21
|
+
webp?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {
|
|
24
|
+
placeholder: any;
|
|
25
|
+
}, __VLS_3: {}, __VLS_8: {}, __VLS_10: {}, __VLS_12: {};
|
|
26
|
+
type __VLS_Slots = {} & {
|
|
27
|
+
placeholder?: (props: typeof __VLS_1) => any;
|
|
28
|
+
} & {
|
|
29
|
+
loading?: (props: typeof __VLS_3) => any;
|
|
30
|
+
} & {
|
|
31
|
+
awaitingLoad?: (props: typeof __VLS_8) => any;
|
|
32
|
+
} & {
|
|
33
|
+
error?: (props: typeof __VLS_10) => any;
|
|
34
|
+
} & {
|
|
35
|
+
default?: (props: typeof __VLS_12) => any;
|
|
36
|
+
};
|
|
37
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
player: Ref<YT.Player | undefined, YT.Player | undefined>;
|
|
39
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
|
+
error: (e: YT.OnErrorEvent, target: YT.Player) => any;
|
|
41
|
+
ready: (e: YT.PlayerEvent) => any;
|
|
42
|
+
"state-change": (e: YT.OnStateChangeEvent, target: YT.Player) => any;
|
|
43
|
+
"playback-quality-change": (e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any;
|
|
44
|
+
"playback-rate-change": (e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any;
|
|
45
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
46
|
+
onError?: ((e: YT.OnErrorEvent, target: YT.Player) => any) | undefined;
|
|
47
|
+
onReady?: ((e: YT.PlayerEvent) => any) | undefined;
|
|
48
|
+
"onState-change"?: ((e: YT.OnStateChangeEvent, target: YT.Player) => any) | undefined;
|
|
49
|
+
"onPlayback-quality-change"?: ((e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any) | undefined;
|
|
50
|
+
"onPlayback-rate-change"?: ((e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any) | undefined;
|
|
51
|
+
}>, {
|
|
52
|
+
trigger: ElementScriptTrigger;
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
playerVars: YT.PlayerVars;
|
|
56
|
+
cookies: boolean;
|
|
57
|
+
thumbnailSize: YoutubeThumbnailSize;
|
|
58
|
+
webp: boolean;
|
|
59
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
61
|
+
export default _default;
|
|
62
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
63
|
+
new (): {
|
|
64
|
+
$slots: S;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -11,7 +11,7 @@ type ClarityFunctions = ((fn: 'start', options: {
|
|
|
11
11
|
session: string;
|
|
12
12
|
page: string;
|
|
13
13
|
userHint: string;
|
|
14
|
-
}>) & ((fn: 'consent') => void) & ((fn: 'set', key: any, value: any) => void) & ((fn: 'event', value: any) => void) & ((fn: 'upgrade', upgradeReason: any) => void) & ((fn: string, ...args: any[]) => void);
|
|
14
|
+
}>) & ((fn: 'consent', enabled?: boolean) => void) & ((fn: 'set', key: any, value: any) => void) & ((fn: 'event', value: any) => void) & ((fn: 'upgrade', upgradeReason: any) => void) & ((fn: string, ...args: any[]) => void);
|
|
15
15
|
export interface ClarityApi {
|
|
16
16
|
clarity: ClarityFunctions & {
|
|
17
17
|
q: any[];
|
|
@@ -16,7 +16,13 @@ export function useScriptClarity(_options) {
|
|
|
16
16
|
schema: import.meta.dev ? ClarityOptions : void 0,
|
|
17
17
|
scriptOptions: {
|
|
18
18
|
use() {
|
|
19
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
// @ts-expect-error untyped
|
|
21
|
+
clarity: Object.assign(function(...params) {
|
|
22
|
+
const clarity = window.clarity;
|
|
23
|
+
return clarity.apply(this, params);
|
|
24
|
+
}, window.clarity)
|
|
25
|
+
};
|
|
20
26
|
}
|
|
21
27
|
},
|
|
22
28
|
clientInit: import.meta.server ? void 0 : () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
export declare const RybbitAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
readonly siteId: import("valibot").StringSchema<undefined>;
|
|
4
|
+
readonly trackSpa: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
5
|
+
readonly trackQuery: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
6
|
+
readonly skipPatterns: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>, undefined>;
|
|
7
|
+
readonly maskPatterns: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>, undefined>;
|
|
8
|
+
readonly debounce: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
|
|
9
|
+
}, undefined>;
|
|
10
|
+
export type RybbitAnalyticsInput = RegistryScriptInput<typeof RybbitAnalyticsOptions, false>;
|
|
11
|
+
export interface RybbitAnalyticsApi {
|
|
12
|
+
pageview: () => void;
|
|
13
|
+
event: (eventName: string, properties?: Record<string, any>) => void;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface Window {
|
|
17
|
+
rybbit: RybbitAnalyticsApi;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare function useScriptRybbitAnalytics<T extends RybbitAnalyticsApi>(_options?: RybbitAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useRegistryScript } from "../utils.js";
|
|
2
|
+
import { array, boolean, number, object, optional, string } from "#nuxt-scripts-validator";
|
|
3
|
+
export const RybbitAnalyticsOptions = object({
|
|
4
|
+
siteId: string(),
|
|
5
|
+
// required
|
|
6
|
+
trackSpa: optional(boolean()),
|
|
7
|
+
trackQuery: optional(boolean()),
|
|
8
|
+
skipPatterns: optional(array(string())),
|
|
9
|
+
maskPatterns: optional(array(string())),
|
|
10
|
+
debounce: optional(number())
|
|
11
|
+
});
|
|
12
|
+
export function useScriptRybbitAnalytics(_options) {
|
|
13
|
+
return useRegistryScript("rybbitAnalytics", (options) => {
|
|
14
|
+
return {
|
|
15
|
+
scriptInput: {
|
|
16
|
+
"src": "https://app.rybbit.io/api/script.js",
|
|
17
|
+
"data-site-id": options?.siteId,
|
|
18
|
+
"data-track-spa": options?.trackSpa,
|
|
19
|
+
"data-track-query": options?.trackQuery,
|
|
20
|
+
"data-skip-patterns": options?.skipPatterns ? JSON.stringify(options.skipPatterns) : void 0,
|
|
21
|
+
"data-mask-patterns": options?.maskPatterns ? JSON.stringify(options.maskPatterns) : void 0,
|
|
22
|
+
"data-debounce": options?.debounce ? options.debounce.toString() : void 0
|
|
23
|
+
},
|
|
24
|
+
schema: import.meta.dev ? RybbitAnalyticsOptions : void 0,
|
|
25
|
+
scriptOptions: {
|
|
26
|
+
use() {
|
|
27
|
+
return { rybbit: window.rybbit };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, _options);
|
|
32
|
+
}
|
|
@@ -17,7 +17,7 @@ export const InitObjectPropertiesSchema = object({
|
|
|
17
17
|
export const SnapTrPixelOptions = object({
|
|
18
18
|
id: string(),
|
|
19
19
|
trackPageView: optional(boolean()),
|
|
20
|
-
...InitObjectPropertiesSchema
|
|
20
|
+
...InitObjectPropertiesSchema?.entries || {}
|
|
21
21
|
});
|
|
22
22
|
export function useScriptSnapchatPixel(_options) {
|
|
23
23
|
return useRegistryScript("snapchatPixel", (options) => ({
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type { CrispInput } from './registry/crisp.js';
|
|
|
25
25
|
import type { GoogleAnalyticsInput } from './registry/google-analytics.js';
|
|
26
26
|
import type { GoogleTagManagerInput } from './registry/google-tag-manager.js';
|
|
27
27
|
import type { UmamiAnalyticsInput } from './registry/umami-analytics.js';
|
|
28
|
+
import type { RybbitAnalyticsInput } from './registry/rybbit-analytics.js';
|
|
28
29
|
export type WarmupStrategy = false | 'preload' | 'preconnect' | 'dns-prefetch';
|
|
29
30
|
export type UseScriptContext<T extends Record<symbol | string, any>> = VueScriptInstance<T>;
|
|
30
31
|
export type NuxtUseScriptOptions<T extends Record<symbol | string, any> = {}> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
@@ -128,6 +129,7 @@ export interface ScriptRegistry {
|
|
|
128
129
|
hotjar?: HotjarInput;
|
|
129
130
|
intercom?: IntercomInput;
|
|
130
131
|
matomoAnalytics?: MatomoAnalyticsInput;
|
|
132
|
+
rybbitAnalytics?: RybbitAnalyticsInput;
|
|
131
133
|
segment?: SegmentInput;
|
|
132
134
|
stripe?: StripeInput;
|
|
133
135
|
xPixel?: XPixelInput;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ModuleHooks } from './module.
|
|
1
|
+
import type { ModuleHooks } from './module.mjs'
|
|
2
2
|
|
|
3
3
|
declare module '@nuxt/schema' {
|
|
4
4
|
interface NuxtHooks extends ModuleHooks {}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export { type ModuleHooks, type ModuleOptions, default } from './module.
|
|
7
|
+
export { type ModuleHooks, type ModuleOptions, default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.7",
|
|
5
5
|
"description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -19,20 +19,25 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/types.d.
|
|
23
|
-
"import": "./dist/module.mjs"
|
|
24
|
-
"require": "./dist/module.cjs"
|
|
22
|
+
"types": "./dist/types.d.mts",
|
|
23
|
+
"import": "./dist/module.mjs"
|
|
25
24
|
},
|
|
26
|
-
"./registry":
|
|
27
|
-
"types": "./dist/registry.d.ts",
|
|
28
|
-
"import": "./dist/registry.mjs"
|
|
29
|
-
}
|
|
25
|
+
"./registry": "./dist/registry.mjs"
|
|
30
26
|
},
|
|
31
|
-
"main": "./dist/module.
|
|
32
|
-
"types": "./dist/types.d.ts",
|
|
27
|
+
"main": "./dist/module.mjs",
|
|
33
28
|
"files": [
|
|
34
29
|
"dist"
|
|
35
30
|
],
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
".": [
|
|
34
|
+
"./dist/types.d.mts"
|
|
35
|
+
],
|
|
36
|
+
"registry": [
|
|
37
|
+
"./dist/registry.d.mts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
36
41
|
"build": {
|
|
37
42
|
"externals": [
|
|
38
43
|
"@unhead/vue",
|
|
@@ -49,12 +54,12 @@
|
|
|
49
54
|
]
|
|
50
55
|
},
|
|
51
56
|
"peerDependencies": {
|
|
52
|
-
"@stripe/stripe-js": "^
|
|
57
|
+
"@stripe/stripe-js": "^7.0.0",
|
|
53
58
|
"@types/google.maps": "^3.58.1",
|
|
54
59
|
"@types/vimeo__player": "^2.18.3",
|
|
55
60
|
"@types/youtube": "^0.1.0",
|
|
56
|
-
"@unhead/vue": "^2.0.
|
|
57
|
-
"nuxt": "^3.16.
|
|
61
|
+
"@unhead/vue": "^2.0.3",
|
|
62
|
+
"nuxt": "^3.16.2"
|
|
58
63
|
},
|
|
59
64
|
"peerDependenciesMeta": {
|
|
60
65
|
"@stripe/stripe-js": {
|
|
@@ -71,57 +76,57 @@
|
|
|
71
76
|
}
|
|
72
77
|
},
|
|
73
78
|
"dependencies": {
|
|
74
|
-
"@nuxt/kit": "^3.
|
|
75
|
-
"@vueuse/core": "^13.
|
|
79
|
+
"@nuxt/kit": "^3.17.3",
|
|
80
|
+
"@vueuse/core": "^13.2.0",
|
|
76
81
|
"consola": "^3.4.2",
|
|
77
82
|
"defu": "^6.1.4",
|
|
78
|
-
"h3": "^1.15.
|
|
83
|
+
"h3": "^1.15.3",
|
|
79
84
|
"magic-string": "^0.30.17",
|
|
80
85
|
"ofetch": "^1.4.1",
|
|
81
86
|
"ohash": "^2.0.11",
|
|
82
87
|
"pathe": "^2.0.3",
|
|
83
88
|
"pkg-types": "^2.1.0",
|
|
84
89
|
"sirv": "^3.0.1",
|
|
85
|
-
"std-env": "^3.
|
|
86
|
-
"ufo": "^1.
|
|
87
|
-
"unplugin": "^2.
|
|
88
|
-
"unstorage": "^1.
|
|
89
|
-
"valibot": "^1.
|
|
90
|
+
"std-env": "^3.9.0",
|
|
91
|
+
"ufo": "^1.6.1",
|
|
92
|
+
"unplugin": "^2.3.4",
|
|
93
|
+
"unstorage": "^1.16.0",
|
|
94
|
+
"valibot": "^1.1.0"
|
|
90
95
|
},
|
|
91
96
|
"devDependencies": {
|
|
92
|
-
"@nuxt/devtools-kit": "^2.
|
|
93
|
-
"@nuxt/devtools-ui-kit": "^2.
|
|
94
|
-
"@nuxt/eslint-config": "^1.
|
|
95
|
-
"@nuxt/module-builder": "^0.
|
|
96
|
-
"@nuxt/test-utils": "3.
|
|
97
|
-
"@types/semver": "^7.
|
|
98
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
99
|
-
"acorn-loose": "^8.
|
|
100
|
-
"bumpp": "^10.1.
|
|
97
|
+
"@nuxt/devtools-kit": "^2.4.1",
|
|
98
|
+
"@nuxt/devtools-ui-kit": "^2.4.1",
|
|
99
|
+
"@nuxt/eslint-config": "^1.4.0",
|
|
100
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
101
|
+
"@nuxt/test-utils": "3.19.0",
|
|
102
|
+
"@types/semver": "^7.7.0",
|
|
103
|
+
"@typescript-eslint/typescript-estree": "^8.32.1",
|
|
104
|
+
"acorn-loose": "^8.5.0",
|
|
105
|
+
"bumpp": "^10.1.1",
|
|
101
106
|
"changelogen": "^0.6.1",
|
|
102
|
-
"eslint": "9.
|
|
103
|
-
"eslint-plugin-n": "^17.
|
|
104
|
-
"happy-dom": "^17.4.
|
|
107
|
+
"eslint": "9.27.0",
|
|
108
|
+
"eslint-plugin-n": "^17.18.0",
|
|
109
|
+
"happy-dom": "^17.4.7",
|
|
105
110
|
"knitwork": "^1.2.0",
|
|
106
|
-
"nuxt": "^3.
|
|
107
|
-
"playwright-core": "^1.
|
|
108
|
-
"shiki": "
|
|
111
|
+
"nuxt": "^3.17.3",
|
|
112
|
+
"playwright-core": "^1.52.0",
|
|
113
|
+
"shiki": "3.4.2",
|
|
109
114
|
"typescript": "5.8.2",
|
|
110
|
-
"vitest": "^3.
|
|
111
|
-
"vue": "^3.5.
|
|
112
|
-
"vue-router": "^4.5.
|
|
113
|
-
"vue-tsc": "^2.2.
|
|
114
|
-
"@nuxt/scripts": "0.11.
|
|
115
|
+
"vitest": "^3.1.3",
|
|
116
|
+
"vue": "^3.5.14",
|
|
117
|
+
"vue-router": "^4.5.1",
|
|
118
|
+
"vue-tsc": "^2.2.10",
|
|
119
|
+
"@nuxt/scripts": "0.11.7"
|
|
115
120
|
},
|
|
116
121
|
"resolutions": {
|
|
117
122
|
"@nuxt/schema": "catalog:",
|
|
118
123
|
"@nuxt/scripts": "workspace:*",
|
|
119
|
-
"@unhead/vue": "2.0.
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"vue": "^3.5.
|
|
124
|
-
"vue-router": "^4.5.
|
|
124
|
+
"@unhead/vue": "^2.0.8",
|
|
125
|
+
"nuxt": "^3.17.3",
|
|
126
|
+
"typescript": "^5.8.3",
|
|
127
|
+
"unhead": "^2.0.8",
|
|
128
|
+
"vue": "^3.5.14",
|
|
129
|
+
"vue-router": "^4.5.1"
|
|
125
130
|
},
|
|
126
131
|
"scripts": {
|
|
127
132
|
"build": "pnpm dev:prepare && pnpm prepack",
|
|
@@ -132,7 +137,7 @@
|
|
|
132
137
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
133
138
|
"typecheck": "vue-tsc --noEmit",
|
|
134
139
|
"bump": "bumpp package.json --commit --push --tag",
|
|
135
|
-
"release": "pnpm build &&
|
|
140
|
+
"release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\" && pnpm publish",
|
|
136
141
|
"lint": "eslint .",
|
|
137
142
|
"lint:fix": "eslint . --fix",
|
|
138
143
|
"test": "pnpm dev:prepare && vitest --run --exclude **/__runtime__ && pnpm test:runtime",
|