@nuxt/scripts 1.0.0-rc.1 → 1.0.0-rc.10

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 (164) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/cli.d.mts +2 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.mjs +50 -0
  5. package/dist/devtools-client/200.html +1 -1
  6. package/dist/devtools-client/404.html +1 -1
  7. package/dist/devtools-client/_nuxt/{ajngqPCs.js → BgPDxVUn.js} +1 -1
  8. package/dist/devtools-client/_nuxt/{DKL6PHO3.js → BmlapxLP.js} +1 -1
  9. package/dist/devtools-client/_nuxt/CM2vefXI.js +188 -0
  10. package/dist/devtools-client/_nuxt/{CfOsp0mU.js → DAF5Qk9P.js} +1 -1
  11. package/dist/devtools-client/_nuxt/{B3kN3DAy.js → Dx6HhVmj.js} +1 -1
  12. package/dist/devtools-client/_nuxt/{dlaR8P-P.js → S8LiR9M1.js} +1 -1
  13. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  14. package/dist/devtools-client/_nuxt/builds/meta/5458a3f2-af35-479c-8852-bf6f92fed611.json +1 -0
  15. package/dist/devtools-client/_nuxt/{entry.BwpOBArY.css → entry.BKkVrcJj.css} +1 -1
  16. package/dist/devtools-client/_nuxt/error-404.d44aGwWI.css +1 -0
  17. package/dist/devtools-client/_nuxt/error-500.NthMfIEt.css +1 -0
  18. package/dist/devtools-client/_nuxt/index.DZD1lwyI.css +1 -0
  19. package/dist/devtools-client/_nuxt/vBkR1GJq.js +1 -0
  20. package/dist/devtools-client/docs/index.html +1 -1
  21. package/dist/devtools-client/first-party/index.html +1 -1
  22. package/dist/devtools-client/index.html +1 -1
  23. package/dist/devtools-client/registry/index.html +1 -1
  24. package/dist/module.d.mts +66 -2
  25. package/dist/module.d.ts +66 -2
  26. package/dist/module.json +1 -1
  27. package/dist/module.mjs +144 -28
  28. package/dist/registry.d.mts +1 -0
  29. package/dist/registry.d.ts +1 -0
  30. package/dist/registry.mjs +14 -14
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +73 -97
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +81 -58
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +73 -97
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +2 -3
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +1 -0
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +2 -3
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +2 -3
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +2 -1
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +2 -3
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +10 -43
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +3 -1
  42. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +10 -43
  43. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +50 -30
  44. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +145 -104
  45. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +50 -30
  46. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +7 -2
  47. package/dist/runtime/components/GoogleMaps/types.d.ts +42 -0
  48. package/dist/runtime/components/GoogleMaps/types.js +1 -0
  49. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +50 -0
  50. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +76 -1
  51. package/dist/runtime/components/ScriptBlueskyEmbed.d.vue.ts +10 -12
  52. package/dist/runtime/components/ScriptBlueskyEmbed.vue +13 -10
  53. package/dist/runtime/components/ScriptBlueskyEmbed.vue.d.ts +10 -12
  54. package/dist/runtime/components/ScriptCarbonAds.d.vue.ts +4 -7
  55. package/dist/runtime/components/ScriptCarbonAds.vue +1 -0
  56. package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +4 -7
  57. package/dist/runtime/components/ScriptCrisp.d.vue.ts +7 -11
  58. package/dist/runtime/components/ScriptCrisp.vue +1 -0
  59. package/dist/runtime/components/ScriptCrisp.vue.d.ts +7 -11
  60. package/dist/runtime/components/ScriptGoogleAdsense.d.vue.ts +4 -7
  61. package/dist/runtime/components/ScriptGoogleAdsense.vue +1 -0
  62. package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +4 -7
  63. package/dist/runtime/components/ScriptInstagramEmbed.d.vue.ts +11 -13
  64. package/dist/runtime/components/ScriptInstagramEmbed.vue +4 -1
  65. package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +11 -13
  66. package/dist/runtime/components/ScriptIntercom.d.vue.ts +7 -11
  67. package/dist/runtime/components/ScriptIntercom.vue +1 -0
  68. package/dist/runtime/components/ScriptIntercom.vue.d.ts +7 -11
  69. package/dist/runtime/components/ScriptLemonSqueezy.d.vue.ts +2 -3
  70. package/dist/runtime/components/ScriptLemonSqueezy.vue +1 -0
  71. package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +2 -3
  72. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +8 -13
  73. package/dist/runtime/components/ScriptPayPalButtons.vue +1 -0
  74. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +8 -13
  75. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +8 -13
  76. package/dist/runtime/components/ScriptPayPalMessages.vue +1 -0
  77. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +8 -13
  78. package/dist/runtime/components/ScriptStripePricingTable.d.vue.ts +5 -9
  79. package/dist/runtime/components/ScriptStripePricingTable.vue +1 -0
  80. package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +5 -9
  81. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +8 -11
  82. package/dist/runtime/components/ScriptVimeoPlayer.vue +1 -0
  83. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +8 -11
  84. package/dist/runtime/components/ScriptXEmbed.d.vue.ts +10 -12
  85. package/dist/runtime/components/ScriptXEmbed.vue +12 -9
  86. package/dist/runtime/components/ScriptXEmbed.vue.d.ts +10 -12
  87. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +8 -13
  88. package/dist/runtime/components/ScriptYouTubePlayer.vue +1 -0
  89. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +8 -13
  90. package/dist/runtime/composables/useScript.js +17 -6
  91. package/dist/runtime/composables/useScriptProxyToken.d.ts +12 -0
  92. package/dist/runtime/composables/useScriptProxyToken.js +4 -0
  93. package/dist/runtime/composables/useScriptProxyUrl.d.ts +12 -0
  94. package/dist/runtime/composables/useScriptProxyUrl.js +27 -0
  95. package/dist/runtime/plugins/proxy-token.server.d.ts +10 -0
  96. package/dist/runtime/plugins/proxy-token.server.js +17 -0
  97. package/dist/runtime/registry/bing-uet.d.ts +189 -11
  98. package/dist/runtime/registry/bing-uet.js +16 -2
  99. package/dist/runtime/registry/bluesky-embed.d.ts +0 -4
  100. package/dist/runtime/registry/bluesky-embed.js +0 -4
  101. package/dist/runtime/registry/clarity.d.ts +6 -2
  102. package/dist/runtime/registry/clarity.js +12 -1
  103. package/dist/runtime/registry/google-analytics.d.ts +6 -2
  104. package/dist/runtime/registry/google-analytics.js +12 -1
  105. package/dist/runtime/registry/google-tag-manager.d.ts +6 -2
  106. package/dist/runtime/registry/google-tag-manager.js +10 -1
  107. package/dist/runtime/registry/gravatar.js +10 -13
  108. package/dist/runtime/registry/matomo-analytics.d.ts +9 -3
  109. package/dist/runtime/registry/matomo-analytics.js +28 -1
  110. package/dist/runtime/registry/meta-pixel.d.ts +8 -2
  111. package/dist/runtime/registry/meta-pixel.js +10 -1
  112. package/dist/runtime/registry/mixpanel-analytics.d.ts +12 -2
  113. package/dist/runtime/registry/mixpanel-analytics.js +16 -4
  114. package/dist/runtime/registry/posthog.d.ts +8 -2
  115. package/dist/runtime/registry/posthog.js +15 -4
  116. package/dist/runtime/registry/schemas.d.ts +65 -0
  117. package/dist/runtime/registry/schemas.js +75 -8
  118. package/dist/runtime/registry/tiktok-pixel.d.ts +16 -2
  119. package/dist/runtime/registry/tiktok-pixel.js +22 -1
  120. package/dist/runtime/registry/x-embed.d.ts +0 -4
  121. package/dist/runtime/registry/x-embed.js +0 -4
  122. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  123. package/dist/runtime/server/bluesky-embed.d.ts +1 -15
  124. package/dist/runtime/server/bluesky-embed.js +25 -6
  125. package/dist/runtime/server/google-maps-geocode-proxy.js +12 -8
  126. package/dist/runtime/server/google-static-maps-proxy.d.ts +1 -1
  127. package/dist/runtime/server/google-static-maps-proxy.js +17 -11
  128. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  129. package/dist/runtime/server/gravatar-proxy.js +10 -10
  130. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  131. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  132. package/dist/runtime/server/instagram-embed.d.ts +1 -16
  133. package/dist/runtime/server/instagram-embed.js +26 -125
  134. package/dist/runtime/server/proxy-handler.js +1 -2
  135. package/dist/runtime/server/utils/cached-upstream.d.ts +55 -0
  136. package/dist/runtime/server/utils/cached-upstream.js +65 -0
  137. package/dist/runtime/server/utils/embed-rewriters.d.ts +19 -0
  138. package/dist/runtime/server/utils/embed-rewriters.js +41 -0
  139. package/dist/runtime/server/utils/image-proxy.d.ts +3 -1
  140. package/dist/runtime/server/utils/image-proxy.js +11 -8
  141. package/dist/runtime/server/utils/instagram-embed.d.ts +16 -0
  142. package/dist/runtime/server/utils/instagram-embed.js +153 -0
  143. package/dist/runtime/server/utils/proxy-url.d.ts +9 -0
  144. package/dist/runtime/server/utils/proxy-url.js +21 -0
  145. package/dist/runtime/server/utils/sign-constants.d.ts +16 -0
  146. package/dist/runtime/server/utils/sign-constants.js +5 -0
  147. package/dist/runtime/server/utils/sign.d.ts +101 -0
  148. package/dist/runtime/server/utils/sign.js +91 -0
  149. package/dist/runtime/server/utils/withSigning.d.ts +23 -0
  150. package/dist/runtime/server/utils/withSigning.js +19 -0
  151. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  152. package/dist/runtime/server/x-embed.js +23 -4
  153. package/dist/runtime/types.d.ts +41 -6
  154. package/dist/runtime/types.js +1 -0
  155. package/dist/stats.mjs +298 -338
  156. package/dist/types-source.mjs +537 -164
  157. package/dist/types.d.mts +2 -2
  158. package/package.json +10 -6
  159. package/dist/devtools-client/_nuxt/C8jhSQ8l.js +0 -1
  160. package/dist/devtools-client/_nuxt/CJD6wrkT.js +0 -188
  161. package/dist/devtools-client/_nuxt/builds/meta/b800a0be-5cab-4ea6-89e3-dd3a85690a73.json +0 -1
  162. package/dist/devtools-client/_nuxt/error-404.CvOVjXeC.css +0 -1
  163. package/dist/devtools-client/_nuxt/error-500.BIm53nmx.css +0 -1
  164. package/dist/devtools-client/_nuxt/index.CA-OpSj0.css +0 -1
@@ -1,20 +1,198 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { BingUetOptions } from './schemas.js';
3
3
  export { BingUetOptions };
4
4
  export type BingUetInput = RegistryScriptInput<typeof BingUetOptions, true, false>;
5
- export interface BingUetApi {
6
- uetq: {
7
- push: (event: string | Record<string, any>) => void;
5
+ export type BingUetConsentStatus = 'granted' | 'denied';
6
+ export interface BingUetConsentOptions {
7
+ /**
8
+ * Controls storage of advertising identifiers. Currently the only field UET honors.
9
+ */
10
+ ad_storage?: BingUetConsentStatus;
11
+ }
12
+ export type BingUetEventName = 'page_view' | 'screen_view' | 'login' | 'sign_up' | 'subscribe' | 'start_trial' | 'lead' | 'generate_lead' | 'submit_lead_form' | 'contact' | 'search' | 'view_search_results' | 'select_content' | 'share' | 'exception' | 'find_location' | 'book_appointment' | 'get_route' | 'view_item' | 'view_item_list' | 'view_promotion' | 'add_to_cart' | 'remove_from_cart' | 'add_to_wishlist' | 'add_payment_info' | 'begin_checkout' | 'checkout_progress' | 'set_checkout_option' | 'purchase' | 'refund' | (string & {});
13
+ export interface BingUetItem {
14
+ id?: string;
15
+ name?: string;
16
+ brand?: string;
17
+ category?: string;
18
+ variant?: string;
19
+ price?: number;
20
+ quantity?: number;
21
+ list_name?: string;
22
+ list_position?: number;
23
+ creative_name?: string;
24
+ creative_slot?: string;
25
+ location_id?: string;
26
+ [key: string]: any;
27
+ }
28
+ export interface BingUetPromotion {
29
+ id?: string;
30
+ name?: string;
31
+ creative_name?: string;
32
+ creative_slot?: string;
33
+ [key: string]: any;
34
+ }
35
+ export interface BingUetEventParams {
36
+ /** Event category (beacon shortcut). */
37
+ ec?: string;
38
+ /** Event action (beacon shortcut). */
39
+ ea?: string;
40
+ /** Event label (beacon shortcut). */
41
+ el?: string;
42
+ /** Event value, numeric (beacon shortcut). */
43
+ ev?: number;
44
+ /** Goal category / goal completion. */
45
+ gc?: string;
46
+ /** Goal value. */
47
+ gv?: number;
48
+ /** Long-form alias for `ec`. */
49
+ event_category?: string;
50
+ /** Long-form alias for `ea`. */
51
+ event_action?: string;
52
+ /** Long-form alias for `el`. */
53
+ event_label?: string;
54
+ /** Long-form alias for `ev`. */
55
+ event_value?: number;
56
+ /** Unique event identifier (dedup). */
57
+ event_id?: string;
58
+ /** Variable revenue amount. */
59
+ revenue_value?: number;
60
+ /** ISO 4217 currency code (e.g. "USD"). */
61
+ currency?: string;
62
+ /** Unique order/transaction ID (dedup). */
63
+ transaction_id?: string;
64
+ /** Ecommerce items. */
65
+ items?: BingUetItem[];
66
+ /** Promotions associated with the event. */
67
+ promotions?: BingUetPromotion[];
68
+ /** Sign-up/login method (e.g. "Google"). */
69
+ method?: string;
70
+ coupon?: string;
71
+ tax?: number;
72
+ shipping?: number;
73
+ affiliation?: string;
74
+ /** Search query. */
75
+ search_term?: string;
76
+ content_type?: string;
77
+ content_id?: string;
78
+ checkout_step?: number;
79
+ checkout_option?: string;
80
+ description?: string;
81
+ name?: string;
82
+ screen_name?: string;
83
+ /** Whether an exception is fatal. */
84
+ fatal?: boolean;
85
+ /** Flags a new customer conversion. */
86
+ new_customer?: boolean | number;
87
+ /** Retail vertical: product ID. */
88
+ ecomm_prodid?: string | string[];
89
+ /** Retail vertical: page type. */
90
+ ecomm_pagetype?: 'home' | 'searchresults' | 'category' | 'product' | 'cart' | 'purchase' | 'other' | (string & {});
91
+ ecomm_totalvalue?: number;
92
+ ecomm_category?: string | string[];
93
+ ecomm_query?: string;
94
+ /** Override page path. */
95
+ page_path?: string;
96
+ /** Override page title. */
97
+ page_title?: string;
98
+ /** Override full page URL. */
99
+ page_location?: string;
100
+ [key: string]: any;
101
+ }
102
+ export interface BingUetEnhancedConversionsPid {
103
+ /** SHA-256 hashed email (lowercase, trimmed). Alias: `email`. */
104
+ em?: string;
105
+ /** SHA-256 hashed phone (E.164 digits only). Alias: `phone_number`. */
106
+ ph?: string;
107
+ /** Long-form alias for `em`. */
108
+ email?: string;
109
+ /** Long-form alias for `ph`. */
110
+ phone_number?: string;
111
+ [key: string]: any;
112
+ }
113
+ export interface BingUetSetParams {
114
+ /** Partner identifiers for enhanced conversions. */
115
+ pid?: BingUetEnhancedConversionsPid;
116
+ page_path?: string;
117
+ page_title?: string;
118
+ page_location?: string;
119
+ [key: string]: any;
120
+ }
121
+ export interface BingUetTcfConfig {
122
+ /** Enable TCF v2.0 auto-consent handling (Microsoft vendorId 1126). */
123
+ enabled?: boolean;
124
+ [key: string]: any;
125
+ }
126
+ export interface BingUetConstructorOptions {
127
+ /** UET tag ID. */
128
+ ti: string;
129
+ /** Alternate tag ID field (same effect as `ti`). */
130
+ tagId?: string;
131
+ /** Auto-fire pageLoad on SPA route changes. */
132
+ enableAutoSpaTracking?: boolean;
133
+ /** Enable TCF v2.0 auto-consent handling. */
134
+ enableAutoConsent?: boolean;
135
+ /** Suppress automatic page_view on load. */
136
+ disableAutoPageView?: boolean;
137
+ /** Disable the UET container entirely. */
138
+ disableContainer?: boolean;
139
+ /** Disable writing the UET visitor ID cookie. */
140
+ disableUetVid?: boolean;
141
+ /** Disable visibility (tab focus/blur) events. */
142
+ disableVisibilityEvents?: boolean;
143
+ /** Defer loading the beacon. */
144
+ deferLoad?: boolean;
145
+ /** Strip query strings from reported URLs. */
146
+ removeQueryFromUrls?: boolean;
147
+ /** Store conversion tracking cookies. */
148
+ storeConvTrackCookies?: boolean;
149
+ /** Cookie domain. */
150
+ cookieDomain?: string;
151
+ /** Cookie flags (e.g. "SameSite=None; Secure"). */
152
+ cookieFlags?: string;
153
+ /** Enable MS DNS cookie. */
154
+ msDnsCookie?: boolean;
155
+ /** UID cookie name. */
156
+ uidCookie?: string;
157
+ /** Error beacon verbosity level. */
158
+ errorBeaconLevel?: number;
159
+ /** Microsoft Clarity project ID for integration. */
160
+ clarityProjectId?: string;
161
+ /** When true, reads `window.enhanced_conversion_data` for gtag-style enhanced conversions. */
162
+ gtagPid?: boolean;
163
+ /** Beacon protocol version. */
164
+ Ver?: 1 | 2;
165
+ /** Associated advertiser ID. */
166
+ advertiserId?: string;
167
+ /** Source tag for GTM integration. */
168
+ gtmTagSource?: string;
169
+ /** Queue reference, typically `window.uetq`. */
170
+ q?: any[];
171
+ [key: string]: any;
172
+ }
173
+ export interface BingUetQueue {
174
+ push: {
175
+ (event: BingUetEventParams): void;
176
+ (command: 'pageLoad'): void;
177
+ (command: 'event', eventName: BingUetEventName, eventParams?: BingUetEventParams): void;
178
+ (command: 'consent', action: 'default' | 'update', consentParams: BingUetConsentOptions): void;
179
+ (command: 'set', params: BingUetSetParams): void;
180
+ (command: 'config', target: 'tcf', params: BingUetTcfConfig): void;
8
181
  };
9
182
  }
183
+ export interface BingUetApi {
184
+ uetq: BingUetQueue;
185
+ }
10
186
  declare global {
11
187
  interface Window {
12
- UET: new (options: {
13
- ti: string;
14
- enableAutoSpaTracking?: boolean;
15
- q?: any[];
16
- }) => BingUetApi['uetq'];
17
- uetq: any[] | BingUetApi['uetq'];
188
+ UET: new (options: BingUetConstructorOptions) => BingUetQueue;
189
+ uetq: any[] | BingUetQueue;
18
190
  }
19
191
  }
20
- export declare function useScriptBingUet<T extends BingUetApi>(_options?: BingUetInput): import("#nuxt-scripts/types").UseScriptContext<T>;
192
+ export interface BingUetConsent {
193
+ /** Push `['consent','update', state]` with the `ad_storage` signal. */
194
+ update: (state: BingUetConsentOptions) => void;
195
+ }
196
+ export declare function useScriptBingUet<T extends BingUetApi>(_options?: BingUetInput & {
197
+ onBeforeUetStart?: (uetq: BingUetQueue) => void;
198
+ }): UseScriptContext<T, BingUetConsent>;
@@ -2,7 +2,7 @@ import { useRegistryScript } from "../utils.js";
2
2
  import { BingUetOptions } from "./schemas.js";
3
3
  export { BingUetOptions };
4
4
  export function useScriptBingUet(_options) {
5
- return useRegistryScript("bingUet", (options) => ({
5
+ const instance = useRegistryScript("bingUet", (options) => ({
6
6
  scriptInput: {
7
7
  src: "https://bat.bing.com/bat.js",
8
8
  crossorigin: false
@@ -23,7 +23,21 @@ export function useScriptBingUet(_options) {
23
23
  }
24
24
  },
25
25
  clientInit: import.meta.server ? void 0 : () => {
26
- window.uetq = window.uetq || [];
26
+ const uetq = window.uetq || [];
27
+ window.uetq = uetq;
28
+ if (options?.defaultConsent) {
29
+ uetq.push("consent", "default", options.defaultConsent);
30
+ }
31
+ _options?.onBeforeUetStart?.(uetq);
27
32
  }
28
33
  }), _options);
34
+ if (import.meta.client && !instance.consent) {
35
+ instance.consent = {
36
+ update: (state) => {
37
+ ;
38
+ instance.proxy.uetq.push("consent", "update", state);
39
+ }
40
+ };
41
+ }
42
+ return instance;
29
43
  }
@@ -98,10 +98,6 @@ export declare function extractBlueskyPostId(url: string): {
98
98
  actor: string;
99
99
  rkey: string;
100
100
  } | undefined;
101
- /**
102
- * Proxy a Bluesky image URL through the server
103
- */
104
- export declare function proxyBlueskyImageUrl(url: string, proxyEndpoint?: string): string;
105
101
  /**
106
102
  * Format a Bluesky post date for display
107
103
  */
@@ -7,10 +7,6 @@ export function extractBlueskyPostId(url) {
7
7
  return void 0;
8
8
  return { actor: match[1], rkey: match[2] };
9
9
  }
10
- export function proxyBlueskyImageUrl(url, proxyEndpoint = "/_scripts/embed/bluesky-image") {
11
- const separator = proxyEndpoint.includes("?") ? "&" : "?";
12
- return `${proxyEndpoint}${separator}url=${encodeURIComponent(url)}`;
13
- }
14
10
  export function formatBlueskyDate(dateString) {
15
11
  const date = new Date(dateString);
16
12
  const time = date.toLocaleString("en-US", {
@@ -1,4 +1,4 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { ClarityOptions } from './schemas.js';
3
3
  export { ClarityOptions };
4
4
  type ClarityFunctions = ((fn: 'start', options?: {
@@ -25,4 +25,8 @@ declare global {
25
25
  }
26
26
  }
27
27
  export type ClarityInput = RegistryScriptInput<typeof ClarityOptions>;
28
- export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): import("#nuxt-scripts/types").UseScriptContext<T>;
28
+ export interface ClarityConsent {
29
+ /** Call `clarity('consent', value)` with either a boolean (default) or Clarity's advanced vector. */
30
+ set: (value: boolean | Record<string, string>) => void;
31
+ }
32
+ export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): UseScriptContext<T, ClarityConsent>;
@@ -2,7 +2,7 @@ import { useRegistryScript } from "../utils.js";
2
2
  import { ClarityOptions } from "./schemas.js";
3
3
  export { ClarityOptions };
4
4
  export function useScriptClarity(_options) {
5
- return useRegistryScript("clarity", (options) => ({
5
+ const instance = useRegistryScript("clarity", (options) => ({
6
6
  scriptInput: {
7
7
  src: `https://www.clarity.ms/tag/${options.id}`
8
8
  },
@@ -22,6 +22,17 @@ export function useScriptClarity(_options) {
22
22
  window.clarity = window.clarity || function(...params) {
23
23
  (window.clarity.q = window.clarity.q || []).push(params);
24
24
  };
25
+ if (options?.defaultConsent !== void 0)
26
+ window.clarity("consent", options.defaultConsent);
25
27
  }
26
28
  }), _options);
29
+ if (import.meta.client && !instance.consent) {
30
+ instance.consent = {
31
+ set: (value) => {
32
+ ;
33
+ instance.proxy.clarity("consent", value);
34
+ }
35
+ };
36
+ }
37
+ return instance;
27
38
  }
@@ -1,4 +1,4 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { ConsentState, RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { GoogleAnalyticsOptions } from './schemas.js';
3
3
  export type GtagCustomParams = Record<string, any>;
4
4
  export type ConsentStatus = 'granted' | 'denied';
@@ -58,6 +58,10 @@ export interface GoogleAnalyticsApi {
58
58
  }
59
59
  export { GoogleAnalyticsOptions };
60
60
  export type GoogleAnalyticsInput = RegistryScriptInput<typeof GoogleAnalyticsOptions>;
61
+ export interface GoogleAnalyticsConsent {
62
+ /** Send `gtag('consent','update', state)` with GCMv2 partial state. */
63
+ update: (state: ConsentState) => void;
64
+ }
61
65
  export declare function useScriptGoogleAnalytics<T extends GoogleAnalyticsApi>(_options?: GoogleAnalyticsInput & {
62
66
  onBeforeGtagStart?: (gtag: GTag) => void;
63
- }): import("#nuxt-scripts/types").UseScriptContext<T>;
67
+ }): UseScriptContext<T, GoogleAnalyticsConsent>;
@@ -3,7 +3,7 @@ import { withQuery } from "ufo";
3
3
  import { GoogleAnalyticsOptions } from "./schemas.js";
4
4
  export { GoogleAnalyticsOptions };
5
5
  export function useScriptGoogleAnalytics(_options) {
6
- return useRegistryScript(_options?.key || "googleAnalytics", (options) => {
6
+ const instance = useRegistryScript(_options?.key || "googleAnalytics", (options) => {
7
7
  const dataLayerName = options?.l ?? "dataLayer";
8
8
  const w = import.meta.client ? window : {};
9
9
  return {
@@ -24,6 +24,8 @@ export function useScriptGoogleAnalytics(_options) {
24
24
  w.gtag = function() {
25
25
  w[dataLayerName].push(arguments);
26
26
  };
27
+ if (options?.defaultConsent)
28
+ w.gtag("consent", "default", options.defaultConsent);
27
29
  _options?.onBeforeGtagStart?.(w.gtag);
28
30
  w.gtag("js", /* @__PURE__ */ new Date());
29
31
  if (options?.id) {
@@ -32,4 +34,13 @@ export function useScriptGoogleAnalytics(_options) {
32
34
  }
33
35
  };
34
36
  }, _options);
37
+ if (import.meta.client && !instance.consent) {
38
+ instance.consent = {
39
+ update: (state) => {
40
+ ;
41
+ instance.proxy.gtag("consent", "update", state);
42
+ }
43
+ };
44
+ }
45
+ return instance;
35
46
  }
@@ -1,4 +1,4 @@
1
- import type { NuxtUseScriptOptions, RegistryScriptInput, UseFunctionType, UseScriptContext } from '#nuxt-scripts/types';
1
+ import type { ConsentState, NuxtUseScriptOptions, RegistryScriptInput, UseFunctionType, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import type { GTag } from './google-analytics.js';
3
3
  import { GoogleTagManagerOptions } from './schemas.js';
4
4
  /**
@@ -68,6 +68,10 @@ declare global {
68
68
  }
69
69
  export { GoogleTagManagerOptions };
70
70
  export type GoogleTagManagerInput = RegistryScriptInput<typeof GoogleTagManagerOptions>;
71
+ export interface GoogleTagManagerConsent {
72
+ /** Push `['consent','update', state]` onto dataLayer with GCMv2 partial state. */
73
+ update: (state: ConsentState) => void;
74
+ }
71
75
  /**
72
76
  * Hook to use Google Tag Manager in Nuxt applications
73
77
  */
@@ -77,4 +81,4 @@ export declare function useScriptGoogleTagManager<T extends GoogleTagManagerApi>
77
81
  * Allows for custom initialization or configuration
78
82
  */
79
83
  onBeforeGtmStart?: (gtag: DataLayerPush) => void;
80
- }): UseScriptContext<UseFunctionType<NuxtUseScriptOptions<T>, T>>;
84
+ }): UseScriptContext<UseFunctionType<NuxtUseScriptOptions<T>, T>, GoogleTagManagerConsent>;
@@ -54,5 +54,14 @@ export function useScriptGoogleTagManager(options) {
54
54
  if (gtag)
55
55
  options.onBeforeGtmStart(gtag);
56
56
  }
57
- return instance;
57
+ const typed = instance;
58
+ if (import.meta.client && !typed.consent) {
59
+ typed.consent = {
60
+ update: (state) => {
61
+ ;
62
+ typed.proxy.dataLayer.push(["consent", "update", state]);
63
+ }
64
+ };
65
+ }
66
+ return typed;
58
67
  }
@@ -1,4 +1,5 @@
1
1
  import { scriptsPrefix, useRegistryScript } from "#nuxt-scripts/utils";
2
+ import { useScriptProxyUrl } from "../composables/useScriptProxyUrl.js";
2
3
  import { GravatarOptions } from "./schemas.js";
3
4
  export { GravatarOptions } from "./schemas.js";
4
5
  export function useScriptGravatar(_options) {
@@ -6,13 +7,11 @@ export function useScriptGravatar(_options) {
6
7
  const size = options?.size ?? 80;
7
8
  const defaultImg = options?.default ?? "mp";
8
9
  const rating = options?.rating ?? "g";
9
- const buildQuery = (overrides) => {
10
- const params = new URLSearchParams();
11
- params.set("s", String(overrides?.size ?? size));
12
- params.set("d", overrides?.default ?? defaultImg);
13
- params.set("r", overrides?.rating ?? rating);
14
- return params.toString();
15
- };
10
+ const buildQuery = (overrides) => ({
11
+ s: overrides?.size ?? size,
12
+ d: overrides?.default ?? defaultImg,
13
+ r: overrides?.rating ?? rating
14
+ });
16
15
  return {
17
16
  scriptInput: {
18
17
  src: "https://secure.gravatar.com/js/gprofiles.js"
@@ -21,13 +20,11 @@ export function useScriptGravatar(_options) {
21
20
  scriptOptions: {
22
21
  use: () => {
23
22
  const prefix = scriptsPrefix();
23
+ const proxyUrl = useScriptProxyUrl();
24
+ const path = `${prefix}/proxy/gravatar`;
24
25
  return {
25
- getAvatarUrl: (hash, overrides) => {
26
- return `${prefix}/proxy/gravatar?hash=${encodeURIComponent(hash)}&${buildQuery(overrides)}`;
27
- },
28
- getAvatarUrlFromEmail: (email, overrides) => {
29
- return `${prefix}/proxy/gravatar?email=${encodeURIComponent(email)}&${buildQuery(overrides)}`;
30
- }
26
+ getAvatarUrl: (hash, overrides) => proxyUrl(path, { hash, ...buildQuery(overrides) }),
27
+ getAvatarUrlFromEmail: (email, overrides) => proxyUrl(path, { email, ...buildQuery(overrides) })
31
28
  };
32
29
  }
33
30
  }
@@ -1,12 +1,18 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { MatomoAnalyticsOptions } from './schemas.js';
3
3
  export { MatomoAnalyticsOptions };
4
4
  export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false>;
5
- interface MatomoAnalyticsApi {
5
+ export interface MatomoAnalyticsApi {
6
6
  _paq: unknown[];
7
7
  }
8
8
  declare global {
9
9
  interface Window extends MatomoAnalyticsApi {
10
10
  }
11
11
  }
12
- export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
12
+ export interface MatomoConsent {
13
+ /** Push `setConsentGiven`. Requires `defaultConsent: 'required' | 'given'` at registration to have an effect. */
14
+ give: () => void;
15
+ /** Push `forgetConsentGiven`. Requires `defaultConsent: 'required' | 'given'` at registration to have an effect. */
16
+ forget: () => void;
17
+ }
18
+ export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): UseScriptContext<T, MatomoConsent>;
@@ -5,7 +5,7 @@ import { useRegistryScript } from "../utils.js";
5
5
  import { MatomoAnalyticsOptions } from "./schemas.js";
6
6
  export { MatomoAnalyticsOptions };
7
7
  export function useScriptMatomoAnalytics(_options) {
8
- return useRegistryScript("matomoAnalytics", (options) => {
8
+ const instance = useRegistryScript("matomoAnalytics", (options) => {
9
9
  const normalizedCloudId = options?.cloudId ? withoutTrailingSlash(withoutProtocol(options.cloudId)) : void 0;
10
10
  const origin = options?.matomoUrl ? options.matomoUrl : `https://cdn.matomo.cloud/${normalizedCloudId}/`;
11
11
  const _paq = import.meta.client ? window._paq = window._paq || [] : [];
@@ -30,6 +30,12 @@ export function useScriptMatomoAnalytics(_options) {
30
30
  }
31
31
  },
32
32
  clientInit: import.meta.server ? void 0 : () => {
33
+ if (options?.defaultConsent === "required") {
34
+ _paq.push(["requireConsent"]);
35
+ } else if (options?.defaultConsent === "given") {
36
+ _paq.push(["requireConsent"]);
37
+ _paq.push(["setConsentGiven"]);
38
+ }
33
39
  if (options?.enableLinkTracking) {
34
40
  _paq.push(["enableLinkTracking"]);
35
41
  }
@@ -59,4 +65,25 @@ export function useScriptMatomoAnalytics(_options) {
59
65
  }
60
66
  };
61
67
  }, _options);
68
+ if (import.meta.client && !instance.consent) {
69
+ const requiresConsent = _options?.defaultConsent === "required" || _options?.defaultConsent === "given";
70
+ const warnIfUnsafe = import.meta.dev ? (method) => {
71
+ if (!requiresConsent) {
72
+ logger.warn(`matomo consent.${method}() is a no-op unless \`defaultConsent: 'required'\` or \`'given'\` is set at registration.`);
73
+ }
74
+ } : () => {
75
+ };
76
+ const paq = instance.proxy._paq;
77
+ instance.consent = {
78
+ give: () => {
79
+ warnIfUnsafe("give");
80
+ paq.push(["setConsentGiven"]);
81
+ },
82
+ forget: () => {
83
+ warnIfUnsafe("forget");
84
+ paq.push(["forgetConsentGiven"]);
85
+ }
86
+ };
87
+ }
88
+ return instance;
62
89
  }
@@ -1,4 +1,4 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { MetaPixelOptions } from './schemas.js';
3
3
  type StandardEvents = 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent';
4
4
  interface EventObjectProperties {
@@ -38,4 +38,10 @@ declare global {
38
38
  }
39
39
  export { MetaPixelOptions };
40
40
  export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false>;
41
- export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
41
+ export interface MetaPixelConsent {
42
+ /** Call `fbq('consent','grant')`. */
43
+ grant: () => void;
44
+ /** Call `fbq('consent','revoke')`. */
45
+ revoke: () => void;
46
+ }
47
+ export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): UseScriptContext<T, MetaPixelConsent>;
@@ -2,7 +2,7 @@ import { useRegistryScript } from "../utils.js";
2
2
  import { MetaPixelOptions } from "./schemas.js";
3
3
  export { MetaPixelOptions };
4
4
  export function useScriptMetaPixel(_options) {
5
- return useRegistryScript("metaPixel", (options) => ({
5
+ const instance = useRegistryScript("metaPixel", (options) => ({
6
6
  scriptInput: {
7
7
  src: "https://connect.facebook.net/en_US/fbevents.js",
8
8
  crossorigin: false
@@ -27,8 +27,17 @@ export function useScriptMetaPixel(_options) {
27
27
  fbq.loaded = true;
28
28
  fbq.version = "2.0";
29
29
  fbq.queue = [];
30
+ if (options?.defaultConsent)
31
+ fbq("consent", options.defaultConsent === "granted" ? "grant" : "revoke");
30
32
  fbq("init", options?.id);
31
33
  fbq("track", "PageView");
32
34
  }
33
35
  }), _options);
36
+ if (import.meta.client && !instance.consent) {
37
+ instance.consent = {
38
+ grant: () => instance.proxy.fbq("consent", "grant"),
39
+ revoke: () => instance.proxy.fbq("consent", "revoke")
40
+ };
41
+ }
42
+ return instance;
34
43
  }
@@ -1,4 +1,4 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import { MixpanelAnalyticsOptions } from './schemas.js';
3
3
  export { MixpanelAnalyticsOptions };
4
4
  export type MixpanelAnalyticsInput = RegistryScriptInput<typeof MixpanelAnalyticsOptions>;
@@ -12,6 +12,10 @@ export interface MixpanelAnalyticsApi {
12
12
  };
13
13
  register: (properties: Record<string, any>) => void;
14
14
  init: (token: string, config?: Record<string, any>) => void;
15
+ /** Opt the user in to tracking. Available after the real SDK loads. */
16
+ opt_in_tracking?: () => void;
17
+ /** Opt the user out of tracking. Available after the real SDK loads. */
18
+ opt_out_tracking?: () => void;
15
19
  };
16
20
  }
17
21
  declare global {
@@ -19,4 +23,10 @@ declare global {
19
23
  mixpanel: MixpanelAnalyticsApi['mixpanel'];
20
24
  }
21
25
  }
22
- export declare function useScriptMixpanelAnalytics<T extends MixpanelAnalyticsApi>(_options?: MixpanelAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
26
+ export interface MixpanelConsent {
27
+ /** Call `mixpanel.opt_in_tracking()`. */
28
+ optIn: () => void;
29
+ /** Call `mixpanel.opt_out_tracking()`. For boot-time opt-out, use `defaultConsent: 'opt-out'` instead. */
30
+ optOut: () => void;
31
+ }
32
+ export declare function useScriptMixpanelAnalytics<T extends MixpanelAnalyticsApi>(_options?: MixpanelAnalyticsInput): UseScriptContext<T, MixpanelConsent>;
@@ -1,10 +1,10 @@
1
1
  import { useRegistryScript } from "../utils.js";
2
2
  import { MixpanelAnalyticsOptions } from "./schemas.js";
3
3
  export { MixpanelAnalyticsOptions };
4
- const methods = ["track", "identify", "reset", "register"];
4
+ const methods = ["track", "identify", "reset", "register", "opt_in_tracking", "opt_out_tracking"];
5
5
  const peopleMethods = ["set"];
6
6
  export function useScriptMixpanelAnalytics(_options) {
7
- return useRegistryScript("mixpanelAnalytics", (options) => {
7
+ const instance = useRegistryScript("mixpanelAnalytics", (options) => {
8
8
  return {
9
9
  scriptInput: {
10
10
  src: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"
@@ -38,9 +38,21 @@ export function useScriptMixpanelAnalytics(_options) {
38
38
  mp._i.push([token, config, name]);
39
39
  };
40
40
  }
41
- if (options?.token)
42
- mp.init(options.token);
41
+ if (options?.token) {
42
+ const optOutByDefault = options?.defaultConsent === "opt-out";
43
+ mp.init(options.token, optOutByDefault ? { opt_out_tracking_by_default: true } : void 0);
44
+ if (options?.defaultConsent === "opt-in") {
45
+ mp.opt_in_tracking?.();
46
+ }
47
+ }
43
48
  }
44
49
  };
45
50
  }, _options);
51
+ if (import.meta.client && !instance.consent) {
52
+ instance.consent = {
53
+ optIn: () => instance.proxy.mixpanel.opt_in_tracking?.(),
54
+ optOut: () => instance.proxy.mixpanel.opt_out_tracking?.()
55
+ };
56
+ }
57
+ return instance;
46
58
  }
@@ -1,4 +1,4 @@
1
- import type { RegistryScriptInput } from '#nuxt-scripts/types';
1
+ import type { RegistryScriptInput, UseScriptContext } from '#nuxt-scripts/types';
2
2
  import type { PostHog, PostHogConfig } from 'posthog-js';
3
3
  import { PostHogOptions } from './schemas.js';
4
4
  export { PostHogOptions };
@@ -22,4 +22,10 @@ declare global {
22
22
  }[];
23
23
  }
24
24
  }
25
- export declare function useScriptPostHog<T extends PostHogApi>(_options?: PostHogInput): import("#nuxt-scripts/types").UseScriptContext<T>;
25
+ export interface PostHogConsent {
26
+ /** Call `posthog.opt_in_capturing()`. */
27
+ optIn: () => void;
28
+ /** Call `posthog.opt_out_capturing()`. For boot-time opt-out, use `defaultConsent: 'opt-out'` instead. */
29
+ optOut: () => void;
30
+ }
31
+ export declare function useScriptPostHog<T extends PostHogApi>(_options?: PostHogInput): UseScriptContext<T, PostHogConsent>;