@c15t/react 3.0.0-alpha.9 → 3.0.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 (147) hide show
  1. package/AGENTS.md +7 -9
  2. package/README.md +41 -70
  3. package/SKILL.md +1 -1
  4. package/dist/aggregate-components.js +1 -1
  5. package/dist/components/consent-gate/atoms.js +1 -1
  6. package/dist/components/consent-gate/frame.js +2 -0
  7. package/dist/components/consent-gate/index.js +1 -1
  8. package/dist/components/iab-panel/atoms/root.js +1 -1
  9. package/dist/components/iab-panel/iab-panel.js +1 -1
  10. package/dist/components/iab-prompt/atoms/root.js +1 -1
  11. package/dist/components/iab-prompt/iab-prompt.js +1 -1
  12. package/dist/components/panel/atoms/root.js +1 -1
  13. package/dist/components/panel-trigger/atoms/root.js +1 -1
  14. package/dist/components/panel-trigger/panel-trigger.js +1 -1
  15. package/dist/components/panel-trigger/toolbar-loader.js +2 -0
  16. package/dist/components/preferences/atoms/root.js +1 -1
  17. package/dist/components/prompt/atoms/early-tap-script.js +2 -0
  18. package/dist/components/prompt/atoms/root.js +1 -1
  19. package/dist/components/shared/primitives/button.js +1 -1
  20. package/dist/components/shared/surface-styles.js +1 -1
  21. package/dist/consent-gate.js +1 -1
  22. package/dist/context/index.js +1 -1
  23. package/dist/devtools.js +1 -1
  24. package/dist/iab/styles.tw3.css +2 -2
  25. package/dist/iab-dialog-deferred.js +2 -0
  26. package/dist/iab.js +1 -1
  27. package/dist/index-parts/consent-gate.js +1 -1
  28. package/dist/index-parts/core.js +1 -1
  29. package/dist/index-parts/frame.js +1 -0
  30. package/dist/index-parts/hosted.js +1 -0
  31. package/dist/index-parts/offline.js +1 -0
  32. package/dist/index-parts/presets.js +1 -0
  33. package/dist/index.js +1 -1
  34. package/dist/modes.js +1 -0
  35. package/dist/panel-link.js +1 -1
  36. package/dist/panel-trigger.js +1 -1
  37. package/dist/provider.js +1 -1
  38. package/dist/styles.tw3.css +2 -2
  39. package/dist/transports/hosted.js +1 -0
  40. package/dist/transports/manifest.js +1 -0
  41. package/dist/utils/deferred-module.js +1 -1
  42. package/dist/version.js +1 -1
  43. package/dist-types/chunk-warming.d.ts +7 -6
  44. package/dist-types/components/consent-gate/frame.d.ts +19 -0
  45. package/dist-types/components/consent-gate/index.d.ts +3 -19
  46. package/dist-types/components/iab-prompt/iab-prompt.d.ts +1 -1
  47. package/dist-types/components/panel/index.d.ts +1 -1
  48. package/dist-types/components/panel-trigger/toolbar-loader.d.ts +34 -0
  49. package/dist-types/components/preferences/index.d.ts +1 -1
  50. package/dist-types/components/prompt/atoms/early-tap-script.d.ts +17 -0
  51. package/dist-types/components/prompt/index.d.ts +1 -1
  52. package/dist-types/components/shared/surface-styles.d.ts +26 -2
  53. package/dist-types/consent-gate.d.ts +1 -1
  54. package/dist-types/context/index.d.ts +3 -3
  55. package/dist-types/context.d.ts +2 -0
  56. package/dist-types/gpp.d.ts +1 -1
  57. package/dist-types/iab-dialog-deferred.d.ts +36 -0
  58. package/dist-types/iab.d.ts +3 -2
  59. package/dist-types/index-parts/consent-gate.d.ts +1 -1
  60. package/dist-types/index-parts/core.d.ts +1 -2
  61. package/dist-types/index-parts/frame.d.ts +7 -0
  62. package/dist-types/index-parts/hosted.d.ts +7 -0
  63. package/dist-types/index-parts/offline.d.ts +7 -0
  64. package/dist-types/index-parts/presets.d.ts +7 -0
  65. package/dist-types/index.d.ts +5 -1
  66. package/dist-types/modes.d.ts +26 -0
  67. package/dist-types/panel-link.d.ts +1 -1
  68. package/dist-types/panel-trigger.d.ts +1 -1
  69. package/dist-types/provider.d.ts +3 -3
  70. package/dist-types/transports/hosted.d.ts +36 -0
  71. package/dist-types/transports/manifest.d.ts +48 -0
  72. package/dist-types/version.d.ts +1 -1
  73. package/docs/README.md +7 -9
  74. package/docs/concepts/choose-your-setup.md +45 -10
  75. package/docs/concepts/consent-categories.md +1 -1
  76. package/docs/concepts/consent-state.md +5 -2
  77. package/docs/concepts/data-fetching.md +100 -42
  78. package/docs/concepts/modes.md +281 -0
  79. package/docs/customization/dark-mode.md +1 -1
  80. package/docs/customization/motion.md +2 -2
  81. package/docs/customization/recipes.md +4 -4
  82. package/docs/customization/slots.md +25 -25
  83. package/docs/customization/stylesheets.md +12 -14
  84. package/docs/customization/tailwind.md +17 -11
  85. package/docs/customization/tokens.md +36 -7
  86. package/docs/frameworks/react/components/consent-banner.md +14 -10
  87. package/docs/frameworks/react/components/consent-dialog.md +14 -10
  88. package/docs/frameworks/react/components/consent-provider.md +51 -44
  89. package/docs/frameworks/react/components.md +14 -10
  90. package/docs/frameworks/react/content-security-policy.md +21 -12
  91. package/docs/frameworks/react/hooks.md +2 -2
  92. package/docs/frameworks/react/iab.md +20 -2
  93. package/docs/frameworks/react/quickstart.md +63 -97
  94. package/docs/frameworks/react/rendering.md +168 -94
  95. package/docs/frameworks/react/scripts.md +19 -28
  96. package/docs/frameworks/react/troubleshooting.md +57 -25
  97. package/docs/frameworks/react/upgrade-v3.md +110 -62
  98. package/docs/guides/banner-experiments.md +21 -6
  99. package/docs/guides/troubleshooting.md +89 -25
  100. package/docs/guides/verify-consent.md +23 -8
  101. package/docs/integrations/adobe-analytics.md +60 -64
  102. package/docs/integrations/ahrefs-analytics.md +58 -63
  103. package/docs/integrations/amplitude.md +60 -64
  104. package/docs/integrations/clearbit.md +59 -63
  105. package/docs/integrations/cloudflare-web-analytics.md +56 -60
  106. package/docs/integrations/cloudflare-zaraz.md +55 -57
  107. package/docs/integrations/crisp.md +64 -69
  108. package/docs/integrations/databuddy.md +62 -64
  109. package/docs/integrations/fathom-analytics.md +56 -60
  110. package/docs/integrations/front-chat.md +56 -60
  111. package/docs/integrations/google-maps.md +25 -13
  112. package/docs/integrations/google-tag-manager.md +153 -77
  113. package/docs/integrations/google-tag.md +134 -78
  114. package/docs/integrations/heap.md +56 -60
  115. package/docs/integrations/hightouch.md +55 -60
  116. package/docs/integrations/hotjar.md +60 -64
  117. package/docs/integrations/intercom.md +55 -60
  118. package/docs/integrations/klaviyo.md +65 -66
  119. package/docs/integrations/linkedin-insights.md +58 -63
  120. package/docs/integrations/logrocket.md +55 -60
  121. package/docs/integrations/matomo-analytics.md +58 -60
  122. package/docs/integrations/meta-pixel.md +56 -60
  123. package/docs/integrations/microsoft-clarity.md +57 -60
  124. package/docs/integrations/microsoft-uet.md +58 -61
  125. package/docs/integrations/mixpanel-analytics.md +73 -75
  126. package/docs/integrations/one-dollar-stats.md +53 -59
  127. package/docs/integrations/openai-pixel.md +58 -60
  128. package/docs/integrations/overview.md +59 -42
  129. package/docs/integrations/pinterest-tag.md +56 -60
  130. package/docs/integrations/pirsch.md +54 -60
  131. package/docs/integrations/plausible-analytics.md +55 -60
  132. package/docs/integrations/posthog.md +56 -60
  133. package/docs/integrations/promptwatch.md +57 -63
  134. package/docs/integrations/reddit-pixel.md +57 -60
  135. package/docs/integrations/rudderstack.md +65 -67
  136. package/docs/integrations/rybbit-analytics.md +70 -75
  137. package/docs/integrations/segment.md +56 -60
  138. package/docs/integrations/sentry.md +65 -60
  139. package/docs/integrations/snapchat-pixel.md +54 -60
  140. package/docs/integrations/tiktok-pixel.md +59 -63
  141. package/docs/integrations/umami-analytics.md +54 -60
  142. package/docs/integrations/vercel-analytics.md +53 -59
  143. package/docs/integrations/vercel-speed-insights.md +317 -0
  144. package/docs/integrations/x-pixel.md +57 -63
  145. package/docs/integrations/youtube.md +25 -13
  146. package/package.json +18 -8
  147. package/docs/upgrade-v3.md +0 -429
@@ -2,22 +2,31 @@
2
2
  title: Intercom
3
3
  description: Load the Intercom messenger only after functionality consent with
4
4
  the c15t intercom helper, set its region and check it in DevTools.
5
+ seoTitle: Intercom cookie consent with c15t
6
+ seoDescription: Show the Intercom Messenger only with functionality consent. Set
7
+ it up with the c15t intercom helper and its regional API settings.
5
8
  icon: intercom
6
9
  group: integrations
7
10
  ---
8
11
 
12
+ The c15t `intercom` helper keeps the Intercom Messenger off the page until
13
+ `functionality` has consent. Until then, c15t does not define `window.Intercom`
14
+ or `window.intercomSettings`. If the visitor withdraws consent, the helper does
15
+ not call an Intercom API, such as `shutdown`. The Messenger continues to work
16
+ until c15t reloads the page, which c15t does by default.
17
+
9
18
  ## Configure Intercom
10
19
 
11
20
  Copy the app ID from your Intercom installation snippet, where it is set as
12
21
  `app_id`. If your workspace is hosted in the EU or Australia, also set
13
22
  `apiBase`.
14
23
 
15
- | Package manager | Command |
16
- | :-------------- | :------------------------------------- |
17
- | npm | `npm install @c15t/integrations@alpha` |
18
- | pnpm | `pnpm add @c15t/integrations@alpha` |
19
- | yarn | `yarn add @c15t/integrations@alpha` |
20
- | bun | `bun add @c15t/integrations@alpha` |
24
+ | Package manager | Command |
25
+ | :-------------- | :------------------------------- |
26
+ | npm | `npm install @c15t/integrations` |
27
+ | pnpm | `pnpm add @c15t/integrations` |
28
+ | yarn | `yarn add @c15t/integrations` |
29
+ | bun | `bun add @c15t/integrations` |
21
30
 
22
31
  ```ts title="src/consent-scripts.ts"
23
32
  import { intercom } from '@c15t/integrations/intercom';
@@ -32,51 +41,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
32
41
  SDK initializer or tag-manager entry, so the vendor loads only through c15t.
33
42
 
34
43
  The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
35
- quickstart already created a scripts file, such as `lib/scripts.ts` in the
36
- Next.js guide, add the helper to that array instead of creating a second file.
44
+ quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
45
+ in the Next.js guide, add the helper to that array instead of creating a
46
+ second file.
37
47
  The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
38
48
  point for your framework below. These are edits to that provider, not a second
39
49
  provider.
40
50
 
41
51
  **Next.js**
42
52
 
43
- Import the configuration into the client boundary from your router guide:
44
-
45
- ```ts
46
- import { ConsentRoot } from 'c15t/next';
47
- import { scripts } from './consent-scripts';
48
- ```
53
+ Add the configuration to `scripts` in `c15t.config.ts`, next to
54
+ `next.config.ts`:
49
55
 
50
- Keep the server-resolved `state` and shared `consentConfig` from your
51
- router guide. Its manifest, init and save URLs stay in effect. Add
52
- `scripts` as a top-level prop on the existing root:
56
+ ```ts title="c15t.config.ts"
57
+ import { defineConsentConfig } from 'c15t/next';
58
+ import { scripts } from './src/consent-scripts';
53
59
 
54
- ```tsx
55
- <ConsentRoot state={state} config={consentConfig} scripts={scripts}>
56
- {children}
57
- </ConsentRoot>
60
+ export default defineConsentConfig({ scripts });
58
61
  ```
59
62
 
60
- App Router, Pages Router and static export all use this `ConsentRoot` in
61
- the `'use client'` wrapper `components/consent.tsx`. Keep `scripts` there,
62
- because a Server Component cannot pass script callbacks to it. See
63
+ Keep the rest of your config, such as `mode` and `routePrefix`, in the
64
+ same call. `ConsentRoot` reads the config in the browser, so the layout
65
+ keeps passing only `state`. App Router, Pages Router and static export all
66
+ read the same file. See
63
67
  [Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
64
68
 
65
69
  **TanStack Start**
66
70
 
67
71
  Import the configuration into your root route and pass it to the existing
68
- `ConsentRoot` as a top-level prop. Keep the loader, `backendURL` and
69
- `initRoute` from the [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
72
+ `ConsentRoot` as a top-level prop. Keep the loader from the
73
+ [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
70
74
 
71
75
  ```tsx title="src/routes/__root.tsx"
72
76
  import { scripts } from '../consent-scripts';
73
77
 
74
- <ConsentRoot
75
- state={consent}
76
- backendURL={backendURL}
77
- initRoute={false}
78
- scripts={scripts}
79
- >
78
+ <ConsentRoot state={consent} scripts={scripts}>
80
79
  ```
81
80
 
82
81
  Import vendor helpers in the root route module, not in a server function.
@@ -95,8 +94,8 @@ import { scripts } from './consent-scripts';
95
94
  <ConsentProvider options={{ mode, scripts }}>
96
95
  ```
97
96
 
98
- `mode` is the `hosted({ url: 'https://your-project.inth.app' })` value
99
- from the [React quickstart](../frameworks/react/quickstart.md). Keep the banner,
97
+ `mode` is the `manifest()` value from the
98
+ [React quickstart](../frameworks/react/quickstart.md). Keep the banner,
100
99
  dialog and preferences link inside the provider. See
101
100
  [React scripts and embeds](../frameworks/react/scripts.md).
102
101
 
@@ -125,15 +124,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
125
124
  Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
126
125
 
127
126
  ```ts title="src/main.ts"
127
+ import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
128
128
  import { scripts } from './consent-scripts';
129
129
 
130
130
  app.use(c15tVue, {
131
- backendURL: 'https://your-project.inth.app',
131
+ mode: manifest(),
132
132
  scripts,
133
133
  });
134
134
  ```
135
135
 
136
- Keep your existing backend URL and other options. The plugin starts one
136
+ Keep your existing `mode` and other options. The plugin starts one
137
137
  script loader when the app mounts, after it has applied the visitor's stored
138
138
  choice. Do not also call `createScriptLoader` from a component. See
139
139
  [Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
@@ -141,12 +141,11 @@ choice. Do not also call `createScriptLoader` from a component. See
141
141
  **Astro**
142
142
 
143
143
  Add the scripts to the client entrypoint from the
144
- [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), the module that the
145
- integration's `clientEntrypoint` option names. Keep `mode`, `ui` and the
146
- framework integration in `astro.config.mjs` as they are. If the module
147
- already exports scripts, combine the two arrays.
144
+ [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
145
+ which the integration finds on its own. Keep `astro.config.mjs` as it is.
146
+ If the module already exports scripts, combine the two arrays.
148
147
 
149
- ```ts title="src/consent-client.ts"
148
+ ```ts title="src/c15t.client.ts"
150
149
  import type { C15tClientOptionsExtension } from 'c15t/astro';
151
150
  import { scripts } from './consent-scripts';
152
151
 
@@ -166,15 +165,13 @@ pass them as a top-level prop:
166
165
 
167
166
  ```svelte title="src/App.svelte"
168
167
  <script lang="ts">
169
- import { ConsentManagerProvider, hosted } from '@c15t/svelte';
168
+ import { ConsentProvider, manifest } from '@c15t/svelte';
170
169
  import { scripts } from './consent-scripts';
171
-
172
- const mode = hosted({ url: 'https://your-project.inth.app' });
173
170
  </script>
174
171
 
175
- <ConsentManagerProvider {mode} {scripts}>
172
+ <ConsentProvider mode={manifest()} {scripts}>
176
173
  <!-- Keep your application, consent UI and preferences link here. -->
177
- </ConsentManagerProvider>
174
+ </ConsentProvider>
178
175
  ```
179
176
 
180
177
  Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
@@ -182,22 +179,21 @@ The provider owns the loader and disposes it on unmount.
182
179
 
183
180
  **SvelteKit**
184
181
 
185
- Add the scripts to the existing root layout provider. Keep the server load
186
- and its serializable prefetch data from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
182
+ Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
183
+ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
187
184
 
188
185
  ```svelte title="src/routes/+layout.svelte"
189
186
  <script lang="ts">
190
- import { ConsentManagerProvider, hosted } from '@c15t/svelte';
187
+ import { ConsentRoot } from '@c15t/svelte';
191
188
  import { scripts } from '../consent-scripts';
192
189
 
193
190
  let { children, data } = $props();
194
- const mode = hosted({ url: 'https://your-project.inth.app' });
195
191
  </script>
196
192
 
197
- <ConsentManagerProvider {mode} {scripts} prefetch={data.prefetch}>
193
+ <ConsentRoot state={data.consent} {scripts}>
198
194
  {@render children()}
199
195
  <!-- Keep your consent UI and preferences link here. -->
200
- </ConsentManagerProvider>
196
+ </ConsentRoot>
201
197
  ```
202
198
 
203
199
  Import vendor helpers in the layout component, not in `+layout.server.ts`:
@@ -224,20 +220,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
224
220
 
225
221
  **JavaScript**
226
222
 
227
- Pass the scripts to `init()` from `@c15t/browser`, next to your backend
228
- URL:
223
+ Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
229
224
 
230
225
  ```ts
231
- import { init } from '@c15t/browser';
226
+ import { init, manifest } from '@c15t/browser';
232
227
  import { scripts } from './consent-scripts';
233
228
 
234
229
  const consent = init({
235
- backendURL: 'https://your-project.inth.app',
230
+ mode: manifest(),
236
231
  scripts,
237
232
  });
238
233
  ```
239
234
 
240
- Keep the backend URL from your quickstart. With
235
+ Keep the mode from your quickstart. With
241
236
  `createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
242
237
  A kernel you create yourself needs a loader from
243
238
  `c15t/modules/script-loader`. Attach one loader per kernel. See
@@ -247,7 +242,7 @@ A kernel you create yourself needs a loader from
247
242
 
248
243
  | Option | Default | Behavior |
249
244
  | ----------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
250
- | `appId` | Required | Sets `app_id` and the loader URL. The helper trims it. Empty or whitespace-only values throw. |
245
+ | `appId` | Required | Sets `app_id` and the loader URL. The helper trims it. Empty or whitespace-only values log an error and the script does not load. |
251
246
  | `apiBase` | `https://api-iam.intercom.io` | Regional API base. `INTERCOM_API_BASES` from `@c15t/integrations/intercom` lists `us`, `eu` and `au`. |
252
247
  | `settings` | None | Extra JSON-serializable settings merged into `window.intercomSettings`. `appId` and `apiBase` override any `app_id` or `api_base` here. |
253
248
  | `scriptSrc` | `https://widget.intercom.io/widget/<appId>` | Loader URL override. A blank value falls back to the default. |
@@ -308,8 +303,8 @@ permission before each of your own event calls. The reload does not delete
308
303
  cookies the vendor already set; see
309
304
  [clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
310
305
 
311
- The helper sets `vendor` to its script ID, so once you declare that vendor a
312
- visitor can turn it off inside an allowed category. See
306
+ The helper lists its vendor by name in the preference dialog, so a visitor can
307
+ turn it off inside an allowed category. See
313
308
  [vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
314
309
  [consent verification guide](../guides/verify-consent.md) covers navigation,
315
310
  expiry and hosting checks.
@@ -3,23 +3,36 @@ title: Klaviyo
3
3
  description: Load Klaviyo signup forms and onsite tracking only after marketing
4
4
  and measurement consent with the c15t klaviyo helper, gate your own events,
5
5
  and check it in DevTools.
6
+ seoTitle: Klaviyo cookie consent with c15t
7
+ seoDescription: Load Klaviyo only after marketing and measurement consent, or
8
+ show its signup forms with marketing consent only. Set it up with the c15t
9
+ klaviyo helper.
6
10
  icon: klaviyo
7
11
  group: integrations
8
12
  ---
9
13
 
14
+ The c15t `klaviyo` helper keeps Klaviyo.js off the page until both `marketing`
15
+ and `measurement` have consent. Klaviyo.js shows signup forms and also tracks
16
+ visitors on your site. Until then, c15t does not create the `klaviyo` object. If
17
+ the visitor withdraws consent, c15t removes the loader and, by default, reloads
18
+ the page. With `mode: 'forms-only'`, the helper needs only `marketing` and sets
19
+ the Klaviyo `__kla_off` opt-out cookie before the bundle runs. The `category`
20
+ option replaces the default consent condition.
21
+
10
22
  ## Configure Klaviyo
11
23
 
12
24
  Copy the six-character public API key, also called the site ID, from
13
25
  **Settings > Account > API keys** in Klaviyo. It appears in every page that
14
26
  loads Klaviyo, so it is safe in browser code. Never put a private key
15
- (`pk_...`) in the browser; the helper throws if you pass one.
27
+ (`pk_...`) in the browser. If you pass one, the helper logs an error and
28
+ Klaviyo does not load.
16
29
 
17
- | Package manager | Command |
18
- | :-------------- | :------------------------------------- |
19
- | npm | `npm install @c15t/integrations@alpha` |
20
- | pnpm | `pnpm add @c15t/integrations@alpha` |
21
- | yarn | `yarn add @c15t/integrations@alpha` |
22
- | bun | `bun add @c15t/integrations@alpha` |
30
+ | Package manager | Command |
31
+ | :-------------- | :------------------------------- |
32
+ | npm | `npm install @c15t/integrations` |
33
+ | pnpm | `pnpm add @c15t/integrations` |
34
+ | yarn | `yarn add @c15t/integrations` |
35
+ | bun | `bun add @c15t/integrations` |
23
36
 
24
37
  ```ts title="src/consent-scripts.ts"
25
38
  import { klaviyo } from '@c15t/integrations/klaviyo';
@@ -38,51 +51,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
38
51
  SDK initializer or tag-manager entry, so the vendor loads only through c15t.
39
52
 
40
53
  The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
41
- quickstart already created a scripts file, such as `lib/scripts.ts` in the
42
- Next.js guide, add the helper to that array instead of creating a second file.
54
+ quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
55
+ in the Next.js guide, add the helper to that array instead of creating a
56
+ second file.
43
57
  The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
44
58
  point for your framework below. These are edits to that provider, not a second
45
59
  provider.
46
60
 
47
61
  **Next.js**
48
62
 
49
- Import the configuration into the client boundary from your router guide:
50
-
51
- ```ts
52
- import { ConsentRoot } from 'c15t/next';
53
- import { scripts } from './consent-scripts';
54
- ```
63
+ Add the configuration to `scripts` in `c15t.config.ts`, next to
64
+ `next.config.ts`:
55
65
 
56
- Keep the server-resolved `state` and shared `consentConfig` from your
57
- router guide. Its manifest, init and save URLs stay in effect. Add
58
- `scripts` as a top-level prop on the existing root:
66
+ ```ts title="c15t.config.ts"
67
+ import { defineConsentConfig } from 'c15t/next';
68
+ import { scripts } from './src/consent-scripts';
59
69
 
60
- ```tsx
61
- <ConsentRoot state={state} config={consentConfig} scripts={scripts}>
62
- {children}
63
- </ConsentRoot>
70
+ export default defineConsentConfig({ scripts });
64
71
  ```
65
72
 
66
- App Router, Pages Router and static export all use this `ConsentRoot` in
67
- the `'use client'` wrapper `components/consent.tsx`. Keep `scripts` there,
68
- because a Server Component cannot pass script callbacks to it. See
73
+ Keep the rest of your config, such as `mode` and `routePrefix`, in the
74
+ same call. `ConsentRoot` reads the config in the browser, so the layout
75
+ keeps passing only `state`. App Router, Pages Router and static export all
76
+ read the same file. See
69
77
  [Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
70
78
 
71
79
  **TanStack Start**
72
80
 
73
81
  Import the configuration into your root route and pass it to the existing
74
- `ConsentRoot` as a top-level prop. Keep the loader, `backendURL` and
75
- `initRoute` from the [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
82
+ `ConsentRoot` as a top-level prop. Keep the loader from the
83
+ [TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
76
84
 
77
85
  ```tsx title="src/routes/__root.tsx"
78
86
  import { scripts } from '../consent-scripts';
79
87
 
80
- <ConsentRoot
81
- state={consent}
82
- backendURL={backendURL}
83
- initRoute={false}
84
- scripts={scripts}
85
- >
88
+ <ConsentRoot state={consent} scripts={scripts}>
86
89
  ```
87
90
 
88
91
  Import vendor helpers in the root route module, not in a server function.
@@ -101,8 +104,8 @@ import { scripts } from './consent-scripts';
101
104
  <ConsentProvider options={{ mode, scripts }}>
102
105
  ```
103
106
 
104
- `mode` is the `hosted({ url: 'https://your-project.inth.app' })` value
105
- from the [React quickstart](../frameworks/react/quickstart.md). Keep the banner,
107
+ `mode` is the `manifest()` value from the
108
+ [React quickstart](../frameworks/react/quickstart.md). Keep the banner,
106
109
  dialog and preferences link inside the provider. See
107
110
  [React scripts and embeds](../frameworks/react/scripts.md).
108
111
 
@@ -131,15 +134,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
131
134
  Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
132
135
 
133
136
  ```ts title="src/main.ts"
137
+ import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
134
138
  import { scripts } from './consent-scripts';
135
139
 
136
140
  app.use(c15tVue, {
137
- backendURL: 'https://your-project.inth.app',
141
+ mode: manifest(),
138
142
  scripts,
139
143
  });
140
144
  ```
141
145
 
142
- Keep your existing backend URL and other options. The plugin starts one
146
+ Keep your existing `mode` and other options. The plugin starts one
143
147
  script loader when the app mounts, after it has applied the visitor's stored
144
148
  choice. Do not also call `createScriptLoader` from a component. See
145
149
  [Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
@@ -147,12 +151,11 @@ choice. Do not also call `createScriptLoader` from a component. See
147
151
  **Astro**
148
152
 
149
153
  Add the scripts to the client entrypoint from the
150
- [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), the module that the
151
- integration's `clientEntrypoint` option names. Keep `mode`, `ui` and the
152
- framework integration in `astro.config.mjs` as they are. If the module
153
- already exports scripts, combine the two arrays.
154
+ [Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
155
+ which the integration finds on its own. Keep `astro.config.mjs` as it is.
156
+ If the module already exports scripts, combine the two arrays.
154
157
 
155
- ```ts title="src/consent-client.ts"
158
+ ```ts title="src/c15t.client.ts"
156
159
  import type { C15tClientOptionsExtension } from 'c15t/astro';
157
160
  import { scripts } from './consent-scripts';
158
161
 
@@ -172,15 +175,13 @@ pass them as a top-level prop:
172
175
 
173
176
  ```svelte title="src/App.svelte"
174
177
  <script lang="ts">
175
- import { ConsentManagerProvider, hosted } from '@c15t/svelte';
178
+ import { ConsentProvider, manifest } from '@c15t/svelte';
176
179
  import { scripts } from './consent-scripts';
177
-
178
- const mode = hosted({ url: 'https://your-project.inth.app' });
179
180
  </script>
180
181
 
181
- <ConsentManagerProvider {mode} {scripts}>
182
+ <ConsentProvider mode={manifest()} {scripts}>
182
183
  <!-- Keep your application, consent UI and preferences link here. -->
183
- </ConsentManagerProvider>
184
+ </ConsentProvider>
184
185
  ```
185
186
 
186
187
  Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
@@ -188,22 +189,21 @@ The provider owns the loader and disposes it on unmount.
188
189
 
189
190
  **SvelteKit**
190
191
 
191
- Add the scripts to the existing root layout provider. Keep the server load
192
- and its serializable prefetch data from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
192
+ Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
193
+ handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
193
194
 
194
195
  ```svelte title="src/routes/+layout.svelte"
195
196
  <script lang="ts">
196
- import { ConsentManagerProvider, hosted } from '@c15t/svelte';
197
+ import { ConsentRoot } from '@c15t/svelte';
197
198
  import { scripts } from '../consent-scripts';
198
199
 
199
200
  let { children, data } = $props();
200
- const mode = hosted({ url: 'https://your-project.inth.app' });
201
201
  </script>
202
202
 
203
- <ConsentManagerProvider {mode} {scripts} prefetch={data.prefetch}>
203
+ <ConsentRoot state={data.consent} {scripts}>
204
204
  {@render children()}
205
205
  <!-- Keep your consent UI and preferences link here. -->
206
- </ConsentManagerProvider>
206
+ </ConsentRoot>
207
207
  ```
208
208
 
209
209
  Import vendor helpers in the layout component, not in `+layout.server.ts`:
@@ -230,20 +230,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
230
230
 
231
231
  **JavaScript**
232
232
 
233
- Pass the scripts to `init()` from `@c15t/browser`, next to your backend
234
- URL:
233
+ Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
235
234
 
236
235
  ```ts
237
- import { init } from '@c15t/browser';
236
+ import { init, manifest } from '@c15t/browser';
238
237
  import { scripts } from './consent-scripts';
239
238
 
240
239
  const consent = init({
241
- backendURL: 'https://your-project.inth.app',
240
+ mode: manifest(),
242
241
  scripts,
243
242
  });
244
243
  ```
245
244
 
246
- Keep the backend URL from your quickstart. With
245
+ Keep the mode from your quickstart. With
247
246
  `createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
248
247
  A kernel you create yourself needs a loader from
249
248
  `c15t/modules/script-loader`. Attach one loader per kernel. See
@@ -251,12 +250,12 @@ A kernel you create yourself needs a loader from
251
250
 
252
251
  ## Options
253
252
 
254
- | Option | Default | Behavior |
255
- | -------------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
256
- | `publicApiKey` | Required | Six-letter-or-digit public API key. Surrounding whitespace is trimmed. Any other value throws, with a separate message for private keys. |
257
- | `mode` | `'full'` | `'full'` loads forms and web tracking. `'forms-only'` turns Klaviyo's web tracking off before the bundle starts; see [forms-only mode](#forms-only-mode). |
258
- | `category` | `{ and: ['marketing', 'measurement'] }`, or `'marketing'` in forms-only mode | Consent condition that must hold before Klaviyo.js loads. Accepts any category or `and`/`or`/`not` condition. |
259
- | `scriptUrl` | `https://static.klaviyo.com/onsite/js/<publicApiKey>/klaviyo.js` | Loader URL override, such as a first-party proxy. Must be `https:`. A blank value falls back to the default. |
253
+ | Option | Default | Behavior |
254
+ | -------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
255
+ | `publicApiKey` | Required | Six-letter-or-digit public API key. Surrounding whitespace is trimmed. Any other value, including a missing key, logs an error and the script does not load. Private keys get their own message. |
256
+ | `mode` | `'full'` | `'full'` loads forms and web tracking. `'forms-only'` turns Klaviyo's web tracking off before the bundle starts; see [forms-only mode](#forms-only-mode). |
257
+ | `category` | `{ and: ['marketing', 'measurement'] }`, or `'marketing'` in forms-only mode | Consent condition that must hold before Klaviyo.js loads. Accepts any category or `and`/`or`/`not` condition. |
258
+ | `scriptUrl` | `https://static.klaviyo.com/onsite/js/<publicApiKey>/klaviyo.js` | Loader URL override, such as a first-party proxy. Must be `https:`. A blank value falls back to the default. |
260
259
 
261
260
  ## Why Klaviyo needs two categories
262
261
 
@@ -479,8 +478,8 @@ permission before each of your own event calls. The reload does not delete
479
478
  cookies the vendor already set; see
480
479
  [clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
481
480
 
482
- The helper sets `vendor` to its script ID, so once you declare that vendor a
483
- visitor can turn it off inside an allowed category. See
481
+ The helper lists its vendor by name in the preference dialog, so a visitor can
482
+ turn it off inside an allowed category. See
484
483
  [vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
485
484
  [consent verification guide](../guides/verify-consent.md) covers navigation,
486
485
  expiry and hosting checks.