@nuxt/scripts 1.0.0-beta.24 → 1.0.0-beta.25

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 (60) hide show
  1. package/dist/client/200.html +1 -1
  2. package/dist/client/404.html +1 -1
  3. package/dist/client/_nuxt/{Bh9fd9qr.js → C-7nRtzO.js} +1 -1
  4. package/dist/client/_nuxt/{UTi7FhVv.js → D5k4eN9O.js} +1 -1
  5. package/dist/client/_nuxt/DjhmCJlE.js +162 -0
  6. package/dist/client/_nuxt/{B7aPLMNo.js → TJ5JFHov.js} +1 -1
  7. package/dist/client/_nuxt/builds/latest.json +1 -1
  8. package/dist/client/_nuxt/builds/meta/2ec0342e-5e00-4781-82aa-c3c0f9154516.json +1 -0
  9. package/dist/client/_nuxt/entry.C5SUNdim.css +1 -0
  10. package/dist/client/_nuxt/error-404.C_3_IG5y.css +1 -0
  11. package/dist/client/_nuxt/error-500.DSv6YikH.css +1 -0
  12. package/dist/client/index.html +1 -1
  13. package/dist/module.d.mts +6 -20
  14. package/dist/module.d.ts +6 -20
  15. package/dist/module.json +1 -1
  16. package/dist/module.mjs +303 -277
  17. package/dist/registry.mjs +121 -71
  18. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +5 -1
  19. package/dist/runtime/composables/useScriptTriggerConsent.d.ts +10 -0
  20. package/dist/runtime/composables/useScriptTriggerConsent.js +32 -19
  21. package/dist/runtime/registry/bing-uet.d.ts +20 -0
  22. package/dist/runtime/registry/bing-uet.js +29 -0
  23. package/dist/runtime/registry/bluesky-embed.d.ts +1 -1
  24. package/dist/runtime/registry/crisp.d.ts +1 -1
  25. package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
  26. package/dist/runtime/registry/google-adsense.d.ts +1 -1
  27. package/dist/runtime/registry/hotjar.d.ts +1 -1
  28. package/dist/runtime/registry/instagram-embed.d.ts +1 -1
  29. package/dist/runtime/registry/intercom.d.ts +1 -1
  30. package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
  31. package/dist/runtime/registry/meta-pixel.d.ts +1 -1
  32. package/dist/runtime/registry/mixpanel-analytics.d.ts +22 -0
  33. package/dist/runtime/registry/mixpanel-analytics.js +46 -0
  34. package/dist/runtime/registry/npm.d.ts +1 -1
  35. package/dist/runtime/registry/reddit-pixel.d.ts +1 -1
  36. package/dist/runtime/registry/schemas.d.ts +19 -0
  37. package/dist/runtime/registry/schemas.js +19 -0
  38. package/dist/runtime/registry/snapchat-pixel.d.ts +1 -1
  39. package/dist/runtime/registry/tiktok-pixel.d.ts +1 -1
  40. package/dist/runtime/registry/vercel-analytics.d.ts +1 -1
  41. package/dist/runtime/registry/x-embed.d.ts +1 -1
  42. package/dist/runtime/registry/x-pixel.d.ts +1 -1
  43. package/dist/runtime/server/proxy-handler.js +36 -23
  44. package/dist/runtime/server/utils/privacy.d.ts +1 -1
  45. package/dist/runtime/server/utils/privacy.js +3 -3
  46. package/dist/runtime/types.d.ts +30 -18
  47. package/dist/runtime/utils/pure.d.ts +1 -1
  48. package/dist/runtime/utils.js +1 -1
  49. package/dist/shared/scripts.ViOoYQXH.mjs +381 -0
  50. package/dist/stats.d.mts +78 -3
  51. package/dist/stats.d.ts +78 -3
  52. package/dist/stats.mjs +2255 -164
  53. package/dist/types-source.mjs +47 -0
  54. package/package.json +13 -13
  55. package/dist/client/_nuxt/BNNMZFwZ.js +0 -162
  56. package/dist/client/_nuxt/builds/meta/78647cef-f45a-4560-82b4-b9364815198a.json +0 -1
  57. package/dist/client/_nuxt/entry.CACgbLJl.css +0 -1
  58. package/dist/client/_nuxt/error-404.DMdWw4vT.css +0 -1
  59. package/dist/client/_nuxt/error-500.CROTF27X.css +0 -1
  60. package/dist/shared/scripts.Crpn87WB.mjs +0 -318
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { whenever } from "@vueuse/core";
3
- import { inject, onUnmounted, provide, shallowRef } from "vue";
3
+ import { inject, onUnmounted, provide, ref, shallowRef } from "vue";
4
4
  import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
5
5
  import { MARKER_CLUSTERER_INJECTION_KEY } from "./ScriptGoogleMapsMarkerClusterer.vue";
6
6
  export const ADVANCED_MARKER_ELEMENT_INJECTION_KEY = /* @__PURE__ */ Symbol("marker");
@@ -39,8 +39,11 @@ const eventsWithMapMouseEventPayload = [
39
39
  const mapContext = inject(MAP_INJECTION_KEY, void 0);
40
40
  const markerClustererContext = inject(MARKER_CLUSTERER_INJECTION_KEY, void 0);
41
41
  const advancedMarkerElement = shallowRef(void 0);
42
+ const isUnmounted = ref(false);
42
43
  whenever(() => mapContext?.map.value && mapContext.mapsApi.value, async () => {
43
44
  await mapContext.mapsApi.value.importLibrary("marker");
45
+ if (isUnmounted.value)
46
+ return;
44
47
  advancedMarkerElement.value = new mapContext.mapsApi.value.marker.AdvancedMarkerElement(props.options);
45
48
  setupAdvancedMarkerElementEventListeners(advancedMarkerElement.value);
46
49
  if (markerClustererContext?.markerClusterer.value) {
@@ -60,6 +63,7 @@ whenever(() => mapContext?.map.value && mapContext.mapsApi.value, async () => {
60
63
  once: true
61
64
  });
62
65
  onUnmounted(() => {
66
+ isUnmounted.value = true;
63
67
  if (!advancedMarkerElement.value || !mapContext?.mapsApi.value) {
64
68
  return;
65
69
  }
@@ -1,12 +1,22 @@
1
+ import type { Ref } from 'vue';
1
2
  import type { ConsentScriptTriggerOptions } from '../types.js';
2
3
  interface UseConsentScriptTriggerApi extends Promise<void> {
3
4
  /**
4
5
  * A function that can be called to accept the consent and load the script.
5
6
  */
6
7
  accept: () => void;
8
+ /**
9
+ * A function that can be called to revoke consent and signal the script should be unloaded.
10
+ */
11
+ revoke: () => void;
12
+ /**
13
+ * Reactive reference to the consent state
14
+ */
15
+ consented: Ref<boolean>;
7
16
  }
8
17
  /**
9
18
  * Load a script once consent has been provided either through a resolvable `consent` or calling the `accept` method.
19
+ * Supports revoking consent via the reactive `consented` ref. Consumers should watch `consented` to react to revocation.
10
20
  * @param options
11
21
  */
12
22
  export declare function useScriptTriggerConsent(options?: ConsentScriptTriggerOptions): UseConsentScriptTriggerApi;
@@ -1,14 +1,37 @@
1
1
  import { onNuxtReady, requestIdleCallback, tryUseNuxtApp } from "nuxt/app";
2
2
  import { isRef, ref, toValue, watch } from "vue";
3
3
  export function useScriptTriggerConsent(options) {
4
- if (import.meta.server)
5
- return new Promise(() => {
4
+ if (import.meta.server) {
5
+ const p = new Promise(() => {
6
6
  });
7
+ p.accept = () => {
8
+ };
9
+ p.revoke = () => {
10
+ };
11
+ p.consented = ref(false);
12
+ return p;
13
+ }
7
14
  const consented = ref(false);
8
15
  const nuxtApp = tryUseNuxtApp();
16
+ if (options?.consent) {
17
+ if (isRef(options?.consent)) {
18
+ watch(options.consent, (_val) => {
19
+ const val = toValue(_val);
20
+ consented.value = Boolean(val);
21
+ }, { immediate: true });
22
+ } else if (typeof options?.consent === "boolean") {
23
+ consented.value = options?.consent;
24
+ } else if (options?.consent instanceof Promise) {
25
+ options.consent.then((res) => {
26
+ consented.value = typeof res === "boolean" ? res : true;
27
+ }).catch(() => {
28
+ consented.value = false;
29
+ });
30
+ }
31
+ }
9
32
  const promise = new Promise((resolve) => {
10
- watch(consented, (ready) => {
11
- if (ready) {
33
+ watch(consented, (newValue, oldValue) => {
34
+ if (newValue && !oldValue) {
12
35
  const runner = nuxtApp?.runWithContext || ((cb) => cb());
13
36
  if (options?.postConsentTrigger instanceof Promise) {
14
37
  options.postConsentTrigger.then(() => runner(resolve));
@@ -32,24 +55,14 @@ export function useScriptTriggerConsent(options) {
32
55
  }
33
56
  runner(resolve);
34
57
  }
35
- });
36
- if (options?.consent) {
37
- if (isRef(options?.consent)) {
38
- watch(options.consent, (_val) => {
39
- const val = toValue(_val);
40
- consented.value = Boolean(val);
41
- }, { immediate: true });
42
- } else if (typeof options?.consent === "boolean") {
43
- consented.value = options?.consent;
44
- } else if (options?.consent instanceof Promise) {
45
- options?.consent.then((res) => {
46
- consented.value = typeof res === "boolean" ? res : true;
47
- });
48
- }
49
- }
58
+ }, { immediate: true });
50
59
  });
51
60
  promise.accept = () => {
52
61
  consented.value = true;
53
62
  };
63
+ promise.revoke = () => {
64
+ consented.value = false;
65
+ };
66
+ promise.consented = consented;
54
67
  return promise;
55
68
  }
@@ -0,0 +1,20 @@
1
+ import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
+ import { BingUetOptions } from './schemas.js';
3
+ export { BingUetOptions };
4
+ export type BingUetInput = RegistryScriptInput<typeof BingUetOptions, true, false>;
5
+ export interface BingUetApi {
6
+ uetq: {
7
+ push: (event: string | Record<string, any>) => void;
8
+ };
9
+ }
10
+ declare global {
11
+ interface Window {
12
+ UET: new (options: {
13
+ ti: string;
14
+ enableAutoSpaTracking?: boolean;
15
+ q?: any[];
16
+ }) => BingUetApi['uetq'];
17
+ uetq: any[] | BingUetApi['uetq'];
18
+ }
19
+ }
20
+ export declare function useScriptBingUet<T extends BingUetApi>(_options?: BingUetInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -0,0 +1,29 @@
1
+ import { useRegistryScript } from "../utils.js";
2
+ import { BingUetOptions } from "./schemas.js";
3
+ export { BingUetOptions };
4
+ export function useScriptBingUet(_options) {
5
+ return useRegistryScript("bingUet", (options) => ({
6
+ scriptInput: {
7
+ src: "https://bat.bing.com/bat.js",
8
+ crossorigin: false
9
+ },
10
+ schema: import.meta.dev ? BingUetOptions : void 0,
11
+ scriptOptions: {
12
+ use() {
13
+ if (options?.id && typeof window.UET === "function" && Array.isArray(window.uetq)) {
14
+ const uetOptions = {
15
+ ti: options.id,
16
+ enableAutoSpaTracking: options.enableAutoSpaTracking ?? true,
17
+ q: window.uetq
18
+ };
19
+ window.uetq = new window.UET(uetOptions);
20
+ window.uetq.push("pageLoad");
21
+ }
22
+ return { uetq: window.uetq };
23
+ }
24
+ },
25
+ clientInit: import.meta.server ? void 0 : () => {
26
+ window.uetq = window.uetq || [];
27
+ }
28
+ }), _options);
29
+ }
@@ -90,7 +90,7 @@ export interface BlueskyEmbedPostData {
90
90
  val: string;
91
91
  }>;
92
92
  }
93
- export type BlueskyEmbedInput = RegistryScriptInput<typeof BlueskyEmbedOptions, false, false, false>;
93
+ export type BlueskyEmbedInput = RegistryScriptInput<typeof BlueskyEmbedOptions, false, false>;
94
94
  /**
95
95
  * Extract the handle/DID and post rkey from a Bluesky post URL
96
96
  */
@@ -1,7 +1,7 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { CrispOptions } from './schemas.js';
3
3
  export { CrispOptions };
4
- export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false, false>;
4
+ export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false>;
5
5
  export interface CrispApi {
6
6
  push: (...args: any[]) => void;
7
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;
@@ -1,7 +1,7 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { FathomAnalyticsOptions } from './schemas.js';
3
3
  export { FathomAnalyticsOptions };
4
- export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false, false, false>;
4
+ export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false, false>;
5
5
  export interface FathomAnalyticsApi {
6
6
  beacon: (ctx: {
7
7
  url: string;
@@ -1,7 +1,7 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { GoogleAdsenseOptions } from './schemas.js';
3
3
  export { GoogleAdsenseOptions };
4
- export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions, true, false, false>;
4
+ export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions, true, false>;
5
5
  export interface GoogleAdsenseApi {
6
6
  /**
7
7
  * The Google Adsense API.
@@ -14,5 +14,5 @@ declare global {
14
14
  };
15
15
  }
16
16
  }
17
- export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false, false>;
17
+ export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false>;
18
18
  export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -1,7 +1,7 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { InstagramEmbedOptions } from './schemas.js';
3
3
  export { InstagramEmbedOptions };
4
- export type InstagramEmbedInput = RegistryScriptInput<typeof InstagramEmbedOptions, false, false, false>;
4
+ export type InstagramEmbedInput = RegistryScriptInput<typeof InstagramEmbedOptions, false, false>;
5
5
  /**
6
6
  * Extract the post shortcode from an Instagram URL
7
7
  */
@@ -2,7 +2,7 @@ import type { InferInput } from '#nuxt-scripts-validator';
2
2
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
3
3
  import { IntercomOptions } from './schemas.js';
4
4
  export { IntercomOptions };
5
- export type IntercomInput = RegistryScriptInput<typeof IntercomOptions, true, false, false>;
5
+ export type IntercomInput = RegistryScriptInput<typeof IntercomOptions, true, false>;
6
6
  export interface IntercomApi {
7
7
  Intercom: ((event: 'boot', data?: InferInput<typeof IntercomOptions>) => void) & ((event: 'shutdown') => void) & ((event: 'update', options?: InferInput<typeof IntercomOptions>) => void) & ((event: 'hide') => void) & ((event: 'show') => void) & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | (string & {})) => void) & ((event: 'showMessages') => void) & ((event: 'showNewMessage', content?: string) => void) & ((event: 'onHide', fn: () => void) => void) & ((event: 'onShow', fn: () => void) => void) & ((event: 'onUnreadCountChange', fn: () => void) => void) & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void) & ((event: 'getVisitorId') => Promise<string>) & ((event: 'startTour', tourId: string | number) => void) & ((event: 'showArticle', articleId: string | number) => void) & ((event: 'showNews', newsItemId: string | number) => void) & ((event: 'startSurvey', surveyId: string | number) => void) & ((event: 'startChecklist', checklistId: string | number) => void) & ((event: 'showTicket', ticketId: string | number) => void) & ((event: 'showConversation', conversationId: string | number) => void) & ((event: 'onUserEmailSupplied', fn: () => void) => void) & ((event: (string & {}), ...params: any[]) => void);
8
8
  }
@@ -1,7 +1,7 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { MatomoAnalyticsOptions } from './schemas.js';
3
3
  export { MatomoAnalyticsOptions };
4
- export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false, false>;
4
+ export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false>;
5
5
  interface MatomoAnalyticsApi {
6
6
  _paq: unknown[];
7
7
  }
@@ -37,5 +37,5 @@ declare global {
37
37
  }
38
38
  }
39
39
  export { MetaPixelOptions };
40
- export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false, false>;
40
+ export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false>;
41
41
  export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -0,0 +1,22 @@
1
+ import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
+ import { MixpanelAnalyticsOptions } from './schemas.js';
3
+ export { MixpanelAnalyticsOptions };
4
+ export type MixpanelAnalyticsInput = RegistryScriptInput<typeof MixpanelAnalyticsOptions>;
5
+ export interface MixpanelAnalyticsApi {
6
+ mixpanel: {
7
+ track: (event: string, properties?: Record<string, any>) => void;
8
+ identify: (distinctId: string) => void;
9
+ reset: () => void;
10
+ people: {
11
+ set: (properties: Record<string, any>) => void;
12
+ };
13
+ register: (properties: Record<string, any>) => void;
14
+ init: (token: string, config?: Record<string, any>) => void;
15
+ };
16
+ }
17
+ declare global {
18
+ interface Window {
19
+ mixpanel: MixpanelAnalyticsApi['mixpanel'];
20
+ }
21
+ }
22
+ export declare function useScriptMixpanelAnalytics<T extends MixpanelAnalyticsApi>(_options?: MixpanelAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -0,0 +1,46 @@
1
+ import { useRegistryScript } from "../utils.js";
2
+ import { MixpanelAnalyticsOptions } from "./schemas.js";
3
+ export { MixpanelAnalyticsOptions };
4
+ const methods = ["track", "identify", "reset", "register"];
5
+ const peopleMethods = ["set"];
6
+ export function useScriptMixpanelAnalytics(_options) {
7
+ return useRegistryScript("mixpanelAnalytics", (options) => {
8
+ return {
9
+ scriptInput: {
10
+ src: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"
11
+ },
12
+ schema: import.meta.dev ? MixpanelAnalyticsOptions : void 0,
13
+ scriptOptions: {
14
+ use() {
15
+ return {
16
+ mixpanel: window.mixpanel
17
+ };
18
+ }
19
+ },
20
+ clientInit: import.meta.server ? void 0 : () => {
21
+ const mp = window.mixpanel = window.mixpanel || [];
22
+ if (!mp.__SV) {
23
+ mp.__SV = 1.2;
24
+ mp._i = mp._i || [];
25
+ mp.init = (token, config, name = "mixpanel") => {
26
+ const target = name === "mixpanel" ? mp : mp[name] = [];
27
+ target.people = target.people || [];
28
+ for (const method of methods) {
29
+ target[method] = (...args) => {
30
+ target.push([method, ...args]);
31
+ };
32
+ }
33
+ for (const method of peopleMethods) {
34
+ target.people[method] = (...args) => {
35
+ target.push([`people.${method}`, ...args]);
36
+ };
37
+ }
38
+ mp._i.push([token, config, name]);
39
+ };
40
+ }
41
+ if (options?.token)
42
+ mp.init(options.token);
43
+ }
44
+ };
45
+ }, _options);
46
+ }
@@ -1,5 +1,5 @@
1
1
  import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
2
  import { NpmOptions } from './schemas.js';
3
3
  export { NpmOptions };
4
- export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true, false>;
4
+ export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true>;
5
5
  export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -13,5 +13,5 @@ declare global {
13
13
  }
14
14
  }
15
15
  export { RedditPixelOptions };
16
- export type RedditPixelInput = RegistryScriptInput<typeof RedditPixelOptions, true, false, false>;
16
+ export type RedditPixelInput = RegistryScriptInput<typeof RedditPixelOptions, true, false>;
17
17
  export declare function useScriptRedditPixel<T extends RedditPixelApi>(_options?: RedditPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -697,6 +697,25 @@ export declare const RybbitAnalyticsOptions: import("valibot").ObjectSchema<{
697
697
  */
698
698
  readonly analyticsHost: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
699
699
  }, undefined>;
700
+ export declare const MixpanelAnalyticsOptions: import("valibot").ObjectSchema<{
701
+ /**
702
+ * Your Mixpanel project token.
703
+ * @see https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#1-initialize-the-library
704
+ */
705
+ readonly token: import("valibot").StringSchema<undefined>;
706
+ }, undefined>;
707
+ export declare const BingUetOptions: import("valibot").ObjectSchema<{
708
+ /**
709
+ * Your Bing UET tag ID.
710
+ * @see https://help.ads.microsoft.com/#apex/ads/en/56682/2-500
711
+ */
712
+ readonly id: import("valibot").StringSchema<undefined>;
713
+ /**
714
+ * Enable automatic SPA page tracking.
715
+ * @default true
716
+ */
717
+ readonly enableAutoSpaTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
718
+ }, undefined>;
700
719
  export declare const SegmentOptions: import("valibot").ObjectSchema<{
701
720
  /**
702
721
  * Your Segment write key.
@@ -695,6 +695,25 @@ export const RybbitAnalyticsOptions = object({
695
695
  */
696
696
  analyticsHost: optional(string())
697
697
  });
698
+ export const MixpanelAnalyticsOptions = object({
699
+ /**
700
+ * Your Mixpanel project token.
701
+ * @see https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#1-initialize-the-library
702
+ */
703
+ token: string()
704
+ });
705
+ export const BingUetOptions = object({
706
+ /**
707
+ * Your Bing UET tag ID.
708
+ * @see https://help.ads.microsoft.com/#apex/ads/en/56682/2-500
709
+ */
710
+ id: string(),
711
+ /**
712
+ * Enable automatic SPA page tracking.
713
+ * @default true
714
+ */
715
+ enableAutoSpaTracking: optional(boolean())
716
+ });
698
717
  export const SegmentOptions = object({
699
718
  /**
700
719
  * Your Segment write key.
@@ -38,5 +38,5 @@ declare global {
38
38
  interface Window extends SnapPixelApi {
39
39
  }
40
40
  }
41
- export type SnapTrPixelInput = RegistryScriptInput<typeof SnapTrPixelOptions, true, false, false>;
41
+ export type SnapTrPixelInput = RegistryScriptInput<typeof SnapTrPixelOptions, true, false>;
42
42
  export declare function useScriptSnapchatPixel<T extends SnapPixelApi>(_options?: SnapTrPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -37,5 +37,5 @@ declare global {
37
37
  }
38
38
  }
39
39
  export { TikTokPixelOptions };
40
- export type TikTokPixelInput = RegistryScriptInput<typeof TikTokPixelOptions, true, false, false>;
40
+ export type TikTokPixelInput = RegistryScriptInput<typeof TikTokPixelOptions, true, false>;
41
41
  export declare function useScriptTikTokPixel<T extends TikTokPixelApi>(_options?: TikTokPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -8,7 +8,7 @@ export interface BeforeSendEvent {
8
8
  url: string;
9
9
  }
10
10
  export type BeforeSend = (event: BeforeSendEvent) => BeforeSendEvent | null;
11
- export type VercelAnalyticsInput = RegistryScriptInput<typeof VercelAnalyticsOptions, false, false, false> & {
11
+ export type VercelAnalyticsInput = RegistryScriptInput<typeof VercelAnalyticsOptions, false, false> & {
12
12
  beforeSend?: BeforeSend;
13
13
  };
14
14
  export interface VercelAnalyticsApi {
@@ -48,7 +48,7 @@ export interface XEmbedTweetData {
48
48
  };
49
49
  };
50
50
  }
51
- export type XEmbedInput = RegistryScriptInput<typeof XEmbedOptions, false, false, false>;
51
+ export type XEmbedInput = RegistryScriptInput<typeof XEmbedOptions, false, false>;
52
52
  /**
53
53
  * Proxy an X/Twitter image URL through the server
54
54
  */
@@ -29,5 +29,5 @@ declare global {
29
29
  }
30
30
  }
31
31
  export { XPixelOptions };
32
- export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false, false>;
32
+ export type XPixelInput = RegistryScriptInput<typeof XPixelOptions, true, false>;
33
33
  export declare function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -168,37 +168,50 @@ export default defineEventHandler(async (event) => {
168
168
  } else if (typeof rawBody === "object") {
169
169
  body = stripPayloadFingerprinting(rawBody, privacy);
170
170
  } else if (typeof rawBody === "string") {
171
- if (rawBody.startsWith("{") || rawBody.startsWith("[")) {
172
- let parsed = null;
173
- try {
174
- parsed = JSON.parse(rawBody);
175
- } catch {
176
- }
177
- if (Array.isArray(parsed)) {
178
- body = parsed.map(
179
- (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
180
- );
181
- } else if (parsed && typeof parsed === "object") {
182
- body = stripPayloadFingerprinting(parsed, privacy);
183
- } else {
184
- body = rawBody;
185
- }
186
- } else if (contentType.includes("application/x-www-form-urlencoded")) {
171
+ if (contentType.includes("application/x-www-form-urlencoded")) {
187
172
  const params = new URLSearchParams(rawBody);
188
173
  const obj = {};
189
- params.forEach((value, key) => {
190
- obj[key] = value;
191
- });
174
+ for (const [key, value] of params.entries()) {
175
+ if (key in obj) {
176
+ const existing = obj[key];
177
+ obj[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
178
+ } else {
179
+ obj[key] = value;
180
+ }
181
+ }
192
182
  const stripped = stripPayloadFingerprinting(obj, privacy);
193
- const stringified = {};
183
+ const out = new URLSearchParams();
194
184
  for (const [k, v] of Object.entries(stripped)) {
195
185
  if (v === void 0 || v === null)
196
186
  continue;
197
- stringified[k] = typeof v === "string" ? v : JSON.stringify(v);
187
+ if (Array.isArray(v)) {
188
+ for (const item of v)
189
+ out.append(k, typeof item === "string" ? item : JSON.stringify(item));
190
+ } else {
191
+ out.append(k, typeof v === "string" ? v : JSON.stringify(v));
192
+ }
198
193
  }
199
- body = new URLSearchParams(stringified).toString();
194
+ body = out.toString();
200
195
  } else {
201
- body = rawBody;
196
+ const maybeJson = contentType.includes("json") || (rawBody.startsWith("{") || rawBody.startsWith("["));
197
+ if (maybeJson) {
198
+ let parsed = null;
199
+ try {
200
+ parsed = JSON.parse(rawBody);
201
+ } catch {
202
+ }
203
+ if (Array.isArray(parsed)) {
204
+ body = parsed.map(
205
+ (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
206
+ );
207
+ } else if (parsed && typeof parsed === "object") {
208
+ body = stripPayloadFingerprinting(parsed, privacy);
209
+ } else {
210
+ body = rawBody;
211
+ }
212
+ } else {
213
+ body = rawBody;
214
+ }
202
215
  }
203
216
  } else {
204
217
  body = rawBody;
@@ -20,7 +20,7 @@ export interface ProxyPrivacy {
20
20
  * Privacy input: `true` = full anonymize, `false` = passthrough (still strips sensitive headers),
21
21
  * or a `ProxyPrivacy` object for granular control (unset flags default to `false` — opt-in).
22
22
  */
23
- export type ProxyPrivacyInput = boolean | ProxyPrivacy | null;
23
+ export type ProxyPrivacyInput = boolean | ProxyPrivacy;
24
24
  /** Resolved privacy with all flags explicitly set. */
25
25
  export type ResolvedProxyPrivacy = Required<ProxyPrivacy>;
26
26
  /**
@@ -10,7 +10,7 @@ const LANG_CODE_RE = /^[a-z]{2}(?:-[a-z]{2,})?$/i;
10
10
  export function resolvePrivacy(input) {
11
11
  if (input === true)
12
12
  return { ...FULL_PRIVACY };
13
- if (input === false || input === void 0 || input === null)
13
+ if (input === false || input === void 0)
14
14
  return { ...NO_PRIVACY };
15
15
  return {
16
16
  ip: input.ip ?? false,
@@ -22,7 +22,7 @@ export function resolvePrivacy(input) {
22
22
  };
23
23
  }
24
24
  export function mergePrivacy(base, override) {
25
- if (override === void 0 || override === null)
25
+ if (override === void 0)
26
26
  return base;
27
27
  if (typeof override === "boolean")
28
28
  return resolvePrivacy(override);
@@ -288,7 +288,7 @@ export function stripPayloadFingerprinting(payload, privacy) {
288
288
  continue;
289
289
  }
290
290
  if (matchesParam(key, STRIP_PARAMS.hardware)) {
291
- result[key] = p.screen ? generalizeHardware(value) : value;
291
+ result[key] = p.hardware ? generalizeHardware(value) : value;
292
292
  continue;
293
293
  }
294
294
  if (matchesParam(key, STRIP_PARAMS.version)) {