@nuxt/scripts 1.0.0-beta.2 → 1.0.0-beta.21

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 (165) hide show
  1. package/README.md +3 -3
  2. package/dist/client/200.html +1 -1
  3. package/dist/client/404.html +1 -1
  4. package/dist/client/_nuxt/{DvH517bE.js → BlmrFwhD.js} +1 -1
  5. package/dist/client/_nuxt/{DfLgoB--.js → BwCYQWJt.js} +1 -1
  6. package/dist/client/_nuxt/DvbTvDd0.js +162 -0
  7. package/dist/client/_nuxt/{B66N9HCo.js → ZrewjUYk.js} +1 -1
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/6660a023-888d-415f-b66d-ce774e6f8f11.json +1 -0
  10. package/dist/client/_nuxt/entry.CACgbLJl.css +1 -0
  11. package/dist/client/_nuxt/error-404.CHeaW3dp.css +1 -0
  12. package/dist/client/_nuxt/error-500.DvOvWme_.css +1 -0
  13. package/dist/client/index.html +1 -1
  14. package/dist/module.d.mts +27 -18
  15. package/dist/module.d.ts +178 -0
  16. package/dist/module.json +1 -1
  17. package/dist/module.mjs +763 -526
  18. package/dist/registry.d.ts +6 -0
  19. package/dist/registry.mjs +109 -21
  20. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +2 -2
  21. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +7 -7
  22. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +2 -2
  23. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +6 -6
  24. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +7 -7
  25. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +6 -6
  26. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +12 -12
  27. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +6 -6
  28. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +1 -1
  29. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +6 -6
  30. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +1 -1
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +5 -5
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +7 -7
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +7 -7
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +7 -7
  35. package/dist/runtime/components/ScriptCrisp.vue +1 -1
  36. package/dist/runtime/components/ScriptGoogleAdsense.vue +1 -1
  37. package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
  38. package/dist/runtime/components/ScriptGravatar.vue +46 -0
  39. package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
  40. package/dist/runtime/components/ScriptInstagramEmbed.vue +1 -1
  41. package/dist/runtime/components/ScriptIntercom.vue +4 -3
  42. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +43 -32
  43. package/dist/runtime/components/ScriptPayPalButtons.vue +48 -79
  44. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +43 -32
  45. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +37 -23
  46. package/dist/runtime/components/ScriptPayPalMessages.vue +46 -50
  47. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +37 -23
  48. package/dist/runtime/components/ScriptStripePricingTable.vue +2 -2
  49. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +9 -0
  50. package/dist/runtime/components/ScriptVimeoPlayer.vue +13 -10
  51. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +9 -0
  52. package/dist/runtime/components/ScriptXEmbed.d.vue.ts +1 -1
  53. package/dist/runtime/components/ScriptXEmbed.vue +1 -1
  54. package/dist/runtime/components/ScriptXEmbed.vue.d.ts +1 -1
  55. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +2 -2
  56. package/dist/runtime/components/ScriptYouTubePlayer.vue +11 -5
  57. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +2 -2
  58. package/dist/runtime/composables/useScript.js +11 -6
  59. package/dist/runtime/composables/useScriptEventPage.js +2 -2
  60. package/dist/runtime/composables/useScriptTriggerConsent.js +1 -1
  61. package/dist/runtime/composables/useScriptTriggerElement.js +1 -1
  62. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +1 -1
  63. package/dist/runtime/registry/clarity.d.ts +10 -15
  64. package/dist/runtime/registry/clarity.js +22 -31
  65. package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
  66. package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
  67. package/dist/runtime/registry/crisp.d.ts +9 -39
  68. package/dist/runtime/registry/crisp.js +2 -33
  69. package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
  70. package/dist/runtime/registry/databuddy-analytics.js +20 -45
  71. package/dist/runtime/registry/fathom-analytics.d.ts +6 -25
  72. package/dist/runtime/registry/fathom-analytics.js +2 -24
  73. package/dist/runtime/registry/google-adsense.d.ts +2 -10
  74. package/dist/runtime/registry/google-adsense.js +2 -11
  75. package/dist/runtime/registry/google-analytics.d.ts +3 -5
  76. package/dist/runtime/registry/google-analytics.js +3 -8
  77. package/dist/runtime/registry/google-maps.d.ts +3 -9
  78. package/dist/runtime/registry/google-maps.js +2 -8
  79. package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
  80. package/dist/runtime/registry/google-recaptcha.js +4 -12
  81. package/dist/runtime/registry/google-sign-in.d.ts +2 -13
  82. package/dist/runtime/registry/google-sign-in.js +2 -22
  83. package/dist/runtime/registry/google-tag-manager.d.ts +3 -28
  84. package/dist/runtime/registry/google-tag-manager.js +4 -27
  85. package/dist/runtime/registry/gravatar.d.ts +25 -0
  86. package/dist/runtime/registry/gravatar.js +32 -0
  87. package/dist/runtime/registry/hotjar.d.ts +3 -5
  88. package/dist/runtime/registry/hotjar.js +2 -5
  89. package/dist/runtime/registry/instagram-embed.d.ts +2 -17
  90. package/dist/runtime/registry/instagram-embed.js +4 -19
  91. package/dist/runtime/registry/intercom.d.ts +3 -11
  92. package/dist/runtime/registry/intercom.js +2 -12
  93. package/dist/runtime/registry/matomo-analytics.d.ts +2 -11
  94. package/dist/runtime/registry/matomo-analytics.js +3 -12
  95. package/dist/runtime/registry/meta-pixel.d.ts +3 -5
  96. package/dist/runtime/registry/meta-pixel.js +2 -4
  97. package/dist/runtime/registry/npm.d.ts +2 -6
  98. package/dist/runtime/registry/npm.js +2 -9
  99. package/dist/runtime/registry/paypal.d.ts +4 -25
  100. package/dist/runtime/registry/paypal.js +3 -66
  101. package/dist/runtime/registry/plausible-analytics.js +18 -13
  102. package/dist/runtime/registry/posthog.d.ts +10 -11
  103. package/dist/runtime/registry/posthog.js +7 -20
  104. package/dist/runtime/registry/reddit-pixel.d.ts +4 -5
  105. package/dist/runtime/registry/reddit-pixel.js +2 -4
  106. package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
  107. package/dist/runtime/registry/rybbit-analytics.js +7 -19
  108. package/dist/runtime/registry/schemas.d.ts +946 -0
  109. package/dist/runtime/registry/schemas.js +901 -0
  110. package/dist/runtime/registry/segment.d.ts +2 -5
  111. package/dist/runtime/registry/segment.js +2 -5
  112. package/dist/runtime/registry/snapchat-pixel.d.ts +3 -32
  113. package/dist/runtime/registry/snapchat-pixel.js +2 -20
  114. package/dist/runtime/registry/stripe.d.ts +3 -4
  115. package/dist/runtime/registry/stripe.js +2 -4
  116. package/dist/runtime/registry/tiktok-pixel.d.ts +3 -6
  117. package/dist/runtime/registry/tiktok-pixel.js +2 -6
  118. package/dist/runtime/registry/umami-analytics.d.ts +2 -31
  119. package/dist/runtime/registry/umami-analytics.js +2 -36
  120. package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
  121. package/dist/runtime/registry/vercel-analytics.js +84 -0
  122. package/dist/runtime/registry/vimeo-player.d.ts +2 -2
  123. package/dist/runtime/registry/vimeo-player.js +1 -1
  124. package/dist/runtime/registry/x-embed.d.ts +2 -16
  125. package/dist/runtime/registry/x-embed.js +2 -17
  126. package/dist/runtime/registry/x-pixel.d.ts +3 -6
  127. package/dist/runtime/registry/x-pixel.js +2 -5
  128. package/dist/runtime/registry/youtube-player.d.ts +7 -7
  129. package/dist/runtime/registry/youtube-player.js +1 -1
  130. package/dist/runtime/server/google-static-maps-proxy.js +1 -1
  131. package/dist/runtime/server/{sw-handler.d.ts → gravatar-proxy.d.ts} +1 -1
  132. package/dist/runtime/server/gravatar-proxy.js +62 -0
  133. package/dist/runtime/server/instagram-embed-asset.js +2 -1
  134. package/dist/runtime/server/instagram-embed-image.js +2 -1
  135. package/dist/runtime/server/instagram-embed.js +22 -13
  136. package/dist/runtime/server/proxy-handler.js +161 -117
  137. package/dist/runtime/server/utils/privacy.d.ts +45 -1
  138. package/dist/runtime/server/utils/privacy.js +103 -40
  139. package/dist/runtime/server/x-embed.js +3 -2
  140. package/dist/runtime/types.d.ts +35 -24
  141. package/dist/runtime/utils/pure.d.ts +0 -4
  142. package/dist/runtime/utils/pure.js +0 -67
  143. package/dist/runtime/utils.d.ts +3 -3
  144. package/dist/runtime/utils.js +12 -7
  145. package/dist/shared/scripts.Crpn87WB.mjs +318 -0
  146. package/dist/stats.d.mts +39 -0
  147. package/dist/stats.d.ts +39 -0
  148. package/dist/stats.mjs +772 -0
  149. package/dist/types-source.d.mts +19 -0
  150. package/dist/types-source.d.ts +19 -0
  151. package/dist/types-source.mjs +975 -0
  152. package/package.json +42 -31
  153. package/dist/client/_nuxt/B8XOar-X.js +0 -162
  154. package/dist/client/_nuxt/builds/meta/133a46c5-a5c1-4a63-87d1-037947a5bcdb.json +0 -1
  155. package/dist/client/_nuxt/entry.D45OuV0w.css +0 -1
  156. package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
  157. package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
  158. package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
  159. package/dist/runtime/components/ScriptPayPalMarks.vue +0 -69
  160. package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +0 -52
  161. package/dist/runtime/plugins/sw-register.client.d.ts +0 -2
  162. package/dist/runtime/plugins/sw-register.client.js +0 -12
  163. package/dist/runtime/server/sw-handler.js +0 -25
  164. package/dist/runtime/sw/proxy-sw.template.d.ts +0 -1
  165. package/dist/runtime/sw/proxy-sw.template.js +0 -54
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
- import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
3
2
  import { defu } from "defu";
4
3
  import { useAsyncData, useHead } from "nuxt/app";
4
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
5
5
  import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
6
6
  import { useScriptVimeoPlayer } from "../registry/vimeo-player";
7
7
  import ScriptAriaLoadingIndicator from "./ScriptAriaLoadingIndicator.vue";
@@ -12,7 +12,9 @@ const props = defineProps({
12
12
  aboveTheFold: { type: Boolean, required: false },
13
13
  vimeoOptions: { type: Object, required: false },
14
14
  id: { type: null, required: false },
15
- url: { type: null, required: false }
15
+ url: { type: null, required: false },
16
+ ratio: { type: String, required: false, default: "16/9" },
17
+ placeholderObjectFit: { type: String, required: false, default: "contain" }
16
18
  });
17
19
  const emits = defineEmits(["play", "playing", "pause", "ended", "timeupdate", "progress", "seeking", "seeked", "texttrackchange", "chapterchange", "cuechange", "cuepoint", "volumechange", "playbackratechange", "bufferstart", "bufferend", "error", "loaded", "durationchange", "fullscreenchange", "qualitychange", "camerachange", "resize", "enterpictureinpicture", "leavepictureinpicture"]);
18
20
  const events = [
@@ -153,12 +155,13 @@ const rootAttrs = computed(() => {
153
155
  "aria-live": "polite",
154
156
  "role": "application",
155
157
  "style": {
156
- maxWidth: "100%",
157
- width: `auto`,
158
- height: "auto",
159
- aspectRatio: `16/9`,
160
- position: "relative",
161
- backgroundColor: "black"
158
+ "--vimeo-ratio": props.ratio,
159
+ "maxWidth": "100%",
160
+ "width": `auto`,
161
+ "height": "auto",
162
+ "aspectRatio": props.ratio,
163
+ "position": "relative",
164
+ "backgroundColor": "black"
162
165
  },
163
166
  ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
164
167
  });
@@ -173,7 +176,7 @@ const placeholderAttrs = computed(() => {
173
176
  style: {
174
177
  cursor: "pointer",
175
178
  width: "100%",
176
- objectFit: "contain",
179
+ objectFit: props.placeholderObjectFit,
177
180
  height: "100%"
178
181
  }
179
182
  });
@@ -197,5 +200,5 @@ onBeforeUnmount(() => player?.unload());
197
200
  </template>
198
201
 
199
202
  <style>
200
- .vimeo-player iframe{aspect-ratio:16/9;height:auto;max-width:100%!important;width:100%}
203
+ .vimeo-player iframe{aspect-ratio:var(--vimeo-ratio,16/9);height:auto;max-width:100%!important;width:100%}
201
204
  </style>
@@ -36,6 +36,13 @@ type __VLS_Props = {
36
36
  vimeoOptions?: VimeoOptions;
37
37
  id?: number | undefined;
38
38
  url?: string | undefined;
39
+ ratio?: string;
40
+ /**
41
+ * Object-fit for the placeholder image.
42
+ *
43
+ * @default 'contain'
44
+ */
45
+ placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
39
46
  };
40
47
  declare var __VLS_1: any, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
41
48
  type __VLS_Slots = {} & {
@@ -117,6 +124,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
117
124
  onLeavepictureinpicture?: ((event: never, player: Vimeo.Player) => any) | undefined;
118
125
  }>, {
119
126
  trigger: ElementScriptTrigger;
127
+ ratio: string;
128
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
120
129
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
121
130
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
122
131
  declare const _default: typeof __VLS_export;
@@ -7,7 +7,7 @@ type __VLS_Props = {
7
7
  tweetId: string;
8
8
  /**
9
9
  * Custom API endpoint for fetching tweet data
10
- * @default '/_scripts/x-embed'
10
+ * @default '/api/_scripts/x-embed'
11
11
  */
12
12
  apiEndpoint?: string;
13
13
  /**
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { computed } from "vue";
3
2
  import { useAsyncData } from "nuxt/app";
3
+ import { computed } from "vue";
4
4
  import { formatCount, formatTweetDate, proxyXImageUrl } from "../registry/x-embed";
5
5
  const props = defineProps({
6
6
  tweetId: { type: String, required: true },
@@ -7,7 +7,7 @@ type __VLS_Props = {
7
7
  tweetId: string;
8
8
  /**
9
9
  * Custom API endpoint for fetching tweet data
10
- * @default '/_scripts/x-embed'
10
+ * @default '/api/_scripts/x-embed'
11
11
  */
12
12
  apiEndpoint?: string;
13
13
  /**
@@ -61,12 +61,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
61
61
  trigger: ElementScriptTrigger;
62
62
  width: number;
63
63
  height: number;
64
- playerVars: YT.PlayerVars;
65
64
  ratio: string;
65
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
66
+ playerVars: YT.PlayerVars;
66
67
  cookies: boolean;
67
68
  thumbnailSize: YoutubeThumbnailSize;
68
69
  webp: boolean;
69
- placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
70
70
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
71
71
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
72
72
  declare const _default: typeof __VLS_export;
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
- import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
3
2
  import { defu } from "defu";
4
3
  import { useHead } from "nuxt/app";
4
+ import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
5
5
  import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
6
6
  import { useScriptYouTubePlayer } from "../registry/youtube-player";
7
7
  import ScriptAriaLoadingIndicator from "./ScriptAriaLoadingIndicator.vue";
@@ -30,6 +30,7 @@ const events = [
30
30
  "onError",
31
31
  "onApiChange"
32
32
  ];
33
+ const CAMEL_CASE_RE = /([A-Z])/g;
33
34
  const rootEl = ref();
34
35
  const youtubeEl = ref();
35
36
  const ready = ref(false);
@@ -70,9 +71,11 @@ onMounted(() => {
70
71
  onLoaded(async (instance) => {
71
72
  if (!isTriggered.value && trigger instanceof Promise) {
72
73
  const triggered = await trigger;
73
- if (!triggered) return;
74
+ if (!triggered)
75
+ return;
74
76
  }
75
- if (!youtubeEl.value) return;
77
+ if (!youtubeEl.value)
78
+ return;
76
79
  const YouTube = instance.YT instanceof Promise ? await instance.YT : instance.YT;
77
80
  await new Promise((resolve) => {
78
81
  if (typeof YT.Player === "undefined")
@@ -80,7 +83,8 @@ onMounted(() => {
80
83
  else
81
84
  resolve();
82
85
  });
83
- if (!youtubeEl.value) return;
86
+ if (!youtubeEl.value)
87
+ return;
84
88
  player.value = new YT.Player(youtubeEl.value, {
85
89
  host: !props.cookies ? "https://www.youtube-nocookie.com" : "https://www.youtube.com",
86
90
  videoId: props.videoId,
@@ -89,7 +93,7 @@ onMounted(() => {
89
93
  playerVars: props.playerVars,
90
94
  ...props.playerOptions,
91
95
  events: Object.fromEntries(events.map((event) => [event, (e) => {
92
- const emitEventName = event.replace(/([A-Z])/g, "-$1").replace("on-", "").toLowerCase();
96
+ const emitEventName = event.replace(CAMEL_CASE_RE, "-$1").replace("on-", "").toLowerCase();
93
97
  emits(emitEventName, e);
94
98
  if (event === "onReady") {
95
99
  ready.value = true;
@@ -151,6 +155,8 @@ const placeholderAttrs = computed(() => {
151
155
  src: isFallbackPlaceHolder.value ? fallbackPlaceHolder.value : placeholder.value,
152
156
  alt: "",
153
157
  loading: props.aboveTheFold ? "eager" : "lazy",
158
+ // @ts-expect-error untyped
159
+ fetchpriority: props.aboveTheFold ? "high" : void 0,
154
160
  style: {
155
161
  width: "100%",
156
162
  objectFit: props.placeholderObjectFit,
@@ -61,12 +61,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
61
61
  trigger: ElementScriptTrigger;
62
62
  width: number;
63
63
  height: number;
64
- playerVars: YT.PlayerVars;
65
64
  ratio: string;
65
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
66
+ playerVars: YT.PlayerVars;
66
67
  cookies: boolean;
67
68
  thumbnailSize: YoutubeThumbnailSize;
68
69
  webp: boolean;
69
- placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
70
70
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
71
71
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
72
72
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,14 @@
1
- import { defu } from "defu";
1
+ import { resolveTrigger } from "#build/nuxt-scripts-trigger-resolver";
2
2
  import { useScript as _useScript } from "@unhead/vue/scripts";
3
- import { reactive, ref } from "vue";
4
- import { onNuxtReady, useNuxtApp, useRuntimeConfig, injectHead, useHead } from "nuxt/app";
3
+ import { defu } from "defu";
4
+ import { injectHead, onNuxtReady, useHead, useNuxtApp, useRuntimeConfig } from "nuxt/app";
5
+ import { ref } from "vue";
5
6
  import { logger } from "../logger.js";
6
- import { resolveTrigger } from "#build/nuxt-scripts-trigger-resolver";
7
+ function ensureScripts(nuxtApp) {
8
+ if (!nuxtApp.$scripts) {
9
+ nuxtApp.$scripts = {};
10
+ }
11
+ }
7
12
  function useNuxtScriptRuntimeConfig() {
8
13
  return useRuntimeConfig().public["nuxt-scripts"];
9
14
  }
@@ -22,7 +27,7 @@ export function useScript(input, options) {
22
27
  script: [{ src, type: "text/partytown" }]
23
28
  });
24
29
  const nuxtApp2 = useNuxtApp();
25
- nuxtApp2.$scripts = nuxtApp2.$scripts || reactive({});
30
+ ensureScripts(nuxtApp2);
26
31
  const status = ref("loaded");
27
32
  const stub = {
28
33
  id: src,
@@ -50,7 +55,7 @@ export function useScript(input, options) {
50
55
  if (!options.head) {
51
56
  throw new Error("useScript() has been called without Nuxt context.");
52
57
  }
53
- nuxtApp.$scripts = nuxtApp.$scripts || reactive({});
58
+ ensureScripts(nuxtApp);
54
59
  const exists = !!nuxtApp.$scripts?.[id];
55
60
  const err = options._validate?.();
56
61
  if (import.meta.dev && import.meta.client && err) {
@@ -1,5 +1,5 @@
1
- import { useNuxtApp, useRoute, injectHead } from "nuxt/app";
2
- import { ref, onScopeDispose } from "vue";
1
+ import { injectHead, useNuxtApp, useRoute } from "nuxt/app";
2
+ import { onScopeDispose, ref } from "vue";
3
3
  export function useScriptEventPage(onChange) {
4
4
  const nuxt = useNuxtApp();
5
5
  const route = useRoute();
@@ -1,5 +1,5 @@
1
+ import { onNuxtReady, requestIdleCallback, tryUseNuxtApp } from "nuxt/app";
1
2
  import { isRef, ref, toValue, watch } from "vue";
2
- import { tryUseNuxtApp, onNuxtReady, requestIdleCallback } from "nuxt/app";
3
3
  export function useScriptTriggerConsent(options) {
4
4
  if (import.meta.server)
5
5
  return new Promise(() => {
@@ -2,7 +2,7 @@ import {
2
2
  useEventListener,
3
3
  useIntersectionObserver
4
4
  } from "@vueuse/core";
5
- import { tryOnScopeDispose, tryOnMounted } from "@vueuse/shared";
5
+ import { tryOnMounted, tryOnScopeDispose } from "@vueuse/shared";
6
6
  import { watch } from "vue";
7
7
  function useElementVisibilityPromise(element) {
8
8
  let observer;
@@ -1,5 +1,5 @@
1
- import { tryOnScopeDispose } from "@vueuse/shared";
2
1
  import { useTimeoutFn } from "@vueuse/core";
2
+ import { tryOnScopeDispose } from "@vueuse/shared";
3
3
  import { onNuxtReady } from "nuxt/app";
4
4
  export function useScriptTriggerIdleTimeout(options) {
5
5
  if (import.meta.server) {
@@ -1,17 +1,19 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
- type ClarityFunctions = ((fn: 'start', options: {
3
- content: boolean;
4
- cookies: string[];
5
- dob: number;
6
- expire: number;
7
- projectId: string;
8
- upload: string;
2
+ import { ClarityOptions } from './schemas.js';
3
+ export { ClarityOptions };
4
+ type ClarityFunctions = ((fn: 'start', options?: {
5
+ content?: boolean;
6
+ cookies?: string[];
7
+ dob?: number;
8
+ expire?: number;
9
+ projectId?: string;
10
+ upload?: string;
9
11
  }) => void) & ((fn: 'identify', id: string, session?: string, page?: string, userHint?: string) => Promise<{
10
12
  id: string;
11
13
  session: string;
12
14
  page: string;
13
15
  userHint: string;
14
- }>) & ((fn: 'consent', enabled?: boolean) => void) & ((fn: 'set', key: any, value: any) => void) & ((fn: 'event', value: any) => void) & ((fn: 'upgrade', upgradeReason: any) => void) & ((fn: string, ...args: any[]) => void);
16
+ }>) & ((fn: 'consent', enabled?: boolean | Record<string, string>) => void) & ((fn: 'set', key: string, value: string | string[]) => void) & ((fn: 'event', value: string) => void) & ((fn: 'upgrade', upgradeReason: string) => void) & ((fn: (string & {}), ...args: any[]) => void);
15
17
  export interface ClarityApi {
16
18
  clarity: ClarityFunctions & {
17
19
  q: any[];
@@ -22,12 +24,5 @@ declare global {
22
24
  interface Window extends ClarityApi {
23
25
  }
24
26
  }
25
- export declare const ClarityOptions: import("valibot").ObjectSchema<{
26
- /**
27
- * The Clarity token.
28
- */
29
- readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 10, undefined>]>;
30
- }, undefined>;
31
27
  export type ClarityInput = RegistryScriptInput<typeof ClarityOptions>;
32
28
  export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): import("#nuxt-scripts/types").UseScriptContext<T>;
33
- export {};
@@ -1,36 +1,27 @@
1
1
  import { useRegistryScript } from "../utils.js";
2
- import { minLength, object, string, pipe } from "#nuxt-scripts-validator";
3
- export const ClarityOptions = object({
4
- /**
5
- * The Clarity token.
6
- */
7
- id: pipe(string(), minLength(10))
8
- });
2
+ import { ClarityOptions } from "./schemas.js";
3
+ export { ClarityOptions };
9
4
  export function useScriptClarity(_options) {
10
- return useRegistryScript(
11
- "clarity",
12
- (options) => ({
13
- scriptInput: {
14
- src: `https://www.clarity.ms/tag/${options.id}`
15
- },
16
- schema: import.meta.dev ? ClarityOptions : void 0,
17
- scriptOptions: {
18
- use() {
19
- return {
20
- // @ts-expect-error untyped
21
- clarity: Object.assign(function(...params) {
22
- const clarity = window.clarity;
23
- return clarity.apply(this, params);
24
- }, window.clarity)
25
- };
26
- }
27
- },
28
- clientInit: import.meta.server ? void 0 : () => {
29
- window.clarity = window.clarity || function(...params) {
30
- (window.clarity.q = window.clarity.q || []).push(params);
5
+ return useRegistryScript("clarity", (options) => ({
6
+ scriptInput: {
7
+ src: `https://www.clarity.ms/tag/${options.id}`
8
+ },
9
+ schema: import.meta.dev ? ClarityOptions : void 0,
10
+ scriptOptions: {
11
+ use() {
12
+ return {
13
+ // @ts-expect-error untyped
14
+ clarity: Object.assign(function(...params) {
15
+ const clarity = window.clarity;
16
+ return clarity.apply(this, params);
17
+ }, window.clarity)
31
18
  };
32
19
  }
33
- }),
34
- _options
35
- );
20
+ },
21
+ clientInit: import.meta.server ? void 0 : () => {
22
+ window.clarity = window.clarity || function(...params) {
23
+ (window.clarity.q = window.clarity.q || []).push(params);
24
+ };
25
+ }
26
+ }), _options);
36
27
  }
@@ -1,4 +1,6 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
+ import { CloudflareWebAnalyticsOptions } from './schemas.js';
3
+ export { CloudflareWebAnalyticsOptions };
2
4
  /**
3
5
  * Sample:
4
6
  * <!-- Cloudflare Web Analytics -->
@@ -16,18 +18,5 @@ declare global {
16
18
  interface Window extends CloudflareWebAnalyticsApi {
17
19
  }
18
20
  }
19
- export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSchema<{
20
- /**
21
- * The Cloudflare Web Analytics token.
22
- */
23
- readonly token: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 32, undefined>]>;
24
- /**
25
- * Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
26
- * and listening to the onpopstate. Hash-based router is not supported.
27
- *
28
- * @default true
29
- */
30
- readonly spa: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
31
- }, undefined>;
32
21
  export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>;
33
22
  export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -1,18 +1,6 @@
1
1
  import { useRegistryScript } from "../utils.js";
2
- import { boolean, minLength, object, optional, pipe, string } from "#nuxt-scripts-validator";
3
- export const CloudflareWebAnalyticsOptions = object({
4
- /**
5
- * The Cloudflare Web Analytics token.
6
- */
7
- token: pipe(string(), minLength(32)),
8
- /**
9
- * Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
10
- * and listening to the onpopstate. Hash-based router is not supported.
11
- *
12
- * @default true
13
- */
14
- spa: optional(boolean())
15
- });
2
+ import { CloudflareWebAnalyticsOptions } from "./schemas.js";
3
+ export { CloudflareWebAnalyticsOptions };
16
4
  export function useScriptCloudflareWebAnalytics(_options) {
17
5
  return useRegistryScript("cloudflareWebAnalytics", (options) => ({
18
6
  scriptInput: {
@@ -1,46 +1,16 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
- export declare const CrispOptions: import("valibot").ObjectSchema<{
3
- /**
4
- * The Crisp ID.
5
- */
6
- readonly id: import("valibot").StringSchema<undefined>;
7
- /**
8
- * Extra configuration options. Used to configure the locale.
9
- * Same as CRISP_RUNTIME_CONFIG.
10
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/
11
- */
12
- readonly runtimeConfig: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
13
- readonly locale: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
14
- }, undefined>, undefined>;
15
- /**
16
- * Associated a session, equivalent to using CRISP_TOKEN_ID variable.
17
- * Same as CRISP_TOKEN_ID.
18
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/
19
- */
20
- readonly tokenId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
21
- /**
22
- * Restrict the domain that the Crisp cookie is set on.
23
- * Same as CRISP_COOKIE_DOMAIN.
24
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/
25
- */
26
- readonly cookieDomain: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
27
- /**
28
- * The cookie expiry in seconds.
29
- * Same as CRISP_COOKIE_EXPIRATION.
30
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/#change-cookie-expiration-date
31
- */
32
- readonly cookieExpiry: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
33
- }, undefined>;
2
+ import { CrispOptions } from './schemas.js';
3
+ export { CrispOptions };
34
4
  export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false, false>;
35
5
  export interface CrispApi {
36
6
  push: (...args: any[]) => void;
37
- is: (name: 'chat:opened' | 'chat:closed' | 'chat:visible' | 'chat:hidden' | 'chat:small' | 'chat:large' | 'session:ongoing' | 'website:available' | 'overlay:opened' | 'overlay:closed' | string) => boolean;
38
- set: (name: 'message:text' | 'session:data' | 'session:segments' | 'session:event' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company' | string, value: any) => void;
39
- get: (name: 'chat:unread:count' | 'message:text' | 'session:identifier' | 'session:data' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company' | string) => any;
40
- do: (name: 'chat:open' | 'chat:close' | 'chat:toggle' | 'chat:show' | 'chat:hide' | 'helpdesk:search' | 'helpdesk:article:open' | 'helpdesk:query' | 'overlay:open' | 'overlay:close' | 'message:send' | 'message:show' | 'message:read' | 'message:thread:start' | 'message:thread:end' | 'session:reset' | 'trigger:run' | string, arg2?: any) => any;
41
- on: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | string, callback: (...args: any[]) => any) => void;
42
- off: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | string, callback: (...args: any[]) => any) => void;
43
- config: (options: any) => void;
7
+ is: (name: 'chat:opened' | 'chat:closed' | 'chat:visible' | 'chat:hidden' | 'chat:small' | 'chat:large' | 'session:ongoing' | 'website:available' | 'overlay:opened' | 'overlay:closed' | (string & {})) => boolean;
8
+ set: ((name: 'message:text' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company', value: string) => void) & ((name: 'session:data', value: [[string, string | number | boolean], ...[string, string | number | boolean][]]) => void) & ((name: 'session:segments', value: string[]) => void) & ((name: 'session:event', value: [[string, Record<string, any>?, string?]]) => void) & ((name: (string & {}), value: any) => void);
9
+ get: ((name: 'chat:unread:count') => number) & ((name: 'message:text' | 'session:identifier' | 'user:email' | 'user:phone' | 'user:nickname' | 'user:avatar' | 'user:company') => string) & ((name: 'session:data', key: string) => string | number | boolean) & ((name: (string & {})) => any);
10
+ do: (name: 'chat:open' | 'chat:close' | 'chat:toggle' | 'chat:show' | 'chat:hide' | 'helpdesk:search' | 'helpdesk:article:open' | 'helpdesk:query' | 'overlay:open' | 'overlay:close' | 'message:send' | 'message:show' | 'message:read' | 'message:thread:start' | 'message:thread:end' | 'session:reset' | 'trigger:run', arg2?: any) => any;
11
+ on: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | (string & {}), callback: (...args: any[]) => any) => void;
12
+ off: (name: 'session:loaded' | 'chat:initiated' | 'chat:opened' | 'chat:closed' | 'message:sent' | 'message:received' | 'message:compose:sent' | 'message:compose:received' | 'user:email:changed' | 'user:phone:changed' | 'user:nickname:changed' | 'user:avatar:changed' | 'website:availability:changed' | 'helpdesk:queried' | (string & {}), callback: (...args: any[]) => any) => void;
13
+ config: ((name: 'container:index', value: number) => void) & ((name: 'color:theme', value: 'default' | 'amber' | 'black' | 'blue' | 'blue_grey' | 'light_blue' | 'brown' | 'cyan' | 'green' | 'light_green' | 'grey' | 'indigo' | 'orange' | 'deep_orange' | 'pink' | 'purple' | 'deep_purple' | 'red' | 'teal') => void) & ((name: 'position:reverse' | 'hide:on:mobile' | 'hide:on:away' | 'lock:maximized' | 'lock:fullview' | 'show:operator:count' | 'sound:mute', value: boolean) => void) & ((name: (string & {}), value: any) => void);
44
14
  help: () => void;
45
15
  [key: string]: any;
46
16
  }
@@ -1,37 +1,6 @@
1
1
  import { useRegistryScript } from "../utils.js";
2
- import { object, string, optional, number } from "#nuxt-scripts-validator";
3
- export const CrispOptions = object({
4
- /**
5
- * The Crisp ID.
6
- */
7
- id: string(),
8
- /**
9
- * Extra configuration options. Used to configure the locale.
10
- * Same as CRISP_RUNTIME_CONFIG.
11
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/
12
- */
13
- runtimeConfig: optional(object({
14
- locale: optional(string())
15
- })),
16
- /**
17
- * Associated a session, equivalent to using CRISP_TOKEN_ID variable.
18
- * Same as CRISP_TOKEN_ID.
19
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/
20
- */
21
- tokenId: optional(string()),
22
- /**
23
- * Restrict the domain that the Crisp cookie is set on.
24
- * Same as CRISP_COOKIE_DOMAIN.
25
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/
26
- */
27
- cookieDomain: optional(string()),
28
- /**
29
- * The cookie expiry in seconds.
30
- * Same as CRISP_COOKIE_EXPIRATION.
31
- * @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/#change-cookie-expiration-date
32
- */
33
- cookieExpiry: optional(number())
34
- });
2
+ import { CrispOptions } from "./schemas.js";
3
+ export { CrispOptions };
35
4
  export function useScriptCrisp(_options) {
36
5
  let readyPromise = Promise.resolve();
37
6
  return useRegistryScript("crisp", (options) => ({
@@ -1,39 +1,6 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
- export declare const DatabuddyAnalyticsOptions: import("valibot").ObjectSchema<{
3
- readonly clientId: import("valibot").StringSchema<undefined>;
4
- readonly scriptUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
5
- readonly apiUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
6
- readonly disabled: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
7
- readonly trackScreenViews: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
8
- readonly trackPerformance: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
9
- readonly trackSessions: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
10
- readonly trackWebVitals: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
11
- readonly trackErrors: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
12
- readonly trackOutgoingLinks: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
13
- readonly trackScrollDepth: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
14
- readonly trackEngagement: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
15
- readonly trackInteractions: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
16
- readonly trackAttributes: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
17
- readonly trackHashChanges: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
18
- readonly trackExitIntent: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
19
- readonly trackBounceRate: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
20
- readonly enableBatching: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
21
- readonly batchSize: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
22
- readonly batchTimeout: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
23
- readonly enableRetries: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
24
- readonly maxRetries: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
25
- readonly initialRetryDelay: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
26
- readonly samplingRate: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
27
- readonly sdk: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
28
- readonly sdkVersion: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
29
- readonly enableObservability: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
30
- readonly observabilityService: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
31
- readonly observabilityEnvironment: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
32
- readonly observabilityVersion: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
33
- readonly enableLogging: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
34
- readonly enableTracing: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
35
- readonly enableErrorTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
36
- }, undefined>;
2
+ import { DatabuddyAnalyticsOptions } from './schemas.js';
3
+ export { DatabuddyAnalyticsOptions };
37
4
  export type DatabuddyAnalyticsInput = RegistryScriptInput<typeof DatabuddyAnalyticsOptions, false>;
38
5
  export interface DatabuddyAnalyticsApi {
39
6
  /**