@nuxt/scripts 0.6.6 → 0.7.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.
- package/dist/client/200.html +8 -8
- package/dist/client/404.html +8 -8
- package/dist/client/_nuxt/{aQeyjCqJ.js → C1IUq70_.js} +1 -1
- package/dist/client/_nuxt/{BKIFFtfV.js → CnUvXFHd.js} +1 -1
- package/dist/client/_nuxt/DOi3Eb0n.js +31 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/e4092e18-9a58-41ab-947e-35e1f2082b75.json +1 -0
- package/dist/client/_nuxt/error-404.CHrXIISA.css +1 -0
- package/dist/client/_nuxt/error-500.CrsjMPPf.css +1 -0
- package/dist/client/_nuxt/{BKJqCZ0j.js → iQqcKxZm.js} +1 -1
- package/dist/client/index.html +8 -8
- package/dist/module.json +2 -2
- package/dist/module.mjs +10 -4
- package/dist/runtime/components/ScriptCrisp.vue +10 -7
- package/dist/runtime/components/ScriptGoogleAdsense.vue +7 -7
- package/dist/runtime/components/ScriptGoogleMaps.vue +236 -68
- package/dist/runtime/components/ScriptIntercom.vue +10 -7
- package/dist/runtime/components/ScriptLemonSqueezy.vue +1 -1
- package/dist/runtime/components/ScriptStripePricingTable.vue +6 -6
- package/dist/runtime/components/ScriptVimeoPlayer.vue +62 -40
- package/dist/runtime/components/ScriptYouTubePlayer.vue +9 -9
- package/dist/runtime/composables/useScript.d.ts +6 -1
- package/dist/runtime/composables/useScript.js +8 -8
- package/dist/runtime/composables/useScriptEventPage.d.ts +0 -3
- package/dist/runtime/registry/clarity.d.ts +1 -12
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +1 -3
- package/dist/runtime/registry/crisp.d.ts +1 -3
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -3
- package/dist/runtime/registry/google-adsense.d.ts +1 -3
- package/dist/runtime/registry/google-analytics.d.ts +2 -10
- package/dist/runtime/registry/google-maps.d.ts +2 -4
- package/dist/runtime/registry/google-maps.js +1 -3
- package/dist/runtime/registry/google-tag-manager.d.ts +2 -10
- package/dist/runtime/registry/hotjar.d.ts +1 -3
- package/dist/runtime/registry/intercom.d.ts +1 -3
- package/dist/runtime/registry/lemon-squeezy.d.ts +1 -3
- package/dist/runtime/registry/matomo-analytics.d.ts +1 -3
- package/dist/runtime/registry/meta-pixel.d.ts +1 -3
- package/dist/runtime/registry/npm.d.ts +1 -3
- package/dist/runtime/registry/plausible-analytics.d.ts +1 -3
- package/dist/runtime/registry/segment.d.ts +1 -3
- package/dist/runtime/registry/stripe.d.ts +1 -3
- package/dist/runtime/registry/vimeo-player.d.ts +1 -3
- package/dist/runtime/registry/vimeo-player.js +1 -1
- package/dist/runtime/registry/x-pixel.d.ts +1 -3
- package/dist/runtime/registry/youtube-player.d.ts +1 -3
- package/dist/runtime/registry/youtube-player.js +1 -1
- package/dist/runtime/types.d.ts +3 -3
- package/dist/runtime/utils.d.ts +2 -4
- package/package.json +29 -23
- package/dist/client/_nuxt/DcF05ETD.js +0 -31
- package/dist/client/_nuxt/builds/meta/3dcaf2bf-82f1-460f-80a6-1412196a7a77.json +0 -1
- package/dist/client/_nuxt/error-404.B7Lh29wY.css +0 -1
- package/dist/client/_nuxt/error-500.B_VIyt60.css +0 -1
|
@@ -26,11 +26,11 @@ const containerEl = ref<HTMLDivElement | undefined>()
|
|
|
26
26
|
const instance = useScript(`https://js.stripe.com/v3/pricing-table.js`, {
|
|
27
27
|
trigger: useScriptTriggerElement({ trigger: props.trigger, el: rootEl }),
|
|
28
28
|
})
|
|
29
|
-
const {
|
|
29
|
+
const { onLoaded, status } = instance
|
|
30
30
|
|
|
31
31
|
const pricingTable = ref<HTMLElement | undefined>()
|
|
32
32
|
onMounted(() => {
|
|
33
|
-
|
|
33
|
+
onLoaded(() => {
|
|
34
34
|
const StripePricingTable = window.customElements.get('stripe-pricing-table')!
|
|
35
35
|
const stripePricingTable = new StripePricingTable()
|
|
36
36
|
stripePricingTable.setAttribute('publishable-key', props.publishableKey)
|
|
@@ -45,7 +45,7 @@ onMounted(() => {
|
|
|
45
45
|
rootEl.value!.appendChild(stripePricingTable)
|
|
46
46
|
emit('ready', instance)
|
|
47
47
|
})
|
|
48
|
-
watch(
|
|
48
|
+
watch(status, (status) => {
|
|
49
49
|
if (status === 'error') {
|
|
50
50
|
emit('error')
|
|
51
51
|
}
|
|
@@ -60,9 +60,9 @@ onBeforeUnmount(() => {
|
|
|
60
60
|
<template>
|
|
61
61
|
<div ref="rootEl">
|
|
62
62
|
<div ref="containerEl" />
|
|
63
|
-
<slot v-if="
|
|
64
|
-
<slot v-if="
|
|
65
|
-
<slot v-else-if="
|
|
63
|
+
<slot v-if="status === 'loading'" name="loading" />
|
|
64
|
+
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
|
|
65
|
+
<slot v-else-if="status === 'error'" name="error" />
|
|
66
66
|
<slot />
|
|
67
67
|
</div>
|
|
68
68
|
</template>
|
|
@@ -8,12 +8,7 @@ import { useScriptTriggerElement } from '../composables/useScriptTriggerElement'
|
|
|
8
8
|
import { useScriptVimeoPlayer } from '../registry/vimeo-player'
|
|
9
9
|
import { useAsyncData, useHead } from '#imports'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
// custom
|
|
13
|
-
trigger?: ElementScriptTrigger
|
|
14
|
-
placeholderAttrs?: ImgHTMLAttributes
|
|
15
|
-
rootAttrs?: HTMLAttributes
|
|
16
|
-
aboveTheFold?: boolean
|
|
11
|
+
interface VimeoOptions {
|
|
17
12
|
// copied from @types/vimeo__player
|
|
18
13
|
id?: number | undefined
|
|
19
14
|
url?: string | undefined
|
|
@@ -25,7 +20,7 @@ const props = withDefaults(defineProps<{
|
|
|
25
20
|
controls?: boolean | undefined
|
|
26
21
|
dnt?: boolean | undefined
|
|
27
22
|
height?: number | undefined
|
|
28
|
-
|
|
23
|
+
|
|
29
24
|
interactive_params?: string | undefined
|
|
30
25
|
keyboard?: boolean | undefined
|
|
31
26
|
loop?: boolean | undefined
|
|
@@ -42,12 +37,19 @@ const props = withDefaults(defineProps<{
|
|
|
42
37
|
title?: boolean | undefined
|
|
43
38
|
transparent?: boolean | undefined
|
|
44
39
|
width?: number | undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(defineProps<{
|
|
43
|
+
// custom
|
|
44
|
+
trigger?: ElementScriptTrigger
|
|
45
|
+
placeholderAttrs?: ImgHTMLAttributes
|
|
46
|
+
rootAttrs?: HTMLAttributes
|
|
47
|
+
aboveTheFold?: boolean
|
|
48
|
+
vimeoOptions?: VimeoOptions
|
|
49
|
+
id?: number | undefined
|
|
50
|
+
url?: string | undefined
|
|
45
51
|
}>(), {
|
|
46
52
|
trigger: 'mousedown',
|
|
47
|
-
width: 640,
|
|
48
|
-
height: 480,
|
|
49
|
-
loop: false,
|
|
50
|
-
controls: true,
|
|
51
53
|
})
|
|
52
54
|
|
|
53
55
|
const emits = defineEmits<TEmits>()
|
|
@@ -122,7 +124,7 @@ if (props.trigger === 'mousedown') {
|
|
|
122
124
|
})
|
|
123
125
|
}
|
|
124
126
|
const ready = ref(false)
|
|
125
|
-
const {
|
|
127
|
+
const { onLoaded, status } = useScriptVimeoPlayer({
|
|
126
128
|
scriptOptions: {
|
|
127
129
|
trigger,
|
|
128
130
|
},
|
|
@@ -140,12 +142,16 @@ if (import.meta.server) {
|
|
|
140
142
|
})
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
const id = computed(() => {
|
|
146
|
+
return props.vimeoOptions?.id || props.id
|
|
147
|
+
})
|
|
148
|
+
|
|
143
149
|
const { data: payload } = useAsyncData(
|
|
144
|
-
`vimeo-embed:${
|
|
150
|
+
`vimeo-embed:${id.value}`,
|
|
145
151
|
// TODO ideally we cache this
|
|
146
|
-
() => $fetch(`https://vimeo.com/api/v2/video/${
|
|
152
|
+
() => $fetch(`https://vimeo.com/api/v2/video/${id.value}.json`).then(res => (res as any)[0]),
|
|
147
153
|
{
|
|
148
|
-
watch: [
|
|
154
|
+
watch: [id],
|
|
149
155
|
},
|
|
150
156
|
)
|
|
151
157
|
|
|
@@ -169,10 +175,26 @@ defineExpose({
|
|
|
169
175
|
setPlaybackRate: (rate: number) => player?.setPlaybackRate(rate),
|
|
170
176
|
})
|
|
171
177
|
|
|
178
|
+
const width = computed(() => {
|
|
179
|
+
return props.vimeoOptions?.width || elVimeo.value?.parentNode?.offsetWidth || 640
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const height = computed(() => {
|
|
183
|
+
return props.vimeoOptions?.height || elVimeo.value?.parentNode?.offsetHeight || 480
|
|
184
|
+
})
|
|
185
|
+
|
|
172
186
|
onMounted(() => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
187
|
+
onLoaded(async ({ Vimeo }) => {
|
|
188
|
+
const vimeoOptions = props.vimeoOptions || {}
|
|
189
|
+
if (!vimeoOptions.id && props.id) {
|
|
190
|
+
vimeoOptions.id = props.id
|
|
191
|
+
}
|
|
192
|
+
if (!vimeoOptions.url && props.url) {
|
|
193
|
+
vimeoOptions.url = props.url
|
|
194
|
+
}
|
|
195
|
+
vimeoOptions.width = width.value
|
|
196
|
+
vimeoOptions.height = height.value
|
|
197
|
+
player = new Vimeo.Player(elVimeo.value, vimeoOptions)
|
|
176
198
|
if (clickTriggered) {
|
|
177
199
|
player!.play()
|
|
178
200
|
clickTriggered = false
|
|
@@ -186,35 +208,35 @@ onMounted(() => {
|
|
|
186
208
|
})
|
|
187
209
|
}
|
|
188
210
|
})
|
|
211
|
+
})
|
|
189
212
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
})
|
|
213
|
+
watch(() => props.id, (v) => {
|
|
214
|
+
if (v) {
|
|
215
|
+
player?.loadVideo(Number(v))
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
watch(status, (status) => {
|
|
219
|
+
if (status === 'error') {
|
|
220
|
+
// @ts-expect-error untyped
|
|
221
|
+
emits('error')
|
|
222
|
+
}
|
|
201
223
|
})
|
|
202
224
|
|
|
203
225
|
const rootAttrs = computed(() => {
|
|
204
226
|
return defu(props.rootAttrs, {
|
|
205
|
-
'aria-busy':
|
|
206
|
-
'aria-label':
|
|
227
|
+
'aria-busy': status.value === 'loading',
|
|
228
|
+
'aria-label': status.value === 'awaitingLoad'
|
|
207
229
|
? 'Vimeo Player - Placeholder'
|
|
208
|
-
:
|
|
230
|
+
: status.value === 'loading'
|
|
209
231
|
? 'Vimeo Player - Loading'
|
|
210
232
|
: 'Vimeo Player - Loaded',
|
|
211
233
|
'aria-live': 'polite',
|
|
212
234
|
'role': 'application',
|
|
213
235
|
'style': {
|
|
214
236
|
maxWidth: '100%',
|
|
215
|
-
width: `${
|
|
216
|
-
height:
|
|
217
|
-
aspectRatio:
|
|
237
|
+
width: `${width.value}px`,
|
|
238
|
+
height: 'auto',
|
|
239
|
+
aspectRatio: `16/9`,
|
|
218
240
|
position: 'relative',
|
|
219
241
|
backgroundColor: 'black',
|
|
220
242
|
},
|
|
@@ -242,19 +264,19 @@ onBeforeUnmount(() => player?.unload())
|
|
|
242
264
|
|
|
243
265
|
<template>
|
|
244
266
|
<div ref="rootEl" v-bind="rootAttrs">
|
|
245
|
-
<div v-show="ready" ref="elVimeo" class="vimeo-player"
|
|
267
|
+
<div v-show="ready" ref="elVimeo" class="vimeo-player" />
|
|
246
268
|
<slot v-if="!ready" v-bind="payload" :placeholder="placeholder" name="placeholder">
|
|
247
269
|
<img v-if="placeholder" v-bind="placeholderAttrs">
|
|
248
270
|
</slot>
|
|
249
|
-
<slot v-if="
|
|
271
|
+
<slot v-if="status === 'loading'" name="loading">
|
|
250
272
|
<ScriptLoadingIndicator color="white" />
|
|
251
273
|
</slot>
|
|
252
|
-
<slot v-if="
|
|
253
|
-
<slot v-else-if="
|
|
274
|
+
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
|
|
275
|
+
<slot v-else-if="status === 'error'" name="error" />
|
|
254
276
|
<slot />
|
|
255
277
|
</div>
|
|
256
278
|
</template>
|
|
257
279
|
|
|
258
280
|
<style>
|
|
259
|
-
.vimeo-player iframe{max-width:100%!important}
|
|
281
|
+
.vimeo-player iframe{aspect-ratio:16/9;height:auto;max-width:100%!important;width:100%}
|
|
260
282
|
</style>
|
|
@@ -44,7 +44,7 @@ const rootEl = ref()
|
|
|
44
44
|
const youtubeEl = ref()
|
|
45
45
|
const ready = ref(false)
|
|
46
46
|
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
|
|
47
|
-
const {
|
|
47
|
+
const { onLoaded, status } = useScriptYouTubePlayer({
|
|
48
48
|
scriptOptions: {
|
|
49
49
|
trigger,
|
|
50
50
|
},
|
|
@@ -58,7 +58,7 @@ if (props.trigger === 'mousedown') {
|
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
onMounted(() => {
|
|
61
|
-
|
|
61
|
+
onLoaded(async (instance) => {
|
|
62
62
|
const YouTube: typeof YT & { ready: (fn: () => void) => void } = await instance.YT
|
|
63
63
|
await new Promise<void>((resolve) => {
|
|
64
64
|
if (typeof YT.Player === 'undefined')
|
|
@@ -85,7 +85,7 @@ onMounted(() => {
|
|
|
85
85
|
}])),
|
|
86
86
|
})
|
|
87
87
|
})
|
|
88
|
-
watch(
|
|
88
|
+
watch(status, (status) => {
|
|
89
89
|
if (status === 'error') {
|
|
90
90
|
// @ts-expect-error untyped
|
|
91
91
|
emits('error')
|
|
@@ -99,10 +99,10 @@ defineExpose({
|
|
|
99
99
|
|
|
100
100
|
const rootAttrs = computed(() => {
|
|
101
101
|
return defu(props.rootAttrs, {
|
|
102
|
-
'aria-busy':
|
|
103
|
-
'aria-label':
|
|
102
|
+
'aria-busy': status.value === 'loading',
|
|
103
|
+
'aria-label': status.value === 'awaitingLoad'
|
|
104
104
|
? 'YouTube Player - Placeholder'
|
|
105
|
-
:
|
|
105
|
+
: status.value === 'loading'
|
|
106
106
|
? 'YouTube Player - Loading'
|
|
107
107
|
: 'YouTube Player - Loaded',
|
|
108
108
|
'aria-live': 'polite',
|
|
@@ -161,11 +161,11 @@ const placeholderAttrs = computed(() => {
|
|
|
161
161
|
<slot v-if="!ready" :placeholder="placeholder" name="placeholder">
|
|
162
162
|
<img v-bind="placeholderAttrs">
|
|
163
163
|
</slot>
|
|
164
|
-
<slot v-if="
|
|
164
|
+
<slot v-if="status === 'loading'" name="loading">
|
|
165
165
|
<ScriptLoadingIndicator />
|
|
166
166
|
</slot>
|
|
167
|
-
<slot v-if="
|
|
168
|
-
<slot v-else-if="
|
|
167
|
+
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
|
|
168
|
+
<slot v-else-if="status === 'error'" name="error" />
|
|
169
169
|
<slot />
|
|
170
170
|
</div>
|
|
171
171
|
</template>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { UseScriptInput, VueScriptInstance } from '@unhead/vue';
|
|
2
|
+
import type { UseFunctionType, AsAsyncFunctionValues } from '@unhead/schema';
|
|
2
3
|
import type { NuxtUseScriptOptions } from '#nuxt-scripts';
|
|
3
|
-
export
|
|
4
|
+
export type UseScriptContext<T extends Record<symbol | string, any>> = (Promise<T> & VueScriptInstance<T>) & AsAsyncFunctionValues<T> & {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use top-level functions instead.
|
|
7
|
+
*/
|
|
4
8
|
$script: Promise<T> & VueScriptInstance<T>;
|
|
5
9
|
};
|
|
10
|
+
export declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>, U = Record<symbol | string, any>>(input: UseScriptInput, options?: NuxtUseScriptOptions<T, U>): UseScriptContext<UseFunctionType<NuxtUseScriptOptions<T, U>, T>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveScriptKey } from "unhead";
|
|
2
2
|
import { defu } from "defu";
|
|
3
3
|
import { useScript as _useScript } from "@unhead/vue";
|
|
4
4
|
import { injectHead, onNuxtReady, useNuxtApp, useRuntimeConfig, reactive } from "#imports";
|
|
@@ -11,7 +11,7 @@ export function useScript(input, options) {
|
|
|
11
11
|
if (options.trigger === "onNuxtReady")
|
|
12
12
|
options.trigger = onNuxtReady;
|
|
13
13
|
const nuxtApp = useNuxtApp();
|
|
14
|
-
const id =
|
|
14
|
+
const id = resolveScriptKey(input);
|
|
15
15
|
nuxtApp.$scripts = nuxtApp.$scripts || reactive({});
|
|
16
16
|
if (nuxtApp.$scripts[id]) {
|
|
17
17
|
return nuxtApp.$scripts[id];
|
|
@@ -29,7 +29,7 @@ export function useScript(input, options) {
|
|
|
29
29
|
nuxtApp.$scripts[id] = instance;
|
|
30
30
|
if (import.meta.dev && import.meta.client) {
|
|
31
31
|
let syncScripts = function() {
|
|
32
|
-
nuxtApp._scripts[instance
|
|
32
|
+
nuxtApp._scripts[instance.id] = payload;
|
|
33
33
|
nuxtApp.hooks.callHook("scripts:updated", { scripts: nuxtApp._scripts });
|
|
34
34
|
};
|
|
35
35
|
const payload = {
|
|
@@ -39,21 +39,21 @@ export function useScript(input, options) {
|
|
|
39
39
|
events: []
|
|
40
40
|
};
|
|
41
41
|
nuxtApp._scripts = nuxtApp._scripts || {};
|
|
42
|
-
if (!nuxtApp._scripts[instance
|
|
42
|
+
if (!nuxtApp._scripts[instance.id]) {
|
|
43
43
|
const head = injectHead();
|
|
44
44
|
head.hooks.hook("script:updated", (ctx) => {
|
|
45
|
-
if (ctx.script.id !== instance
|
|
45
|
+
if (ctx.script.id !== instance.id)
|
|
46
46
|
return;
|
|
47
47
|
payload.events.push({
|
|
48
48
|
type: "status",
|
|
49
49
|
status: ctx.script.status,
|
|
50
50
|
at: Date.now()
|
|
51
51
|
});
|
|
52
|
-
payload.$script = instance
|
|
52
|
+
payload.$script = instance;
|
|
53
53
|
syncScripts();
|
|
54
54
|
});
|
|
55
55
|
head.hooks.hook("script:instance-fn", (ctx) => {
|
|
56
|
-
if (ctx.script.id !== instance
|
|
56
|
+
if (ctx.script.id !== instance.id || String(ctx.fn).startsWith("__v_"))
|
|
57
57
|
return;
|
|
58
58
|
payload.events.push({
|
|
59
59
|
type: "fn-call",
|
|
@@ -62,7 +62,7 @@ export function useScript(input, options) {
|
|
|
62
62
|
});
|
|
63
63
|
syncScripts();
|
|
64
64
|
});
|
|
65
|
-
payload.$script = instance
|
|
65
|
+
payload.$script = instance;
|
|
66
66
|
payload.events.push({
|
|
67
67
|
type: "status",
|
|
68
68
|
status: "awaitingLoad",
|
|
@@ -2,7 +2,4 @@ import type { TrackedPage } from '#nuxt-scripts';
|
|
|
2
2
|
export declare function useScriptEventPage(onChange?: (payload: TrackedPage) => void): import("vue").Ref<{
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
path: string;
|
|
5
|
-
}, TrackedPage | {
|
|
6
|
-
title?: string | undefined;
|
|
7
|
-
path: string;
|
|
8
5
|
}>;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
|
-
/**
|
|
3
|
-
* <script type="text/javascript">
|
|
4
|
-
* (function(c,l,a,r,i,t,y){
|
|
5
|
-
* c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
|
6
|
-
* t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
|
7
|
-
* y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
|
8
|
-
* })(window, document, "clarity", "script", "mpy5c6k7xi");
|
|
9
|
-
* </script>
|
|
10
|
-
*/
|
|
11
2
|
type ClarityFunctions = ((fn: 'start', options: {
|
|
12
3
|
content: boolean;
|
|
13
4
|
cookies: string[];
|
|
@@ -38,7 +29,5 @@ export declare const ClarityOptions: import("valibot").ObjectSchema<{
|
|
|
38
29
|
readonly id: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 10, undefined>]>;
|
|
39
30
|
}, undefined>;
|
|
40
31
|
export type ClarityInput = RegistryScriptInput<typeof ClarityOptions>;
|
|
41
|
-
export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): T
|
|
42
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
43
|
-
};
|
|
32
|
+
export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): import("../composables/useScript").UseScriptContext<T>;
|
|
44
33
|
export {};
|
|
@@ -30,6 +30,4 @@ export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSche
|
|
|
30
30
|
readonly spa: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, never>;
|
|
31
31
|
}, undefined>;
|
|
32
32
|
export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>;
|
|
33
|
-
export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): T
|
|
34
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
35
|
-
};
|
|
33
|
+
export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -57,6 +57,4 @@ declare global {
|
|
|
57
57
|
$crisp: CrispApi;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
export declare function useScriptCrisp<T extends CrispApi>(_options?: CrispInput): T
|
|
61
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
62
|
-
};
|
|
60
|
+
export declare function useScriptCrisp<T extends CrispApi>(_options?: CrispInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -47,6 +47,4 @@ declare global {
|
|
|
47
47
|
fathom: FathomAnalyticsApi;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?: FathomAnalyticsInput): T
|
|
51
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
52
|
-
};
|
|
50
|
+
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?: FathomAnalyticsInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -23,6 +23,4 @@ declare global {
|
|
|
23
23
|
*
|
|
24
24
|
* 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.
|
|
25
25
|
*/
|
|
26
|
-
export declare function useScriptGoogleAdsense<T extends GoogleAdsenseApi>(_options?: GoogleAdsenseInput): T
|
|
27
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
28
|
-
};
|
|
26
|
+
export declare function useScriptGoogleAdsense<T extends GoogleAdsenseApi>(_options?: GoogleAdsenseInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -5,15 +5,7 @@ export declare const GoogleAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
|
5
5
|
readonly l: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
6
6
|
}, undefined>;
|
|
7
7
|
export type GoogleAnalyticsInput = RegistryScriptInput<typeof GoogleAnalyticsOptions>;
|
|
8
|
-
export declare function useScriptGoogleAnalytics(_options?: GoogleAnalyticsInput): {
|
|
8
|
+
export declare function useScriptGoogleAnalytics(_options?: GoogleAnalyticsInput): import("../composables/useScript").UseScriptContext<{
|
|
9
9
|
dataLayer: DataLayer;
|
|
10
10
|
gtag: GTag;
|
|
11
|
-
}
|
|
12
|
-
$script: Promise<{
|
|
13
|
-
dataLayer: DataLayer;
|
|
14
|
-
gtag: GTag;
|
|
15
|
-
}> & import("@unhead/vue").VueScriptInstance<{
|
|
16
|
-
dataLayer: DataLayer;
|
|
17
|
-
gtag: GTag;
|
|
18
|
-
}>;
|
|
19
|
-
};
|
|
11
|
+
}>;
|
|
@@ -15,7 +15,7 @@ export declare const GoogleMapsOptions: import("valibot").ObjectSchema<{
|
|
|
15
15
|
export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>;
|
|
16
16
|
type MapsNamespace = typeof google.maps;
|
|
17
17
|
export interface GoogleMapsApi {
|
|
18
|
-
maps:
|
|
18
|
+
maps: Promise<MapsNamespace>;
|
|
19
19
|
}
|
|
20
20
|
declare global {
|
|
21
21
|
interface Window {
|
|
@@ -24,7 +24,5 @@ declare global {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
export declare function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMapsInput): T
|
|
28
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
29
|
-
};
|
|
27
|
+
export declare function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMapsInput): import("../composables/useScript").UseScriptContext<T>;
|
|
30
28
|
export {};
|
|
@@ -9,15 +9,7 @@ export declare const GoogleTagManagerOptions: import("valibot").ObjectSchema<{
|
|
|
9
9
|
readonly l: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
10
10
|
}, undefined>;
|
|
11
11
|
export type GoogleTagManagerInput = RegistryScriptInput<typeof GoogleTagManagerOptions>;
|
|
12
|
-
export declare function useScriptGoogleTagManager(_options?: GoogleTagManagerInput): {
|
|
12
|
+
export declare function useScriptGoogleTagManager(_options?: GoogleTagManagerInput): import("../composables/useScript").UseScriptContext<{
|
|
13
13
|
dataLayer: DataLayer;
|
|
14
14
|
google_tag_manager: import("third-party-capital").GoogleTagManagerInstance;
|
|
15
|
-
}
|
|
16
|
-
$script: Promise<{
|
|
17
|
-
dataLayer: DataLayer;
|
|
18
|
-
google_tag_manager: import("third-party-capital").GoogleTagManagerInstance;
|
|
19
|
-
}> & import("@unhead/vue").VueScriptInstance<{
|
|
20
|
-
dataLayer: DataLayer;
|
|
21
|
-
google_tag_manager: import("third-party-capital").GoogleTagManagerInstance;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
15
|
+
}>;
|
|
@@ -17,6 +17,4 @@ export declare const HotjarOptions: import("valibot").ObjectSchema<{
|
|
|
17
17
|
readonly sv: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, never>;
|
|
18
18
|
}, undefined>;
|
|
19
19
|
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false, false>;
|
|
20
|
-
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): T
|
|
21
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
22
|
-
};
|
|
20
|
+
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -19,6 +19,4 @@ declare global {
|
|
|
19
19
|
intercomSettings?: any;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export declare function useScriptIntercom<T extends IntercomApi>(_options?: IntercomInput): T
|
|
23
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
24
|
-
};
|
|
22
|
+
export declare function useScriptIntercom<T extends IntercomApi>(_options?: IntercomInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -69,6 +69,4 @@ declare global {
|
|
|
69
69
|
LemonSqueezy: LemonSqueezyApi;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
export declare function useScriptLemonSqueezy<T extends LemonSqueezyApi>(_options?: LemonSqueezyInput): T
|
|
73
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
74
|
-
};
|
|
72
|
+
export declare function useScriptLemonSqueezy<T extends LemonSqueezyApi>(_options?: LemonSqueezyInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -13,7 +13,5 @@ declare global {
|
|
|
13
13
|
interface Window extends MatomoAnalyticsApi {
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): T
|
|
17
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
18
|
-
};
|
|
16
|
+
export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): import("../composables/useScript").UseScriptContext<T>;
|
|
19
17
|
export {};
|
|
@@ -37,7 +37,5 @@ export declare const MetaPixelOptions: import("valibot").ObjectSchema<{
|
|
|
37
37
|
readonly id: import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>;
|
|
38
38
|
}, undefined>;
|
|
39
39
|
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false, false>;
|
|
40
|
-
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): T
|
|
41
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
42
|
-
};
|
|
40
|
+
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): import("../composables/useScript").UseScriptContext<T>;
|
|
43
41
|
export {};
|
|
@@ -6,6 +6,4 @@ export declare const NpmOptions: import("valibot").ObjectSchema<{
|
|
|
6
6
|
readonly type: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
7
7
|
}, undefined>;
|
|
8
8
|
export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true, false>;
|
|
9
|
-
export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): T
|
|
10
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
11
|
-
};
|
|
9
|
+
export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -14,6 +14,4 @@ declare global {
|
|
|
14
14
|
plausible: PlausibleAnalyticsApi;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
export declare function useScriptPlausibleAnalytics<T extends PlausibleAnalyticsApi>(_options?: PlausibleAnalyticsInput): T
|
|
18
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
19
|
-
};
|
|
17
|
+
export declare function useScriptPlausibleAnalytics<T extends PlausibleAnalyticsApi>(_options?: PlausibleAnalyticsInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -29,7 +29,5 @@ declare global {
|
|
|
29
29
|
interface Window extends SegmentApi {
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export declare function useScriptSegment<T extends SegmentApi>(_options?: SegmentInput): T
|
|
33
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
34
|
-
};
|
|
32
|
+
export declare function useScriptSegment<T extends SegmentApi>(_options?: SegmentInput): import("../composables/useScript").UseScriptContext<T>;
|
|
35
33
|
export {};
|
|
@@ -10,6 +10,4 @@ declare global {
|
|
|
10
10
|
interface Window extends StripeApi {
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
export declare function useScriptStripe<T extends StripeApi>(_options?: StripeInput): T
|
|
14
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
15
|
-
};
|
|
13
|
+
export declare function useScriptStripe<T extends StripeApi>(_options?: StripeInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -11,7 +11,5 @@ declare global {
|
|
|
11
11
|
interface Window extends VimeoPlayerApi {
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
export declare function useScriptVimeoPlayer<T extends VimeoPlayerApi>(_options?: VimeoPlayerInput): T
|
|
15
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
16
|
-
};
|
|
14
|
+
export declare function useScriptVimeoPlayer<T extends VimeoPlayerApi>(_options?: VimeoPlayerInput): import("../composables/useScript").UseScriptContext<T>;
|
|
17
15
|
export {};
|
|
@@ -15,7 +15,7 @@ export function useScriptVimeoPlayer(_options) {
|
|
|
15
15
|
}
|
|
16
16
|
}), _options);
|
|
17
17
|
if (import.meta.client) {
|
|
18
|
-
const _ = watch(instance
|
|
18
|
+
const _ = watch(instance.status, (status) => {
|
|
19
19
|
if (status === "loading") {
|
|
20
20
|
useHead({
|
|
21
21
|
link: [
|
|
@@ -32,7 +32,5 @@ export declare const XPixelOptions: import("valibot").ObjectSchema<{
|
|
|
32
32
|
readonly version: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, never>;
|
|
33
33
|
}, undefined>;
|
|
34
34
|
export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false, false>;
|
|
35
|
-
export declare function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput): T
|
|
36
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
37
|
-
};
|
|
35
|
+
export declare function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput): import("../composables/useScript").UseScriptContext<T>;
|
|
38
36
|
export {};
|
|
@@ -10,6 +10,4 @@ declare global {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export type YouTubePlayerInput = RegistryScriptInput;
|
|
13
|
-
export declare function useScriptYouTubePlayer<T extends YouTubePlayerApi>(_options: YouTubePlayerInput): T
|
|
14
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
15
|
-
};
|
|
13
|
+
export declare function useScriptYouTubePlayer<T extends YouTubePlayerApi>(_options: YouTubePlayerInput): import("../composables/useScript").UseScriptContext<T>;
|
|
@@ -25,7 +25,7 @@ export function useScriptYouTubePlayer(_options) {
|
|
|
25
25
|
}
|
|
26
26
|
}), _options);
|
|
27
27
|
if (import.meta.client) {
|
|
28
|
-
const _ = watch(instance
|
|
28
|
+
const _ = watch(instance.status, (status) => {
|
|
29
29
|
if (status === "loading") {
|
|
30
30
|
useHead({
|
|
31
31
|
link: [
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -23,14 +23,14 @@ import type { ClarityInput } from './registry/clarity.js';
|
|
|
23
23
|
import type { CrispInput } from './registry/crisp.js';
|
|
24
24
|
import type { GoogleAnalyticsInput } from './registry/google-analytics.js';
|
|
25
25
|
import type { GoogleTagManagerInput } from './registry/google-tag-manager.js';
|
|
26
|
-
export type NuxtUseScriptOptions<T
|
|
26
|
+
export type NuxtUseScriptOptions<T extends Record<symbol | string, any> = {}, U = {}> = Omit<UseScriptOptions<T, U>, 'trigger'> & {
|
|
27
27
|
/**
|
|
28
28
|
* The trigger to load the script:
|
|
29
29
|
* - `onNuxtReady` - Load the script when Nuxt is ready.
|
|
30
|
-
* - `manual` - Load the script manually by calling
|
|
30
|
+
* - `manual` - Load the script manually by calling `load()`.
|
|
31
31
|
* - `Promise` - Load the script when the promise resolves.
|
|
32
32
|
*/
|
|
33
|
-
trigger?: UseScriptOptions<T>['trigger'] | 'onNuxtReady';
|
|
33
|
+
trigger?: UseScriptOptions<T, U>['trigger'] | 'onNuxtReady';
|
|
34
34
|
/**
|
|
35
35
|
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
36
36
|
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|