@c15t/scripts 2.2.0-canary-20260804162155 → 3.0.0-alpha.0

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 (197) hide show
  1. package/AGENTS.md +74 -48
  2. package/README.md +3 -3
  3. package/dist/e2e-test-utils.js +60 -24
  4. package/dist/engine/compile.js +45 -45
  5. package/dist/engine/runtime.js +119 -119
  6. package/dist/registry.js +186 -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 +31 -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/google-tag-manager.js +20 -20
  47. package/dist-types/__tests__/helpers.d.ts +10 -10
  48. package/dist-types/engine/compile.d.ts +2 -2
  49. package/dist-types/engine/runtime.d.ts +3 -3
  50. package/dist-types/registry.d.ts +182 -173
  51. package/dist-types/resolve.d.ts +2 -2
  52. package/dist-types/types.d.ts +2 -2
  53. package/dist-types/vendors/_shared/attributes.d.ts +2 -2
  54. package/dist-types/vendors/_shared/google-consent.d.ts +2 -2
  55. package/dist-types/vendors/_shared/install-builders.d.ts +1 -1
  56. package/dist-types/vendors/_shared/script-url.d.ts +6 -6
  57. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +14 -14
  58. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +27 -27
  59. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +40 -40
  60. package/dist-types/vendors/ads-and-pixels/openai-pixel.d.ts +211 -0
  61. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +28 -29
  62. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +23 -23
  63. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +22 -22
  64. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +15 -15
  65. package/dist-types/vendors/analytics/adobe-analytics.d.ts +3 -3
  66. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +5 -5
  67. package/dist-types/vendors/analytics/amplitude.d.ts +24 -24
  68. package/dist-types/vendors/analytics/clearbit.d.ts +5 -5
  69. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +6 -6
  70. package/dist-types/vendors/analytics/databuddy.d.ts +34 -31
  71. package/dist-types/vendors/analytics/fathom-analytics.d.ts +8 -8
  72. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  73. package/dist-types/vendors/analytics/heap.d.ts +17 -17
  74. package/dist-types/vendors/analytics/hightouch.d.ts +15 -15
  75. package/dist-types/vendors/analytics/hotjar.d.ts +9 -9
  76. package/dist-types/vendors/analytics/logrocket.d.ts +11 -11
  77. package/dist-types/vendors/analytics/matomo-analytics.d.ts +3 -3
  78. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +12 -13
  79. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +20 -20
  80. package/dist-types/vendors/analytics/pirsch.d.ts +10 -10
  81. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  82. package/dist-types/vendors/analytics/posthog.d.ts +35 -32
  83. package/dist-types/vendors/analytics/promptwatch.d.ts +5 -5
  84. package/dist-types/vendors/analytics/rudderstack.d.ts +16 -16
  85. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +15 -15
  86. package/dist-types/vendors/analytics/segment.d.ts +11 -11
  87. package/dist-types/vendors/analytics/umami-analytics.d.ts +9 -9
  88. package/dist-types/vendors/analytics/vercel-analytics.d.ts +13 -13
  89. package/dist-types/vendors/functional/crisp.d.ts +9 -9
  90. package/dist-types/vendors/functional/intercom.d.ts +12 -12
  91. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +16 -16
  92. package/docs/README.md +74 -48
  93. package/docs/assets/v3/brand-bar.png +0 -0
  94. package/docs/assets/v3/brand-card.png +0 -0
  95. package/docs/assets/v3/choice-wall.png +0 -0
  96. package/docs/assets/v3/mobile-card.png +0 -0
  97. package/docs/assets/v3/preferences.png +0 -0
  98. package/docs/customization/overview.md +45 -0
  99. package/docs/customization/recipes.md +79 -0
  100. package/docs/customization/slots.md +55 -0
  101. package/docs/customization/tokens.md +76 -0
  102. package/docs/customization/translations.md +49 -0
  103. package/docs/frameworks/javascript/script-loader.md +30 -339
  104. package/docs/frameworks/next/script-loader.md +134 -467
  105. package/docs/frameworks/react/script-loader.md +35 -535
  106. package/docs/guides/consent-state.md +60 -0
  107. package/docs/guides/data-fetching.md +163 -0
  108. package/docs/guides/deployment-modes.md +63 -0
  109. package/docs/guides/troubleshooting.md +68 -0
  110. package/docs/guides/verify-consent.md +62 -0
  111. package/docs/integrations/adobe-analytics.md +239 -105
  112. package/docs/integrations/ahrefs-analytics.md +238 -104
  113. package/docs/integrations/amplitude.md +219 -157
  114. package/docs/integrations/building-integrations.md +32 -224
  115. package/docs/integrations/clearbit.md +247 -86
  116. package/docs/integrations/cloudflare-web-analytics.md +250 -84
  117. package/docs/integrations/crisp.md +251 -97
  118. package/docs/integrations/databuddy.md +259 -153
  119. package/docs/integrations/fathom-analytics.md +239 -96
  120. package/docs/integrations/google-maps.md +328 -207
  121. package/docs/integrations/google-tag-manager.md +248 -96
  122. package/docs/integrations/google-tag.md +261 -90
  123. package/docs/integrations/heap.md +222 -149
  124. package/docs/integrations/hightouch.md +225 -131
  125. package/docs/integrations/hotjar.md +239 -90
  126. package/docs/integrations/intercom.md +239 -98
  127. package/docs/integrations/linkedin-insights.md +243 -113
  128. package/docs/integrations/logrocket.md +241 -123
  129. package/docs/integrations/matomo-analytics.md +256 -111
  130. package/docs/integrations/meta-pixel.md +197 -324
  131. package/docs/integrations/microsoft-clarity.md +233 -114
  132. package/docs/integrations/microsoft-uet.md +245 -110
  133. package/docs/integrations/mixpanel-analytics.md +252 -87
  134. package/docs/integrations/openai-pixel.md +441 -0
  135. package/docs/integrations/overview.md +95 -133
  136. package/docs/integrations/pirsch.md +249 -96
  137. package/docs/integrations/plausible-analytics.md +241 -100
  138. package/docs/integrations/posthog.md +353 -214
  139. package/docs/integrations/promptwatch.md +251 -81
  140. package/docs/integrations/reddit-pixel.md +226 -173
  141. package/docs/integrations/rudderstack.md +244 -187
  142. package/docs/integrations/rybbit-analytics.md +244 -91
  143. package/docs/integrations/segment.md +238 -92
  144. package/docs/integrations/snapchat-pixel.md +240 -110
  145. package/docs/integrations/tiktok-pixel.md +249 -81
  146. package/docs/integrations/umami-analytics.md +242 -95
  147. package/docs/integrations/vercel-analytics.md +242 -90
  148. package/docs/integrations/x-pixel.md +238 -104
  149. package/docs/integrations/youtube.md +354 -142
  150. package/docs/upgrade-v3.md +334 -0
  151. package/package.json +85 -78
  152. package/readme.json +2 -2
  153. package/dist/e2e-test-utils.cjs +0 -166
  154. package/dist/engine/compile.cjs +0 -130
  155. package/dist/engine/runtime.cjs +0 -475
  156. package/dist/registry.cjs +0 -423
  157. package/dist/resolve.cjs +0 -71
  158. package/dist/types.cjs +0 -69
  159. package/dist/vendors/_shared/attributes.cjs +0 -55
  160. package/dist/vendors/_shared/google-consent.cjs +0 -69
  161. package/dist/vendors/_shared/install-builders.cjs +0 -59
  162. package/dist/vendors/_shared/script-url.cjs +0 -78
  163. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +0 -89
  164. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +0 -206
  165. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +0 -151
  166. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +0 -151
  167. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +0 -131
  168. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +0 -130
  169. package/dist/vendors/ads-and-pixels/x-pixel.cjs +0 -92
  170. package/dist/vendors/analytics/adobe-analytics.cjs +0 -90
  171. package/dist/vendors/analytics/ahrefs-analytics.cjs +0 -68
  172. package/dist/vendors/analytics/amplitude.cjs +0 -193
  173. package/dist/vendors/analytics/clearbit.cjs +0 -69
  174. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +0 -73
  175. package/dist/vendors/analytics/databuddy.cjs +0 -144
  176. package/dist/vendors/analytics/fathom-analytics.cjs +0 -76
  177. package/dist/vendors/analytics/google-tag.cjs +0 -107
  178. package/dist/vendors/analytics/heap.cjs +0 -181
  179. package/dist/vendors/analytics/hightouch.cjs +0 -153
  180. package/dist/vendors/analytics/hotjar.cjs +0 -85
  181. package/dist/vendors/analytics/logrocket.cjs +0 -99
  182. package/dist/vendors/analytics/matomo-analytics.cjs +0 -232
  183. package/dist/vendors/analytics/microsoft-clarity.cjs +0 -138
  184. package/dist/vendors/analytics/mixpanel-analytics.cjs +0 -134
  185. package/dist/vendors/analytics/pirsch.cjs +0 -108
  186. package/dist/vendors/analytics/plausible-analytics.cjs +0 -122
  187. package/dist/vendors/analytics/posthog.cjs +0 -236
  188. package/dist/vendors/analytics/promptwatch.cjs +0 -70
  189. package/dist/vendors/analytics/rudderstack.cjs +0 -227
  190. package/dist/vendors/analytics/rybbit-analytics.cjs +0 -104
  191. package/dist/vendors/analytics/segment.cjs +0 -97
  192. package/dist/vendors/analytics/umami-analytics.cjs +0 -80
  193. package/dist/vendors/analytics/vercel-analytics.cjs +0 -94
  194. package/dist/vendors/functional/crisp.cjs +0 -143
  195. package/dist/vendors/functional/intercom.cjs +0 -89
  196. package/dist/vendors/tag-managers/google-tag-manager.cjs +0 -100
  197. package/docs/shared/react/guides/script-loader.md +0 -311
package/AGENTS.md CHANGED
@@ -1,62 +1,88 @@
1
1
  # @c15t/scripts
2
2
 
3
- > Consent-aware script integration docs for analytics, advertising pixels, tag managers, widgets, and custom loaders.
3
+ > Consent-aware vendor integrations and Consent Mode loading contracts.
4
4
 
5
5
  These docs ship inside the package so coding agents can read them offline. Open the topic file you need from the list below — paths are relative to this file.
6
6
 
7
+ ## Using these docs
8
+
9
+ These docs describe v3. Start with Inth hosted setup, identify the framework, router and deployment, then read its quickstart. Static sites can use Inth directly. Use page Markdown and package-bundled docs for targeted context. Verify scripts, rejection, reload and preferences; banner visibility alone is insufficient.
10
+
11
+ ## Start here
12
+
13
+ - [Connect your integrations](./docs/integrations/overview.md)
14
+ - [Customize your consent interface](./docs/customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
15
+ - [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
16
+ - [Upgrade to v3 policies](./docs/upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
17
+
18
+ ## More documentation
19
+
20
+ [Documentation index](https://c15t.com/docs/llms.txt) · [Full Markdown context](https://c15t.com/llms-full.txt). Prefer the index and individual pages for focused tasks.
21
+
7
22
  ## Frameworks
8
23
 
9
- Install and configure c15t in JavaScript, React, and Next.js applications.
24
+ - [JavaScript script loading](./docs/frameworks/javascript/script-loader.md): Attach a script loader to the consent kernel and dispose it with the application.
25
+ - [Load scripts with consent](./docs/frameworks/next/script-loader.md): Register vendor scripts in your existing Next.js ConsentRoot and handle loading and revocation.
26
+ - [Load scripts with consent](./docs/frameworks/react/script-loader.md): Register vendor scripts once and let effective permissions control loading.
27
+
28
+ ## Guides
29
+
30
+ - [Understand consent state](./docs/guides/consent-state.md): Distinguish policy resolution, effective permissions, explicit choices, notices and privacy signals.
31
+ - [Data fetching and transports](./docs/guides/data-fetching.md): Choose cached manifests, backend init or offline policy resolution, and understand where consent records are saved.
32
+ - [Choose a deployment mode](./docs/guides/deployment-modes.md): Choose who runs your consent backend, then select manifest, init or offline resolution for your deployment.
33
+ - [Troubleshoot consent](./docs/guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
34
+ - [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
10
35
 
11
- - [Script Loader](./docs/frameworks/javascript/script-loader.md): Gate third-party scripts behind consent — load Google Analytics, Meta Pixel, and other tracking scripts only when users grant permission.
12
- - [Script Loader](./docs/frameworks/next/script-loader.md): Gate third-party scripts behind consent in Next.js — load Google Analytics, Meta Pixel, and other tracking scripts only when users grant permission.
13
- - [Script Loader](./docs/frameworks/react/script-loader.md): Gate third-party scripts behind consent in React — load Google Analytics, Meta Pixel, and other tracking scripts only when users grant permission.
36
+ ## Customization
37
+
38
+ - [Customize your consent interface](./docs/customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
39
+ - [Banner styling recipes](./docs/customization/recipes.md): See real v3 components and reuse the exact theme configuration behind the examples.
40
+ - [Style component slots](./docs/customization/slots.md): Target a specific c15t component part without replacing its markup or behavior.
41
+ - [Theme tokens and CSS](./docs/customization/tokens.md): Style c15t with semantic tokens and use the stylesheet that matches your CSS tooling.
42
+ - [Copy and translations](./docs/customization/translations.md): Change consent wording through i18n and test the complete prompt and preferences flow.
14
43
 
15
44
  ## Integrations
16
45
 
17
- Connect analytics, advertising, maps, media, and other third-party tools behind consent.
18
-
19
- - [Adobe Analytics](./docs/integrations/adobe-analytics.md): Adobe Analytics loaded through an Adobe Experience Platform Data Collection Tags embed URL.
20
- - [Ahrefs Analytics](./docs/integrations/ahrefs-analytics.md): Cookieless web analytics from Ahrefs with a prebuilt helper that wires the project key into a c15t-managed script.
21
- - [Amplitude](./docs/integrations/amplitude.md): Load Amplitude Browser SDK 2 with c15t and gate product analytics behind measurement consent.
22
- - [Build a Custom Script Integration](./docs/integrations/building-integrations.md): Learn when to use a raw Script, when to build a reusable manifest-backed integration, and how to debug and test custom consent-aware scripts in c15t.
23
- - [Clearbit](./docs/integrations/clearbit.md): Visitor and company enrichment loaded with Clearbit's account-keyed tags.js snippet.
24
- - [Cloudflare Web Analytics](./docs/integrations/cloudflare-web-analytics.md): Cookieless analytics from Cloudflare with a prebuilt helper that serializes the beacon config into the `data-cf-beacon` attribute.
25
- - [Crisp](./docs/integrations/crisp.md): Load Crisp live chat with website ID, runtime, cookie, and session options.
26
- - [Databuddy](./docs/integrations/databuddy.md): Databuddy is a privacy-focused analytics platform that helps you understand user behavior and track events. It supports cookieless tracking and manages consent automatically through c15t's consent state synchronization.
27
- - [Fathom Analytics](./docs/integrations/fathom-analytics.md): Privacy-friendly cookieless analytics with a prebuilt helper that maps Fathom's data attributes into a c15t-managed script.
28
- - [Google Maps](./docs/integrations/google-maps.md): Render Google Maps only after consent with one shared Maps JavaScript API loader and independently managed map instances.
29
- - [GA4 + Google Ads (gtag.js)](./docs/integrations/google-tag.md): Send data to Google Analytics 4 and Google Ads with automatic Consent Mode v2 support.
30
- - [Google Tag Manager](./docs/integrations/google-tag-manager.md): Deploy and manage marketing tags centrally with automatic consent state synchronization.
31
- - [Heap](./docs/integrations/heap.md): Load Heap with c15t and gate autocapture product analytics behind measurement consent.
32
- - [Hightouch](./docs/integrations/hightouch.md): Load Hightouch Events with c15t and gate the browser SDK behind measurement consent.
33
- - [Hotjar](./docs/integrations/hotjar.md): Product analytics and behavior insights with a prebuilt helper that seeds Hotjar globals before loading the vendor bundle.
34
- - [Intercom](./docs/integrations/intercom.md): Bootstrap Intercom settings and load the messenger widget bundle.
35
- - [LinkedIn Insights](./docs/integrations/linkedin-insights.md): Track conversions and build matched audiences for LinkedIn advertising campaigns.
36
- - [LogRocket](./docs/integrations/logrocket.md): Session replay and monitoring loaded after measurement consent with LogRocket's browser SDK.
37
- - [Matomo Analytics](./docs/integrations/matomo-analytics.md): Load Matomo with c15t and keep Matomo's queue aligned with measurement consent.
38
- - [Meta Pixel](./docs/integrations/meta-pixel.md): Track conversions and build audiences for Facebook and Instagram advertising campaigns.
39
- - [Microsoft Clarity](./docs/integrations/microsoft-clarity.md): Session replay and behavior analytics with a prebuilt helper that keeps Clarity consent synchronized with c15t measurement state.
40
- - [Microsoft UET](./docs/integrations/microsoft-uet.md): Track conversions and measure performance for Microsoft Advertising and Bing Ads.
41
- - [Mixpanel Analytics](./docs/integrations/mixpanel-analytics.md): Load Mixpanel with c15t and let Mixpanel's own opt-in and opt-out APIs follow measurement consent.
42
- - [Integrations](./docs/integrations/overview.md): Load analytics, pixels, tag managers, and widgets through c15t so consent state controls when they run, update, and appear in your consent UI.
43
- - [Pirsch](./docs/integrations/pirsch.md): Privacy-friendly, cookieless analytics loaded with Pirsch's fixed script id and identification-code attributes.
44
- - [Plausible Analytics](./docs/integrations/plausible-analytics.md): Privacy-friendly cookieless analytics with a prebuilt helper that preserves Plausible's queue bootstrap and loader attributes.
45
- - [PostHog](./docs/integrations/posthog.md): PostHog is an open-source product analytics platform for tracking user behavior, session replays, feature flags, and A/B testing. It supports cookieless tracking, allowing analytics to continue even without cookie consent.
46
- - [Promptwatch](./docs/integrations/promptwatch.md): Promptwatch analyzes traffic on your site for Artificial Intelligence (AI) traffic and usage insights. Data is stored in the EU without user-identifiable information.
47
- - [Reddit Pixel](./docs/integrations/reddit-pixel.md): Track conversions and build retargeting audiences for Reddit advertising campaigns.
48
- - [RudderStack](./docs/integrations/rudderstack.md): Load RudderStack's JavaScript SDK with c15t and gate the browser SDK behind measurement consent.
49
- - [Rybbit Analytics](./docs/integrations/rybbit-analytics.md): Privacy-friendly analytics with script-tag configuration via Rybbit's data attributes.
50
- - [Segment](./docs/integrations/segment.md): Load Segment Analytics.js with c15t and gate it behind measurement consent.
51
- - [Snapchat Pixel](./docs/integrations/snapchat-pixel.md): Measure Snapchat ad performance and build remarketing audiences with a prebuilt pixel helper.
52
- - [TikTok Pixel](./docs/integrations/tiktok-pixel.md): Measure ad performance and build audiences for TikTok advertising campaigns.
53
- - [Umami Analytics](./docs/integrations/umami-analytics.md): Open-source, cookieless analytics with a prebuilt helper that maps Umami's data attributes into a c15t-managed script.
54
- - [Vercel Analytics](./docs/integrations/vercel-analytics.md): Bootstrap Vercel Analytics with a declarative queue and script attributes.
55
- - [X Pixel (Twitter Pixel)](./docs/integrations/x-pixel.md): Track conversions and build audiences for advertising campaigns on X (formerly Twitter).
56
- - [YouTube](./docs/integrations/youtube.md): Keep YouTube iframes unmounted until consent with a privacy-enhanced, lazy-loaded React or Next.js embed.
46
+ - [Adobe Analytics](./docs/integrations/adobe-analytics.md): Configure Adobe Analytics with c15t v3, understand measurement permission and verify loading and revocation.
47
+ - [Ahrefs Analytics](./docs/integrations/ahrefs-analytics.md): Configure Ahrefs Analytics with c15t v3, understand measurement permission and verify loading and revocation.
48
+ - [Amplitude](./docs/integrations/amplitude.md): Configure Amplitude with c15t v3, understand measurement permission and verify loading and revocation.
49
+ - [Custom integrations](./docs/integrations/building-integrations.md): Define loading, initialization and consent-change behavior for a vendor without a helper.
50
+ - [Clearbit](./docs/integrations/clearbit.md): Configure Clearbit with c15t v3, understand marketing permission and verify loading and revocation.
51
+ - [Cloudflare Web Analytics](./docs/integrations/cloudflare-web-analytics.md): Configure Cloudflare Web Analytics with c15t v3, understand measurement permission and verify loading and revocation.
52
+ - [Crisp](./docs/integrations/crisp.md): Configure Crisp with c15t v3, understand functionality permission and verify loading and revocation.
53
+ - [Databuddy](./docs/integrations/databuddy.md): Configure Databuddy's initial and updated consent state with c15t v3.
54
+ - [Fathom Analytics](./docs/integrations/fathom-analytics.md): Configure Fathom Analytics with c15t v3, understand measurement permission and verify loading and revocation.
55
+ - [Google Maps](./docs/integrations/google-maps.md): Prevent a map iframe from mounting before the required permission.
56
+ - [Google Tag](./docs/integrations/google-tag.md): Configure gtag with c15t Consent Mode signals and understand its loading behavior.
57
+ - [Google Tag Manager](./docs/integrations/google-tag-manager.md): Load GTM with c15t consent signals and verify the tags inside your container.
58
+ - [Heap](./docs/integrations/heap.md): Configure Heap with c15t v3, understand measurement permission and verify loading and revocation.
59
+ - [Hightouch](./docs/integrations/hightouch.md): Configure Hightouch with c15t v3, understand measurement permission and verify loading and revocation.
60
+ - [Hotjar](./docs/integrations/hotjar.md): Configure Hotjar with c15t v3, understand measurement permission and verify loading and revocation.
61
+ - [Intercom](./docs/integrations/intercom.md): Load the Intercom messenger with functionality permission and configure its region.
62
+ - [LinkedIn Insight Tag](./docs/integrations/linkedin-insights.md): Configure LinkedIn Insight Tag with c15t v3, understand marketing permission and verify loading and revocation.
63
+ - [LogRocket](./docs/integrations/logrocket.md): Configure LogRocket with c15t v3, understand measurement permission and verify loading and revocation.
64
+ - [Matomo Analytics](./docs/integrations/matomo-analytics.md): Choose gated loading or Matomo consent signaling and configure the correct tracker endpoints.
65
+ - [Meta Pixel](./docs/integrations/meta-pixel.md): Register the Meta Pixel under marketing permission and verify event calls after revocation.
66
+ - [Microsoft Clarity](./docs/integrations/microsoft-clarity.md): Configure Microsoft Clarity with c15t v3, understand measurement permission and verify loading and revocation.
67
+ - [Microsoft UET](./docs/integrations/microsoft-uet.md): Configure Microsoft UET with c15t v3, understand marketing permission and verify loading and revocation.
68
+ - [Mixpanel](./docs/integrations/mixpanel-analytics.md): Configure Mixpanel with c15t v3, understand measurement permission and verify loading and revocation.
69
+ - [OpenAI Pixel](./docs/integrations/openai-pixel.md): Configure the OpenAI Measurement Pixel for ChatGPT Ads with c15t v3, manage marketing permission and verify conversion delivery.
70
+ - [Overview](./docs/integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, chat and embedded content.
71
+ - [Pirsch](./docs/integrations/pirsch.md): Configure Pirsch with c15t v3, understand measurement permission and verify loading and revocation.
72
+ - [Plausible Analytics](./docs/integrations/plausible-analytics.md): Configure Plausible Analytics with c15t v3, understand measurement permission and verify loading and revocation.
73
+ - [PostHog](./docs/integrations/posthog.md): Choose PostHog loading and cookieless behavior, configure the region, and synchronize v3 permissions.
74
+ - [Promptwatch](./docs/integrations/promptwatch.md): Configure Promptwatch with c15t v3, understand measurement permission and verify loading and revocation.
75
+ - [Reddit Pixel](./docs/integrations/reddit-pixel.md): Configure Reddit Pixel with c15t v3, understand marketing permission and verify loading and revocation.
76
+ - [RudderStack](./docs/integrations/rudderstack.md): Gate the RudderStack browser SDK or map c15t categories to destination consent IDs.
77
+ - [Rybbit Analytics](./docs/integrations/rybbit-analytics.md): Configure Rybbit Analytics with c15t v3, understand measurement permission and verify loading and revocation.
78
+ - [Segment](./docs/integrations/segment.md): Configure Segment with c15t v3, understand measurement permission and verify loading and revocation.
79
+ - [Snapchat Pixel](./docs/integrations/snapchat-pixel.md): Configure Snapchat Pixel with c15t v3, understand marketing permission and verify loading and revocation.
80
+ - [TikTok Pixel](./docs/integrations/tiktok-pixel.md): Configure TikTok Pixel with c15t v3, understand marketing permission and verify loading and revocation.
81
+ - [Umami Analytics](./docs/integrations/umami-analytics.md): Configure Umami Analytics with c15t v3, understand measurement permission and verify loading and revocation.
82
+ - [Vercel Analytics](./docs/integrations/vercel-analytics.md): Configure Vercel Analytics with c15t v3, understand measurement permission and verify loading and revocation.
83
+ - [X Pixel](./docs/integrations/x-pixel.md): Configure X Pixel with c15t v3, understand marketing permission and verify loading and revocation.
84
+ - [YouTube](./docs/integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
57
85
 
58
86
  ## Reference
59
87
 
60
- Concepts, legal templates, open-source policies, and contributor documentation.
61
-
62
- - [Script Loader](./docs/shared/react/guides/script-loader.md): Reference page for script loader.
88
+ - [Upgrade to v3 policies](./docs/upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  <a href="https://github.com/c15t/c15t/blob/main/LICENSE.md"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/c15t/c15t/license.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/github/c15t/c15t/license.svg?variant=outline&mode=light" alt="License"></picture></a>
16
16
  <a href="https://c15t.link/discord"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/discord/1312171102268690493.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/discord/1312171102268690493.svg?variant=outline&mode=light" alt="Discord"></picture></a>
17
17
  <a href="https://skills.sh/c15t/skills/c15t"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/skills/c15t/skills/c15t.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/skills/c15t/skills/c15t.svg?variant=outline&mode=light" alt="Skills"></picture></a>
18
- <a href="https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fscripts"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&color=ffc803&labelTextColor=000000&valueColor=000000&mode=dark"><img src="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&color=ffc803&labelTextColor=000000&valueColor=000000&mode=light" alt="Made by Inth"></picture></a>
18
+ <a href="https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fscripts"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=dark"><img src="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=light" alt="Made by Inth"></picture></a>
19
19
  </p>
20
20
 
21
21
  Consent-aware script integrations for Google Tag Manager, Google Consent Mode v2, GA4, Google Ads, Meta Pixel, analytics tools, pixels, tag managers, and widgets.
@@ -28,7 +28,7 @@ Consent-aware script integrations for Google Tag Manager, Google Consent Mode v2
28
28
  - Consent-gated Meta Pixel and conversion pixel loading
29
29
  - Easy integration with c15t's script loader
30
30
  - Configuration options for each supported vendor
31
- - Supported vendors include Google Tag Manager, Meta Pixel, Amplitude, Heap, PostHog, TikTok Pixel, LinkedIn Insights, Microsoft UET, X Pixel, Reddit Pixel, Snapchat Pixel, Intercom, Crisp, and more
31
+ - Supported vendors include Google Tag Manager, Meta Pixel, OpenAI Pixel, Amplitude, Heap, PostHog, TikTok Pixel, LinkedIn Insights, Microsoft UET, X Pixel, Reddit Pixel, Snapchat Pixel, Intercom, Crisp, and more
32
32
 
33
33
  ## Documentation
34
34
 
@@ -38,7 +38,7 @@ For further information, guides, and examples visit the [reference documentation
38
38
 
39
39
  - **Google Tag Manager**: Loads with Google Consent Mode v2 defaults set to denied; GTM-managed tags fire only once matching consent is granted ([guide](https://c15t.com/docs/integrations/google-tag-manager))
40
40
  - **Google Analytics 4 + Google Ads (gtag.js)**: Consent Mode v2 defaults and consent updates when users make a choice ([guide](https://c15t.com/docs/integrations/google-tag))
41
- - **Conversion pixels**: Meta Pixel, TikTok Pixel, LinkedIn Insights, Microsoft UET (Microsoft Ads), X Pixel, Reddit Pixel, Snapchat Pixel
41
+ - **Conversion pixels**: Meta Pixel, OpenAI Pixel, TikTok Pixel, LinkedIn Insights, Microsoft UET (Microsoft Ads), X Pixel, Reddit Pixel, Snapchat Pixel
42
42
  - **Analytics**: PostHog, Amplitude, Heap, Segment, RudderStack, Hightouch, Mixpanel, Microsoft Clarity, Hotjar, Plausible, Fathom, Matomo, Umami, Vercel Analytics
43
43
  - **Chat widgets**: Intercom, Crisp
44
44
 
@@ -1,11 +1,46 @@
1
+ import { createConsentKernel } from "@c15t/core";
2
+ import { createScriptLoader } from "@c15t/core/modules/script-loader";
1
3
  import { afterEach, vi } from "vitest";
2
- import { clearAllScripts, loadScripts, updateScripts } from "../../core/src/libs/script-loader";
4
+ let kernel = createConsentKernel();
5
+ let loader = null;
6
+ const e2e_test_utils_muteSubscription = function(source) {
7
+ return {
8
+ ...source,
9
+ subscribe: ()=>()=>{}
10
+ };
11
+ };
12
+ const e2e_test_utils_reconcileScripts = function(scripts, consents) {
13
+ const before = loader ? loader.getLoadedScriptIds() : [];
14
+ kernel.commands.save(consents);
15
+ if (loader) loader.updateScripts(scripts);
16
+ else loader = createScriptLoader({
17
+ kernel: e2e_test_utils_muteSubscription(kernel),
18
+ scripts
19
+ });
20
+ const after = loader.getLoadedScriptIds();
21
+ return {
22
+ loaded: after.filter((id)=>!before.includes(id)),
23
+ unloaded: before.filter((id)=>!after.includes(id))
24
+ };
25
+ };
26
+ const e2e_test_utils_loadScripts = function(scripts, consents) {
27
+ return e2e_test_utils_reconcileScripts(scripts, consents).loaded;
28
+ };
29
+ const e2e_test_utils_updateScripts = function(scripts, consents) {
30
+ return e2e_test_utils_reconcileScripts(scripts, consents);
31
+ };
32
+ const e2e_test_utils_clearAllScripts = function() {
33
+ loader?.dispose();
34
+ loader = null;
35
+ kernel.dispose();
36
+ kernel = createConsentKernel();
37
+ };
3
38
  const deniedConsents = {
4
- necessary: true,
39
+ experience: false,
5
40
  functionality: false,
6
- measurement: false,
7
41
  marketing: false,
8
- experience: false
42
+ measurement: false,
43
+ necessary: true
9
44
  };
10
45
  const grantedMeasurementConsents = {
11
46
  ...deniedConsents,
@@ -15,27 +50,27 @@ const grantedMarketingConsents = {
15
50
  ...deniedConsents,
16
51
  marketing: true
17
52
  };
18
- function isArgumentsPayload(value) {
53
+ const e2e_test_utils_isArgumentsPayload = function(value) {
19
54
  return '[object Arguments]' === Object.prototype.toString.call(value);
20
- }
21
- function toArgs(value) {
55
+ };
56
+ const e2e_test_utils_toArgs = function(value) {
22
57
  return Array.from(value);
23
- }
24
- function installAppendProbe(target, onAppend) {
58
+ };
59
+ const e2e_test_utils_installAppendProbe = function(target, onAppend) {
25
60
  const originalAppendChild = target.appendChild.bind(target);
26
61
  return vi.spyOn(target, 'appendChild').mockImplementation((node)=>{
27
62
  const appended = originalAppendChild(node);
28
63
  if (node instanceof HTMLScriptElement) onAppend(node, window);
29
64
  return appended;
30
65
  });
31
- }
32
- function installHeadProbe(onAppend) {
33
- return installAppendProbe(document.head, onAppend);
34
- }
35
- function installBodyProbe(onAppend) {
36
- return installAppendProbe(document.body, onAppend);
37
- }
38
- function resetVendorGlobals() {
66
+ };
67
+ const e2e_test_utils_installHeadProbe = function(onAppend) {
68
+ return e2e_test_utils_installAppendProbe(document.head, onAppend);
69
+ };
70
+ const e2e_test_utils_installBodyProbe = function(onAppend) {
71
+ return e2e_test_utils_installAppendProbe(document.body, onAppend);
72
+ };
73
+ const e2e_test_utils_resetVendorGlobals = function() {
39
74
  const win = window;
40
75
  for (const key of [
41
76
  'TiktokAnalyticsObject',
@@ -78,6 +113,7 @@ function resetVendorGlobals() {
78
113
  'plausible',
79
114
  'posthog',
80
115
  'rdt',
116
+ 'oaiq',
81
117
  'rudderanalytics',
82
118
  'rudderAnalyticsBuildType',
83
119
  'RudderSnippetVersion',
@@ -87,15 +123,15 @@ function resetVendorGlobals() {
87
123
  'uetq',
88
124
  'va',
89
125
  'vaq'
90
- ])delete win[key];
91
- }
92
- function registerVendorContractCleanup() {
126
+ ])Reflect.deleteProperty(win, key);
127
+ };
128
+ const e2e_test_utils_registerVendorContractCleanup = function() {
93
129
  afterEach(()=>{
94
- clearAllScripts();
130
+ e2e_test_utils_clearAllScripts();
95
131
  vi.restoreAllMocks();
96
132
  document.head.innerHTML = '';
97
133
  document.body.innerHTML = '';
98
- resetVendorGlobals();
134
+ e2e_test_utils_resetVendorGlobals();
99
135
  });
100
- }
101
- export { deniedConsents, grantedMarketingConsents, grantedMeasurementConsents, installBodyProbe, installHeadProbe, isArgumentsPayload, loadScripts, registerVendorContractCleanup, toArgs, updateScripts };
136
+ };
137
+ export { deniedConsents, e2e_test_utils_clearAllScripts as clearAllScripts, e2e_test_utils_installBodyProbe as installBodyProbe, e2e_test_utils_installHeadProbe as installHeadProbe, e2e_test_utils_isArgumentsPayload as isArgumentsPayload, e2e_test_utils_loadScripts as loadScripts, e2e_test_utils_registerVendorContractCleanup as registerVendorContractCleanup, e2e_test_utils_toArgs as toArgs, e2e_test_utils_updateScripts as updateScripts, grantedMarketingConsents, grantedMeasurementConsents };
@@ -1,29 +1,29 @@
1
1
  import { VENDOR_MANIFEST_KIND, VENDOR_MANIFEST_SCHEMA_VERSION } from "../types.js";
2
- const EXACT_PLACEHOLDER_PATTERN = /^\{\{([A-Za-z0-9_]+)\}\}$/;
3
- const PLACEHOLDER_PATTERN = /\{\{([A-Za-z0-9_]+)\}\}/g;
4
- function getConfigValue(config, key) {
2
+ const EXACT_PLACEHOLDER_PATTERN = /^\{\{(?<capture1>[A-Za-z0-9_]+)\}\}$/u;
3
+ const PLACEHOLDER_PATTERN = /\{\{(?<capture1>[A-Za-z0-9_]+)\}\}/gu;
4
+ const compile_getConfigValue = function(config, key) {
5
5
  if (!(key in config)) throw new Error(`Missing manifest interpolation value for '${key}'.`);
6
6
  const value = config[key];
7
7
  if ('function' == typeof value) throw new Error(`Manifest interpolation value for '${key}' must be serializable.`);
8
8
  return value;
9
- }
10
- function stringifyInterpolatedValue(value, key) {
9
+ };
10
+ const compile_stringifyInterpolatedValue = function(value, key) {
11
11
  if (void 0 === value) throw new Error(`Missing manifest interpolation value for '${key}'.`);
12
12
  if ('string' == typeof value) return value;
13
13
  if (null === value) return 'null';
14
14
  if ('object' == typeof value) return JSON.stringify(value);
15
15
  return String(value);
16
- }
17
- function interpolateString(template, config) {
16
+ };
17
+ const compile_interpolateString = function(template, config) {
18
18
  const exactMatch = template.match(EXACT_PLACEHOLDER_PATTERN);
19
- if (exactMatch) return getConfigValue(config, exactMatch[1]);
19
+ if (exactMatch) return compile_getConfigValue(config, exactMatch[1]);
20
20
  return template.replace(PLACEHOLDER_PATTERN, (_match, key)=>{
21
- const value = getConfigValue(config, key);
22
- return stringifyInterpolatedValue(value, key);
21
+ const value = compile_getConfigValue(config, key);
22
+ return compile_stringifyInterpolatedValue(value, key);
23
23
  });
24
- }
25
- function interpolateValue(value, config) {
26
- if ('string' == typeof value) return interpolateString(value, config);
24
+ };
25
+ const compile_interpolateValue = function interpolateValue(value, config) {
26
+ if ('string' == typeof value) return compile_interpolateString(value, config);
27
27
  if (Array.isArray(value)) return value.map((item)=>interpolateValue(item, config));
28
28
  if (null !== value && 'object' == typeof value) {
29
29
  const result = {};
@@ -34,12 +34,12 @@ function interpolateValue(value, config) {
34
34
  return result;
35
35
  }
36
36
  return value;
37
- }
38
- function interpolateSteps(steps, config) {
37
+ };
38
+ const compile_interpolateSteps = function(steps, config) {
39
39
  if (!steps) return [];
40
- return steps.map((step)=>interpolateValue(step, config));
41
- }
42
- function extractInstallArtifacts(install) {
40
+ return steps.map((step)=>compile_interpolateValue(step, config));
41
+ };
42
+ const compile_extractInstallArtifacts = function(install) {
43
43
  const loadScriptSteps = install.filter((step)=>'loadScript' === step.type);
44
44
  if (loadScriptSteps.length > 1) throw new Error('Vendor manifests may only declare a single loadScript step in install.');
45
45
  if (1 === loadScriptSteps.length) {
@@ -53,37 +53,37 @@ function extractInstallArtifacts(install) {
53
53
  return {
54
54
  setupSteps: install
55
55
  };
56
- }
57
- function validateManifestContract(manifest) {
56
+ };
57
+ const compile_validateManifestContract = function(manifest) {
58
58
  if (manifest.kind !== VENDOR_MANIFEST_KIND) throw new Error(`Unsupported manifest kind '${String(manifest.kind)}'. Expected '${VENDOR_MANIFEST_KIND}'.`);
59
59
  if (manifest.schemaVersion !== VENDOR_MANIFEST_SCHEMA_VERSION) throw new Error(`Unsupported manifest schema version '${String(manifest.schemaVersion)}'. Expected '${VENDOR_MANIFEST_SCHEMA_VERSION}'.`);
60
- }
61
- function compileManifest(manifest, config = {}) {
62
- validateManifestContract(manifest);
63
- const bootstrapSteps = interpolateSteps(manifest.bootstrap, config);
64
- const install = interpolateSteps(manifest.install, config);
65
- const { loadScript, setupSteps } = extractInstallArtifacts(install);
60
+ };
61
+ const compile_compileManifest = function(manifest, config = {}) {
62
+ compile_validateManifestContract(manifest);
63
+ const bootstrapSteps = compile_interpolateSteps(manifest.bootstrap, config);
64
+ const install = compile_interpolateSteps(manifest.install, config);
65
+ const { loadScript, setupSteps } = compile_extractInstallArtifacts(install);
66
66
  return {
67
+ afterLoadSteps: compile_interpolateSteps(manifest.afterLoad, config),
68
+ alwaysLoad: void 0 === manifest.alwaysLoad ? void 0 : compile_interpolateValue(manifest.alwaysLoad, config),
69
+ bootstrapSteps,
70
+ category: compile_interpolateValue(manifest.category, config),
71
+ consentMapping: manifest.consentMapping ? compile_interpolateValue(manifest.consentMapping, config) : void 0,
72
+ consentSignal: manifest.consentSignal,
73
+ consentSignalTarget: 'string' == typeof manifest.consentSignalTarget ? compile_interpolateValue(manifest.consentSignalTarget, config) : manifest.consentSignalTarget,
67
74
  kind: manifest.kind,
75
+ loadScript,
76
+ onBeforeLoadDeniedSteps: compile_interpolateSteps(manifest.onBeforeLoadDenied, config),
77
+ onBeforeLoadGrantedSteps: compile_interpolateSteps(manifest.onBeforeLoadGranted, config),
78
+ onConsentChangeSteps: compile_interpolateSteps(manifest.onConsentChange, config),
79
+ onConsentDeniedSteps: compile_interpolateSteps(manifest.onConsentDenied, config),
80
+ onConsentGrantedSteps: compile_interpolateSteps(manifest.onConsentGranted, config),
81
+ onLoadDeniedSteps: compile_interpolateSteps(manifest.onLoadDenied, config),
82
+ onLoadGrantedSteps: compile_interpolateSteps(manifest.onLoadGranted, config),
83
+ persistAfterConsentRevoked: void 0 === manifest.persistAfterConsentRevoked ? void 0 : compile_interpolateValue(manifest.persistAfterConsentRevoked, config),
68
84
  schemaVersion: manifest.schemaVersion,
69
- vendor: manifest.vendor,
70
- category: interpolateValue(manifest.category, config),
71
- alwaysLoad: void 0 === manifest.alwaysLoad ? void 0 : interpolateValue(manifest.alwaysLoad, config),
72
- persistAfterConsentRevoked: void 0 === manifest.persistAfterConsentRevoked ? void 0 : interpolateValue(manifest.persistAfterConsentRevoked, config),
73
- bootstrapSteps,
74
85
  setupSteps,
75
- loadScript,
76
- afterLoadSteps: interpolateSteps(manifest.afterLoad, config),
77
- onBeforeLoadGrantedSteps: interpolateSteps(manifest.onBeforeLoadGranted, config),
78
- onBeforeLoadDeniedSteps: interpolateSteps(manifest.onBeforeLoadDenied, config),
79
- onLoadGrantedSteps: interpolateSteps(manifest.onLoadGranted, config),
80
- onLoadDeniedSteps: interpolateSteps(manifest.onLoadDenied, config),
81
- onConsentChangeSteps: interpolateSteps(manifest.onConsentChange, config),
82
- onConsentGrantedSteps: interpolateSteps(manifest.onConsentGranted, config),
83
- onConsentDeniedSteps: interpolateSteps(manifest.onConsentDenied, config),
84
- consentMapping: manifest.consentMapping ? interpolateValue(manifest.consentMapping, config) : void 0,
85
- consentSignal: manifest.consentSignal,
86
- consentSignalTarget: 'string' == typeof manifest.consentSignalTarget ? interpolateValue(manifest.consentSignalTarget, config) : manifest.consentSignalTarget
86
+ vendor: manifest.vendor
87
87
  };
88
- }
89
- export { compileManifest, interpolateValue };
88
+ };
89
+ export { compile_compileManifest as compileManifest, compile_interpolateValue as interpolateValue };