@owlmeans/web-consent 0.1.18-rc.40 → 0.1.18-rc.42
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/README.md +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/web-consent/SKILL.md +16 -16
- package/build/consent/component.d.ts +1 -1
- package/build/consent/component.d.ts.map +1 -1
- package/build/consent/component.js +10 -28
- package/build/consent/component.js.map +1 -1
- package/build/consent/consts.local.d.ts +20 -0
- package/build/consent/consts.local.d.ts.map +1 -0
- package/build/consent/consts.local.js +20 -0
- package/build/consent/consts.local.js.map +1 -0
- package/build/consent/toggle.d.ts +1 -10
- package/build/consent/toggle.d.ts.map +1 -1
- package/build/consent/toggle.js +2 -2
- package/build/consent/toggle.js.map +1 -1
- package/build/consent/types.d.ts +11 -0
- package/build/consent/types.d.ts.map +1 -0
- package/build/consent/types.js +2 -0
- package/build/consent/types.js.map +1 -0
- package/build/consent/widget.d.ts +1 -1
- package/build/consent/widget.js +6 -6
- package/build/consent/widget.js.map +1 -1
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/lib/utils/types.d.ts +28 -0
- package/build/lib/utils/types.d.ts.map +1 -0
- package/build/lib/utils/types.js +2 -0
- package/build/lib/utils/types.js.map +1 -0
- package/build/lib/utils.d.ts +3 -24
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +8 -26
- package/build/lib/utils.js.map +1 -1
- package/build/policy/component.d.ts.map +1 -1
- package/build/policy/component.js +7 -7
- package/build/policy/component.js.map +1 -1
- package/build/policy/types.local.d.ts +13 -0
- package/build/policy/types.local.d.ts.map +1 -0
- package/build/policy/types.local.js +2 -0
- package/build/policy/types.local.js.map +1 -0
- package/build/types.d.ts +1 -1
- package/build/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/consent/component.tsx +14 -37
- package/src/consent/consts.local.ts +19 -0
- package/src/consent/toggle.tsx +5 -15
- package/src/consent/types.ts +10 -0
- package/src/consent/widget.tsx +6 -6
- package/src/index.ts +7 -6
- package/src/lib/utils/types.ts +28 -0
- package/src/lib/utils.ts +11 -26
- package/src/policy/component.tsx +12 -24
- package/src/policy/types.local.ts +12 -0
- package/src/types.ts +1 -1
- package/tests/a11y.spec.ts +2 -2
- package/tests/consent.spec.ts +8 -10
- package/tests/context.ts +2 -2
- package/tests/linker.spec.ts +7 -7
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
6
6
|
your project's skill store (`.agents/skills/`):
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
9
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.49
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/web-consent",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.42",
|
|
5
|
+
"generatedAt": "2026-10-05T21:03:06.398Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,13 +8,13 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/web-consent
|
|
9
9
|
|
|
10
10
|
**Layer:** Web (React)
|
|
11
|
-
**Install:** `"@owlmeans/web-consent": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/web-consent": "^0.1.18-rc.42"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
The browser components of the consent set. The model — categories, storage, migration, the store,
|
|
14
14
|
Consent Mode signalling — is `@owlmeans/consent`, and this package re-exports a **named selection**
|
|
15
|
-
of it (listed under Key Exports) so an application usually has one import.
|
|
15
|
+
of it (listed under Key Exports) so an application usually has one import. Four public
|
|
16
16
|
`@owlmeans/consent` exports are deliberately not in that list — `makeConsentStore`,
|
|
17
|
-
`
|
|
17
|
+
`CONSENT_SETUP_FLAG`, `CONSENT_SIGNAL_DEFAULTS` and the `ConsentListener` type —
|
|
18
18
|
so a caller that needs one of them imports it from `@owlmeans/consent` directly. **Read the
|
|
19
19
|
`consent` skill for the model; read this one for the components.**
|
|
20
20
|
|
|
@@ -41,7 +41,7 @@ components — see below.
|
|
|
41
41
|
| `useConsent(opts?)` | This document's consent state and the actions over it (`UseConsentModel`) — **it also initialises the store on mount**, see below |
|
|
42
42
|
| `useConsentCategory(key)` | Whether one category is granted, for a component gating a single thing |
|
|
43
43
|
| `CookieConsentProps` / `CookiePolicyProps` / `ConsentLink` | The component props |
|
|
44
|
-
| Re-exports from `@owlmeans/consent` | The complete list: `consentStore
|
|
44
|
+
| Re-exports from `@owlmeans/consent` | The complete list: `consentStore`; `consentStorageHelper` (`readConsent`, `writeConsent`, `clearConsent`, `migrateConsent`); `consentModeHelper` (`applyConsent`, `pushConsentDefaults`, `consentBootstrapScript`, `consentDefaults`, `consentUpdate`, `gtagConsent`, `trackingGranted`, `consentGateScript`); `consentI18nHelper` (`defaultConsentTranslate`, `interpolate`, `normalizeLocale`); `DEFAULT_CONSENT_CATEGORIES`, `DEFAULT_CONSENT_MESSAGES`, `CONSENT_KEY`, `CONSENT_COOKIE_DAYS`, `CONSENT_SCHEMA_VERSION`, `CONSENT_LOCALES`, `CONSENT_ESSENTIAL` / `CONSENT_ANALYTICS` / `CONSENT_MARKETING`, the plugin seam (`consentPluginHelper`: `registerConsentPlugin`, `consentPlugins`, `decorateConsentUrl`, `consentDomains`, `adoptConsent`, `startConsentPlugins`, `adoptConsentLanguage`), the linker (`consentLinkHelper`: `consentLinker`, `encodeConsentLink`, `decodeConsentLink`, `stripConsentLinkParam`, `consentLinkerScript`, `writeConsentLanguage`; `CONSENT_LANGUAGE_KEY`, `CONSENT_EVENT`, `CONSENT_LINK_PARAM`, `CONSENT_LINK_MAX_AGE`, `CONSENT_LINK_SKEW`), and the types `ConsentCategory`, `ConsentOptions`, `ConsentReason`, `ConsentRecord`, `ConsentService`, `ConsentSignal`, `ConsentState`, `ConsentStore`, `ConsentLocale`, `ConsentLinkerOptions`, `ConsentLinkerLanguage`, `ConsentPlugin`, `ConsentLinkPayload` and the five helper interfaces |
|
|
45
45
|
|
|
46
46
|
## Mounting the dialog
|
|
47
47
|
|
|
@@ -67,7 +67,7 @@ import { CookieConsent } from '@owlmeans/web-consent'
|
|
|
67
67
|
- `policyHref` is a plain string, so an app-resolved path, a framework route and a raw href all
|
|
68
68
|
work — the component must not know how its host does routing.
|
|
69
69
|
- `noReopenButton` hides the floating button for an app that offers a footer link instead; that link
|
|
70
|
-
calls `
|
|
70
|
+
calls `consentStore.open('reopen')`.
|
|
71
71
|
- **The re-open button is a bare icon in the very corner (`bottom-1 left-1`), not a card.** No
|
|
72
72
|
filled background, no border, no shadow, no hover-scale — `bg-transparent`, dimmed
|
|
73
73
|
(`opacity-70`) at rest and picked out on hover/focus — because it sits on every page of a site
|
|
@@ -76,7 +76,7 @@ import { CookieConsent } from '@owlmeans/web-consent'
|
|
|
76
76
|
(`h-11 w-11`). `[data-consent-reopen]` is what any test or CSS override keys on.
|
|
77
77
|
- **`linker` (`ConsentLinkerOptions`)** turns on cross-domain consent (see the `consent` skill's
|
|
78
78
|
plugin-seam section): `<CookieConsent linker={{ domains: ['owlmeans.com', 'owlmeans.pl'] }} />`
|
|
79
|
-
passes it straight to `useConsent`, which registers `consentLinker` on mount. With it set and
|
|
79
|
+
passes it straight to `useConsent`, which registers `consentLinkHelper.consentLinker` on mount. With it set and
|
|
80
80
|
more than just the current host to disclose, a domain line renders right after the description
|
|
81
81
|
(`[data-consent-domains]`, added to the dialog's `aria-describedby`) — computed DIRECTLY from
|
|
82
82
|
`linker.domains` plus the current host, not through the plugin registry, so it never depends on
|
|
@@ -134,9 +134,9 @@ required category is disclosure, not a question.
|
|
|
134
134
|
## A menu row for a host that already has one
|
|
135
135
|
|
|
136
136
|
`ConsentMenuWidget` renders one row — icon, translated label, `onClick` reopening the dialog
|
|
137
|
-
(`
|
|
137
|
+
(`consentStore.open('reopen')` by default, or a caller's own `onSelect`) — for a host whose own
|
|
138
138
|
navigation already carries a settings menu and would rather offer cookie preferences there than as
|
|
139
|
-
a second floating button. It calls `
|
|
139
|
+
a second floating button. It calls `consentStore.open` directly, never `useConsent()`, for the same
|
|
140
140
|
init-on-mount reason as everywhere else in this document.
|
|
141
141
|
|
|
142
142
|
**It carries no presence signalling of its own.** A host that wants `CookieConsent`'s floating
|
|
@@ -152,11 +152,11 @@ row. A context-free host (an Astro island with its own menu) owns that judgement
|
|
|
152
152
|
## Reading the decision
|
|
153
153
|
|
|
154
154
|
```tsx
|
|
155
|
-
import { useConsent, useConsentCategory
|
|
155
|
+
import { consentStore, useConsent, useConsentCategory } from '@owlmeans/web-consent'
|
|
156
156
|
|
|
157
157
|
const consent = useConsent() // { record, open, reason, granted, save, acceptAll, openDialog, close }
|
|
158
158
|
const analytics = useConsentCategory('analytics') // one category, for a component gating one thing
|
|
159
|
-
if (
|
|
159
|
+
if (consentStore.granted('analytics')) { /* outside React — a click handler, a service */ }
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
Both hooks subscribe through `useSyncExternalStore` over the module-singleton store, because consent
|
|
@@ -171,9 +171,9 @@ a component that only wanted to read has to plan for:
|
|
|
171
171
|
- **It opens the dialog.** `init` reads storage, and with no stored record it publishes
|
|
172
172
|
`open: true, reason: 'initial'`. So a `useConsent()` in a card that merely wanted `granted('analytics')`
|
|
173
173
|
gates the page for a first-time visitor. Read a single category with `useConsentCategory(key)` —
|
|
174
|
-
that hook subscribes and does **not** init — or `
|
|
174
|
+
that hook subscribes and does **not** init — or `consentStore.granted(key)` outside React.
|
|
175
175
|
- **The first `useConsent` to mount fixes the Consent Mode defaults.** `init` calls
|
|
176
|
-
`pushConsentDefaults`, which is idempotent through the `CONSENT_SETUP_FLAG` window flag: whoever
|
|
176
|
+
`consentModeHelper.pushConsentDefaults`, which is idempotent through the `CONSENT_SETUP_FLAG` window flag: whoever
|
|
177
177
|
gets there first declares the `consent/default` signals from *its* categories, and every later
|
|
178
178
|
call returns immediately. A bare `useConsent()` mounting before `CookieConsent` therefore declares
|
|
179
179
|
`DEFAULT_CONSENT_CATEGORIES`' signals and the app's own `categories` never declare theirs — which
|
|
@@ -191,11 +191,11 @@ why it is generated rather than written: a hand-written policy drifts the first
|
|
|
191
191
|
changes, and nobody notices because nobody reads it until it matters.
|
|
192
192
|
|
|
193
193
|
```tsx
|
|
194
|
-
import {
|
|
194
|
+
import { googleTagHelper } from '@owlmeans/web-gtm'
|
|
195
195
|
|
|
196
196
|
<CookiePolicy
|
|
197
197
|
operator="Example Sp. z o.o." privacyHref="/legal/privacy" termsHref="/legal/terms"
|
|
198
|
-
services={googleTag !== '' ? googleTagServices(googleTag) : undefined}
|
|
198
|
+
services={googleTag !== '' ? googleTagHelper.googleTagServices(googleTag) : undefined}
|
|
199
199
|
/>
|
|
200
200
|
```
|
|
201
201
|
|
|
@@ -270,7 +270,7 @@ incremental `tsc -b` — rebuild `@owlmeans/consent` with `tsc -b --force`, or c
|
|
|
270
270
|
bundle from `build/i18n`. **Once a `translate` prop is given,
|
|
271
271
|
the packaged bundle is not consulted at all**, so a wrapper that forwards a framework resolver alone
|
|
272
272
|
renders the English default for every key the application has not overridden, in every language. The
|
|
273
|
-
resolver must fall through to `defaultConsentTranslate(locale)` for the default — which is exactly
|
|
273
|
+
resolver must fall through to `consentI18nHelper.defaultConsentTranslate(locale)` for the default — which is exactly
|
|
274
274
|
what `@owlmeans/web-panel/consent` does, and why an app inside the panel family mounts
|
|
275
275
|
`PanelCookieConsent` / `PanelCookiePolicy` rather than these components directly.
|
|
276
276
|
|
|
@@ -287,7 +287,7 @@ caller's, already resolved.
|
|
|
287
287
|
- `consent` — the model: categories, `globalVar`, storage and migration, Consent Mode v2, the
|
|
288
288
|
ordering rule. Read it before changing anything a category means
|
|
289
289
|
- `web-gtm` — the head snippet that carries a stored decision to a Google tag, and
|
|
290
|
-
`googleTagServices(id)` for this page's `services`
|
|
290
|
+
`googleTagHelper.googleTagServices(id)` for this page's `services`
|
|
291
291
|
- `astro` — stamping that snippet from a static site's layout
|
|
292
292
|
- `login-methods` / `login-plugins` — the sign-in precondition that raises this dialog with
|
|
293
293
|
`reason: 'login'`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/consent/component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/consent/component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAA;AAMjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAerD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA0IhD,CAAA"}
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import { Cookie } from 'lucide-react';
|
|
4
|
-
import { DEFAULT_CONSENT_CATEGORIES,
|
|
5
|
-
import {
|
|
4
|
+
import { DEFAULT_CONSENT_CATEGORIES, consentI18nHelper, consentStorageHelper } from '@owlmeans/consent';
|
|
5
|
+
import { webConsentUtils } from '../lib/utils.js';
|
|
6
6
|
import { useConsent } from '../hooks.js';
|
|
7
7
|
import { ConsentToggle } from './toggle.js';
|
|
8
|
-
|
|
9
|
-
* The cookie preferences dialog, and the button that brings it back.
|
|
10
|
-
*
|
|
11
|
-
* Deliberately built from raw elements rather than shadcn primitives. One of the three surfaces
|
|
12
|
-
* this serves is an Astro island on a site that vendors its own component library, and requiring a
|
|
13
|
-
* consumer to install a UI family in order to render a consent notice would put the notice out of
|
|
14
|
-
* reach of the site that needs it most.
|
|
15
|
-
*
|
|
16
|
-
* Flat by rule, because it is the first thing every new visitor of a generated app sees: the
|
|
17
|
-
* surface and every colour come from the host's theme tokens (ground, ink, muted, hairline, one
|
|
18
|
-
* accent), depth comes from a hairline border and the overlay alone, and nothing paints a
|
|
19
|
-
* gradient, a shadow, a glow or a `backdrop-filter`. The accept action is the one accent pill,
|
|
20
|
-
* the others are outlined pills; every control is at least 44px tall and shows a 3px focus ring.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* The focus ring every control here shows: 3px solid in the theme's ring colour, 3px off the
|
|
24
|
-
* element. An outline rather than a box-shadow ring, so it survives a host that zeroes shadows.
|
|
25
|
-
*/
|
|
26
|
-
const FOCUS = 'focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-ring';
|
|
8
|
+
import { FOCUS } from './consts.local.js';
|
|
27
9
|
/** A pill button: 44px tall at minimum, full width on a phone, sharing the row above that. */
|
|
28
|
-
const PILL = cn('inline-flex min-h-11 flex-1 items-center justify-center rounded-full px-6 py-2.5 text-[15px] transition-colors motion-safe:active:scale-[0.98]', FOCUS);
|
|
10
|
+
const PILL = webConsentUtils.cn('inline-flex min-h-11 flex-1 items-center justify-center rounded-full px-6 py-2.5 text-[15px] transition-colors motion-safe:active:scale-[0.98]', FOCUS);
|
|
29
11
|
/** A text link: muted, underlined at rest (colour is never the only signal), 44px tall to tap. */
|
|
30
|
-
const LINK = cn('inline-flex min-h-11 items-center font-semibold underline decoration-1 underline-offset-4 transition-colors hover:text-foreground hover:decoration-2', FOCUS);
|
|
12
|
+
const LINK = webConsentUtils.cn('inline-flex min-h-11 items-center font-semibold underline decoration-1 underline-offset-4 transition-colors hover:text-foreground hover:decoration-2', FOCUS);
|
|
31
13
|
export const CookieConsent = props => {
|
|
32
14
|
const categories = props.categories ?? DEFAULT_CONSENT_CATEGORIES;
|
|
33
|
-
const t = props.translate ?? defaultConsentTranslate(props.locale);
|
|
15
|
+
const t = props.translate ?? consentI18nHelper.defaultConsentTranslate(props.locale);
|
|
34
16
|
const consentOpts = {
|
|
35
17
|
categories,
|
|
36
18
|
...(props.storageKey != null ? { storageKey: props.storageKey } : {}),
|
|
@@ -40,7 +22,7 @@ export const CookieConsent = props => {
|
|
|
40
22
|
...(props.linker != null ? { linker: props.linker } : {}),
|
|
41
23
|
};
|
|
42
24
|
const consent = useConsent(consentOpts);
|
|
43
|
-
const domains = disclosedDomains(props.linker);
|
|
25
|
+
const domains = webConsentUtils.disclosedDomains(props.linker);
|
|
44
26
|
const optional = categories.filter(category => category.required !== true);
|
|
45
27
|
const [draft, setDraft] = useState({});
|
|
46
28
|
// Re-seed the draft whenever the dialog opens, from what is actually stored: a visitor who opens
|
|
@@ -49,7 +31,7 @@ export const CookieConsent = props => {
|
|
|
49
31
|
if (!consent.open) {
|
|
50
32
|
return;
|
|
51
33
|
}
|
|
52
|
-
const stored = consent.record ?? readConsent({
|
|
34
|
+
const stored = consent.record ?? consentStorageHelper.readConsent({
|
|
53
35
|
...(props.storageKey != null ? { storageKey: props.storageKey } : {}),
|
|
54
36
|
});
|
|
55
37
|
setDraft(Object.fromEntries(optional.map(category => [category.key, stored?.[category.key] === true])));
|
|
@@ -67,8 +49,8 @@ export const CookieConsent = props => {
|
|
|
67
49
|
// today. Saying so, and relabelling the primary action, is what makes the interruption make
|
|
68
50
|
// sense rather than look like the page asking twice.
|
|
69
51
|
const gated = consent.reason === 'login';
|
|
70
|
-
return _jsxs(_Fragment, { children: [consent.open && _jsx("div", { className: "fixed inset-0 z-[999998] flex items-center justify-center overflow-y-auto bg-black/70 px-4 py-6", "aria-modal": "true", role: "dialog", "aria-labelledby": "cc-title", "aria-describedby": domains.length > 1 ? 'cc-desc cc-domains' : 'cc-desc', "data-consent-dialog": true, children: _jsxs("div", { className: cn('relative z-[999999] w-full max-w-lg rounded-3xl border border-border bg-background p-6 text-foreground sm:p-8', props.className), children: [_jsxs("div", { className: "mb-4 flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted text-primary", children: _jsx(Cookie, { className: "h-5 w-5", "aria-hidden": "true" }) }), _jsx("h2", { id: "cc-title", className: "text-balance text-xl font-extrabold tracking-tight text-foreground sm:text-2xl", children: t('title', 'Cookie Preferences') })] }), _jsx("p", { id: "cc-desc", className: "mb-6 text-pretty text-sm leading-relaxed text-muted-foreground", children: t('description', 'We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic.') }), domains.length > 1 && _jsx("p", { id: "cc-domains", "data-consent-domains": true, className: "mb-6 -mt-3 text-pretty text-xs text-muted-foreground", children: interpolate(t('domains', 'This choice applies to {{domains}}.'), { domains: domains.join(', ') }) }), _jsx("div", { className: "space-y-3", children: categories.map(category => _jsx(ConsentToggle, { id: `cc-${category.key}`, label: t(category.labelKey, category.key), description: t(category.descriptionKey, ''), checked: draft[category.key] === true, ...(category.required === true ? { required: true } : {}), requiredLabel: t('required', 'Required'), onChange: value => setDraft(current => ({ ...current, [category.key]: value })) }, category.key)) }), gated && _jsx("p", { role: "status", "data-consent-reason": true, className: "mt-4 text-sm font-semibold text-foreground", children: t('loginReason', 'Signing in stores a session cookie. Accept essential cookies to continue.') }), _jsxs("div", { className: "mt-8 flex flex-col gap-3 sm:flex-row sm:gap-4", children: [_jsx("button", { type: "button", onClick: onSave, "data-consent-save": true, className: cn(PILL, 'border-[1.5px] border-foreground bg-transparent font-semibold text-foreground hover:bg-muted'), children: t('savePreferences', 'Save Preferences') }), _jsx("button", { type: "button", onClick: onAcceptAll, "data-consent-accept-all": true, className: cn(PILL, 'bg-primary font-bold text-primary-foreground hover:bg-primary/90'), children: gated
|
|
52
|
+
return _jsxs(_Fragment, { children: [consent.open && _jsx("div", { className: "fixed inset-0 z-[999998] flex items-center justify-center overflow-y-auto bg-black/70 px-4 py-6", "aria-modal": "true", role: "dialog", "aria-labelledby": "cc-title", "aria-describedby": domains.length > 1 ? 'cc-desc cc-domains' : 'cc-desc', "data-consent-dialog": true, children: _jsxs("div", { className: webConsentUtils.cn('relative z-[999999] w-full max-w-lg rounded-3xl border border-border bg-background p-6 text-foreground sm:p-8', props.className), children: [_jsxs("div", { className: "mb-4 flex items-center gap-3", children: [_jsx("div", { className: "flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-muted text-primary", children: _jsx(Cookie, { className: "h-5 w-5", "aria-hidden": "true" }) }), _jsx("h2", { id: "cc-title", className: "text-balance text-xl font-extrabold tracking-tight text-foreground sm:text-2xl", children: t('title', 'Cookie Preferences') })] }), _jsx("p", { id: "cc-desc", className: "mb-6 text-pretty text-sm leading-relaxed text-muted-foreground", children: t('description', 'We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic.') }), domains.length > 1 && _jsx("p", { id: "cc-domains", "data-consent-domains": true, className: "mb-6 -mt-3 text-pretty text-xs text-muted-foreground", children: consentI18nHelper.interpolate(t('domains', 'This choice applies to {{domains}}.'), { domains: domains.join(', ') }) }), _jsx("div", { className: "space-y-3", children: categories.map(category => _jsx(ConsentToggle, { id: `cc-${category.key}`, label: t(category.labelKey, category.key), description: t(category.descriptionKey, ''), checked: draft[category.key] === true, ...(category.required === true ? { required: true } : {}), requiredLabel: t('required', 'Required'), onChange: value => setDraft(current => ({ ...current, [category.key]: value })) }, category.key)) }), gated && _jsx("p", { role: "status", "data-consent-reason": true, className: "mt-4 text-sm font-semibold text-foreground", children: t('loginReason', 'Signing in stores a session cookie. Accept essential cookies to continue.') }), _jsxs("div", { className: "mt-8 flex flex-col gap-3 sm:flex-row sm:gap-4", children: [_jsx("button", { type: "button", onClick: onSave, "data-consent-save": true, className: webConsentUtils.cn(PILL, 'border-[1.5px] border-foreground bg-transparent font-semibold text-foreground hover:bg-muted'), children: t('savePreferences', 'Save Preferences') }), _jsx("button", { type: "button", onClick: onAcceptAll, "data-consent-accept-all": true, className: webConsentUtils.cn(PILL, 'bg-primary font-bold text-primary-foreground hover:bg-primary/90'), children: gated
|
|
71
53
|
? t('acceptAndContinue', 'Accept & continue')
|
|
72
|
-
: t('acceptAll', 'Accept All') })] }), (props.policyHref != null || props.links != null) && _jsxs("div", { className: "mt-3 flex flex-wrap justify-center gap-x-4 text-[13px] text-muted-foreground", children: [props.policyHref != null && _jsx("a", { href: props.policyHref, target: "_blank", rel: "noopener noreferrer", className: LINK, children: t('policyLink', 'Cookie Policy') }), props.links?.map(link => _jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", className: LINK, children: t(link.labelKey, link.defaultLabel) }, link.href))] })] }) }), props.noReopenButton !== true && consent.record != null && !consent.open && _jsx("button", { type: "button", onClick: () => consent.openDialog('reopen'), "aria-label": t('openPreferences', 'Cookie preferences'), "data-consent-reopen": true, className: cn('fixed bottom-1 left-1 z-[999997] inline-flex h-11 w-11 items-center justify-center rounded border-0 bg-transparent p-0 text-muted-foreground opacity-70 transition-opacity hover:opacity-100 hover:text-primary focus-visible:opacity-100', FOCUS), children: _jsx(Cookie, { className: "h-5 w-5", "aria-hidden": "true" }) })] });
|
|
54
|
+
: t('acceptAll', 'Accept All') })] }), (props.policyHref != null || props.links != null) && _jsxs("div", { className: "mt-3 flex flex-wrap justify-center gap-x-4 text-[13px] text-muted-foreground", children: [props.policyHref != null && _jsx("a", { href: props.policyHref, target: "_blank", rel: "noopener noreferrer", className: LINK, children: t('policyLink', 'Cookie Policy') }), props.links?.map(link => _jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", className: LINK, children: t(link.labelKey, link.defaultLabel) }, link.href))] })] }) }), props.noReopenButton !== true && consent.record != null && !consent.open && _jsx("button", { type: "button", onClick: () => consent.openDialog('reopen'), "aria-label": t('openPreferences', 'Cookie preferences'), "data-consent-reopen": true, className: webConsentUtils.cn('fixed bottom-1 left-1 z-[999997] inline-flex h-11 w-11 items-center justify-center rounded border-0 bg-transparent p-0 text-muted-foreground opacity-70 transition-opacity hover:opacity-100 hover:text-primary focus-visible:opacity-100', FOCUS), children: _jsx(Cookie, { className: "h-5 w-5", "aria-hidden": "true" }) })] });
|
|
73
55
|
};
|
|
74
56
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/consent/component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/consent/component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAW,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,0BAA0B,EAAsB,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC3H,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,8FAA8F;AAC9F,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAC7B,gJAAgJ,EAChJ,KAAK,CACN,CAAA;AAED,kGAAkG;AAClG,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAC7B,sJAAsJ,EACtJ,KAAK,CACN,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAA2B,KAAK,CAAC,EAAE;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,0BAA0B,CAAA;IACjE,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAEpF,MAAM,WAAW,GAAG;QAClB,UAAU;Q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
|
|
4
|
+
* Deliberately built from raw elements rather than shadcn primitives. One of the three surfaces
|
|
5
|
+
* this serves is an Astro island on a site that vendors its own component library, and requiring a
|
|
6
|
+
* consumer to install a UI family in order to render a consent notice would put the notice out of
|
|
7
|
+
* reach of the site that needs it most.
|
|
8
|
+
*
|
|
9
|
+
* Flat by rule, because it is the first thing every new visitor of a generated app sees: the
|
|
10
|
+
* surface and every colour come from the host's theme tokens (ground, ink, muted, hairline, one
|
|
11
|
+
* accent), depth comes from a hairline border and the overlay alone, and nothing paints a
|
|
12
|
+
* gradient, a shadow, a glow or a `backdrop-filter`. The accept action is the one accent pill,
|
|
13
|
+
* the others are outlined pills; every control is at least 44px tall and shows a 3px focus ring.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The focus ring every control here shows: 3px solid in the theme's ring colour, 3px off the
|
|
17
|
+
* element. An outline rather than a box-shadow ring, so it survives a host that zeroes shadows.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FOCUS = "focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-ring";
|
|
20
|
+
//# sourceMappingURL=consts.local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/consent/consts.local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH;;;GAGG;AACH,eAAO,MAAM,KAAK,sFAAsF,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cookie preferences dialog, and the button that brings it back.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately built from raw elements rather than shadcn primitives. One of the three surfaces
|
|
5
|
+
* this serves is an Astro island on a site that vendors its own component library, and requiring a
|
|
6
|
+
* consumer to install a UI family in order to render a consent notice would put the notice out of
|
|
7
|
+
* reach of the site that needs it most.
|
|
8
|
+
*
|
|
9
|
+
* Flat by rule, because it is the first thing every new visitor of a generated app sees: the
|
|
10
|
+
* surface and every colour come from the host's theme tokens (ground, ink, muted, hairline, one
|
|
11
|
+
* accent), depth comes from a hairline border and the overlay alone, and nothing paints a
|
|
12
|
+
* gradient, a shadow, a glow or a `backdrop-filter`. The accept action is the one accent pill,
|
|
13
|
+
* the others are outlined pills; every control is at least 44px tall and shows a 3px focus ring.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The focus ring every control here shows: 3px solid in the theme's ring colour, 3px off the
|
|
17
|
+
* element. An outline rather than a box-shadow ring, so it survives a host that zeroes shadows.
|
|
18
|
+
*/
|
|
19
|
+
export const FOCUS = 'focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-ring';
|
|
20
|
+
//# sourceMappingURL=consts.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/consent/consts.local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,mFAAmF,CAAA"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
description: string;
|
|
6
|
-
checked: boolean;
|
|
7
|
-
/** A required category is disclosure, not a question: locked on, and labelled as such. */
|
|
8
|
-
required?: boolean;
|
|
9
|
-
requiredLabel: string;
|
|
10
|
-
onChange: (value: boolean) => void;
|
|
11
|
-
}
|
|
2
|
+
import type { ConsentToggleProps } from './types.js';
|
|
12
3
|
/**
|
|
13
4
|
* One category row: a hairline card with the label, the description and a switch.
|
|
14
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/consent/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/consent/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA+ChD,CAAA"}
|
package/build/consent/toggle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { webConsentUtils } from '../lib/utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* One category row: a hairline card with the label, the description and a switch.
|
|
5
5
|
*
|
|
@@ -20,6 +20,6 @@ export const ConsentToggle = ({ id, label, description, checked, required, requi
|
|
|
20
20
|
...(required === true ? [`${id}-required`] : []),
|
|
21
21
|
...(description !== '' ? [`${id}-desc`] : []),
|
|
22
22
|
];
|
|
23
|
-
return (_jsxs("div", { className: "flex items-center justify-between gap-4 rounded-2xl border border-border p-4", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "mb-0.5 flex flex-wrap items-center gap-x-2 text-sm font-bold text-foreground", children: [_jsx("span", { id: `${id}-label`, children: label }), required === true && _jsx("span", { id: `${id}-required`, className: "text-xs font-bold uppercase tracking-wide text-muted-foreground", children: requiredLabel })] }), description !== '' && _jsx("p", { id: `${id}-desc`, className: "text-pretty text-xs leading-relaxed text-muted-foreground", children: description })] }), _jsxs("label", { className: cn('relative inline-flex h-11 w-14 flex-shrink-0 items-center justify-center', required === true ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'), children: [_jsx("input", { id: id, type: "checkbox", "aria-labelledby": `${id}-label`, ...(described.length > 0 ? { 'aria-describedby': described.join(' ') } : {}), className: "peer sr-only", checked: checked || required === true, disabled: required === true, onChange: event => onChange(event.target.checked) }), _jsx("span", { className: cn('relative h-6 w-11 rounded-full transition-colors duration-300 peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-ring', checked || required === true ? 'bg-primary' : 'bg-muted-foreground/40'), children: _jsx("span", { className: cn('absolute top-0.5 left-0 h-5 w-5 rounded-full bg-white transition-transform duration-300', checked || required === true ? 'translate-x-5' : 'translate-x-0.5') }) })] })] }));
|
|
23
|
+
return (_jsxs("div", { className: "flex items-center justify-between gap-4 rounded-2xl border border-border p-4", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "mb-0.5 flex flex-wrap items-center gap-x-2 text-sm font-bold text-foreground", children: [_jsx("span", { id: `${id}-label`, children: label }), required === true && _jsx("span", { id: `${id}-required`, className: "text-xs font-bold uppercase tracking-wide text-muted-foreground", children: requiredLabel })] }), description !== '' && _jsx("p", { id: `${id}-desc`, className: "text-pretty text-xs leading-relaxed text-muted-foreground", children: description })] }), _jsxs("label", { className: webConsentUtils.cn('relative inline-flex h-11 w-14 flex-shrink-0 items-center justify-center', required === true ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'), children: [_jsx("input", { id: id, type: "checkbox", "aria-labelledby": `${id}-label`, ...(described.length > 0 ? { 'aria-describedby': described.join(' ') } : {}), className: "peer sr-only", checked: checked || required === true, disabled: required === true, onChange: event => onChange(event.target.checked) }), _jsx("span", { className: webConsentUtils.cn('relative h-6 w-11 rounded-full transition-colors duration-300 peer-focus-visible:outline-3 peer-focus-visible:outline-offset-3 peer-focus-visible:outline-ring', checked || required === true ? 'bg-primary' : 'bg-muted-foreground/40'), children: _jsx("span", { className: webConsentUtils.cn('absolute top-0.5 left-0 h-5 w-5 rounded-full bg-white transition-transform duration-300', checked || required === true ? 'translate-x-5' : 'translate-x-0.5') }) })] })] }));
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../src/consent/toggle.tsx"],"names":[],"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,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7E,SAAS,EAAC,cAAc,EACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,KAAK,IAAI,EACrC,QAAQ,EAAE,QAAQ,KAAK,IAAI,EAC3B,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GACjD,EACF,eAAM,SAAS,EAAE,eAAe,CAAC,EAAE,CACjC,gKAAgK,EAChK,OAAO,IAAI,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAwB,CACvE,YACC,eAAM,SAAS,EAAE,eAAe,CAAC,EAAE,CACjC,yFAAyF,EACzF,OAAO,IAAI,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,CACnE,GAAI,GACA,IACD,IACJ,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ConsentToggleProps {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
/** A required category is disclosure, not a question: locked on, and labelled as such. */
|
|
7
|
+
required?: boolean;
|
|
8
|
+
requiredLabel: string;
|
|
9
|
+
onChange: (value: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/consent/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/consent/types.ts"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,7 @@ import type { ConsentMenuWidgetProps } from '../types.js';
|
|
|
11
11
|
* button while this row is reachable announces that from whatever component of its own stays
|
|
12
12
|
* mounted for the menu's whole lifetime — see `useConsentMenuPresence` in `@owlmeans/web-panel/consent`.
|
|
13
13
|
*
|
|
14
|
-
* Uses `
|
|
14
|
+
* Uses `consentStore.open` directly rather than the `useConsent()` hook: that hook's mount itself
|
|
15
15
|
* triggers `consentStore.init()`, which a row that only needs to trigger a reopen must not do.
|
|
16
16
|
*/
|
|
17
17
|
export declare const ConsentMenuWidget: FC<ConsentMenuWidgetProps>;
|
package/build/consent/widget.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Cookie } from 'lucide-react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { consentStore, consentI18nHelper } from '@owlmeans/consent';
|
|
5
|
+
import { webConsentUtils } from '../lib/utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* One row a HOST'S OWN menu can render to reopen the preferences dialog, in place of (or beside)
|
|
8
8
|
* the floating button `CookieConsent` renders itself. No outer row padding here — the host's own
|
|
@@ -14,18 +14,18 @@ import { cn } from '../lib/utils.js';
|
|
|
14
14
|
* button while this row is reachable announces that from whatever component of its own stays
|
|
15
15
|
* mounted for the menu's whole lifetime — see `useConsentMenuPresence` in `@owlmeans/web-panel/consent`.
|
|
16
16
|
*
|
|
17
|
-
* Uses `
|
|
17
|
+
* Uses `consentStore.open` directly rather than the `useConsent()` hook: that hook's mount itself
|
|
18
18
|
* triggers `consentStore.init()`, which a row that only needs to trigger a reopen must not do.
|
|
19
19
|
*/
|
|
20
20
|
export const ConsentMenuWidget = props => {
|
|
21
|
-
const t = props.translate ?? defaultConsentTranslate(props.locale);
|
|
21
|
+
const t = props.translate ?? consentI18nHelper.defaultConsentTranslate(props.locale);
|
|
22
22
|
const onClick = useCallback(() => {
|
|
23
23
|
if (props.onSelect != null) {
|
|
24
24
|
props.onSelect();
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
consentStore.open('reopen');
|
|
28
28
|
}, [props.onSelect]);
|
|
29
|
-
return _jsxs("button", { type: "button", onClick: onClick, "data-consent-menu-widget": true, className: cn('flex w-full min-w-0 items-center gap-2 rounded-md text-left text-sm text-popover-foreground transition-colors hover:bg-accent', props.className), children: [_jsx(Cookie, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "flex-1 truncate", children: props.label ?? t('openPreferences', 'Cookie preferences') })] });
|
|
29
|
+
return _jsxs("button", { type: "button", onClick: onClick, "data-consent-menu-widget": true, className: webConsentUtils.cn('flex w-full min-w-0 items-center gap-2 rounded-md text-left text-sm text-popover-foreground transition-colors hover:bg-accent', props.className), children: [_jsx(Cookie, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "flex-1 truncate", children: props.label ?? t('openPreferences', 'Cookie preferences') })] });
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/consent/widget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/consent/widget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+B,KAAK,CAAC,EAAE;IACnE,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAEpF,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/B,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;YAC3B,KAAK,CAAC,QAAQ,EAAE,CAAA;YAChB,OAAM;QACR,CAAC;QACD,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC7B,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEpB,OAAO,kBACL,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,oCAC9B,SAAS,EAAE,eAAe,CAAC,EAAE,CAC3B,+HAA+H,EAC/H,KAAK,CAAC,SAAS,CAChB,aAED,KAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,iBAAa,MAAM,GAAG,EAC1D,eAAM,SAAS,EAAC,iBAAiB,YAAE,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAQ,IAC7F,CAAA;AACX,CAAC,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export * from './hooks.js';
|
|
|
3
3
|
export * from './consent/component.js';
|
|
4
4
|
export * from './consent/widget.js';
|
|
5
5
|
export * from './consent/toggle.js';
|
|
6
|
+
export type * from './consent/types.js';
|
|
6
7
|
export * from './policy/component.js';
|
|
7
|
-
export { consentStore, openConsent, isConsented, readConsent, writeConsent, clearConsent,
|
|
8
|
-
export type { ConsentCategory, ConsentOptions, ConsentReason, ConsentRecord, ConsentService, ConsentSignal, ConsentState, ConsentStore, ConsentLocale, ConsentLinkerOptions, ConsentLinkerLanguage, ConsentPlugin, ConsentLinkPayload, } from '@owlmeans/consent';
|
|
8
|
+
export { consentStore, openConsent, isConsented, readConsent, writeConsent, clearConsent, consentBootstrapScript, DEFAULT_CONSENT_CATEGORIES, DEFAULT_CONSENT_MESSAGES, defaultConsentTranslate, CONSENT_KEY, CONSENT_COOKIE_DAYS, CONSENT_SCHEMA_VERSION, CONSENT_LOCALES, CONSENT_ESSENTIAL, CONSENT_ANALYTICS, CONSENT_MARKETING, decorateConsentUrl, CONSENT_LANGUAGE_KEY, CONSENT_EVENT, encodeConsentLink, consentLinkerScript, CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW, consentStorageHelper, consentModeHelper, consentI18nHelper, consentPluginHelper, consentLinkHelper, } from '@owlmeans/consent';
|
|
9
|
+
export type { ConsentCategory, ConsentOptions, ConsentReason, ConsentRecord, ConsentService, ConsentSignal, ConsentState, ConsentStore, ConsentLocale, ConsentLinkerOptions, ConsentLinkerLanguage, ConsentPlugin, ConsentLinkPayload, ConsentStorageHelper, ConsentModeHelper, ConsentI18nHelper, ConsentPluginHelper, ConsentLinkHelper, } from '@owlmeans/consent';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AAErC,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAC/E,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,mBAAmB,oBAAoB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AAErC,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAC/E,sBAAsB,EACtB,0BAA0B,EAAE,wBAAwB,EAAE,uBAAuB,EAC7E,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,eAAe,EACzE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EACvD,kBAAkB,EAAE,oBAAoB,EACxC,aAAa,EACb,iBAAiB,EAAE,mBAAmB,EACtC,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,EAC3D,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,GACnG,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAC5F,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,aAAa,EAAE,kBAAkB,EACzH,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,GACnG,MAAM,mBAAmB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -3,5 +3,5 @@ export * from './consent/component.js';
|
|
|
3
3
|
export * from './consent/widget.js';
|
|
4
4
|
export * from './consent/toggle.js';
|
|
5
5
|
export * from './policy/component.js';
|
|
6
|
-
export { consentStore, openConsent, isConsented, readConsent, writeConsent, clearConsent,
|
|
6
|
+
export { consentStore, openConsent, isConsented, readConsent, writeConsent, clearConsent, consentBootstrapScript, DEFAULT_CONSENT_CATEGORIES, DEFAULT_CONSENT_MESSAGES, defaultConsentTranslate, CONSENT_KEY, CONSENT_COOKIE_DAYS, CONSENT_SCHEMA_VERSION, CONSENT_LOCALES, CONSENT_ESSENTIAL, CONSENT_ANALYTICS, CONSENT_MARKETING, decorateConsentUrl, CONSENT_LANGUAGE_KEY, CONSENT_EVENT, encodeConsentLink, consentLinkerScript, CONSENT_LINK_PARAM, CONSENT_LINK_MAX_AGE, CONSENT_LINK_SKEW, consentStorageHelper, consentModeHelper, consentI18nHelper, consentPluginHelper, consentLinkHelper, } from '@owlmeans/consent';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,uBAAuB,CAAA;AAErC,OAAO,EACL,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAC/E,sBAAsB,EACtB,0BAA0B,EAAE,wBAAwB,EAAE,uBAAuB,EAC7E,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,eAAe,EACzE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EACvD,kBAAkB,EAAE,oBAAoB,EACxC,aAAa,EACb,iBAAiB,EAAE,mBAAmB,EACtC,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,EAC3D,oBAAoB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,GACnG,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ClassValue } from 'clsx';
|
|
2
|
+
import type { ConsentLinkerOptions } from '@owlmeans/consent';
|
|
3
|
+
/** What the dialog and the policy page share: class merging and the disclosed domains. */
|
|
4
|
+
export interface WebConsentUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Class-name merge, owned by this package rather than reached through the `@` alias contract.
|
|
7
|
+
*
|
|
8
|
+
* The `@` contract exists so a consumer's own THEME and shadcn primitives win over a package's
|
|
9
|
+
* copies. `cn` has neither in it — it is four lines of string merging — and requiring an alias for
|
|
10
|
+
* it would mean every consumer of a consent dialog must first adopt an OwlMeans UI contract. One
|
|
11
|
+
* of the sites that needs this dialog most is an Astro site with its own component library and no
|
|
12
|
+
* such alias, so the dialog would simply fail to build there.
|
|
13
|
+
*/
|
|
14
|
+
cn: (...inputs: ClassValue[]) => string;
|
|
15
|
+
/**
|
|
16
|
+
* The domains one document's choice is disclosed as applying to: this host plus every domain
|
|
17
|
+
* `linker` names, deduplicated, current host first.
|
|
18
|
+
*
|
|
19
|
+
* Computed directly from `linker.domains` rather than through `@owlmeans/consent`'s
|
|
20
|
+
* `consentDomains()` registry helper: `CookieConsent` and `CookiePolicy` already have the
|
|
21
|
+
* configuration in hand as a prop, and a component that reads it straight has no reason to depend
|
|
22
|
+
* on whether `consentLinker` has finished registering itself yet (`consentStore.init` runs that
|
|
23
|
+
* registration from an effect, a render tick after mount). `consentDomains()` stays the right call
|
|
24
|
+
* for a caller that does NOT have `linker` in hand.
|
|
25
|
+
*/
|
|
26
|
+
disclosedDomains: (linker: ConsentLinkerOptions | undefined) => string[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B;;;;;;;;OAQG;IACH,EAAE,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,KAAK,MAAM,CAAA;IACvC;;;;;;;;;;OAUG;IACH,gBAAgB,EAAE,CAAC,MAAM,EAAE,oBAAoB,GAAG,SAAS,KAAK,MAAM,EAAE,CAAA;CACzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":""}
|
package/build/lib/utils.d.ts
CHANGED
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Class-name merge, owned by this package rather than reached through the `@` alias contract.
|
|
5
|
-
*
|
|
6
|
-
* The `@` contract exists so a consumer's own THEME and shadcn primitives win over a package's
|
|
7
|
-
* copies. `cn` has neither in it — it is four lines of string merging — and requiring an alias for
|
|
8
|
-
* it would mean every consumer of a consent dialog must first adopt an OwlMeans UI contract. One
|
|
9
|
-
* of the sites that needs this dialog most is an Astro site with its own component library and no
|
|
10
|
-
* such alias, so the dialog would simply fail to build there.
|
|
11
|
-
*/
|
|
12
|
-
export declare function cn(...inputs: ClassValue[]): string;
|
|
13
|
-
/**
|
|
14
|
-
* The domains one document's choice is disclosed as applying to: this host plus every domain
|
|
15
|
-
* `linker` names, deduplicated, current host first.
|
|
16
|
-
*
|
|
17
|
-
* Computed directly from `linker.domains` rather than through `@owlmeans/consent`'s
|
|
18
|
-
* `consentDomains()` registry helper: `CookieConsent` and `CookiePolicy` already have the
|
|
19
|
-
* configuration in hand as a prop, and a component that reads it straight has no reason to depend
|
|
20
|
-
* on whether `consentLinker` has finished registering itself yet (`consentStore.init` runs that
|
|
21
|
-
* registration from an effect, a render tick after mount). `consentDomains()` stays the right call
|
|
22
|
-
* for a caller that does NOT have `linker` in hand.
|
|
23
|
-
*/
|
|
24
|
-
export declare const disclosedDomains: (linker: ConsentLinkerOptions | undefined) => string[];
|
|
1
|
+
import type { WebConsentUtils } from './utils/types.js';
|
|
2
|
+
export declare const createWebConsentUtils: () => WebConsentUtils;
|
|
3
|
+
export declare const webConsentUtils: WebConsentUtils;
|
|
25
4
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,eAAO,MAAM,qBAAqB,QAAO,eAUxC,CAAA;AAED,eAAO,MAAM,eAAe,iBAA0B,CAAA"}
|