@nuxt/scripts 0.6.5 → 0.7.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 +1 -1
- package/dist/client/200.html +9 -9
- package/dist/client/404.html +9 -9
- package/dist/client/_nuxt/{D3k5CjNA.js → BW5_3H_7.js} +1 -1
- package/dist/client/_nuxt/{D9Ze639F.js → CObySb1Z.js} +1 -1
- package/dist/client/_nuxt/Cdyv1BV6.js +31 -0
- package/dist/client/_nuxt/{D6UD5WyS.js → DPxoUSuY.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/b4af023e-aaec-4265-8ade-ce133bb4c4c3.json +1 -0
- package/dist/client/_nuxt/entry.FVeyw1Qn.css +1 -0
- package/dist/client/_nuxt/error-404.D8Cdd2Pl.css +1 -0
- package/dist/client/_nuxt/error-500.BENoupyF.css +1 -0
- package/dist/client/index.html +9 -9
- package/dist/module.d.mts +2 -10
- package/dist/module.d.ts +2 -10
- package/dist/module.json +2 -2
- package/dist/module.mjs +13 -4
- package/dist/runtime/components/ScriptCrisp.vue +10 -7
- package/dist/runtime/components/ScriptGoogleAdsense.vue +7 -7
- package/dist/runtime/components/ScriptGoogleMaps.vue +224 -66
- 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 -38
- 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 +2 -2
- package/dist/runtime/composables/useScriptEventPage.js +6 -5
- 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-analytics.js +6 -3
- 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/matomo-analytics.js +6 -2
- package/dist/runtime/registry/meta-pixel.d.ts +2 -3
- package/dist/runtime/registry/meta-pixel.js +5 -1
- 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 +2 -5
- 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/x-pixel.js +6 -2
- 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 +5 -5
- package/dist/runtime/types.js +1 -1
- package/dist/runtime/utils.d.ts +2 -4
- package/package.json +41 -37
- package/dist/client/_nuxt/BA8oXX6l.js +0 -31
- package/dist/client/_nuxt/builds/meta/a5c6ec68-62ae-43af-96d0-bdd9f64f38b1.json +0 -1
- package/dist/client/_nuxt/entry.Cts5wDvr.css +0 -1
- package/dist/client/_nuxt/error-404.-RjlvToe.css +0 -1
- package/dist/client/_nuxt/error-500.Bz7LXgZy.css +0 -1
|
@@ -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",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TrackedPage } from '#nuxt-scripts';
|
|
2
|
-
export declare function useScriptEventPage(onChange?: (payload: TrackedPage) => void): import("
|
|
3
|
-
title?: string;
|
|
2
|
+
export declare function useScriptEventPage(onChange?: (payload: TrackedPage) => void): import("vue").Ref<{
|
|
3
|
+
title?: string | undefined;
|
|
4
4
|
path: string;
|
|
5
5
|
}>;
|
|
@@ -10,7 +10,8 @@ export function useScriptEventPage(onChange) {
|
|
|
10
10
|
if (import.meta.server)
|
|
11
11
|
return payload;
|
|
12
12
|
let lastPayload = { path: "", title: "" };
|
|
13
|
-
let stopDomWatcher
|
|
13
|
+
let stopDomWatcher = () => {
|
|
14
|
+
};
|
|
14
15
|
nuxt.hooks.hook("page:finish", () => {
|
|
15
16
|
Promise.race([
|
|
16
17
|
// possibly no head update is needed
|
|
@@ -18,15 +19,15 @@ export function useScriptEventPage(onChange) {
|
|
|
18
19
|
new Promise((resolve) => {
|
|
19
20
|
stopDomWatcher = head.hooks.hook("dom:rendered", () => resolve());
|
|
20
21
|
})
|
|
21
|
-
]).finally(() => {
|
|
22
|
-
stopDomWatcher && stopDomWatcher();
|
|
23
|
-
}).then(() => {
|
|
22
|
+
]).finally(stopDomWatcher).then(() => {
|
|
24
23
|
payload.value = {
|
|
25
24
|
path: route.fullPath,
|
|
26
25
|
title: document.title
|
|
27
26
|
};
|
|
28
27
|
if (lastPayload.path !== payload.value.path || lastPayload.title !== payload.value.title) {
|
|
29
|
-
|
|
28
|
+
if (onChange) {
|
|
29
|
+
onChange(payload.value);
|
|
30
|
+
}
|
|
30
31
|
lastPayload = payload.value;
|
|
31
32
|
}
|
|
32
33
|
});
|
|
@@ -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
|
+
}>;
|
|
@@ -7,7 +7,7 @@ export const GoogleAnalyticsOptions = object({
|
|
|
7
7
|
});
|
|
8
8
|
function use(options) {
|
|
9
9
|
const gtag = function(...args) {
|
|
10
|
-
window[options.l ?? "dataLayer"]
|
|
10
|
+
window["gtag-" + (options.l ?? "dataLayer")](...args);
|
|
11
11
|
};
|
|
12
12
|
return {
|
|
13
13
|
dataLayer: window[options.l ?? "dataLayer"],
|
|
@@ -33,8 +33,11 @@ export function useScriptGoogleAnalytics(_options) {
|
|
|
33
33
|
// eslint-disable-next-line
|
|
34
34
|
clientInit: import.meta.server ? void 0 : () => {
|
|
35
35
|
window[options?.l ?? "dataLayer"] = window[options?.l ?? "dataLayer"] || [];
|
|
36
|
-
window[options?.l ?? "dataLayer"]
|
|
37
|
-
|
|
36
|
+
window["gtag-" + (options?.l ?? "dataLayer")] = function() {
|
|
37
|
+
window[options?.l ?? "dataLayer"].push(arguments);
|
|
38
|
+
};
|
|
39
|
+
window["gtag-" + (options?.l ?? "dataLayer")]("js", /* @__PURE__ */ new Date());
|
|
40
|
+
window["gtag-" + (options?.l ?? "dataLayer")]("config", options?.id);
|
|
38
41
|
}
|
|
39
42
|
}), _options);
|
|
40
43
|
}
|
|
@@ -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 {};
|
|
@@ -26,8 +26,12 @@ export function useScriptMatomoAnalytics(_options) {
|
|
|
26
26
|
},
|
|
27
27
|
clientInit: import.meta.server ? void 0 : () => {
|
|
28
28
|
const _paq = window._paq = window._paq || [];
|
|
29
|
-
options?.trackPageView
|
|
30
|
-
|
|
29
|
+
if (options?.trackPageView) {
|
|
30
|
+
_paq.push(["trackPageView"]);
|
|
31
|
+
}
|
|
32
|
+
if (options?.enableLinkTracking) {
|
|
33
|
+
_paq.push(["enableLinkTracking"]);
|
|
34
|
+
}
|
|
31
35
|
_paq.push(["setTrackerUrl", withBase(`/matomo.php`, withHttps(options?.matomoUrl))]);
|
|
32
36
|
_paq.push(["setSiteId", options?.siteId || "1"]);
|
|
33
37
|
}
|
|
@@ -27,6 +27,7 @@ export interface MetaPixelApi {
|
|
|
27
27
|
queue: any[];
|
|
28
28
|
};
|
|
29
29
|
_fbq: MetaPixelApi['fbq'];
|
|
30
|
+
callMethod?: FbqFns;
|
|
30
31
|
}
|
|
31
32
|
declare global {
|
|
32
33
|
interface Window extends MetaPixelApi {
|
|
@@ -36,7 +37,5 @@ export declare const MetaPixelOptions: import("valibot").ObjectSchema<{
|
|
|
36
37
|
readonly id: import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], undefined>;
|
|
37
38
|
}, undefined>;
|
|
38
39
|
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false, false>;
|
|
39
|
-
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): T
|
|
40
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
41
|
-
};
|
|
40
|
+
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): import("../composables/useScript").UseScriptContext<T>;
|
|
42
41
|
export {};
|
|
@@ -17,7 +17,11 @@ export function useScriptMetaPixel(_options) {
|
|
|
17
17
|
},
|
|
18
18
|
clientInit: import.meta.server ? void 0 : () => {
|
|
19
19
|
const fbq = window.fbq = function(...params) {
|
|
20
|
-
|
|
20
|
+
if (fbq.callMethod) {
|
|
21
|
+
fbq.callMethod(...params);
|
|
22
|
+
} else {
|
|
23
|
+
fbq.queue.push(params);
|
|
24
|
+
}
|
|
21
25
|
};
|
|
22
26
|
if (!window._fbq)
|
|
23
27
|
window._fbq = fbq;
|
|
@@ -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>;
|
|
@@ -24,13 +24,10 @@ interface AnalyticsApi {
|
|
|
24
24
|
*/
|
|
25
25
|
push: (args: any[]) => void;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
28
|
-
}
|
|
27
|
+
export type SegmentApi = Pick<AnalyticsApi, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'reset'>;
|
|
29
28
|
declare global {
|
|
30
29
|
interface Window extends SegmentApi {
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
export declare function useScriptSegment<T extends SegmentApi>(_options?: SegmentInput): T
|
|
34
|
-
$script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
|
|
35
|
-
};
|
|
32
|
+
export declare function useScriptSegment<T extends SegmentApi>(_options?: SegmentInput): import("../composables/useScript").UseScriptContext<T>;
|
|
36
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 {};
|
|
@@ -12,8 +12,12 @@ export function useScriptXPixel(_options) {
|
|
|
12
12
|
crossorigin: false
|
|
13
13
|
},
|
|
14
14
|
clientInit: import.meta.server ? void 0 : () => {
|
|
15
|
-
const s = window.twq = function() {
|
|
16
|
-
|
|
15
|
+
const s = window.twq = function(...args) {
|
|
16
|
+
if (e.exe) {
|
|
17
|
+
s.exe(s, args);
|
|
18
|
+
} else {
|
|
19
|
+
s.queue.push(args);
|
|
20
|
+
}
|
|
17
21
|
};
|
|
18
22
|
s.version = options?.version || "1.1";
|
|
19
23
|
s.queue = [
|
|
@@ -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
|
|
@@ -124,8 +124,8 @@ export type NuxtConfigScriptRegistryEntry<T> = true | 'mock' | T | [T, NuxtUseSc
|
|
|
124
124
|
export type NuxtConfigScriptRegistry<T extends keyof ScriptRegistry = keyof ScriptRegistry> = Partial<{
|
|
125
125
|
[key in T]: NuxtConfigScriptRegistryEntry<ScriptRegistry[key]>;
|
|
126
126
|
}>;
|
|
127
|
-
declare const
|
|
128
|
-
export type EmptyOptionsSchema = typeof
|
|
127
|
+
declare const _emptyOptions: ObjectSchema<{}, undefined>;
|
|
128
|
+
export type EmptyOptionsSchema = typeof _emptyOptions;
|
|
129
129
|
type ScriptInput = ScriptBase & DataKeys & SchemaAugmentations['script'];
|
|
130
130
|
export type RegistryScriptInput<T extends ObjectSchema<any, any> = EmptyOptionsSchema, Bundelable extends boolean = true, Usable extends boolean = false, CanBypassOptions extends boolean = true> = (InferInput<T> & {
|
|
131
131
|
/**
|
package/dist/runtime/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { object } from "valibot";
|
|
2
|
-
const
|
|
2
|
+
const _emptyOptions = object({});
|
package/dist/runtime/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InferInput, ObjectSchema } from 'valibot';
|
|
2
|
-
import type { UseScriptInput
|
|
2
|
+
import type { UseScriptInput } from '@unhead/vue';
|
|
3
3
|
import type { EmptyOptionsSchema, NuxtUseScriptOptions, RegistryScriptInput, ScriptRegistry } from '#nuxt-scripts';
|
|
4
4
|
type OptionsFn<O extends ObjectSchema<any, any>> = (options: InferInput<O>) => ({
|
|
5
5
|
scriptInput?: UseScriptInput;
|
|
@@ -8,7 +8,5 @@ type OptionsFn<O extends ObjectSchema<any, any>> = (options: InferInput<O>) => (
|
|
|
8
8
|
clientInit?: () => void;
|
|
9
9
|
});
|
|
10
10
|
export declare function scriptRuntimeConfig<T extends keyof ScriptRegistry>(key: T): ScriptRegistry[T];
|
|
11
|
-
export declare function useRegistryScript<T extends Record<string | symbol, any>, O extends ObjectSchema<any, any> = EmptyOptionsSchema>(registryKey: keyof ScriptRegistry | string, optionsFn: OptionsFn<O>, _userOptions?: RegistryScriptInput<O>): T
|
|
12
|
-
$script: Promise<T> & VueScriptInstance<T>;
|
|
13
|
-
};
|
|
11
|
+
export declare function useRegistryScript<T extends Record<string | symbol, any>, O extends ObjectSchema<any, any> = EmptyOptionsSchema, U = {}>(registryKey: keyof ScriptRegistry | string, optionsFn: OptionsFn<O>, _userOptions?: RegistryScriptInput<O>): import("./composables/useScript").UseScriptContext<T>;
|
|
14
12
|
export {};
|