@nuxt/scripts 0.11.6 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/client/200.html +9 -9
  3. package/dist/client/404.html +9 -9
  4. package/dist/client/_nuxt/BNOvKpxj.js +21 -0
  5. package/dist/client/_nuxt/{DhL_UpCd.js → D2xoTE-m.js} +1 -1
  6. package/dist/client/_nuxt/{C347yIJI.js → DZpw5SEC.js} +1 -1
  7. package/dist/client/_nuxt/builds/latest.json +1 -1
  8. package/dist/client/_nuxt/builds/meta/74284f3b-1037-4522-9dce-e62d39b7a1ca.json +1 -0
  9. package/dist/client/_nuxt/error-404.i3o1HkNe.css +1 -0
  10. package/dist/client/_nuxt/error-500.CGX2FgfP.css +1 -0
  11. package/dist/client/_nuxt/{Di440A2l.js → qUtuIAKL.js} +1 -1
  12. package/dist/client/index.html +9 -9
  13. package/dist/module.d.mts +2 -1
  14. package/dist/module.json +1 -1
  15. package/dist/registry.mjs +9 -0
  16. package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +2 -19
  17. package/dist/runtime/components/ScriptCrisp.vue.d.ts +2 -23
  18. package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +2 -24
  19. package/dist/runtime/components/ScriptGoogleMaps.vue +4 -4
  20. package/dist/runtime/components/ScriptGoogleMaps.vue.d.ts +3 -73
  21. package/dist/runtime/components/ScriptIntercom.vue.d.ts +2 -27
  22. package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +2 -19
  23. package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +2 -23
  24. package/dist/runtime/components/ScriptVimeoPlayer.vue +12 -4
  25. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +2 -108
  26. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +2 -69
  27. package/dist/runtime/registry/rybbit-analytics.d.ts +46 -0
  28. package/dist/runtime/registry/rybbit-analytics.js +42 -0
  29. package/dist/runtime/registry/umami-analytics.d.ts +7 -1
  30. package/dist/runtime/registry/umami-analytics.js +22 -3
  31. package/dist/runtime/types.d.ts +2 -0
  32. package/dist/runtime/validation/mock.d.ts +3 -0
  33. package/dist/runtime/validation/mock.js +1 -0
  34. package/dist/types.d.mts +3 -1
  35. package/package.json +31 -31
  36. package/dist/client/_nuxt/V79VpDdr.js +0 -21
  37. package/dist/client/_nuxt/builds/meta/3e09fd1b-e587-4ed5-a851-8fd373eda48a.json +0 -1
  38. package/dist/client/_nuxt/error-404.BtCtaqmq.css +0 -1
  39. package/dist/client/_nuxt/error-500.D9fi60uT.css +0 -1
  40. /package/dist/client/_nuxt/{entry.B4DN0kwM.css → entry.DExDtQtx.css} +0 -0
@@ -1,6 +1,5 @@
1
1
  import type { HTMLAttributes, ImgHTMLAttributes } from 'vue';
2
2
  import type { ElementScriptTrigger } from '../types.js';
3
- import ScriptAriaLoadingIndicator from './ScriptAriaLoadingIndicator.vue.js';
4
3
  interface VimeoOptions {
5
4
  id?: number | undefined;
6
5
  url?: string | undefined;
@@ -38,48 +37,8 @@ type __VLS_Props = {
38
37
  id?: number | undefined;
39
38
  url?: string | undefined;
40
39
  };
41
- declare const elVimeo: import("vue").Ref<any, any>;
42
- declare const rootEl: import("vue").Ref<any, any>;
43
- declare const ready: import("vue").Ref<boolean, boolean>;
44
- declare const status: import("vue").Ref<import("@unhead/vue").UseScriptStatus, import("@unhead/vue").UseScriptStatus>;
45
- declare const payload: import("vue").Ref<any, any>;
46
- declare const placeholder: import("vue").ComputedRef<any>;
47
- declare const rootAttrs: import("vue").ComputedRef<HTMLAttributes>;
48
- declare const placeholderAttrs: import("vue").ComputedRef<Omit<ImgHTMLAttributes, "style" | "src" | "loading" | "alt"> & Omit<{
49
- src: any;
50
- alt: string;
51
- loading: "eager" | "lazy";
52
- fetchpriority: string | undefined;
53
- style: {
54
- cursor: "pointer";
55
- width: string;
56
- objectFit: "contain";
57
- height: string;
58
- };
59
- }, "style" | "src" | "loading" | "alt"> & {
60
- style: string | false | import("vue").StyleValue[] | {
61
- cursor: "pointer";
62
- width: string;
63
- objectFit: "contain";
64
- height: string;
65
- } | (Omit<import("vue").CSSProperties, "width" | "height" | "cursor" | "objectFit"> & Omit<{
66
- cursor: "pointer";
67
- width: string;
68
- objectFit: "contain";
69
- height: string;
70
- }, "width" | "height" | "cursor" | "objectFit"> & {
71
- width: string | number | (string & {});
72
- height: string | number | (string & {});
73
- cursor: "alias" | "default" | "auto" | "help" | "copy" | "progress" | "none" | "text" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "-moz-grab" | "-webkit-grab" | "all-scroll" | "cell" | "col-resize" | "context-menu" | "crosshair" | "e-resize" | "ew-resize" | "grab" | "grabbing" | "move" | "n-resize" | "ne-resize" | "nesw-resize" | "no-drop" | "not-allowed" | "ns-resize" | "nw-resize" | "nwse-resize" | "pointer" | "row-resize" | "s-resize" | "se-resize" | "sw-resize" | "vertical-text" | "w-resize" | "wait" | "zoom-in" | "zoom-out";
74
- objectFit: "fill" | "none" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "contain" | "cover" | "scale-down";
75
- });
76
- src: any;
77
- loading: "eager" | "lazy";
78
- alt: string;
79
- }>;
80
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
81
40
  declare var __VLS_1: any, __VLS_3: {}, __VLS_8: {}, __VLS_10: {}, __VLS_12: {};
82
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
41
+ type __VLS_Slots = {} & {
83
42
  placeholder?: (props: typeof __VLS_1) => any;
84
43
  } & {
85
44
  loading?: (props: typeof __VLS_3) => any;
@@ -89,72 +48,7 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
89
48
  error?: (props: typeof __VLS_10) => any;
90
49
  } & {
91
50
  default?: (props: typeof __VLS_12) => any;
92
- }>;
93
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
94
- ScriptAriaLoadingIndicator: typeof ScriptAriaLoadingIndicator;
95
- elVimeo: typeof elVimeo;
96
- rootEl: typeof rootEl;
97
- ready: typeof ready;
98
- status: typeof status;
99
- payload: typeof payload;
100
- placeholder: typeof placeholder;
101
- rootAttrs: typeof rootAttrs;
102
- placeholderAttrs: typeof placeholderAttrs;
103
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
104
- loaded: (event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any;
105
- error: (event: import("@vimeo/player").Error, player: Vimeo.Player) => any;
106
- cuechange: (event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any;
107
- durationchange: (event: import("@vimeo/player").DurationChangeEvent, player: Vimeo.Player) => any;
108
- ended: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
109
- pause: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
110
- play: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
111
- playing: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
112
- progress: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
113
- resize: (event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any;
114
- seeked: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
115
- seeking: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
116
- timeupdate: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
117
- volumechange: (event: import("@vimeo/player").VolumeChangeEvent, player: Vimeo.Player) => any;
118
- fullscreenchange: (event: import("@vimeo/player").FullScreenChangeEvent, player: Vimeo.Player) => any;
119
- texttrackchange: (event: import("@vimeo/player").TextTrackChangeEvent, player: Vimeo.Player) => any;
120
- chapterchange: (event: import("@vimeo/player").VimeoChapter, player: Vimeo.Player) => any;
121
- cuepoint: (event: import("@vimeo/player").CuePointEvent, player: Vimeo.Player) => any;
122
- playbackratechange: (event: import("@vimeo/player").PlaybackRateEvent, player: Vimeo.Player) => any;
123
- bufferstart: (event: never, player: Vimeo.Player) => any;
124
- bufferend: (event: never, player: Vimeo.Player) => any;
125
- qualitychange: (event: import("@vimeo/player").QualityChangeEvent, player: Vimeo.Player) => any;
126
- camerachange: (event: import("@vimeo/player").VimeoCameraProps, player: Vimeo.Player) => any;
127
- enterpictureinpicture: (event: never, player: Vimeo.Player) => any;
128
- leavepictureinpicture: (event: never, player: Vimeo.Player) => any;
129
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
130
- onLoaded?: ((event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any) | undefined;
131
- onError?: ((event: import("@vimeo/player").Error, player: Vimeo.Player) => any) | undefined;
132
- onCuechange?: ((event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any) | undefined;
133
- onDurationchange?: ((event: import("@vimeo/player").DurationChangeEvent, player: Vimeo.Player) => any) | undefined;
134
- onEnded?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
135
- onPause?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
136
- onPlay?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
137
- onPlaying?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
138
- onProgress?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
139
- onResize?: ((event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any) | undefined;
140
- onSeeked?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
141
- onSeeking?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
142
- onTimeupdate?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
143
- onVolumechange?: ((event: import("@vimeo/player").VolumeChangeEvent, player: Vimeo.Player) => any) | undefined;
144
- onFullscreenchange?: ((event: import("@vimeo/player").FullScreenChangeEvent, player: Vimeo.Player) => any) | undefined;
145
- onTexttrackchange?: ((event: import("@vimeo/player").TextTrackChangeEvent, player: Vimeo.Player) => any) | undefined;
146
- onChapterchange?: ((event: import("@vimeo/player").VimeoChapter, player: Vimeo.Player) => any) | undefined;
147
- onCuepoint?: ((event: import("@vimeo/player").CuePointEvent, player: Vimeo.Player) => any) | undefined;
148
- onPlaybackratechange?: ((event: import("@vimeo/player").PlaybackRateEvent, player: Vimeo.Player) => any) | undefined;
149
- onBufferstart?: ((event: never, player: Vimeo.Player) => any) | undefined;
150
- onBufferend?: ((event: never, player: Vimeo.Player) => any) | undefined;
151
- onQualitychange?: ((event: import("@vimeo/player").QualityChangeEvent, player: Vimeo.Player) => any) | undefined;
152
- onCamerachange?: ((event: import("@vimeo/player").VimeoCameraProps, player: Vimeo.Player) => any) | undefined;
153
- onEnterpictureinpicture?: ((event: never, player: Vimeo.Player) => any) | undefined;
154
- onLeavepictureinpicture?: ((event: never, player: Vimeo.Player) => any) | undefined;
155
- }>, {
156
- trigger: ElementScriptTrigger;
157
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
+ };
158
52
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
159
53
  play: () => Promise<void> | undefined;
160
54
  pause: () => Promise<void> | undefined;
@@ -1,6 +1,5 @@
1
1
  import type { HTMLAttributes, ImgHTMLAttributes, Ref } from 'vue';
2
2
  import type { ElementScriptTrigger } from '../types.js';
3
- import ScriptAriaLoadingIndicator from './ScriptAriaLoadingIndicator.vue.js';
4
3
  export type YoutubeThumbnailSize = '1' | '2' | '3' | 'default' | 'mq1' | 'mq2' | 'mq3' | 'mqdefault' | '0' | 'hq1' | 'hq2' | 'hq3' | 'hqdefault' | 'sd1' | 'sd2' | 'sd3' | 'sddefault' | 'hq720' | 'maxresdefault';
5
4
  type __VLS_Props = {
6
5
  placeholderAttrs?: ImgHTMLAttributes;
@@ -21,46 +20,10 @@ type __VLS_Props = {
21
20
  thumbnailSize?: YoutubeThumbnailSize;
22
21
  webp?: boolean;
23
22
  };
24
- declare const rootEl: Ref<any, any>;
25
- declare const youtubeEl: Ref<any, any>;
26
- declare const ready: Ref<boolean, boolean>;
27
- declare const status: Ref<import("@unhead/vue").UseScriptStatus, import("@unhead/vue").UseScriptStatus>;
28
- declare const rootAttrs: import("vue").ComputedRef<HTMLAttributes>;
29
- declare const placeholder: import("vue").ComputedRef<string>;
30
- declare const placeholderAttrs: import("vue").ComputedRef<Omit<ImgHTMLAttributes, "style" | "src" | "loading" | "onLoad" | "alt"> & Omit<{
31
- src: string;
32
- alt: string;
33
- loading: "eager" | "lazy";
34
- style: {
35
- width: string;
36
- objectFit: "contain";
37
- height: string;
38
- };
39
- onLoad(payload: Event): void;
40
- }, "style" | "src" | "loading" | "onLoad" | "alt"> & {
41
- style: string | false | import("vue").StyleValue[] | {
42
- width: string;
43
- objectFit: "contain";
44
- height: string;
45
- } | (Omit<import("vue").CSSProperties, "width" | "height" | "objectFit"> & Omit<{
46
- width: string;
47
- objectFit: "contain";
48
- height: string;
49
- }, "width" | "height" | "objectFit"> & {
50
- width: string | number | (string & {});
51
- height: string | number | (string & {});
52
- objectFit: "fill" | "none" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "contain" | "cover" | "scale-down";
53
- });
54
- src: string;
55
- loading: "eager" | "lazy";
56
- onLoad: ((payload: Event) => void) | ((payload: Event) => void);
57
- alt: string;
58
- }>;
59
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
60
23
  declare var __VLS_1: {
61
24
  placeholder: any;
62
25
  }, __VLS_3: {}, __VLS_8: {}, __VLS_10: {}, __VLS_12: {};
63
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
26
+ type __VLS_Slots = {} & {
64
27
  placeholder?: (props: typeof __VLS_1) => any;
65
28
  } & {
66
29
  loading?: (props: typeof __VLS_3) => any;
@@ -70,37 +33,7 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
70
33
  error?: (props: typeof __VLS_10) => any;
71
34
  } & {
72
35
  default?: (props: typeof __VLS_12) => any;
73
- }>;
74
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
75
- ScriptAriaLoadingIndicator: typeof ScriptAriaLoadingIndicator;
76
- rootEl: typeof rootEl;
77
- youtubeEl: typeof youtubeEl;
78
- ready: typeof ready;
79
- status: typeof status;
80
- rootAttrs: typeof rootAttrs;
81
- placeholder: typeof placeholder;
82
- placeholderAttrs: typeof placeholderAttrs;
83
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
84
- error: (e: YT.OnErrorEvent, target: YT.Player) => any;
85
- ready: (e: YT.PlayerEvent) => any;
86
- "state-change": (e: YT.OnStateChangeEvent, target: YT.Player) => any;
87
- "playback-quality-change": (e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any;
88
- "playback-rate-change": (e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any;
89
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
90
- onError?: ((e: YT.OnErrorEvent, target: YT.Player) => any) | undefined;
91
- onReady?: ((e: YT.PlayerEvent) => any) | undefined;
92
- "onState-change"?: ((e: YT.OnStateChangeEvent, target: YT.Player) => any) | undefined;
93
- "onPlayback-quality-change"?: ((e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any) | undefined;
94
- "onPlayback-rate-change"?: ((e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any) | undefined;
95
- }>, {
96
- trigger: ElementScriptTrigger;
97
- width: number;
98
- height: number;
99
- playerVars: YT.PlayerVars;
100
- cookies: boolean;
101
- thumbnailSize: YoutubeThumbnailSize;
102
- webp: boolean;
103
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ };
104
37
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
105
38
  player: Ref<YT.Player | undefined, YT.Player | undefined>;
106
39
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -0,0 +1,46 @@
1
+ import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
+ export declare const RybbitAnalyticsOptions: import("valibot").ObjectSchema<{
3
+ readonly siteId: import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>], 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
+ /**
13
+ * Tracks a page view
14
+ */
15
+ pageview: () => void;
16
+ /**
17
+ * Tracks a custom event
18
+ * @param name Name of the event
19
+ * @param properties Optional properties for the event
20
+ */
21
+ event: (name: string, properties?: Record<string, any>) => void;
22
+ /**
23
+ * Sets a custom user ID for tracking logged-in users
24
+ * @param userId The user ID to set (will be stored in localStorage)
25
+ */
26
+ identify: (userId: string) => void;
27
+ /**
28
+ * Clears the stored user ID
29
+ */
30
+ clearUserId: () => void;
31
+ /**
32
+ * Gets the currently set user ID
33
+ * @returns The current user ID or null if not set
34
+ */
35
+ getUserId: () => string | null;
36
+ /**
37
+ * @deprecated use top level functions instead
38
+ */
39
+ rybbit: RybbitAnalyticsApi;
40
+ }
41
+ declare global {
42
+ interface Window {
43
+ rybbit: RybbitAnalyticsApi;
44
+ }
45
+ }
46
+ export declare function useScriptRybbitAnalytics<T extends RybbitAnalyticsApi>(_options?: RybbitAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -0,0 +1,42 @@
1
+ import { useRegistryScript } from "../utils.js";
2
+ import { array, boolean, number, object, optional, string, union } from "#nuxt-scripts-validator";
3
+ export const RybbitAnalyticsOptions = object({
4
+ siteId: union([string(), number()]),
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": String(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
+ if (typeof window.rybbit === "undefined") {
28
+ return null;
29
+ }
30
+ return {
31
+ pageview: window.rybbit.pageview,
32
+ event: window.rybbit.event,
33
+ identify: window.rybbit.identify,
34
+ clearUserId: window.rybbit.clearUserId,
35
+ getUserId: window.rybbit.getUserId,
36
+ rybbit: window.rybbit
37
+ };
38
+ }
39
+ }
40
+ };
41
+ }, _options);
42
+ }
@@ -23,11 +23,17 @@ export declare const UmamiAnalyticsOptions: import("valibot").ObjectSchema<{
23
23
  * Events can be filtered in the dashboard by a specific tag.
24
24
  */
25
25
  readonly tag: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
26
+ /**
27
+ * Function that will be called before data is sent to Umami.
28
+ * The function takes two parameters: type and payload.
29
+ * Return the payload to continue sending, or return a falsy value to cancel.
30
+ */
31
+ readonly beforeSend: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").CustomSchema<(type: string, payload: Record<string, any>) => Record<string, any> | null | false, undefined>, import("valibot").StringSchema<undefined>], undefined>, undefined>;
26
32
  }, undefined>;
27
33
  export type UmamiAnalyticsInput = RegistryScriptInput<typeof UmamiAnalyticsOptions, false>;
28
34
  export interface UmamiAnalyticsApi {
29
35
  track: ((payload?: Record<string, any>) => void) & ((event_name: string, event_data: Record<string, any>) => void);
30
- identify: (session_data?: Record<string, any>) => void;
36
+ identify: (session_data?: Record<string, any> | string) => void;
31
37
  }
32
38
  declare global {
33
39
  interface Window {
@@ -1,5 +1,5 @@
1
1
  import { useRegistryScript } from "../utils.js";
2
- import { object, optional, string, boolean, array } from "#nuxt-scripts-validator";
2
+ import { object, optional, string, boolean, array, union, custom } from "#nuxt-scripts-validator";
3
3
  export const UmamiAnalyticsOptions = object({
4
4
  websiteId: string(),
5
5
  // required
@@ -24,11 +24,29 @@ export const UmamiAnalyticsOptions = object({
24
24
  * If you want the tracker to collect events under a specific tag.
25
25
  * Events can be filtered in the dashboard by a specific tag.
26
26
  */
27
- tag: optional(string())
27
+ tag: optional(string()),
28
+ /**
29
+ * Function that will be called before data is sent to Umami.
30
+ * The function takes two parameters: type and payload.
31
+ * Return the payload to continue sending, or return a falsy value to cancel.
32
+ */
33
+ beforeSend: optional(union([
34
+ custom((input) => typeof input === "function"),
35
+ string()
36
+ ]))
28
37
  });
29
38
  export function useScriptUmamiAnalytics(_options) {
30
39
  return useRegistryScript("umamiAnalytics", (options) => {
31
40
  const domains = Array.isArray(options?.domains) ? options.domains.join(",") : options?.domains;
41
+ let beforeSendFunctionName;
42
+ if (import.meta.client) {
43
+ if (options?.beforeSend && typeof options.beforeSend === "function") {
44
+ beforeSendFunctionName = `__umamiBeforeSend_${Math.random().toString(36).substring(2, 15)}`;
45
+ window[beforeSendFunctionName] = options.beforeSend;
46
+ } else if (typeof options.beforeSend === "string") {
47
+ beforeSendFunctionName = options.beforeSend;
48
+ }
49
+ }
32
50
  return {
33
51
  scriptInput: {
34
52
  "src": "https://cloud.umami.is/script.js",
@@ -36,7 +54,8 @@ export function useScriptUmamiAnalytics(_options) {
36
54
  "data-host-url": options?.hostUrl || void 0,
37
55
  "data-auto-track": typeof options?.autoTrack === "boolean" ? options.autoTrack : true,
38
56
  "data-domains": domains || void 0,
39
- "data-tag": options?.tag || void 0
57
+ "data-tag": options?.tag || void 0,
58
+ "data-before-send": beforeSendFunctionName || void 0
40
59
  },
41
60
  schema: import.meta.dev ? UmamiAnalyticsOptions : void 0,
42
61
  scriptOptions: {
@@ -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;
@@ -37,3 +37,6 @@ export declare const minLength: (() => void) & {
37
37
  export declare const pipe: (() => void) & {
38
38
  __mock__: boolean;
39
39
  };
40
+ export declare const custom: (() => void) & {
41
+ __mock__: boolean;
42
+ };
@@ -18,3 +18,4 @@ export const record = noop;
18
18
  export const any = noop;
19
19
  export const minLength = noop;
20
20
  export const pipe = noop;
21
+ export const custom = noop;
package/dist/types.d.mts CHANGED
@@ -4,4 +4,6 @@ declare module '@nuxt/schema' {
4
4
  interface NuxtHooks extends ModuleHooks {}
5
5
  }
6
6
 
7
- export { type ModuleHooks, type ModuleOptions, default } from './module.mjs'
7
+ export { default } from './module.mjs'
8
+
9
+ export { type ModuleHooks, type ModuleOptions } 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.6",
4
+ "version": "0.11.8",
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",
@@ -76,11 +76,11 @@
76
76
  }
77
77
  },
78
78
  "dependencies": {
79
- "@nuxt/kit": "^3.16.2",
80
- "@vueuse/core": "^13.1.0",
79
+ "@nuxt/kit": "^3.17.4",
80
+ "@vueuse/core": "^13.3.0",
81
81
  "consola": "^3.4.2",
82
82
  "defu": "^6.1.4",
83
- "h3": "^1.15.1",
83
+ "h3": "^1.15.3",
84
84
  "magic-string": "^0.30.17",
85
85
  "ofetch": "^1.4.1",
86
86
  "ohash": "^2.0.11",
@@ -89,44 +89,44 @@
89
89
  "sirv": "^3.0.1",
90
90
  "std-env": "^3.9.0",
91
91
  "ufo": "^1.6.1",
92
- "unplugin": "^2.3.2",
93
- "unstorage": "^1.15.0",
94
- "valibot": "^1.0.0"
92
+ "unplugin": "^2.3.5",
93
+ "unstorage": "^1.16.0",
94
+ "valibot": "^1.1.0"
95
95
  },
96
96
  "devDependencies": {
97
- "@nuxt/devtools-kit": "^2.4.0",
98
- "@nuxt/devtools-ui-kit": "^2.4.0",
99
- "@nuxt/eslint-config": "^1.3.0",
97
+ "@nuxt/devtools-kit": "^2.4.1",
98
+ "@nuxt/devtools-ui-kit": "^2.4.1",
99
+ "@nuxt/eslint-config": "^1.4.1",
100
100
  "@nuxt/module-builder": "^1.0.1",
101
- "@nuxt/test-utils": "3.17.2",
101
+ "@nuxt/test-utils": "3.19.1",
102
102
  "@types/semver": "^7.7.0",
103
- "@typescript-eslint/typescript-estree": "^8.30.1",
104
- "acorn-loose": "^8.4.0",
105
- "bumpp": "^10.1.0",
103
+ "@typescript-eslint/typescript-estree": "^8.33.0",
104
+ "acorn-loose": "^8.5.0",
105
+ "bumpp": "^10.1.1",
106
106
  "changelogen": "^0.6.1",
107
- "eslint": "9.24.0",
108
- "eslint-plugin-n": "^17.17.0",
109
- "happy-dom": "^17.4.4",
107
+ "eslint": "9.28.0",
108
+ "eslint-plugin-n": "^17.18.0",
109
+ "happy-dom": "^17.5.6",
110
110
  "knitwork": "^1.2.0",
111
- "nuxt": "^3.16.2",
112
- "playwright-core": "^1.51.1",
113
- "shiki": "2.5.0",
111
+ "nuxt": "^3.17.4",
112
+ "playwright-core": "^1.52.0",
113
+ "shiki": "3.4.2",
114
114
  "typescript": "5.8.2",
115
- "vitest": "^3.1.1",
116
- "vue": "^3.5.13",
117
- "vue-router": "^4.5.0",
118
- "vue-tsc": "^2.2.8",
119
- "@nuxt/scripts": "0.11.6"
115
+ "vitest": "^3.1.4",
116
+ "vue": "^3.5.16",
117
+ "vue-router": "^4.5.1",
118
+ "vue-tsc": "^2.2.10",
119
+ "@nuxt/scripts": "0.11.8"
120
120
  },
121
121
  "resolutions": {
122
122
  "@nuxt/schema": "catalog:",
123
123
  "@nuxt/scripts": "workspace:*",
124
- "@unhead/vue": "^2.0.5",
125
- "nuxt": "^3.16.2",
124
+ "@unhead/vue": "^2.0.10",
125
+ "nuxt": "^3.17.4",
126
126
  "typescript": "^5.8.3",
127
- "unhead": "^2.0.5",
128
- "vue": "^3.5.13",
129
- "vue-router": "^4.5.0"
127
+ "unhead": "^2.0.10",
128
+ "vue": "^3.5.16",
129
+ "vue-router": "^4.5.1"
130
130
  },
131
131
  "scripts": {
132
132
  "build": "pnpm dev:prepare && pnpm prepack",
@@ -137,7 +137,7 @@
137
137
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
138
138
  "typecheck": "vue-tsc --noEmit",
139
139
  "bump": "bumpp package.json --commit --push --tag",
140
- "release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.log\" && pnpm publish",
140
+ "release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\" && pnpm publish",
141
141
  "lint": "eslint .",
142
142
  "lint:fix": "eslint . --fix",
143
143
  "test": "pnpm dev:prepare && vitest --run --exclude **/__runtime__ && pnpm test:runtime",