@c15t/svelte 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.
- package/AGENTS.md +88 -0
- package/README.md +136 -0
- package/SKILL.md +14 -0
- package/dist/actions/focus-trap.d.ts +8 -0
- package/dist/actions/focus-trap.js +23 -0
- package/dist/actions/portal.d.ts +8 -0
- package/dist/actions/portal.js +39 -0
- package/dist/actions/scroll-lock.d.ts +8 -0
- package/dist/actions/scroll-lock.js +23 -0
- package/dist/components/action-button.svelte +119 -0
- package/dist/components/action-button.svelte.d.ts +18 -0
- package/dist/components/branding.svelte +139 -0
- package/dist/components/branding.svelte.d.ts +13 -0
- package/dist/components/consent-dev-tools.svelte +58 -0
- package/dist/components/consent-dev-tools.svelte.d.ts +4 -0
- package/dist/components/frame.svelte +95 -0
- package/dist/components/frame.svelte.d.ts +12 -0
- package/dist/components/iab-panel.svelte +542 -0
- package/dist/components/iab-panel.svelte.d.ts +16 -0
- package/dist/components/iab-prompt.svelte +304 -0
- package/dist/components/iab-prompt.svelte.d.ts +14 -0
- package/dist/components/iab-purpose-item.svelte +511 -0
- package/dist/components/iab-purpose-item.svelte.d.ts +26 -0
- package/dist/components/iab-stack-item.svelte +146 -0
- package/dist/components/iab-stack-item.svelte.d.ts +19 -0
- package/dist/components/iab-vendor-list.svelte +900 -0
- package/dist/components/iab-vendor-list.svelte.d.ts +19 -0
- package/dist/components/icons/c15-t-icon-only.svelte +27 -0
- package/dist/components/icons/c15-t-icon-only.svelte.d.ts +9 -0
- package/dist/components/icons/chevron-down-icon.svelte +30 -0
- package/dist/components/icons/chevron-down-icon.svelte.d.ts +10 -0
- package/dist/components/icons/chevron-right-icon.svelte +36 -0
- package/dist/components/icons/chevron-right-icon.svelte.d.ts +12 -0
- package/dist/components/icons/close-icon.svelte +40 -0
- package/dist/components/icons/close-icon.svelte.d.ts +10 -0
- package/dist/components/icons/consent-icon-only.svelte +36 -0
- package/dist/components/icons/consent-icon-only.svelte.d.ts +9 -0
- package/dist/components/icons/external-link-icon.svelte +30 -0
- package/dist/components/icons/external-link-icon.svelte.d.ts +8 -0
- package/dist/components/icons/globe-icon.svelte +39 -0
- package/dist/components/icons/globe-icon.svelte.d.ts +9 -0
- package/dist/components/icons/info-icon.svelte +42 -0
- package/dist/components/icons/info-icon.svelte.d.ts +9 -0
- package/dist/components/icons/inth-logo.svelte +38 -0
- package/dist/components/icons/inth-logo.svelte.d.ts +9 -0
- package/dist/components/icons/layers-icon.svelte +25 -0
- package/dist/components/icons/layers-icon.svelte.d.ts +8 -0
- package/dist/components/icons/legitimate-interest-icon.svelte +29 -0
- package/dist/components/icons/legitimate-interest-icon.svelte.d.ts +10 -0
- package/dist/components/icons/lock-icon.svelte +31 -0
- package/dist/components/icons/lock-icon.svelte.d.ts +8 -0
- package/dist/components/icons/search-icon.svelte +33 -0
- package/dist/components/icons/search-icon.svelte.d.ts +8 -0
- package/dist/components/inline-legal-links.svelte +95 -0
- package/dist/components/inline-legal-links.svelte.d.ts +10 -0
- package/dist/components/manager-provider.svelte +459 -0
- package/dist/components/manager-provider.svelte.d.ts +27 -0
- package/dist/components/overlay.svelte +79 -0
- package/dist/components/overlay.svelte.d.ts +7 -0
- package/dist/components/panel-link.svelte +33 -0
- package/dist/components/panel-link.svelte.d.ts +10 -0
- package/dist/components/panel-trigger.svelte +237 -0
- package/dist/components/panel-trigger.svelte.d.ts +16 -0
- package/dist/components/panel.svelte +258 -0
- package/dist/components/panel.svelte.d.ts +22 -0
- package/dist/components/policy-actions-renderer.svelte +79 -0
- package/dist/components/policy-actions-renderer.svelte.d.ts +19 -0
- package/dist/components/preferences.svelte +320 -0
- package/dist/components/preferences.svelte.d.ts +8 -0
- package/dist/components/prompt.svelte +514 -0
- package/dist/components/prompt.svelte.d.ts +43 -0
- package/dist/context.svelte.d.ts +125 -0
- package/dist/context.svelte.js +354 -0
- package/dist/devtools-options.d.ts +7 -0
- package/dist/devtools-options.js +1 -0
- package/dist/devtools.d.ts +9 -0
- package/dist/devtools.js +7 -0
- package/dist/headless.d.ts +10 -0
- package/dist/headless.js +7 -0
- package/dist/iab/styles.css +11 -0
- package/dist/iab-loader.d.ts +30 -0
- package/dist/iab-loader.js +33 -0
- package/dist/iab-translations.d.ts +84 -0
- package/dist/iab-translations.js +45 -0
- package/dist/iab-types.d.ts +62 -0
- package/dist/iab-types.js +43 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +21 -0
- package/dist/kit/app.d.ts +35 -0
- package/dist/kit/handle.d.ts +34 -0
- package/dist/kit/handle.js +87 -0
- package/dist/kit/index.d.ts +30 -0
- package/dist/kit/index.js +5 -0
- package/dist/kit/load-consent.d.ts +57 -0
- package/dist/kit/load-consent.js +144 -0
- package/dist/kit/routes.d.ts +46 -0
- package/dist/kit/routes.js +203 -0
- package/dist/kit/types.d.ts +56 -0
- package/dist/kit/types.js +1 -0
- package/dist/primitives/accordion/accordion-item-content.svelte +35 -0
- package/dist/primitives/accordion/accordion-item-content.svelte.d.ts +9 -0
- package/dist/primitives/accordion/accordion-item-trigger.svelte +54 -0
- package/dist/primitives/accordion/accordion-item-trigger.svelte.d.ts +10 -0
- package/dist/primitives/accordion/accordion-item.svelte +61 -0
- package/dist/primitives/accordion/accordion-item.svelte.d.ts +11 -0
- package/dist/primitives/accordion/accordion-root.svelte +61 -0
- package/dist/primitives/accordion/accordion-root.svelte.d.ts +13 -0
- package/dist/primitives/accordion/context.d.ts +18 -0
- package/dist/primitives/accordion/context.js +23 -0
- package/dist/primitives/accordion/index.d.ts +29 -0
- package/dist/primitives/accordion/index.js +11 -0
- package/dist/primitives/collapsible/collapsible-content.svelte +36 -0
- package/dist/primitives/collapsible/collapsible-content.svelte.d.ts +9 -0
- package/dist/primitives/collapsible/collapsible-indicator.svelte +29 -0
- package/dist/primitives/collapsible/collapsible-indicator.svelte.d.ts +9 -0
- package/dist/primitives/collapsible/collapsible-root.svelte +70 -0
- package/dist/primitives/collapsible/collapsible-root.svelte.d.ts +11 -0
- package/dist/primitives/collapsible/collapsible-trigger.svelte +52 -0
- package/dist/primitives/collapsible/collapsible-trigger.svelte.d.ts +10 -0
- package/dist/primitives/collapsible/context.d.ts +10 -0
- package/dist/primitives/collapsible/context.js +12 -0
- package/dist/primitives/collapsible/index.d.ts +26 -0
- package/dist/primitives/collapsible/index.js +11 -0
- package/dist/primitives/dialog/context.d.ts +14 -0
- package/dist/primitives/dialog/context.js +12 -0
- package/dist/primitives/dialog/dialog-backdrop.svelte +39 -0
- package/dist/primitives/dialog/dialog-backdrop.svelte.d.ts +7 -0
- package/dist/primitives/dialog/dialog-close-trigger.svelte +48 -0
- package/dist/primitives/dialog/dialog-close-trigger.svelte.d.ts +11 -0
- package/dist/primitives/dialog/dialog-content.svelte +81 -0
- package/dist/primitives/dialog/dialog-content.svelte.d.ts +9 -0
- package/dist/primitives/dialog/dialog-description.svelte +28 -0
- package/dist/primitives/dialog/dialog-description.svelte.d.ts +9 -0
- package/dist/primitives/dialog/dialog-positioner.svelte +33 -0
- package/dist/primitives/dialog/dialog-positioner.svelte.d.ts +9 -0
- package/dist/primitives/dialog/dialog-root.svelte +117 -0
- package/dist/primitives/dialog/dialog-root.svelte.d.ts +14 -0
- package/dist/primitives/dialog/dialog-title.svelte +28 -0
- package/dist/primitives/dialog/dialog-title.svelte.d.ts +9 -0
- package/dist/primitives/dialog/index.d.ts +50 -0
- package/dist/primitives/dialog/index.js +19 -0
- package/dist/primitives/index.d.ts +7 -0
- package/dist/primitives/index.js +7 -0
- package/dist/primitives/portal/index.d.ts +4 -0
- package/dist/primitives/portal/index.js +2 -0
- package/dist/primitives/portal/portal.svelte +23 -0
- package/dist/primitives/portal/portal.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/context.d.ts +11 -0
- package/dist/primitives/preference-item/context.js +12 -0
- package/dist/primitives/preference-item/index.d.ts +54 -0
- package/dist/primitives/preference-item/index.js +21 -0
- package/dist/primitives/preference-item/preference-item-auxiliary.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-auxiliary.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-content.svelte +68 -0
- package/dist/primitives/preference-item/preference-item-content.svelte.d.ts +14 -0
- package/dist/primitives/preference-item/preference-item-control.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-control.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-header.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-header.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-leading.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-leading.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-meta.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-meta.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-root.svelte +82 -0
- package/dist/primitives/preference-item/preference-item-root.svelte.d.ts +12 -0
- package/dist/primitives/preference-item/preference-item-title.svelte +33 -0
- package/dist/primitives/preference-item/preference-item-title.svelte.d.ts +9 -0
- package/dist/primitives/preference-item/preference-item-trigger.svelte +62 -0
- package/dist/primitives/preference-item/preference-item-trigger.svelte.d.ts +10 -0
- package/dist/primitives/switch/context.d.ts +7 -0
- package/dist/primitives/switch/context.js +12 -0
- package/dist/primitives/switch/index.d.ts +25 -0
- package/dist/primitives/switch/index.js +11 -0
- package/dist/primitives/switch/switch-control.svelte +21 -0
- package/dist/primitives/switch/switch-control.svelte.d.ts +9 -0
- package/dist/primitives/switch/switch-hidden-input.svelte +31 -0
- package/dist/primitives/switch/switch-hidden-input.svelte.d.ts +8 -0
- package/dist/primitives/switch/switch-root.svelte +86 -0
- package/dist/primitives/switch/switch-root.svelte.d.ts +12 -0
- package/dist/primitives/switch/switch-thumb.svelte +14 -0
- package/dist/primitives/switch/switch-thumb.svelte.d.ts +7 -0
- package/dist/primitives/tabs/context.d.ts +11 -0
- package/dist/primitives/tabs/context.js +12 -0
- package/dist/primitives/tabs/index.d.ts +32 -0
- package/dist/primitives/tabs/index.js +11 -0
- package/dist/primitives/tabs/tabs-content.svelte +45 -0
- package/dist/primitives/tabs/tabs-content.svelte.d.ts +11 -0
- package/dist/primitives/tabs/tabs-list.svelte +38 -0
- package/dist/primitives/tabs/tabs-list.svelte.d.ts +10 -0
- package/dist/primitives/tabs/tabs-root.svelte +67 -0
- package/dist/primitives/tabs/tabs-root.svelte.d.ts +14 -0
- package/dist/primitives/tabs/tabs-trigger.svelte +108 -0
- package/dist/primitives/tabs/tabs-trigger.svelte.d.ts +11 -0
- package/dist/server/headers.d.ts +13 -0
- package/dist/server/headers.js +37 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +116 -0
- package/dist/server/normalize-url.d.ts +23 -0
- package/dist/server/normalize-url.js +46 -0
- package/dist/server/types.d.ts +25 -0
- package/dist/server/types.js +1 -0
- package/dist/styles.css +10 -0
- package/dist/transports/offline.d.ts +14 -0
- package/dist/transports/offline.js +22 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +1 -0
- package/dist/use-banner-visibility.svelte.d.ts +25 -0
- package/dist/use-banner-visibility.svelte.js +108 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.js +32 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/docs/README.md +88 -0
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/customization/overview.md +45 -0
- package/docs/customization/recipes.md +79 -0
- package/docs/customization/slots.md +55 -0
- package/docs/customization/tokens.md +76 -0
- package/docs/customization/translations.md +49 -0
- package/docs/frameworks/svelte/quickstart.md +133 -0
- package/docs/frameworks/sveltekit/quickstart.md +144 -0
- package/docs/guides/consent-state.md +60 -0
- package/docs/guides/data-fetching.md +163 -0
- package/docs/guides/deployment-modes.md +63 -0
- package/docs/guides/troubleshooting.md +68 -0
- package/docs/guides/verify-consent.md +62 -0
- package/docs/integrations/adobe-analytics.md +294 -0
- package/docs/integrations/ahrefs-analytics.md +291 -0
- package/docs/integrations/amplitude.md +292 -0
- package/docs/integrations/building-integrations.md +47 -0
- package/docs/integrations/clearbit.md +291 -0
- package/docs/integrations/cloudflare-web-analytics.md +292 -0
- package/docs/integrations/crisp.md +294 -0
- package/docs/integrations/databuddy.md +311 -0
- package/docs/integrations/fathom-analytics.md +293 -0
- package/docs/integrations/google-maps.md +384 -0
- package/docs/integrations/google-tag-manager.md +306 -0
- package/docs/integrations/google-tag.md +305 -0
- package/docs/integrations/heap.md +292 -0
- package/docs/integrations/hightouch.md +293 -0
- package/docs/integrations/hotjar.md +292 -0
- package/docs/integrations/intercom.md +285 -0
- package/docs/integrations/linkedin-insights.md +291 -0
- package/docs/integrations/logrocket.md +293 -0
- package/docs/integrations/matomo-analytics.md +316 -0
- package/docs/integrations/meta-pixel.md +285 -0
- package/docs/integrations/microsoft-clarity.md +292 -0
- package/docs/integrations/microsoft-uet.md +291 -0
- package/docs/integrations/mixpanel-analytics.md +295 -0
- package/docs/integrations/openai-pixel.md +441 -0
- package/docs/integrations/overview.md +111 -0
- package/docs/integrations/pirsch.md +295 -0
- package/docs/integrations/plausible-analytics.md +295 -0
- package/docs/integrations/posthog.md +397 -0
- package/docs/integrations/promptwatch.md +291 -0
- package/docs/integrations/reddit-pixel.md +294 -0
- package/docs/integrations/rudderstack.md +328 -0
- package/docs/integrations/rybbit-analytics.md +296 -0
- package/docs/integrations/segment.md +292 -0
- package/docs/integrations/snapchat-pixel.md +293 -0
- package/docs/integrations/tiktok-pixel.md +291 -0
- package/docs/integrations/umami-analytics.md +295 -0
- package/docs/integrations/vercel-analytics.md +293 -0
- package/docs/integrations/x-pixel.md +291 -0
- package/docs/integrations/youtube.md +405 -0
- package/docs/upgrade-v3.md +334 -0
- package/iab/styles.css +1 -0
- package/package.json +153 -0
- package/readme.json +36 -0
- package/styles.css +1 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @c15t/svelte
|
|
2
|
+
|
|
3
|
+
> Svelte and SvelteKit v3 providers, request loading and static hosting with Inth.
|
|
4
|
+
|
|
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
|
+
|
|
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
|
+
- [Svelte quickstart](./docs/frameworks/svelte/quickstart.md)
|
|
14
|
+
- [SvelteKit quickstart](./docs/frameworks/sveltekit/quickstart.md)
|
|
15
|
+
- [Customize your consent interface](./docs/customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
|
|
16
|
+
- [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
17
|
+
- [Upgrade to v3 policies](./docs/upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
|
|
18
|
+
|
|
19
|
+
## More documentation
|
|
20
|
+
|
|
21
|
+
[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.
|
|
22
|
+
|
|
23
|
+
## Frameworks
|
|
24
|
+
|
|
25
|
+
- [Quickstart](./docs/frameworks/svelte/quickstart.md): Mount c15t components and a persistent preferences link in a Svelte 5 application.
|
|
26
|
+
- [Quickstart](./docs/frameworks/sveltekit/quickstart.md): Resolve consent in a SvelteKit server load and hydrate the provider, or initialize in the browser on static hosting.
|
|
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.
|
|
35
|
+
|
|
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.
|
|
43
|
+
|
|
44
|
+
## Integrations
|
|
45
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
## Reference
|
|
87
|
+
|
|
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
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://c15t.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fsvelte" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="../../docs/assets/c15t-banner-readme-dark.svg" type="image/svg+xml">
|
|
5
|
+
<img src="../../docs/assets/c15t-banner-readme-light.svg" alt="c15t Banner" type="image/svg+xml">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
# @c15t/svelte: Svelte Consent Components
|
|
11
|
+
|
|
12
|
+
<p>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@c15t/svelte"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/npm/%40c15t%2Fsvelte.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/npm/%40c15t%2Fsvelte.svg?variant=outline&mode=light" alt="Latest NPM Version"></picture></a>
|
|
14
|
+
<a href="https://github.com/c15t/c15t"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/c15t/c15t/stars.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/github/c15t/c15t/stars.svg?variant=outline&mode=light" alt="Stars"></picture></a>
|
|
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
|
+
<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
|
+
<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%2Fsvelte"><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
|
+
</p>
|
|
20
|
+
|
|
21
|
+
Developer-first CMP for Svelte: cookie banner, consent manager, preferences centre. GDPR ready with minimal setup and rich customization
|
|
22
|
+
|
|
23
|
+
## Key Features
|
|
24
|
+
|
|
25
|
+
- Works with Svelte 5
|
|
26
|
+
- Headless and fully customizable UI components
|
|
27
|
+
- Automatic GDPR compliance
|
|
28
|
+
- Minimal configuration with TypeScript-first design
|
|
29
|
+
- Comprehensive Consent Management Platform (CMP)
|
|
30
|
+
- Flexible Cookie Banner and Preference Center components
|
|
31
|
+
- Built-in internationalization support
|
|
32
|
+
- Seamless consent storage and tracking
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
- Svelte 5 or later
|
|
37
|
+
- Node.js 20.19 or later
|
|
38
|
+
- A hosted [c15t instance](https://inth.com) (free sign-up) or [self-hosted deployment](https://c15t.com/docs/self-host/v2)
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
Easiest setup with @c15t/cli:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Set up c15t in your project
|
|
46
|
+
pnpm dlx @c15t/cli setup
|
|
47
|
+
# Alternatives:
|
|
48
|
+
# npx @c15t/cli setup
|
|
49
|
+
# bunx --bun @c15t/cli setup
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The CLI will:
|
|
53
|
+
|
|
54
|
+
- Install necessary packages
|
|
55
|
+
- Configure your c15t instance
|
|
56
|
+
- Set up environment variables
|
|
57
|
+
- Add consent management components to your app
|
|
58
|
+
|
|
59
|
+
## Manual Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm add @c15t/svelte
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/svelte/quickstart#manual-setup).
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
1. Wrap your app with `ConsentManagerProvider`
|
|
70
|
+
2. Add `ConsentBanner` and `ConsentDialog` near the root
|
|
71
|
+
3. Customise styling and behaviour to fit your app
|
|
72
|
+
4. For full implementation details, see the [Svelte quickstart docs](https://c15t.com/docs/frameworks/svelte/quickstart)
|
|
73
|
+
|
|
74
|
+
```svelte
|
|
75
|
+
<!-- src/routes/+layout.svelte -->
|
|
76
|
+
<script>
|
|
77
|
+
import { ConsentManagerProvider, ConsentBanner, ConsentDialog } from '@c15t/svelte'
|
|
78
|
+
import '../app.css'
|
|
79
|
+
|
|
80
|
+
let { children } = $props()
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<ConsentManagerProvider
|
|
84
|
+
mode="hosted"
|
|
85
|
+
backendURL="https://your-instance.c15t.dev"
|
|
86
|
+
consentCategories={['necessary', 'measurement', 'marketing']}
|
|
87
|
+
>
|
|
88
|
+
{@render children()}
|
|
89
|
+
<ConsentBanner />
|
|
90
|
+
<ConsentDialog />
|
|
91
|
+
</ConsentManagerProvider>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Import `@c15t/svelte/styles.css` once from your global CSS, such as SvelteKit's `src/app.css`.
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
For further information, guides, and examples visit the [reference documentation](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
99
|
+
|
|
100
|
+
## Support
|
|
101
|
+
|
|
102
|
+
- Join our [Discord community](https://c15t.link/discord)
|
|
103
|
+
- Open an issue on our [GitHub repository](https://github.com/c15t/c15t/issues)
|
|
104
|
+
- Visit [inth.com](https://inth.com) and use the chat widget
|
|
105
|
+
- Contact our support team via email [support@inth.com](mailto:support@inth.com)
|
|
106
|
+
|
|
107
|
+
## Contributing
|
|
108
|
+
|
|
109
|
+
- We're open to all community contributions.
|
|
110
|
+
- Read our [Contribution Guidelines](https://c15t.com/docs/oss/contributing)
|
|
111
|
+
- Review our [Code of Conduct](https://c15t.com/docs/oss/code-of-conduct)
|
|
112
|
+
- Fork the repository
|
|
113
|
+
- Create a new branch for your feature
|
|
114
|
+
- Submit a pull request
|
|
115
|
+
- **All contributions, big or small, are welcome and appreciated.**
|
|
116
|
+
|
|
117
|
+
## Security
|
|
118
|
+
|
|
119
|
+
If you believe you have found a security vulnerability in c15t, we encourage you to **_responsibly disclose this and NOT open a public issue_**. We will investigate all legitimate reports.
|
|
120
|
+
|
|
121
|
+
Our preference is that you make use of GitHub's private vulnerability reporting feature to disclose potential security vulnerabilities in our open-source software. To do this, please visit [https://github.com/c15t/c15t/security](https://github.com/c15t/c15t/security) and click the "Report a vulnerability" button.
|
|
122
|
+
|
|
123
|
+
### Security Policy
|
|
124
|
+
|
|
125
|
+
- Please do not share security vulnerabilities in public forums, issues, or pull requests
|
|
126
|
+
- Provide detailed information about the potential vulnerability
|
|
127
|
+
- Allow reasonable time for us to address the issue before any public disclosure
|
|
128
|
+
- We are committed to addressing security concerns promptly and transparently
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
[Apache License 2.0](https://github.com/c15t/c15t/blob/main/LICENSE.md)
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
**Built by [Inth](https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fsvelte)**
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: c15t-svelte-docs
|
|
3
|
+
description: Read and search the @c15t/svelte documentation. Use when working with @c15t/svelte — its setup, configuration, API, and behavior.
|
|
4
|
+
metadata:
|
|
5
|
+
source: leadtype
|
|
6
|
+
---
|
|
7
|
+
# @c15t/svelte documentation
|
|
8
|
+
|
|
9
|
+
Svelte and SvelteKit v3 providers, request loading and static hosting with Inth.
|
|
10
|
+
|
|
11
|
+
To work with @c15t/svelte, read its bundled docs — they ship with the package and are version-matched to the installed code:
|
|
12
|
+
|
|
13
|
+
- Start with `./AGENTS.md`; it links every per-topic Markdown file under `./docs/`.
|
|
14
|
+
- Prefer these local files over fetching anything over the network.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that traps keyboard focus within a container.
|
|
3
|
+
* Wraps @c15t/ui's framework-agnostic setupFocusTrap.
|
|
4
|
+
*/
|
|
5
|
+
export declare const focusTrap: (node: HTMLElement, enabled?: boolean) => {
|
|
6
|
+
destroy(): void;
|
|
7
|
+
update(newEnabled: boolean): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { setupFocusTrap } from '@c15t/ui/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Svelte action that traps keyboard focus within a container.
|
|
4
|
+
* Wraps @c15t/ui's framework-agnostic setupFocusTrap.
|
|
5
|
+
*/
|
|
6
|
+
export const focusTrap = function focusTrap(node, enabled = true) {
|
|
7
|
+
let cleanup;
|
|
8
|
+
if (enabled) {
|
|
9
|
+
cleanup = setupFocusTrap(node);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
destroy() {
|
|
13
|
+
cleanup?.();
|
|
14
|
+
},
|
|
15
|
+
update(newEnabled) {
|
|
16
|
+
cleanup?.();
|
|
17
|
+
cleanup = undefined;
|
|
18
|
+
if (newEnabled) {
|
|
19
|
+
cleanup = setupFocusTrap(node);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that teleports an element to a target container.
|
|
3
|
+
* Used for rendering modals, banners, and overlays at the document body level.
|
|
4
|
+
*/
|
|
5
|
+
export declare const portal: (node: HTMLElement, target?: HTMLElement | string) => {
|
|
6
|
+
destroy(): void;
|
|
7
|
+
update(newTarget: HTMLElement | string): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that teleports an element to a target container.
|
|
3
|
+
* Used for rendering modals, banners, and overlays at the document body level.
|
|
4
|
+
*/
|
|
5
|
+
export const portal = function portal(node, target = typeof document === 'undefined'
|
|
6
|
+
? null
|
|
7
|
+
: document.body) {
|
|
8
|
+
const resolve = function resolve(t) {
|
|
9
|
+
return typeof t === 'string' ? document.querySelector(t) : t;
|
|
10
|
+
};
|
|
11
|
+
let targetEl = resolve(target);
|
|
12
|
+
if (targetEl) {
|
|
13
|
+
targetEl.appendChild(node);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
// oxlint-disable-next-line no-lonely-if -- Preserve established branch order and control flow.
|
|
17
|
+
if (typeof process === 'undefined' ||
|
|
18
|
+
process.env?.NODE_ENV !== 'production') {
|
|
19
|
+
console.warn(`[c15t/portal] Target element not found: ${target}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
destroy() {
|
|
24
|
+
node.remove();
|
|
25
|
+
},
|
|
26
|
+
update(newTarget) {
|
|
27
|
+
const newTargetEl = resolve(newTarget);
|
|
28
|
+
if (!newTargetEl) {
|
|
29
|
+
if (typeof process === 'undefined' ||
|
|
30
|
+
process.env?.NODE_ENV !== 'production') {
|
|
31
|
+
console.warn(`[c15t/portal] Target element not found: ${newTarget}`);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
newTargetEl.appendChild(node);
|
|
36
|
+
targetEl = newTargetEl;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that locks document scrolling when enabled.
|
|
3
|
+
* Wraps @c15t/ui's framework-agnostic setupScrollLock.
|
|
4
|
+
*/
|
|
5
|
+
export declare const scrollLock: (_node: HTMLElement, enabled?: boolean) => {
|
|
6
|
+
destroy(): void;
|
|
7
|
+
update(newEnabled: boolean): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { setupScrollLock } from '@c15t/ui/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Svelte action that locks document scrolling when enabled.
|
|
4
|
+
* Wraps @c15t/ui's framework-agnostic setupScrollLock.
|
|
5
|
+
*/
|
|
6
|
+
export const scrollLock = function scrollLock(_node, enabled = true) {
|
|
7
|
+
let cleanup;
|
|
8
|
+
if (enabled) {
|
|
9
|
+
cleanup = setupScrollLock();
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
destroy() {
|
|
13
|
+
cleanup?.();
|
|
14
|
+
},
|
|
15
|
+
update(newEnabled) {
|
|
16
|
+
cleanup?.();
|
|
17
|
+
cleanup = undefined;
|
|
18
|
+
if (newEnabled) {
|
|
19
|
+
cleanup = setupScrollLock();
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AllConsentNames } from '@c15t/core';
|
|
3
|
+
import buttonStyles from '@c15t/ui/styles/components/button';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
6
|
+
|
|
7
|
+
import { getConsentContext, getThemeContext } from '../context.svelte';
|
|
8
|
+
import { resolveComponentStyles } from '../utils';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
action,
|
|
12
|
+
variant = 'neutral',
|
|
13
|
+
mode = 'stroke',
|
|
14
|
+
size = 'small',
|
|
15
|
+
children,
|
|
16
|
+
onclick,
|
|
17
|
+
closeConsentBanner = false,
|
|
18
|
+
closeConsentDialog = false,
|
|
19
|
+
category,
|
|
20
|
+
noStyle: localNoStyle,
|
|
21
|
+
class: className,
|
|
22
|
+
...restProps
|
|
23
|
+
}: Omit<HTMLButtonAttributes, 'class'> & {
|
|
24
|
+
action:
|
|
25
|
+
| 'accept-consent'
|
|
26
|
+
| 'reject-consent'
|
|
27
|
+
| 'custom-consent'
|
|
28
|
+
| 'dismiss-notice'
|
|
29
|
+
| 'open-consent-dialog'
|
|
30
|
+
| 'set-consent';
|
|
31
|
+
variant?: 'primary' | 'neutral';
|
|
32
|
+
mode?: 'filled' | 'stroke' | 'lighter' | 'ghost';
|
|
33
|
+
size?: 'medium' | 'small' | 'xsmall' | 'xxsmall';
|
|
34
|
+
children?: Snippet;
|
|
35
|
+
closeConsentBanner?: boolean;
|
|
36
|
+
closeConsentDialog?: boolean;
|
|
37
|
+
category?: AllConsentNames;
|
|
38
|
+
noStyle?: boolean;
|
|
39
|
+
class?: string;
|
|
40
|
+
} = $props();
|
|
41
|
+
|
|
42
|
+
const consent = getConsentContext();
|
|
43
|
+
const theme = getThemeContext();
|
|
44
|
+
|
|
45
|
+
const noStyle = $derived(localNoStyle ?? theme.noStyle ?? false);
|
|
46
|
+
|
|
47
|
+
const defaultThemeKey = $derived(
|
|
48
|
+
variant === 'primary'
|
|
49
|
+
? ('buttonPrimary' as const)
|
|
50
|
+
: ('buttonSecondary' as const)
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const variantClasses = $derived(noStyle ? '' : buttonStyles.button);
|
|
54
|
+
|
|
55
|
+
const buttonStyle = $derived(
|
|
56
|
+
resolveComponentStyles(
|
|
57
|
+
defaultThemeKey,
|
|
58
|
+
theme.theme,
|
|
59
|
+
{ className, noStyle },
|
|
60
|
+
noStyle
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const handleClick = async function handleClick(
|
|
65
|
+
e: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }
|
|
66
|
+
) {
|
|
67
|
+
onclick?.(e);
|
|
68
|
+
if (e.defaultPrevented) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const { state } = consent;
|
|
72
|
+
switch (action) {
|
|
73
|
+
case 'accept-consent':
|
|
74
|
+
await state.saveConsents('all');
|
|
75
|
+
return;
|
|
76
|
+
case 'reject-consent':
|
|
77
|
+
await state.saveConsents('necessary');
|
|
78
|
+
return;
|
|
79
|
+
case 'custom-consent':
|
|
80
|
+
await state.saveConsents('custom');
|
|
81
|
+
return;
|
|
82
|
+
case 'dismiss-notice':
|
|
83
|
+
await state.dismissNotice();
|
|
84
|
+
break;
|
|
85
|
+
case 'open-consent-dialog':
|
|
86
|
+
state.setActiveUI('dialog');
|
|
87
|
+
return;
|
|
88
|
+
case 'set-consent':
|
|
89
|
+
if (category) {
|
|
90
|
+
state.setSelectedConsent(category, true);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
default:
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (closeConsentBanner || closeConsentDialog) {
|
|
97
|
+
state.setActiveUI('none');
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<button
|
|
103
|
+
type="button"
|
|
104
|
+
class={[variantClasses, buttonStyle.className].filter(Boolean).join(' ')}
|
|
105
|
+
data-variant={noStyle ? undefined : variant}
|
|
106
|
+
data-mode={noStyle ? undefined : mode}
|
|
107
|
+
data-size={noStyle ? undefined : size}
|
|
108
|
+
style={buttonStyle.style
|
|
109
|
+
? Object.entries(buttonStyle.style)
|
|
110
|
+
.map(([k, v]) => `${k}:${v}`)
|
|
111
|
+
.join(';')
|
|
112
|
+
: undefined}
|
|
113
|
+
{...restProps}
|
|
114
|
+
onclick={handleClick}
|
|
115
|
+
>
|
|
116
|
+
{#if children}
|
|
117
|
+
{@render children()}
|
|
118
|
+
{/if}
|
|
119
|
+
</button>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AllConsentNames } from '@c15t/core';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
type $$ComponentProps = Omit<HTMLButtonAttributes, 'class'> & {
|
|
5
|
+
action: 'accept-consent' | 'reject-consent' | 'custom-consent' | 'dismiss-notice' | 'open-consent-dialog' | 'set-consent';
|
|
6
|
+
variant?: 'primary' | 'neutral';
|
|
7
|
+
mode?: 'filled' | 'stroke' | 'lighter' | 'ghost';
|
|
8
|
+
size?: 'medium' | 'small' | 'xsmall' | 'xxsmall';
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
closeConsentBanner?: boolean;
|
|
11
|
+
closeConsentDialog?: boolean;
|
|
12
|
+
category?: AllConsentNames;
|
|
13
|
+
noStyle?: boolean;
|
|
14
|
+
class?: string;
|
|
15
|
+
};
|
|
16
|
+
declare const ActionButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
17
|
+
type ActionButton = ReturnType<typeof ActionButton>;
|
|
18
|
+
export default ActionButton;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defaultTranslationConfig } from '@c15t/core';
|
|
3
|
+
import styles from '@c15t/ui/styles/components/branding';
|
|
4
|
+
import { resolveTranslations } from '@c15t/ui/utils';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
6
|
+
|
|
7
|
+
import { getConsentContext, getThemeContext } from '../context.svelte';
|
|
8
|
+
import { resolveComponentStyles } from '../utils';
|
|
9
|
+
import C15TIconOnly from './icons/c15-t-icon-only.svelte';
|
|
10
|
+
import InthLogo from './icons/inth-logo.svelte';
|
|
11
|
+
|
|
12
|
+
type ResolvedBranding = 'c15t' | 'inth' | 'none';
|
|
13
|
+
type BrandingVariant = 'footer' | 'dialog-tag' | 'banner-tag';
|
|
14
|
+
type BrandingThemeKey =
|
|
15
|
+
| 'consentBannerTag'
|
|
16
|
+
| 'consentDialogTag'
|
|
17
|
+
| 'consentWidgetTag'
|
|
18
|
+
| 'iabConsentBannerTag'
|
|
19
|
+
| 'iabConsentDialogTag';
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
hideBranding = false,
|
|
23
|
+
noStyle: localNoStyle,
|
|
24
|
+
variant = 'footer',
|
|
25
|
+
themeKey,
|
|
26
|
+
class: className,
|
|
27
|
+
'data-testid': testId,
|
|
28
|
+
}: {
|
|
29
|
+
hideBranding?: boolean;
|
|
30
|
+
noStyle?: boolean;
|
|
31
|
+
variant?: BrandingVariant;
|
|
32
|
+
themeKey?: BrandingThemeKey;
|
|
33
|
+
class?: string;
|
|
34
|
+
'data-testid'?: string;
|
|
35
|
+
} = $props();
|
|
36
|
+
|
|
37
|
+
const consent = getConsentContext();
|
|
38
|
+
const theme = getThemeContext();
|
|
39
|
+
|
|
40
|
+
const noStyle = $derived(localNoStyle ?? theme.noStyle ?? false);
|
|
41
|
+
const branding = $derived(consent.state.branding);
|
|
42
|
+
const translations = $derived(
|
|
43
|
+
resolveTranslations(
|
|
44
|
+
consent.state.translationConfig,
|
|
45
|
+
defaultTranslationConfig
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const resolveBranding = function resolveBranding(
|
|
50
|
+
value: string
|
|
51
|
+
): ResolvedBranding {
|
|
52
|
+
if (value === 'none') {
|
|
53
|
+
return 'none';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (value === 'inth' || value === 'consent') {
|
|
57
|
+
return 'inth';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return 'c15t';
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const resolvedBranding = $derived(resolveBranding(branding));
|
|
64
|
+
const showBranding = $derived(!hideBranding && resolvedBranding !== 'none');
|
|
65
|
+
let refHostname = $state('');
|
|
66
|
+
onMount(() => {
|
|
67
|
+
refHostname = window.location.hostname;
|
|
68
|
+
});
|
|
69
|
+
const refParam = $derived(refHostname ? `?ref=${refHostname}` : '');
|
|
70
|
+
const brandingHref = $derived(
|
|
71
|
+
resolvedBranding === 'inth'
|
|
72
|
+
? `https://inth.com${refParam}`
|
|
73
|
+
: `https://c15t.com${refParam}`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const baseClassName = $derived(
|
|
77
|
+
[
|
|
78
|
+
styles.branding,
|
|
79
|
+
variant === 'footer' ? '' : styles.brandingTag,
|
|
80
|
+
variant === 'dialog-tag' ? styles.brandingTagDialog : '',
|
|
81
|
+
variant === 'banner-tag' ? styles.brandingTagBanner : '',
|
|
82
|
+
]
|
|
83
|
+
.filter(Boolean)
|
|
84
|
+
.join(' ')
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const brandingStyle = $derived(
|
|
88
|
+
resolveComponentStyles(
|
|
89
|
+
themeKey ?? 'consentDialogTag',
|
|
90
|
+
theme.theme,
|
|
91
|
+
{
|
|
92
|
+
baseClassName,
|
|
93
|
+
className,
|
|
94
|
+
},
|
|
95
|
+
noStyle
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
{#if showBranding}
|
|
101
|
+
<!-- No `dir` here: the copy follows the page direction and only the
|
|
102
|
+
wordmark below is pinned to LTR. -->
|
|
103
|
+
<a
|
|
104
|
+
class={brandingStyle.className || ''}
|
|
105
|
+
href={brandingHref}
|
|
106
|
+
data-branding={resolvedBranding}
|
|
107
|
+
data-variant={variant}
|
|
108
|
+
data-testid={testId}
|
|
109
|
+
>
|
|
110
|
+
<span
|
|
111
|
+
class={styles.brandingContent || ''}
|
|
112
|
+
data-slot="tag-content"
|
|
113
|
+
>
|
|
114
|
+
<span class={styles.brandingCopy || ''}>
|
|
115
|
+
<span class={styles.brandingText || ''}
|
|
116
|
+
>{translations.common.securedBy}</span
|
|
117
|
+
>
|
|
118
|
+
</span>
|
|
119
|
+
{#if resolvedBranding === 'inth'}
|
|
120
|
+
<span
|
|
121
|
+
dir="ltr"
|
|
122
|
+
class={`${styles.brandingWordmark || ''} ${styles.brandingInth || ''}`}
|
|
123
|
+
>
|
|
124
|
+
<InthLogo aria-hidden={true} />
|
|
125
|
+
</span>
|
|
126
|
+
{:else}
|
|
127
|
+
<span
|
|
128
|
+
dir="ltr"
|
|
129
|
+
class={`${styles.brandingWordmark || ''} ${styles.brandingC15T || ''}`}
|
|
130
|
+
>
|
|
131
|
+
<span class={styles.brandingC15TMark || ''}>
|
|
132
|
+
<C15TIconOnly aria-hidden={true} />
|
|
133
|
+
</span>
|
|
134
|
+
<span class={styles.brandingWordmarkLabel || ''}>c15t</span>
|
|
135
|
+
</span>
|
|
136
|
+
{/if}
|
|
137
|
+
</span>
|
|
138
|
+
</a>
|
|
139
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type BrandingVariant = 'footer' | 'dialog-tag' | 'banner-tag';
|
|
2
|
+
type BrandingThemeKey = 'consentBannerTag' | 'consentDialogTag' | 'consentWidgetTag' | 'iabConsentBannerTag' | 'iabConsentDialogTag';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
hideBranding?: boolean;
|
|
5
|
+
noStyle?: boolean;
|
|
6
|
+
variant?: BrandingVariant;
|
|
7
|
+
themeKey?: BrandingThemeKey;
|
|
8
|
+
class?: string;
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Branding: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type Branding = ReturnType<typeof Branding>;
|
|
13
|
+
export default Branding;
|