@c15t/scripts 2.2.0 → 3.0.0-alpha.1

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 (202) hide show
  1. package/AGENTS.md +77 -48
  2. package/README.md +4 -3
  3. package/dist/e2e-test-utils.js +60 -24
  4. package/dist/engine/compile.js +45 -45
  5. package/dist/engine/runtime.js +130 -119
  6. package/dist/registry.js +196 -176
  7. package/dist/resolve.js +12 -12
  8. package/dist/vendors/_shared/attributes.js +5 -5
  9. package/dist/vendors/_shared/google-consent.js +10 -10
  10. package/dist/vendors/_shared/install-builders.js +9 -9
  11. package/dist/vendors/_shared/script-url.js +12 -12
  12. package/dist/vendors/ads-and-pixels/linkedin-insights.js +16 -16
  13. package/dist/vendors/ads-and-pixels/meta-pixel.js +82 -82
  14. package/dist/vendors/ads-and-pixels/microsoft-uet.js +57 -57
  15. package/dist/vendors/ads-and-pixels/openai-pixel.js +88 -0
  16. package/dist/vendors/ads-and-pixels/reddit-pixel.js +39 -39
  17. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +25 -25
  18. package/dist/vendors/ads-and-pixels/tiktok-pixel.js +31 -31
  19. package/dist/vendors/ads-and-pixels/x-pixel.js +17 -17
  20. package/dist/vendors/analytics/adobe-analytics.js +17 -17
  21. package/dist/vendors/analytics/ahrefs-analytics.js +8 -8
  22. package/dist/vendors/analytics/amplitude.js +39 -39
  23. package/dist/vendors/analytics/clearbit.js +11 -11
  24. package/dist/vendors/analytics/cloudflare-web-analytics.js +13 -13
  25. package/dist/vendors/analytics/databuddy.js +45 -45
  26. package/dist/vendors/analytics/fathom-analytics.js +15 -15
  27. package/dist/vendors/analytics/google-tag.js +23 -23
  28. package/dist/vendors/analytics/heap.js +37 -37
  29. package/dist/vendors/analytics/hightouch.js +30 -30
  30. package/dist/vendors/analytics/hotjar.js +14 -14
  31. package/dist/vendors/analytics/logrocket.js +24 -24
  32. package/dist/vendors/analytics/matomo-analytics.js +51 -51
  33. package/dist/vendors/analytics/microsoft-clarity.js +34 -31
  34. package/dist/vendors/analytics/mixpanel-analytics.js +31 -31
  35. package/dist/vendors/analytics/pirsch.js +27 -27
  36. package/dist/vendors/analytics/plausible-analytics.js +24 -24
  37. package/dist/vendors/analytics/posthog.js +84 -79
  38. package/dist/vendors/analytics/promptwatch.js +8 -8
  39. package/dist/vendors/analytics/rudderstack.js +50 -50
  40. package/dist/vendors/analytics/rybbit-analytics.js +30 -30
  41. package/dist/vendors/analytics/segment.js +16 -16
  42. package/dist/vendors/analytics/umami-analytics.js +16 -16
  43. package/dist/vendors/analytics/vercel-analytics.js +22 -22
  44. package/dist/vendors/functional/crisp.js +49 -51
  45. package/dist/vendors/functional/intercom.js +18 -18
  46. package/dist/vendors/tag-managers/cloudflare-zaraz.js +98 -0
  47. package/dist/vendors/tag-managers/google-tag-manager.js +20 -20
  48. package/dist-types/__tests__/helpers.d.ts +11 -11
  49. package/dist-types/engine/compile.d.ts +3 -3
  50. package/dist-types/engine/runtime.d.ts +3 -3
  51. package/dist-types/registry.d.ts +191 -173
  52. package/dist-types/resolve.d.ts +3 -3
  53. package/dist-types/types.d.ts +2 -2
  54. package/dist-types/vendors/_shared/attributes.d.ts +2 -2
  55. package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
  56. package/dist-types/vendors/_shared/install-builders.d.ts +2 -2
  57. package/dist-types/vendors/_shared/script-url.d.ts +6 -6
  58. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
  59. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
  60. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
  61. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
  62. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
  63. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
  64. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
  65. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
  66. package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
  67. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
  68. package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
  69. package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
  70. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
  71. package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
  72. package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
  73. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  74. package/dist-types/vendors/analytics/heap.d.ts +17 -17
  75. package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
  76. package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
  77. package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
  78. package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
  79. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
  80. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
  81. package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
  82. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  83. package/dist-types/vendors/analytics/posthog.d.ts +35 -32
  84. package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
  85. package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
  86. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
  87. package/dist-types/vendors/analytics/segment.d.ts +11 -11
  88. package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
  89. package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
  90. package/dist-types/vendors/functional/crisp.d.ts +9 -9
  91. package/dist-types/vendors/functional/intercom.d.ts +12 -12
  92. package/dist-types/vendors/tag-managers/cloudflare-zaraz.d.ts +39 -0
  93. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
  94. package/docs/README.md +77 -48
  95. package/docs/assets/v3/brand-bar.png +0 -0
  96. package/docs/assets/v3/brand-card.png +0 -0
  97. package/docs/assets/v3/choice-wall.png +0 -0
  98. package/docs/assets/v3/mobile-card.png +0 -0
  99. package/docs/assets/v3/preferences.png +0 -0
  100. package/docs/customization/overview.md +45 -0
  101. package/docs/customization/recipes.md +79 -0
  102. package/docs/customization/slots.md +55 -0
  103. package/docs/customization/tokens.md +76 -0
  104. package/docs/customization/translations.md +49 -0
  105. package/docs/frameworks/javascript/script-loader.md +81 -343
  106. package/docs/frameworks/next/script-loader.md +164 -455
  107. package/docs/frameworks/react/script-loader.md +41 -533
  108. package/docs/guides/consent-state.md +60 -0
  109. package/docs/guides/data-fetching.md +163 -0
  110. package/docs/guides/deployment-modes.md +75 -0
  111. package/docs/guides/troubleshooting.md +68 -0
  112. package/docs/guides/verify-consent.md +62 -0
  113. package/docs/integrations/adobe-analytics.md +239 -105
  114. package/docs/integrations/ahrefs-analytics.md +238 -104
  115. package/docs/integrations/amplitude.md +219 -157
  116. package/docs/integrations/building-integrations.md +36 -223
  117. package/docs/integrations/clear-on-revocation.md +167 -0
  118. package/docs/integrations/clearbit.md +247 -86
  119. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  120. package/docs/integrations/cloudflare-zaraz.md +399 -0
  121. package/docs/integrations/crisp.md +251 -97
  122. package/docs/integrations/databuddy.md +259 -153
  123. package/docs/integrations/fathom-analytics.md +239 -96
  124. package/docs/integrations/google-maps.md +328 -207
  125. package/docs/integrations/google-tag-manager.md +248 -96
  126. package/docs/integrations/google-tag.md +261 -90
  127. package/docs/integrations/granular-consent.md +208 -0
  128. package/docs/integrations/heap.md +222 -149
  129. package/docs/integrations/hightouch.md +225 -131
  130. package/docs/integrations/hotjar.md +239 -90
  131. package/docs/integrations/intercom.md +239 -98
  132. package/docs/integrations/linkedin-insights.md +243 -113
  133. package/docs/integrations/logrocket.md +241 -123
  134. package/docs/integrations/matomo-analytics.md +256 -111
  135. package/docs/integrations/meta-pixel.md +197 -324
  136. package/docs/integrations/microsoft-clarity.md +233 -114
  137. package/docs/integrations/microsoft-uet.md +245 -110
  138. package/docs/integrations/mixpanel-analytics.md +252 -87
  139. package/docs/integrations/openai-pixel.md +441 -0
  140. package/docs/integrations/overview.md +96 -133
  141. package/docs/integrations/pirsch.md +249 -96
  142. package/docs/integrations/plausible-analytics.md +241 -100
  143. package/docs/integrations/posthog.md +353 -214
  144. package/docs/integrations/promptwatch.md +251 -81
  145. package/docs/integrations/reddit-pixel.md +226 -173
  146. package/docs/integrations/rudderstack.md +244 -187
  147. package/docs/integrations/rybbit-analytics.md +244 -91
  148. package/docs/integrations/segment.md +238 -92
  149. package/docs/integrations/snapchat-pixel.md +240 -110
  150. package/docs/integrations/tiktok-pixel.md +249 -81
  151. package/docs/integrations/umami-analytics.md +242 -95
  152. package/docs/integrations/vercel-analytics.md +242 -90
  153. package/docs/integrations/x-pixel.md +238 -104
  154. package/docs/integrations/youtube.md +359 -142
  155. package/docs/upgrade-v3.md +381 -0
  156. package/package.json +90 -78
  157. package/dist/e2e-test-utils.cjs +0 -166
  158. package/dist/engine/compile.cjs +0 -130
  159. package/dist/engine/runtime.cjs +0 -475
  160. package/dist/registry.cjs +0 -423
  161. package/dist/resolve.cjs +0 -71
  162. package/dist/types.cjs +0 -69
  163. package/dist/vendors/_shared/attributes.cjs +0 -55
  164. package/dist/vendors/_shared/google-consent.cjs +0 -69
  165. package/dist/vendors/_shared/install-builders.cjs +0 -59
  166. package/dist/vendors/_shared/script-url.cjs +0 -78
  167. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
  168. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
  169. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
  170. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
  171. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
  172. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
  173. package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
  174. package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
  175. package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
  176. package/dist/vendors/analytics/amplitude.cjs +0 -193
  177. package/dist/vendors/analytics/clearbit.cjs +0 -69
  178. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
  179. package/dist/vendors/analytics/databuddy.cjs +0 -144
  180. package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
  181. package/dist/vendors/analytics/google-tag.cjs +0 -107
  182. package/dist/vendors/analytics/heap.cjs +0 -181
  183. package/dist/vendors/analytics/hightouch.cjs +0 -153
  184. package/dist/vendors/analytics/hotjar.cjs +0 -85
  185. package/dist/vendors/analytics/logrocket.cjs +0 -99
  186. package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
  187. package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
  188. package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
  189. package/dist/vendors/analytics/pirsch.cjs +0 -108
  190. package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
  191. package/dist/vendors/analytics/posthog.cjs +0 -236
  192. package/dist/vendors/analytics/promptwatch.cjs +0 -70
  193. package/dist/vendors/analytics/rudderstack.cjs +0 -227
  194. package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
  195. package/dist/vendors/analytics/segment.cjs +0 -97
  196. package/dist/vendors/analytics/umami-analytics.cjs +0 -80
  197. package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
  198. package/dist/vendors/functional/crisp.cjs +0 -143
  199. package/dist/vendors/functional/intercom.cjs +0 -89
  200. package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
  201. package/docs/shared/react/guides/script-loader.md +0 -311
  202. package/readme.json +0 -19
@@ -1,232 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- matomoAnalytics: ()=>matomoAnalytics,
32
- matomoAnalyticsManifest: ()=>matomoAnalyticsManifest
33
- });
34
- const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
35
- const external_types_cjs_namespaceObject = require("../../types.cjs");
36
- const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
37
- function stripProtocol(value) {
38
- if (value.startsWith('https://')) return value.slice(8);
39
- if (value.startsWith('http://')) return value.slice(7);
40
- return value;
41
- }
42
- function resolveMatomoOrigin(options) {
43
- if (options.matomoUrl) return (0, script_url_cjs_namespaceObject.stripTrailingSlashes)(options.matomoUrl);
44
- if (options.cloudId) {
45
- const cleanedCloudId = (0, script_url_cjs_namespaceObject.stripTrailingSlashes)(stripProtocol(options.cloudId));
46
- if (cleanedCloudId.endsWith('.matomo.cloud')) return `https://${cleanedCloudId}`;
47
- return `https://cdn.matomo.cloud/${cleanedCloudId}`;
48
- }
49
- }
50
- function buildInstallSteps(options) {
51
- const install = [
52
- {
53
- type: 'setGlobal',
54
- name: '_paq',
55
- value: [],
56
- ifUndefined: true
57
- },
58
- {
59
- type: 'pushToQueue',
60
- queue: '_paq',
61
- value: [
62
- 'setTrackerUrl',
63
- '{{trackerUrl}}'
64
- ]
65
- },
66
- {
67
- type: 'pushToQueue',
68
- queue: '_paq',
69
- value: [
70
- 'setSiteId',
71
- '{{siteId}}'
72
- ]
73
- }
74
- ];
75
- if (options.enableLinkTracking) install.push({
76
- type: 'pushToQueue',
77
- queue: '_paq',
78
- value: [
79
- 'enableLinkTracking'
80
- ]
81
- });
82
- if (options.disableCookies) install.push({
83
- type: 'pushToQueue',
84
- queue: '_paq',
85
- value: [
86
- 'disableCookies'
87
- ]
88
- });
89
- if (options.enableConsentMode && !options.consentInitiallyGiven) install.push({
90
- type: 'pushToQueue',
91
- queue: '_paq',
92
- value: [
93
- 'requireConsent'
94
- ]
95
- });
96
- if (options.enableConsentMode && options.consentInitiallyGiven) {
97
- install.push({
98
- type: 'pushToQueue',
99
- queue: '_paq',
100
- value: [
101
- 'setConsentGiven'
102
- ]
103
- });
104
- if (options.trackPageView) install.push({
105
- type: 'pushToQueue',
106
- queue: '_paq',
107
- value: [
108
- 'trackPageView'
109
- ]
110
- });
111
- }
112
- if (options.trackPageView && !options.enableConsentMode) install.push({
113
- type: 'pushToQueue',
114
- queue: '_paq',
115
- value: [
116
- 'trackPageView'
117
- ]
118
- });
119
- install.push({
120
- type: 'loadScript',
121
- src: "{{scriptUrl}}",
122
- async: true
123
- });
124
- return install;
125
- }
126
- function buildGrantedHooks(options) {
127
- const onBeforeLoadGranted = [];
128
- if (options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
129
- type: 'pushToQueue',
130
- queue: '_paq',
131
- value: [
132
- 'setConsentGiven'
133
- ]
134
- });
135
- if (options.trackPageView && options.enableConsentMode && !options.consentInitiallyGiven) onBeforeLoadGranted.push({
136
- type: 'pushToQueue',
137
- queue: '_paq',
138
- value: [
139
- 'trackPageView'
140
- ]
141
- });
142
- const onConsentGranted = [];
143
- if (options.enableConsentMode) {
144
- onConsentGranted.push({
145
- type: 'pushToQueue',
146
- queue: '_paq',
147
- value: [
148
- 'setConsentGiven'
149
- ]
150
- });
151
- if (options.trackPageView) onConsentGranted.push({
152
- type: 'pushToQueue',
153
- queue: '_paq',
154
- value: [
155
- 'trackPageView'
156
- ]
157
- });
158
- }
159
- return {
160
- onBeforeLoadGranted,
161
- onConsentGranted
162
- };
163
- }
164
- function buildDeniedHooks(options) {
165
- const onConsentDenied = [];
166
- if (options.enableConsentMode) onConsentDenied.push({
167
- type: 'pushToQueue',
168
- queue: '_paq',
169
- value: [
170
- 'forgetConsentGiven'
171
- ]
172
- });
173
- return onConsentDenied;
174
- }
175
- function createMatomoAnalyticsManifest(options) {
176
- const { onBeforeLoadGranted, onConsentGranted } = buildGrantedHooks(options);
177
- let alwaysLoad;
178
- let persistAfterConsentRevoked;
179
- if (options.enableConsentMode) {
180
- alwaysLoad = true;
181
- persistAfterConsentRevoked = true;
182
- }
183
- return {
184
- ...external_types_cjs_namespaceObject.vendorManifestContract,
185
- vendor: 'matomo-analytics',
186
- category: 'measurement',
187
- alwaysLoad,
188
- persistAfterConsentRevoked,
189
- install: buildInstallSteps(options),
190
- onBeforeLoadGranted,
191
- onConsentGranted,
192
- onConsentDenied: buildDeniedHooks(options)
193
- };
194
- }
195
- const matomoAnalyticsManifest = createMatomoAnalyticsManifest({
196
- enableConsentMode: false,
197
- consentInitiallyGiven: false,
198
- enableLinkTracking: false,
199
- disableCookies: false,
200
- trackPageView: true
201
- });
202
- function matomoAnalytics(options = {}) {
203
- const origin = resolveMatomoOrigin(options);
204
- let trackerUrl = options.trackerUrl;
205
- if (!trackerUrl && origin) trackerUrl = (0, script_url_cjs_namespaceObject.joinUrlPath)(origin, 'matomo.php');
206
- let scriptUrl = options.scriptUrl;
207
- if (!scriptUrl && origin) scriptUrl = (0, script_url_cjs_namespaceObject.joinUrlPath)(origin, 'matomo.js');
208
- if (!trackerUrl || !scriptUrl) throw new Error("matomoAnalytics requires `matomoUrl`, `cloudId`, or explicit `trackerUrl` and `scriptUrl` values.");
209
- const enableConsentMode = 'required' === options.defaultConsent || 'given' === options.defaultConsent;
210
- const consentInitiallyGiven = 'given' === options.defaultConsent;
211
- const manifest = createMatomoAnalyticsManifest({
212
- enableConsentMode,
213
- consentInitiallyGiven,
214
- enableLinkTracking: options.enableLinkTracking ?? false,
215
- disableCookies: options.disableCookies ?? false,
216
- trackPageView: options.trackPageView ?? true
217
- });
218
- return (0, external_resolve_cjs_namespaceObject.resolveManifest)(manifest, {
219
- siteId: String(options.siteId ?? 1),
220
- trackerUrl,
221
- scriptUrl
222
- });
223
- }
224
- exports.matomoAnalytics = __webpack_exports__.matomoAnalytics;
225
- exports.matomoAnalyticsManifest = __webpack_exports__.matomoAnalyticsManifest;
226
- for(var __rspack_i in __webpack_exports__)if (-1 === [
227
- "matomoAnalytics",
228
- "matomoAnalyticsManifest"
229
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
230
- Object.defineProperty(exports, '__esModule', {
231
- value: true
232
- });
@@ -1,138 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- clarity: ()=>clarity,
32
- clarityManifest: ()=>clarityManifest
33
- });
34
- const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
35
- const external_types_cjs_namespaceObject = require("../../types.cjs");
36
- function toClarityConsentState(value) {
37
- if (true === value) return 'granted';
38
- if (false === value) return 'denied';
39
- if ('string' != typeof value) return;
40
- const normalized = value.toLowerCase();
41
- if ('granted' === normalized || 'true' === normalized) return 'granted';
42
- if ('denied' === normalized || 'false' === normalized) return 'denied';
43
- }
44
- function getConsentValue(value, keys) {
45
- for (const key of keys){
46
- const consent = toClarityConsentState(value[key]);
47
- if (consent) return consent;
48
- }
49
- }
50
- function getConsentPayloadFromState(consents) {
51
- let adStorage;
52
- adStorage = consents.marketing ? 'granted' : 'denied';
53
- let analyticsStorage;
54
- analyticsStorage = consents.measurement ? 'granted' : 'denied';
55
- return {
56
- ad_Storage: adStorage,
57
- analytics_Storage: analyticsStorage
58
- };
59
- }
60
- function getClarityConsentPayload(consents, defaultConsent) {
61
- const fallback = getConsentPayloadFromState(consents);
62
- if (void 0 === defaultConsent) return fallback;
63
- const booleanConsent = toClarityConsentState(defaultConsent);
64
- if (booleanConsent) return {
65
- ad_Storage: booleanConsent,
66
- analytics_Storage: booleanConsent
67
- };
68
- if (null !== defaultConsent && 'object' == typeof defaultConsent) return {
69
- ad_Storage: getConsentValue(defaultConsent, [
70
- 'ad_Storage',
71
- 'ad_storage',
72
- 'marketing'
73
- ]) ?? fallback.ad_Storage,
74
- analytics_Storage: getConsentValue(defaultConsent, [
75
- 'analytics_Storage',
76
- 'analytics_storage',
77
- 'measurement',
78
- 'analytics'
79
- ]) ?? fallback.analytics_Storage
80
- };
81
- return fallback;
82
- }
83
- function syncClarityConsent(info, defaultConsent) {
84
- window.clarity?.('consentv2', getClarityConsentPayload(info.consents, defaultConsent));
85
- }
86
- const clarityManifest = {
87
- ...external_types_cjs_namespaceObject.vendorManifestContract,
88
- vendor: 'microsoft-clarity',
89
- category: 'measurement',
90
- persistAfterConsentRevoked: true,
91
- bootstrap: [
92
- {
93
- type: 'defineStubFunction',
94
- name: 'clarity',
95
- queue: {
96
- property: 'q'
97
- },
98
- queueFormat: 'array',
99
- ifUndefined: true
100
- }
101
- ],
102
- install: [
103
- {
104
- type: 'loadScript',
105
- src: "{{scriptUrl}}",
106
- async: true
107
- }
108
- ]
109
- };
110
- function clarity({ id, defaultConsent, scriptUrl }) {
111
- const normalizedId = id.trim();
112
- if (void 0 === scriptUrl && 0 === normalizedId.length) throw new Error(`Invalid Clarity id value "${id}". A non-empty id is required to construct the Clarity loader URL when scriptUrl is not provided.`);
113
- const resolved = (0, external_resolve_cjs_namespaceObject.resolveManifest)(clarityManifest, {
114
- scriptUrl: scriptUrl ?? `https://www.clarity.ms/tag/${normalizedId}`
115
- });
116
- const onBeforeLoad = resolved.onBeforeLoad;
117
- const onConsentChange = resolved.onConsentChange;
118
- return {
119
- ...resolved,
120
- onBeforeLoad: (info)=>{
121
- onBeforeLoad?.(info);
122
- syncClarityConsent(info, defaultConsent);
123
- },
124
- onConsentChange: (info)=>{
125
- onConsentChange?.(info);
126
- syncClarityConsent(info);
127
- }
128
- };
129
- }
130
- exports.clarity = __webpack_exports__.clarity;
131
- exports.clarityManifest = __webpack_exports__.clarityManifest;
132
- for(var __rspack_i in __webpack_exports__)if (-1 === [
133
- "clarity",
134
- "clarityManifest"
135
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
136
- Object.defineProperty(exports, '__esModule', {
137
- value: true
138
- });
@@ -1,134 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- mixpanelAnalytics: ()=>mixpanelAnalytics,
32
- mixpanelAnalyticsManifest: ()=>mixpanelAnalyticsManifest
33
- });
34
- const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
35
- const external_types_cjs_namespaceObject = require("../../types.cjs");
36
- const mixpanelAnalyticsManifest = {
37
- ...external_types_cjs_namespaceObject.vendorManifestContract,
38
- vendor: 'mixpanel-analytics',
39
- category: 'measurement',
40
- alwaysLoad: true,
41
- install: [
42
- {
43
- type: 'setGlobal',
44
- name: 'mixpanel',
45
- value: [],
46
- ifUndefined: true
47
- },
48
- {
49
- type: 'setGlobalPath',
50
- path: [
51
- 'mixpanel',
52
- '__SV'
53
- ],
54
- value: 1.2
55
- },
56
- {
57
- type: 'setGlobalPath',
58
- path: [
59
- 'mixpanel',
60
- '_i'
61
- ],
62
- value: [
63
- [
64
- '{{token}}',
65
- '{{initOptions}}',
66
- 'mixpanel'
67
- ]
68
- ]
69
- },
70
- {
71
- type: 'defineQueueMethods',
72
- target: 'mixpanel',
73
- methods: [
74
- 'track',
75
- 'identify',
76
- 'reset',
77
- 'register',
78
- 'opt_in_tracking',
79
- 'opt_out_tracking'
80
- ]
81
- },
82
- {
83
- type: 'loadScript',
84
- src: "{{scriptUrl}}",
85
- async: true
86
- }
87
- ],
88
- onLoadGranted: [
89
- {
90
- type: 'callGlobal',
91
- global: 'mixpanel',
92
- method: 'opt_in_tracking'
93
- }
94
- ],
95
- onLoadDenied: [
96
- {
97
- type: 'callGlobal',
98
- global: 'mixpanel',
99
- method: 'opt_out_tracking'
100
- }
101
- ],
102
- onConsentGranted: [
103
- {
104
- type: 'callGlobal',
105
- global: 'mixpanel',
106
- method: 'opt_in_tracking'
107
- }
108
- ],
109
- onConsentDenied: [
110
- {
111
- type: 'callGlobal',
112
- global: 'mixpanel',
113
- method: 'opt_out_tracking'
114
- }
115
- ]
116
- };
117
- function mixpanelAnalytics({ token, initOptions, scriptUrl }) {
118
- const normalizedToken = token.trim();
119
- if (!/^[a-f0-9]{32}$/i.test(normalizedToken)) throw new Error("mixpanelAnalytics: token must be a non-empty 32-character hexadecimal string");
120
- return (0, external_resolve_cjs_namespaceObject.resolveManifest)(mixpanelAnalyticsManifest, {
121
- token: normalizedToken,
122
- initOptions: initOptions ?? {},
123
- scriptUrl: scriptUrl ?? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
124
- });
125
- }
126
- exports.mixpanelAnalytics = __webpack_exports__.mixpanelAnalytics;
127
- exports.mixpanelAnalyticsManifest = __webpack_exports__.mixpanelAnalyticsManifest;
128
- for(var __rspack_i in __webpack_exports__)if (-1 === [
129
- "mixpanelAnalytics",
130
- "mixpanelAnalyticsManifest"
131
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
132
- Object.defineProperty(exports, '__esModule', {
133
- value: true
134
- });
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- pirsch: ()=>pirsch,
32
- pirschManifest: ()=>pirschManifest
33
- });
34
- const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
35
- const external_types_cjs_namespaceObject = require("../../types.cjs");
36
- const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
37
- const DEFAULT_PIRSCH_SCRIPT_URL = 'https://api.pirsch.io/pa.js';
38
- const DEFAULT_PIRSCH_EXTENDED_SCRIPT_URL = 'https://api.pirsch.io/pirsch-extended.js';
39
- const pirschManifest = {
40
- ...external_types_cjs_namespaceObject.vendorManifestContract,
41
- vendor: 'pirsch',
42
- category: 'measurement',
43
- install: [
44
- {
45
- type: 'loadScript',
46
- src: "{{scriptUrl}}",
47
- defer: true,
48
- attributes: {
49
- id: "{{scriptElementId}}",
50
- 'data-code': '{{identificationCode}}',
51
- 'data-domain': '{{domain}}',
52
- 'data-dev': '{{dev}}',
53
- 'data-hit-endpoint': '{{hitEndpoint}}',
54
- 'data-event-endpoint': '{{eventEndpoint}}',
55
- 'data-disable-page-views': '{{disablePageViews}}'
56
- }
57
- }
58
- ]
59
- };
60
- function commaListDataAttribute(value) {
61
- if (void 0 === value) return;
62
- if (Array.isArray(value)) {
63
- const items = value.map((item)=>item.trim()).filter((item)=>item.length > 0);
64
- if (0 === items.length) return;
65
- return items.join(',');
66
- }
67
- return (0, script_url_cjs_namespaceObject.trimToUndefined)(value);
68
- }
69
- function presenceDataAttribute(value) {
70
- if (true === value) return '';
71
- }
72
- function getPirschScriptElementId(options) {
73
- if (true === options.extended) return 'pirschextendedjs';
74
- return 'pianjs';
75
- }
76
- function getPirschScriptUrl(options) {
77
- const defaultScriptUrl = true === options.extended ? DEFAULT_PIRSCH_EXTENDED_SCRIPT_URL : DEFAULT_PIRSCH_SCRIPT_URL;
78
- return (0, script_url_cjs_namespaceObject.resolveScriptUrl)((0, script_url_cjs_namespaceObject.trimToUndefined)(options.scriptUrl), defaultScriptUrl);
79
- }
80
- function pirsch(options) {
81
- const identificationCode = options.identificationCode.trim();
82
- if (0 === identificationCode.length) throw new Error('pirsch: invalid identificationCode - must be a non-empty string');
83
- const resolved = (0, external_resolve_cjs_namespaceObject.resolveManifest)(pirschManifest, {
84
- identificationCode,
85
- domain: commaListDataAttribute(options.domain),
86
- dev: (0, script_url_cjs_namespaceObject.trimToUndefined)(options.dev),
87
- hitEndpoint: (0, script_url_cjs_namespaceObject.trimToUndefined)(options.hitEndpoint),
88
- eventEndpoint: (0, script_url_cjs_namespaceObject.trimToUndefined)(options.eventEndpoint),
89
- disablePageViews: presenceDataAttribute(options.disablePageViews),
90
- scriptElementId: getPirschScriptElementId(options),
91
- scriptUrl: getPirschScriptUrl(options)
92
- });
93
- const manifestOnLoad = resolved.onLoad;
94
- resolved.onLoad = (info)=>{
95
- manifestOnLoad?.(info);
96
- if ('loading' !== document.readyState) window.pirschInit?.();
97
- };
98
- return resolved;
99
- }
100
- exports.pirsch = __webpack_exports__.pirsch;
101
- exports.pirschManifest = __webpack_exports__.pirschManifest;
102
- for(var __rspack_i in __webpack_exports__)if (-1 === [
103
- "pirsch",
104
- "pirschManifest"
105
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
106
- Object.defineProperty(exports, '__esModule', {
107
- value: true
108
- });