@luwiostack/cookie-consent 0.2.0 → 0.3.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/README.md +13 -6
- package/dist/index.cjs +164 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +164 -33
- package/dist/index.mjs.map +1 -1
- package/dist/{machine-names-DCujHBVM.cjs → machine-names--nw4DSRE.cjs} +2 -1
- package/dist/{machine-names-DAJioLt5.mjs.map → machine-names--nw4DSRE.cjs.map} +1 -1
- package/dist/{machine-names-DAJioLt5.mjs → machine-names-DX8eCM2Q.mjs} +2 -1
- package/dist/{machine-names-DCujHBVM.cjs.map → machine-names-DX8eCM2Q.mjs.map} +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/{types-ByyibBUg.d.cts → types-WpJKTgRa.d.cts} +3 -1
- package/dist/{types-ByyibBUg.d.cts.map → types-WpJKTgRa.d.cts.map} +1 -1
- package/dist/{types-ByyibBUg.d.mts → types-WpJKTgRa.d.mts} +3 -1
- package/dist/{types-ByyibBUg.d.mts.map → types-WpJKTgRa.d.mts.map} +1 -1
- package/dist/vendors.cjs +1 -1
- package/dist/vendors.d.cts +1 -1
- package/dist/vendors.d.mts +1 -1
- package/dist/vendors.mjs +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-names
|
|
1
|
+
{"version":3,"file":"machine-names--nw4DSRE.cjs","names":[],"sources":["../src/categories.ts","../src/errors.ts","../src/utils/to-machine-name.ts","../src/machine-names.ts"],"sourcesContent":["/**\n * The fixed consent categories, in display order — the same four every consent tool (and Google\n * Consent Mode) works with. `necessary` is always granted. A category's name and description are\n * translated by machine name (`consent_category_<id>`, `consent_category_<id>_description`) from\n * the package catalogs.\n */\nexport const CONSENT_CATEGORIES = ['necessary', 'preferences', 'statistics', 'marketing'] as const\n\n/** `'necessary' | 'preferences' | 'statistics' | 'marketing'` */\nexport type ConsentCategoryId = (typeof CONSENT_CATEGORIES)[number]\n\n/** The category that is always granted and can't be refused. */\nexport const REQUIRED_CATEGORY = 'necessary' satisfies ConsentCategoryId\n\n/** Whether a value is one of the fixed category ids. */\nexport function isConsentCategoryId(value: unknown): value is ConsentCategoryId {\n return (CONSENT_CATEGORIES as readonly unknown[]).includes(value)\n}\n","/** Thrown for an invalid consent configuration or an invalid stored decision. */\nexport class ConsentError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'ConsentError'\n }\n}\n","/**\n * Converts a human-readable name to a stable snake_case machine name.\n *\n * - Normalizes Unicode (NFD) and strips diacritics (é → e, ñ → n, …)\n * - Lowercases\n * - Replaces any run of non-alphanumeric characters with a single underscore\n * - Trims leading/trailing underscores\n */\nexport function toMachineName(name: string): string {\n return name\n .normalize('NFD')\n .replace(/\\p{M}/gu, '') // strip combining marks (diacritics)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_') // non-alphanumeric runs → _\n .replace(/^_|_$/g, '') // trim edges\n}\n","import type { ConsentCategoryId } from './categories'\nimport { ConsentError } from './errors'\nimport type {\n ConsentCookie,\n ConsentCookieParty,\n ConsentCookieType,\n ConsentCookieWordedMaxAge,\n ConsentTransferSafeguard,\n ConsentVendor,\n ConsentVendorDeclaration,\n} from './types'\nimport { toMachineName } from './utils/to-machine-name'\n\n// Every text a cookie list needs has one translation key: a snake_case machine name, like a\n// country's. The categories and the generic words carry a `consent_` prefix, so they can't clash\n// with the app's own keys; a vendor's is its id, a cookie's is its vendor's plus its name.\n\n/** @internal A category's name key, e.g. `consent_category_statistics`. */\nexport const categoryMachineName = (id: ConsentCategoryId) => `consent_category_${id}`\n\n/** @internal A cookie type's key, e.g. `consent_cookie_type_local_storage`. */\nexport const cookieTypeMachineName = (type: ConsentCookieType) => `consent_cookie_type_${type}`\n\n/** @internal A worded lifetime's key: `consent_max_age_session` / `consent_max_age_persistent`. */\nexport const maxAgeMachineName = (maxAge: ConsentCookieWordedMaxAge) => `consent_max_age_${maxAge}`\n\n/** @internal A cookie party's key: `consent_cookie_party_first` / `consent_cookie_party_third`. */\nexport const partyMachineName = (party: ConsentCookieParty) => `consent_cookie_party_${party}`\n\n/** @internal A transfer safeguard's key, e.g. `consent_transfer_safeguard_dpf`. */\nexport const safeguardMachineName = (safeguard: ConsentTransferSafeguard) =>\n `consent_transfer_safeguard_${safeguard}`\n\n/**\n * @internal A cookie's key: its vendor's machine name plus its name, a `*` read as `wildcard` —\n * `google_analytics` + `_ga_*` → `google_analytics_ga_wildcard`.\n */\nexport function cookieMachineName(vendor: string, cookieName: string): string {\n const name = toMachineName(cookieName.replaceAll('*', ' wildcard '))\n return name === '' ? '' : `${vendor}_${name}`\n}\n\n/**\n * @internal A vendor declaration with its machine names, cookies included. Throws when its id or a\n * cookie name has no letters or digits, or when two cookie names come out the same.\n */\nexport function toConsentVendor(declaration: ConsentVendorDeclaration): ConsentVendor {\n const where = `Vendor \"${declaration.id}\"`\n const machine_name = toMachineName(declaration.id)\n if (machine_name === '') {\n throw new ConsentError(`${where}: the id needs letters or digits for its machine name.`)\n }\n // The package's own keys (consent_category_statistics, consent_max_age_session, …) start with\n // `consent`: a vendor named so could produce one of them and render the package's text.\n if (machine_name === 'consent' || machine_name.startsWith('consent_')) {\n throw new ConsentError(\n `${where}: the machine names \"consent\" and \"consent_…\" are reserved for the package's own keys.`,\n )\n }\n const byMachineName = new Map<string, string>()\n const cookies: ConsentCookie[] = declaration.cookies.map((cookie) => {\n const key = cookieMachineName(machine_name, cookie.name)\n if (key === '') {\n throw new ConsentError(`${where}: cookie \"${cookie.name}\" needs letters or digits.`)\n }\n const clash = byMachineName.get(key)\n if (clash !== undefined && clash !== cookie.name) {\n throw new ConsentError(\n `${where}: cookies \"${clash}\" and \"${cookie.name}\" have the same machine name \"${key}\".`,\n )\n }\n byMachineName.set(key, cookie.name)\n const party: ConsentCookieParty = cookie.domain === undefined ? 'first' : 'third'\n return {\n ...cookie,\n machine_name: key,\n type_machine_name: cookieTypeMachineName(cookie.type ?? 'http'),\n party,\n party_machine_name: partyMachineName(party),\n ...(typeof cookie.max_age === 'string'\n ? { max_age_machine_name: maxAgeMachineName(cookie.max_age) }\n : {}),\n }\n })\n const { transfers: declared, ...rest } = declaration\n const transfers = declared?.map((transfer) => ({\n ...transfer,\n safeguard_machine_names: transfer.safeguards.map(safeguardMachineName),\n }))\n return {\n ...rest,\n machine_name,\n ...(transfers !== undefined ? { transfers } : {}),\n cookies,\n }\n}\n"],"mappings":";;;;;;;AAMA,MAAa,qBAAqB;CAAC;CAAa;CAAe;CAAc;AAAW;;AAMxF,MAAa,oBAAoB;;AAGjC,SAAgB,oBAAoB,OAA4C;CAC9E,OAAQ,mBAA0C,SAAS,KAAK;AAClE;;;;AChBA,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;;;;;ACEA,SAAgB,cAAc,MAAsB;CAClD,OAAO,KACJ,UAAU,KAAK,CAAC,CAChB,QAAQ,WAAW,EAAE,CAAC,CACtB,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,QAAQ,UAAU,EAAE;AACzB;;;;ACGA,MAAa,uBAAuB,OAA0B,oBAAoB;;AAGlF,MAAa,yBAAyB,SAA4B,uBAAuB;;AAGzF,MAAa,qBAAqB,WAAsC,mBAAmB;;AAG3F,MAAa,oBAAoB,UAA8B,wBAAwB;;AAGvF,MAAa,wBAAwB,cACnC,8BAA8B;;;;;AAMhC,SAAgB,kBAAkB,QAAgB,YAA4B;CAC5E,MAAM,OAAO,cAAc,WAAW,WAAW,KAAK,YAAY,CAAC;CACnE,OAAO,SAAS,KAAK,KAAK,GAAG,OAAO,GAAG;AACzC;;;;;AAMA,SAAgB,gBAAgB,aAAsD;CACpF,MAAM,QAAQ,WAAW,YAAY,GAAG;CACxC,MAAM,eAAe,cAAc,YAAY,EAAE;CACjD,IAAI,iBAAiB,IACnB,MAAM,IAAI,aAAa,GAAG,MAAM,uDAAuD;CAIzF,IAAI,iBAAiB,aAAa,aAAa,WAAW,UAAU,GAClE,MAAM,IAAI,aACR,GAAG,MAAM,uFACX;CAEF,MAAM,gCAAgB,IAAI,IAAoB;CAC9C,MAAM,UAA2B,YAAY,QAAQ,KAAK,WAAW;EACnE,MAAM,MAAM,kBAAkB,cAAc,OAAO,IAAI;EACvD,IAAI,QAAQ,IACV,MAAM,IAAI,aAAa,GAAG,MAAM,YAAY,OAAO,KAAK,2BAA2B;EAErF,MAAM,QAAQ,cAAc,IAAI,GAAG;EACnC,IAAI,UAAU,KAAA,KAAa,UAAU,OAAO,MAC1C,MAAM,IAAI,aACR,GAAG,MAAM,aAAa,MAAM,SAAS,OAAO,KAAK,gCAAgC,IAAI,GACvF;EAEF,cAAc,IAAI,KAAK,OAAO,IAAI;EAClC,MAAM,QAA4B,OAAO,WAAW,KAAA,IAAY,UAAU;EAC1E,OAAO;GACL,GAAG;GACH,cAAc;GACd,mBAAmB,sBAAsB,OAAO,QAAQ,MAAM;GAC9D;GACA,oBAAoB,iBAAiB,KAAK;GAC1C,GAAI,OAAO,OAAO,YAAY,WAC1B,EAAE,sBAAsB,kBAAkB,OAAO,OAAO,EAAE,IAC1D,CAAC;EACP;CACF,CAAC;CACD,MAAM,EAAE,WAAW,UAAU,GAAG,SAAS;CACzC,MAAM,YAAY,UAAU,KAAK,cAAc;EAC7C,GAAG;EACH,yBAAyB,SAAS,WAAW,IAAI,oBAAoB;CACvE,EAAE;CACF,OAAO;EACL,GAAG;EACH;EACA,GAAI,cAAc,KAAA,IAAY,EAAE,UAAU,IAAI,CAAC;EAC/C;CACF;AACF"}
|
|
@@ -67,6 +67,7 @@ function toConsentVendor(declaration) {
|
|
|
67
67
|
const where = `Vendor "${declaration.id}"`;
|
|
68
68
|
const machine_name = toMachineName(declaration.id);
|
|
69
69
|
if (machine_name === "") throw new ConsentError(`${where}: the id needs letters or digits for its machine name.`);
|
|
70
|
+
if (machine_name === "consent" || machine_name.startsWith("consent_")) throw new ConsentError(`${where}: the machine names "consent" and "consent_…" are reserved for the package's own keys.`);
|
|
70
71
|
const byMachineName = /* @__PURE__ */ new Map();
|
|
71
72
|
const cookies = declaration.cookies.map((cookie) => {
|
|
72
73
|
const key = cookieMachineName(machine_name, cookie.name);
|
|
@@ -99,4 +100,4 @@ function toConsentVendor(declaration) {
|
|
|
99
100
|
//#endregion
|
|
100
101
|
export { REQUIRED_CATEGORY as a, CONSENT_CATEGORIES as i, toConsentVendor as n, isConsentCategoryId as o, ConsentError as r, categoryMachineName as t };
|
|
101
102
|
|
|
102
|
-
//# sourceMappingURL=machine-names-
|
|
103
|
+
//# sourceMappingURL=machine-names-DX8eCM2Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-names-
|
|
1
|
+
{"version":3,"file":"machine-names-DX8eCM2Q.mjs","names":[],"sources":["../src/categories.ts","../src/errors.ts","../src/utils/to-machine-name.ts","../src/machine-names.ts"],"sourcesContent":["/**\n * The fixed consent categories, in display order — the same four every consent tool (and Google\n * Consent Mode) works with. `necessary` is always granted. A category's name and description are\n * translated by machine name (`consent_category_<id>`, `consent_category_<id>_description`) from\n * the package catalogs.\n */\nexport const CONSENT_CATEGORIES = ['necessary', 'preferences', 'statistics', 'marketing'] as const\n\n/** `'necessary' | 'preferences' | 'statistics' | 'marketing'` */\nexport type ConsentCategoryId = (typeof CONSENT_CATEGORIES)[number]\n\n/** The category that is always granted and can't be refused. */\nexport const REQUIRED_CATEGORY = 'necessary' satisfies ConsentCategoryId\n\n/** Whether a value is one of the fixed category ids. */\nexport function isConsentCategoryId(value: unknown): value is ConsentCategoryId {\n return (CONSENT_CATEGORIES as readonly unknown[]).includes(value)\n}\n","/** Thrown for an invalid consent configuration or an invalid stored decision. */\nexport class ConsentError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'ConsentError'\n }\n}\n","/**\n * Converts a human-readable name to a stable snake_case machine name.\n *\n * - Normalizes Unicode (NFD) and strips diacritics (é → e, ñ → n, …)\n * - Lowercases\n * - Replaces any run of non-alphanumeric characters with a single underscore\n * - Trims leading/trailing underscores\n */\nexport function toMachineName(name: string): string {\n return name\n .normalize('NFD')\n .replace(/\\p{M}/gu, '') // strip combining marks (diacritics)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_') // non-alphanumeric runs → _\n .replace(/^_|_$/g, '') // trim edges\n}\n","import type { ConsentCategoryId } from './categories'\nimport { ConsentError } from './errors'\nimport type {\n ConsentCookie,\n ConsentCookieParty,\n ConsentCookieType,\n ConsentCookieWordedMaxAge,\n ConsentTransferSafeguard,\n ConsentVendor,\n ConsentVendorDeclaration,\n} from './types'\nimport { toMachineName } from './utils/to-machine-name'\n\n// Every text a cookie list needs has one translation key: a snake_case machine name, like a\n// country's. The categories and the generic words carry a `consent_` prefix, so they can't clash\n// with the app's own keys; a vendor's is its id, a cookie's is its vendor's plus its name.\n\n/** @internal A category's name key, e.g. `consent_category_statistics`. */\nexport const categoryMachineName = (id: ConsentCategoryId) => `consent_category_${id}`\n\n/** @internal A cookie type's key, e.g. `consent_cookie_type_local_storage`. */\nexport const cookieTypeMachineName = (type: ConsentCookieType) => `consent_cookie_type_${type}`\n\n/** @internal A worded lifetime's key: `consent_max_age_session` / `consent_max_age_persistent`. */\nexport const maxAgeMachineName = (maxAge: ConsentCookieWordedMaxAge) => `consent_max_age_${maxAge}`\n\n/** @internal A cookie party's key: `consent_cookie_party_first` / `consent_cookie_party_third`. */\nexport const partyMachineName = (party: ConsentCookieParty) => `consent_cookie_party_${party}`\n\n/** @internal A transfer safeguard's key, e.g. `consent_transfer_safeguard_dpf`. */\nexport const safeguardMachineName = (safeguard: ConsentTransferSafeguard) =>\n `consent_transfer_safeguard_${safeguard}`\n\n/**\n * @internal A cookie's key: its vendor's machine name plus its name, a `*` read as `wildcard` —\n * `google_analytics` + `_ga_*` → `google_analytics_ga_wildcard`.\n */\nexport function cookieMachineName(vendor: string, cookieName: string): string {\n const name = toMachineName(cookieName.replaceAll('*', ' wildcard '))\n return name === '' ? '' : `${vendor}_${name}`\n}\n\n/**\n * @internal A vendor declaration with its machine names, cookies included. Throws when its id or a\n * cookie name has no letters or digits, or when two cookie names come out the same.\n */\nexport function toConsentVendor(declaration: ConsentVendorDeclaration): ConsentVendor {\n const where = `Vendor \"${declaration.id}\"`\n const machine_name = toMachineName(declaration.id)\n if (machine_name === '') {\n throw new ConsentError(`${where}: the id needs letters or digits for its machine name.`)\n }\n // The package's own keys (consent_category_statistics, consent_max_age_session, …) start with\n // `consent`: a vendor named so could produce one of them and render the package's text.\n if (machine_name === 'consent' || machine_name.startsWith('consent_')) {\n throw new ConsentError(\n `${where}: the machine names \"consent\" and \"consent_…\" are reserved for the package's own keys.`,\n )\n }\n const byMachineName = new Map<string, string>()\n const cookies: ConsentCookie[] = declaration.cookies.map((cookie) => {\n const key = cookieMachineName(machine_name, cookie.name)\n if (key === '') {\n throw new ConsentError(`${where}: cookie \"${cookie.name}\" needs letters or digits.`)\n }\n const clash = byMachineName.get(key)\n if (clash !== undefined && clash !== cookie.name) {\n throw new ConsentError(\n `${where}: cookies \"${clash}\" and \"${cookie.name}\" have the same machine name \"${key}\".`,\n )\n }\n byMachineName.set(key, cookie.name)\n const party: ConsentCookieParty = cookie.domain === undefined ? 'first' : 'third'\n return {\n ...cookie,\n machine_name: key,\n type_machine_name: cookieTypeMachineName(cookie.type ?? 'http'),\n party,\n party_machine_name: partyMachineName(party),\n ...(typeof cookie.max_age === 'string'\n ? { max_age_machine_name: maxAgeMachineName(cookie.max_age) }\n : {}),\n }\n })\n const { transfers: declared, ...rest } = declaration\n const transfers = declared?.map((transfer) => ({\n ...transfer,\n safeguard_machine_names: transfer.safeguards.map(safeguardMachineName),\n }))\n return {\n ...rest,\n machine_name,\n ...(transfers !== undefined ? { transfers } : {}),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a,GAAG,MAAM,YAAY,OAAO,KAAK,2BAA2B;EAErF,MAAM,QAAQ,cAAc,IAAI,GAAG;EACnC,IAAI,UAAU,KAAA,KAAa,UAAU,OAAO,MAC1C,MAAM,IAAI,aACR,GAAG,MAAM,aAAa,MAAM,SAAS,OAAO,KAAK,gCAAgC,IAAI,GACvF;EAEF,cAAc,IAAI,KAAK,OAAO,IAAI;EAClC,MAAM,QAA4B,OAAO,WAAW,KAAA,IAAY,UAAU;EAC1E,OAAO;GACL,GAAG;GACH,cAAc;GACd,mBAAmB,sBAAsB,OAAO,QAAQ,MAAM;GAC9D;GACA,oBAAoB,iBAAiB,KAAK;GAC1C,GAAI,OAAO,OAAO,YAAY,WAC1B,EAAE,sBAAsB,kBAAkB,OAAO,OAAO,EAAE,IAC1D,CAAC;EACP;CACF,CAAC;CACD,MAAM,EAAE,WAAW,UAAU,GAAG,SAAS;CACzC,MAAM,YAAY,UAAU,KAAK,cAAc;EAC7C,GAAG;EACH,yBAAyB,SAAS,WAAW,IAAI,oBAAoB;CACvE,EAAE;CACF,OAAO;EACL,GAAG;EACH;EACA,GAAI,cAAc,KAAA,IAAY,EAAE,UAAU,IAAI,CAAC;EAC/C;CACF;AACF"}
|
package/dist/react.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-
|
|
1
|
+
import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-WpJKTgRa.cjs";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
//#region src/react/consent-context.d.ts
|
|
4
4
|
interface ConsentContextValue {
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-
|
|
1
|
+
import { S as ConsentCategoryId, d as ConsentSnapshot, f as ConsentStatus, n as ConsentCategory, u as ConsentManager, y as ConsentDecision } from "./types-WpJKTgRa.mjs";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
//#region src/react/consent-context.d.ts
|
|
4
4
|
interface ConsentContextValue {
|
|
@@ -223,6 +223,8 @@ interface ConsentConfig {
|
|
|
223
223
|
* `@luwiostack/storage` (persists across tabs and restarts, synced between tabs; where storage is
|
|
224
224
|
* blocked or full the decision just isn't kept). A store you pass in fails per its own `onError`
|
|
225
225
|
* — by default a failed write throws out of `acceptAll()` & co. Pass `memoryStore()` in tests.
|
|
226
|
+
* A store of your own must return the same object from `read()` until its value changes (as
|
|
227
|
+
* `@luwiostack/storage`'s stores do): that's how consent tells a change apart.
|
|
226
228
|
*/
|
|
227
229
|
store?: ObservableStore<StoredConsent>;
|
|
228
230
|
/** The current time in epoch milliseconds. Default `Date.now` — inject for tests. */
|
|
@@ -269,4 +271,4 @@ interface ConsentManager {
|
|
|
269
271
|
}
|
|
270
272
|
//#endregion
|
|
271
273
|
export { REQUIRED_CATEGORY as C, ConsentCategoryId as S, ConsentVendorDeclaration as _, ConsentCookieDeclaration as a, ConsentDecisionInput as b, ConsentCookieType as c, ConsentSnapshot as d, ConsentStatus as f, ConsentVendor as g, ConsentTransferSafeguard as h, ConsentCookie as i, ConsentCookieWordedMaxAge as l, ConsentTransferDeclaration as m, ConsentCategory as n, ConsentCookieMaxAge as o, ConsentTransfer as p, ConsentConfig as r, ConsentCookieParty as s, ConsentCategoriesConfig as t, ConsentManager as u, StoredConsent as v, isConsentCategoryId as w, CONSENT_CATEGORIES as x, ConsentDecision as y };
|
|
272
|
-
//# sourceMappingURL=types-
|
|
274
|
+
//# sourceMappingURL=types-WpJKTgRa.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-WpJKTgRa.d.cts","names":[],"s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;;EAEpC,UAAU,KAAK,sBAAsB;;EAErC"}
|
|
@@ -223,6 +223,8 @@ interface ConsentConfig {
|
|
|
223
223
|
* `@luwiostack/storage` (persists across tabs and restarts, synced between tabs; where storage is
|
|
224
224
|
* blocked or full the decision just isn't kept). A store you pass in fails per its own `onError`
|
|
225
225
|
* — by default a failed write throws out of `acceptAll()` & co. Pass `memoryStore()` in tests.
|
|
226
|
+
* A store of your own must return the same object from `read()` until its value changes (as
|
|
227
|
+
* `@luwiostack/storage`'s stores do): that's how consent tells a change apart.
|
|
226
228
|
*/
|
|
227
229
|
store?: ObservableStore<StoredConsent>;
|
|
228
230
|
/** The current time in epoch milliseconds. Default `Date.now` — inject for tests. */
|
|
@@ -269,4 +271,4 @@ interface ConsentManager {
|
|
|
269
271
|
}
|
|
270
272
|
//#endregion
|
|
271
273
|
export { REQUIRED_CATEGORY as C, ConsentCategoryId as S, ConsentVendorDeclaration as _, ConsentCookieDeclaration as a, ConsentDecisionInput as b, ConsentCookieType as c, ConsentSnapshot as d, ConsentStatus as f, ConsentVendor as g, ConsentTransferSafeguard as h, ConsentCookie as i, ConsentCookieWordedMaxAge as l, ConsentTransferDeclaration as m, ConsentCategory as n, ConsentCookieMaxAge as o, ConsentTransfer as p, ConsentConfig as r, ConsentCookieParty as s, ConsentCategoriesConfig as t, ConsentManager as u, StoredConsent as v, isConsentCategoryId as w, CONSENT_CATEGORIES as x, ConsentDecision as y };
|
|
272
|
-
//# sourceMappingURL=types-
|
|
274
|
+
//# sourceMappingURL=types-WpJKTgRa.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-WpJKTgRa.d.mts","names":[],"sources":["../src/categories.ts","../src/domain/consent-decision.ts","../src/types.ts"],"mappings":";;;;;;;;cAMa;;KAGD,4BAA4B;;cAG3B;;iBAGG,oBAAoB,iBAAiB,SAAS;;;UCX7C;EACf;EACA;EACA,SAAS,SAAS;EAClB;;;;;;;;;cAUW;;WACF;WACA;;WAEA;UAGF;;SAQA,IAAI,OAAO,uBAAuB;;SAclC,OAAO,OAAO,uBAAuB;;EAS5C,UAAU,IAAI;;EAKd,WAAW;;EAKX,OAAO,OAAO;;EAcd,UAAU;;;;;;;;;;UCtEK;WACN,IAAI;;WAEJ;;WAEA;;WAEA;;WAEA,kBAAkB;;;;;;;UAQZ;;;;;WAKN;;WAEA;;;;;WAKA,qBAAqB;;WAErB,kBAAkB;;;;;;UAOZ,sBAAsB;;WAE5B;WACA,qBAAqB;WACrB,kBAAkB;;;;;;;KAQjB;;UAGK;;WAEN;;WAEA,qBAAqB;;;UAIf,wBAAwB;;WAE9B;;;KAIC;;KAGA;;;;;KAWA,+BAA+B;;KAG/B;;;;;UAMK;;WAEN;;WAEA,UAAU;;WAEV,OAAO;;WAEP,SAAS;;;;;WAKT;;;;;;;;UASM,sBAAsB;;;;;WAK5B;;WAEA;;WAEA,OAAO;;WAEP;;;;;WAKA;;;UAIM;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;;;;KAUU;;UAGK;WACN,QAAQ;;WAER,UAAU;;;;;;;;KAST,0BAA0B,QACpC,OAAO,4BAA4B;UAGpB;;;;;EAKf,aAAa;;;;;EAKb;;;;;EAKA;;;;;;;;;EASA,QAAQ,gBAAgB;;EAExB;;;;;EAKA,YAAY,MAAM,wBAAwB,UAAU;;;UAIrC;;WAEN,qBAAqB;;WAErB,kBAAkB;;WAElB;;EAET,eAAe;;EAEf,UAAU;;;;;;;EAOV,UAAU,UAAU,mBAAmB;;EAEvC,WAAW,UAAU;;EAErB,aAAa;;EAEb,aAAa;;EAEb,KAAK,SAAS,SAAS,qBAAqB;;EAE5C,SAAS,KAAK,sBAAsB;;EAEpC,UAAU,KAAK,sBAAsB;;EAErC"}
|
package/dist/vendors.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_machine_names = require("./machine-names
|
|
2
|
+
const require_machine_names = require("./machine-names--nw4DSRE.cjs");
|
|
3
3
|
//#region src/vendors/define-vendor.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and
|
package/dist/vendors.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ConsentCategoryId, _ as ConsentVendorDeclaration, a as ConsentCookieDeclaration, g as ConsentVendor, i as ConsentCookie, m as ConsentTransferDeclaration, p as ConsentTransfer, t as ConsentCategoriesConfig } from "./types-
|
|
1
|
+
import { S as ConsentCategoryId, _ as ConsentVendorDeclaration, a as ConsentCookieDeclaration, g as ConsentVendor, i as ConsentCookie, m as ConsentTransferDeclaration, p as ConsentTransfer, t as ConsentCategoriesConfig } from "./types-WpJKTgRa.cjs";
|
|
2
2
|
//#region src/vendors/define-vendor.d.ts
|
|
3
3
|
interface VendorPresetOptions<Name extends string = string> {
|
|
4
4
|
/**
|
package/dist/vendors.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ConsentCategoryId, _ as ConsentVendorDeclaration, a as ConsentCookieDeclaration, g as ConsentVendor, i as ConsentCookie, m as ConsentTransferDeclaration, p as ConsentTransfer, t as ConsentCategoriesConfig } from "./types-
|
|
1
|
+
import { S as ConsentCategoryId, _ as ConsentVendorDeclaration, a as ConsentCookieDeclaration, g as ConsentVendor, i as ConsentCookie, m as ConsentTransferDeclaration, p as ConsentTransfer, t as ConsentCategoriesConfig } from "./types-WpJKTgRa.mjs";
|
|
2
2
|
//#region src/vendors/define-vendor.d.ts
|
|
3
3
|
interface VendorPresetOptions<Name extends string = string> {
|
|
4
4
|
/**
|
package/dist/vendors.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as REQUIRED_CATEGORY, n as toConsentVendor, o as isConsentCategoryId, r as ConsentError } from "./machine-names-
|
|
1
|
+
import { a as REQUIRED_CATEGORY, n as toConsentVendor, o as isConsentCategoryId, r as ConsentError } from "./machine-names-DX8eCM2Q.mjs";
|
|
2
2
|
//#region src/vendors/define-vendor.ts
|
|
3
3
|
/**
|
|
4
4
|
* Define a reusable vendor preset — how every preset in `@luwiostack/cookie-consent/vendors` is built, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luwiostack/cookie-consent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Cookie consent — typed, app-defined categories with vendor cookie declarations (plus ready-made presets), persisted to localStorage with policy-version and expiry re-consent, script unblocking and removal of a withdrawn category's cookies. React-free core plus a provider, useConsent and a gating component; no UI — apps build their own banner.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"consent",
|