@consenti/ui 0.4.0 → 0.6.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/dist/react.d.cts CHANGED
@@ -64,6 +64,10 @@ type ComplianceType = 'auto' | ComplianceGroupId | (string & {}) | Symbol;
64
64
 
65
65
  interface ComplianceMapData {
66
66
  version: string;
67
+ /** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
68
+ * resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
69
+ * replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
70
+ override?: boolean;
67
71
  countries: Record<string, CountryComplianceEntry>;
68
72
  }
69
73
  interface CountryComplianceEntry {
@@ -83,6 +87,9 @@ interface ConsentDbRecord {
83
87
  tenantId: string;
84
88
  visitorId: string;
85
89
  profileId: string;
90
+ /** The profile's `version` when this consent was last given — with `profileId`, pins the exact
91
+ * on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
92
+ profileVersion?: number;
86
93
  locale: string;
87
94
  consentJson: ConsentValue;
88
95
  gpcDetected: boolean;
@@ -281,7 +288,12 @@ interface ResolvedProfile {
281
288
  /** Apply WCAG 2.1 AA accessibility enhancements to the widget. */
282
289
  enhanceAccessibility?: boolean;
283
290
  }
284
- type WidgetCountryResolverFn = () => Promise<{
291
+ type WidgetCountryResolverFn = (hints: {
292
+ timezone: string;
293
+ language: string;
294
+ languages: string[];
295
+ locale: string;
296
+ }) => Promise<{
285
297
  country: string | null;
286
298
  region: string | null;
287
299
  confidence: number;
@@ -340,8 +352,11 @@ interface ComplianceWidgetConfig {
340
352
  * document from (the browser's own HTTP cache honors whatever `Cache-Control`/`ETag` the
341
353
  * response sends — no custom caching here), or an inline operator-supplied `ComplianceMapData`
342
354
  * object. Invalid data from either a URL or an object logs a warning and falls back to
343
- * `'default'`. Only overrides the country→group mapping — country/region detection itself
344
- * always uses the embedded geo data. */
355
+ * `'default'`. Only overrides the country→group mapping — country/region detection itself always
356
+ * uses the embedded geo data. A country the map doesn't list falls back to the embedded mapping
357
+ * unless the document sets `override: true` (then it gets the strictest group, `'opt-in'`).
358
+ * Unlike the server, an omitted `override` is NOT `true` here: widget maps have always merged
359
+ * over the embedded mapping, and that stays the default. */
345
360
  complianceMap?: 'default' | string | ComplianceMapData;
346
361
  tcf?: TcfWidgetConfig;
347
362
  gpp?: GppWidgetConfig;
@@ -622,6 +637,7 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
622
637
  private initializing;
623
638
  private profile;
624
639
  private resolvedBase;
640
+ private profilePatches;
625
641
  /** cookieId → Category lookup, rebuilt whenever `profile` changes. Avoids rescanning categories on every consent action. */
626
642
  private categoryIndex;
627
643
  /** Watchers created by the declarative `data-consenti-*` DOM scan — destroyed alongside the widget since they have no other owner. */
@@ -677,6 +693,14 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
677
693
  * cookies per compliance group (built-in or custom) without authoring a separate profile for
678
694
  * each one. Applied before `profileOverride`, which still always wins as the final catch-all. */
679
695
  private applyComplianceGroupOverride;
696
+ /**
697
+ * Applied in order: compliance-group override → `config.profileOverride` → each `setProfile()`
698
+ * patch. The `setProfile()` patches are kept as a list and replayed, not folded into one
699
+ * object, because folding runs `deepMerge` patch-onto-patch, which consumes `null`/`'*': null`
700
+ * delete markers before they ever reach the profile they were meant to delete from.
701
+ */
702
+ private applyProfileOverrides;
703
+ private warnIfAcceptOnly;
680
704
  /**
681
705
  * Whether `window.__tcfapi`/`window.__gpp` should stay uninstalled because the corresponding
682
706
  * server-side registration (`compliance.tcf`/`compliance.gpp`) is unconfirmed (cmpId/cmpVersion
package/dist/react.d.ts CHANGED
@@ -64,6 +64,10 @@ type ComplianceType = 'auto' | ComplianceGroupId | (string & {}) | Symbol;
64
64
 
65
65
  interface ComplianceMapData {
66
66
  version: string;
67
+ /** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
68
+ * resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
69
+ * replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
70
+ override?: boolean;
67
71
  countries: Record<string, CountryComplianceEntry>;
68
72
  }
69
73
  interface CountryComplianceEntry {
@@ -83,6 +87,9 @@ interface ConsentDbRecord {
83
87
  tenantId: string;
84
88
  visitorId: string;
85
89
  profileId: string;
90
+ /** The profile's `version` when this consent was last given — with `profileId`, pins the exact
91
+ * on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
92
+ profileVersion?: number;
86
93
  locale: string;
87
94
  consentJson: ConsentValue;
88
95
  gpcDetected: boolean;
@@ -281,7 +288,12 @@ interface ResolvedProfile {
281
288
  /** Apply WCAG 2.1 AA accessibility enhancements to the widget. */
282
289
  enhanceAccessibility?: boolean;
283
290
  }
284
- type WidgetCountryResolverFn = () => Promise<{
291
+ type WidgetCountryResolverFn = (hints: {
292
+ timezone: string;
293
+ language: string;
294
+ languages: string[];
295
+ locale: string;
296
+ }) => Promise<{
285
297
  country: string | null;
286
298
  region: string | null;
287
299
  confidence: number;
@@ -340,8 +352,11 @@ interface ComplianceWidgetConfig {
340
352
  * document from (the browser's own HTTP cache honors whatever `Cache-Control`/`ETag` the
341
353
  * response sends — no custom caching here), or an inline operator-supplied `ComplianceMapData`
342
354
  * object. Invalid data from either a URL or an object logs a warning and falls back to
343
- * `'default'`. Only overrides the country→group mapping — country/region detection itself
344
- * always uses the embedded geo data. */
355
+ * `'default'`. Only overrides the country→group mapping — country/region detection itself always
356
+ * uses the embedded geo data. A country the map doesn't list falls back to the embedded mapping
357
+ * unless the document sets `override: true` (then it gets the strictest group, `'opt-in'`).
358
+ * Unlike the server, an omitted `override` is NOT `true` here: widget maps have always merged
359
+ * over the embedded mapping, and that stays the default. */
345
360
  complianceMap?: 'default' | string | ComplianceMapData;
346
361
  tcf?: TcfWidgetConfig;
347
362
  gpp?: GppWidgetConfig;
@@ -622,6 +637,7 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
622
637
  private initializing;
623
638
  private profile;
624
639
  private resolvedBase;
640
+ private profilePatches;
625
641
  /** cookieId → Category lookup, rebuilt whenever `profile` changes. Avoids rescanning categories on every consent action. */
626
642
  private categoryIndex;
627
643
  /** Watchers created by the declarative `data-consenti-*` DOM scan — destroyed alongside the widget since they have no other owner. */
@@ -677,6 +693,14 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
677
693
  * cookies per compliance group (built-in or custom) without authoring a separate profile for
678
694
  * each one. Applied before `profileOverride`, which still always wins as the final catch-all. */
679
695
  private applyComplianceGroupOverride;
696
+ /**
697
+ * Applied in order: compliance-group override → `config.profileOverride` → each `setProfile()`
698
+ * patch. The `setProfile()` patches are kept as a list and replayed, not folded into one
699
+ * object, because folding runs `deepMerge` patch-onto-patch, which consumes `null`/`'*': null`
700
+ * delete markers before they ever reach the profile they were meant to delete from.
701
+ */
702
+ private applyProfileOverrides;
703
+ private warnIfAcceptOnly;
680
704
  /**
681
705
  * Whether `window.__tcfapi`/`window.__gpp` should stay uninstalled because the corresponding
682
706
  * server-side registration (`compliance.tcf`/`compliance.gpp`) is unconfirmed (cmpId/cmpVersion
package/dist/vue.d.cts CHANGED
@@ -66,6 +66,10 @@ type ComplianceType = 'auto' | ComplianceGroupId | (string & {}) | Symbol;
66
66
 
67
67
  interface ComplianceMapData {
68
68
  version: string;
69
+ /** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
70
+ * resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
71
+ * replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
72
+ override?: boolean;
69
73
  countries: Record<string, CountryComplianceEntry>;
70
74
  }
71
75
  interface CountryComplianceEntry {
@@ -85,6 +89,9 @@ interface ConsentDbRecord {
85
89
  tenantId: string;
86
90
  visitorId: string;
87
91
  profileId: string;
92
+ /** The profile's `version` when this consent was last given — with `profileId`, pins the exact
93
+ * on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
94
+ profileVersion?: number;
88
95
  locale: string;
89
96
  consentJson: ConsentValue;
90
97
  gpcDetected: boolean;
@@ -283,7 +290,12 @@ interface ResolvedProfile {
283
290
  /** Apply WCAG 2.1 AA accessibility enhancements to the widget. */
284
291
  enhanceAccessibility?: boolean;
285
292
  }
286
- type WidgetCountryResolverFn = () => Promise<{
293
+ type WidgetCountryResolverFn = (hints: {
294
+ timezone: string;
295
+ language: string;
296
+ languages: string[];
297
+ locale: string;
298
+ }) => Promise<{
287
299
  country: string | null;
288
300
  region: string | null;
289
301
  confidence: number;
@@ -342,8 +354,11 @@ interface ComplianceWidgetConfig {
342
354
  * document from (the browser's own HTTP cache honors whatever `Cache-Control`/`ETag` the
343
355
  * response sends — no custom caching here), or an inline operator-supplied `ComplianceMapData`
344
356
  * object. Invalid data from either a URL or an object logs a warning and falls back to
345
- * `'default'`. Only overrides the country→group mapping — country/region detection itself
346
- * always uses the embedded geo data. */
357
+ * `'default'`. Only overrides the country→group mapping — country/region detection itself always
358
+ * uses the embedded geo data. A country the map doesn't list falls back to the embedded mapping
359
+ * unless the document sets `override: true` (then it gets the strictest group, `'opt-in'`).
360
+ * Unlike the server, an omitted `override` is NOT `true` here: widget maps have always merged
361
+ * over the embedded mapping, and that stays the default. */
347
362
  complianceMap?: 'default' | string | ComplianceMapData;
348
363
  tcf?: TcfWidgetConfig;
349
364
  gpp?: GppWidgetConfig;
@@ -624,6 +639,7 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
624
639
  private initializing;
625
640
  private profile;
626
641
  private resolvedBase;
642
+ private profilePatches;
627
643
  /** cookieId → Category lookup, rebuilt whenever `profile` changes. Avoids rescanning categories on every consent action. */
628
644
  private categoryIndex;
629
645
  /** Watchers created by the declarative `data-consenti-*` DOM scan — destroyed alongside the widget since they have no other owner. */
@@ -679,6 +695,14 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
679
695
  * cookies per compliance group (built-in or custom) without authoring a separate profile for
680
696
  * each one. Applied before `profileOverride`, which still always wins as the final catch-all. */
681
697
  private applyComplianceGroupOverride;
698
+ /**
699
+ * Applied in order: compliance-group override → `config.profileOverride` → each `setProfile()`
700
+ * patch. The `setProfile()` patches are kept as a list and replayed, not folded into one
701
+ * object, because folding runs `deepMerge` patch-onto-patch, which consumes `null`/`'*': null`
702
+ * delete markers before they ever reach the profile they were meant to delete from.
703
+ */
704
+ private applyProfileOverrides;
705
+ private warnIfAcceptOnly;
682
706
  /**
683
707
  * Whether `window.__tcfapi`/`window.__gpp` should stay uninstalled because the corresponding
684
708
  * server-side registration (`compliance.tcf`/`compliance.gpp`) is unconfirmed (cmpId/cmpVersion
package/dist/vue.d.ts CHANGED
@@ -66,6 +66,10 @@ type ComplianceType = 'auto' | ComplianceGroupId | (string & {}) | Symbol;
66
66
 
67
67
  interface ComplianceMapData {
68
68
  version: string;
69
+ /** `true` (default): this map replaces the embedded one entirely, so only the countries listed here
70
+ * resolve (server side). `false`: `countries` is merged over the embedded map — a listed country
71
+ * replaces its embedded entry wholesale, every unlisted country keeps its built-in mapping. */
72
+ override?: boolean;
69
73
  countries: Record<string, CountryComplianceEntry>;
70
74
  }
71
75
  interface CountryComplianceEntry {
@@ -85,6 +89,9 @@ interface ConsentDbRecord {
85
89
  tenantId: string;
86
90
  visitorId: string;
87
91
  profileId: string;
92
+ /** The profile's `version` when this consent was last given — with `profileId`, pins the exact
93
+ * on-disk snapshot (the banner text the visitor saw). Absent on records from before it was tracked. */
94
+ profileVersion?: number;
88
95
  locale: string;
89
96
  consentJson: ConsentValue;
90
97
  gpcDetected: boolean;
@@ -283,7 +290,12 @@ interface ResolvedProfile {
283
290
  /** Apply WCAG 2.1 AA accessibility enhancements to the widget. */
284
291
  enhanceAccessibility?: boolean;
285
292
  }
286
- type WidgetCountryResolverFn = () => Promise<{
293
+ type WidgetCountryResolverFn = (hints: {
294
+ timezone: string;
295
+ language: string;
296
+ languages: string[];
297
+ locale: string;
298
+ }) => Promise<{
287
299
  country: string | null;
288
300
  region: string | null;
289
301
  confidence: number;
@@ -342,8 +354,11 @@ interface ComplianceWidgetConfig {
342
354
  * document from (the browser's own HTTP cache honors whatever `Cache-Control`/`ETag` the
343
355
  * response sends — no custom caching here), or an inline operator-supplied `ComplianceMapData`
344
356
  * object. Invalid data from either a URL or an object logs a warning and falls back to
345
- * `'default'`. Only overrides the country→group mapping — country/region detection itself
346
- * always uses the embedded geo data. */
357
+ * `'default'`. Only overrides the country→group mapping — country/region detection itself always
358
+ * uses the embedded geo data. A country the map doesn't list falls back to the embedded mapping
359
+ * unless the document sets `override: true` (then it gets the strictest group, `'opt-in'`).
360
+ * Unlike the server, an omitted `override` is NOT `true` here: widget maps have always merged
361
+ * over the embedded mapping, and that stays the default. */
347
362
  complianceMap?: 'default' | string | ComplianceMapData;
348
363
  tcf?: TcfWidgetConfig;
349
364
  gpp?: GppWidgetConfig;
@@ -624,6 +639,7 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
624
639
  private initializing;
625
640
  private profile;
626
641
  private resolvedBase;
642
+ private profilePatches;
627
643
  /** cookieId → Category lookup, rebuilt whenever `profile` changes. Avoids rescanning categories on every consent action. */
628
644
  private categoryIndex;
629
645
  /** Watchers created by the declarative `data-consenti-*` DOM scan — destroyed alongside the widget since they have no other owner. */
@@ -679,6 +695,14 @@ declare class ConsentiSetup implements ConsentiWidgetAPI {
679
695
  * cookies per compliance group (built-in or custom) without authoring a separate profile for
680
696
  * each one. Applied before `profileOverride`, which still always wins as the final catch-all. */
681
697
  private applyComplianceGroupOverride;
698
+ /**
699
+ * Applied in order: compliance-group override → `config.profileOverride` → each `setProfile()`
700
+ * patch. The `setProfile()` patches are kept as a list and replayed, not folded into one
701
+ * object, because folding runs `deepMerge` patch-onto-patch, which consumes `null`/`'*': null`
702
+ * delete markers before they ever reach the profile they were meant to delete from.
703
+ */
704
+ private applyProfileOverrides;
705
+ private warnIfAcceptOnly;
682
706
  /**
683
707
  * Whether `window.__tcfapi`/`window.__gpp` should stay uninstalled because the corresponding
684
708
  * server-side registration (`compliance.tcf`/`compliance.gpp`) is unconfirmed (cmpId/cmpVersion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consenti/ui",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "GDPR-style cookie consent widget — zero required runtime dependencies",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -81,14 +81,14 @@
81
81
  "devDependencies": {
82
82
  "@consenti/types": "*",
83
83
  "@consenti/utils": "*",
84
- "@types/node": "^26.1.1",
85
- "@types/react": "^19.0.0",
84
+ "@types/node": "^26.1.2",
85
+ "@types/react": "^19.2.18",
86
86
  "sass": "^1.102.0",
87
87
  "tsup": "^8.5.0",
88
88
  "tsx": "^4.23.0",
89
89
  "typescript": "^6.0.3",
90
90
  "vite": "^8.2.0",
91
- "vue": "^3.5.40"
91
+ "vue": "^3.5.41"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "react": ">=18.0.0",