@walkeros/web-source-cmp-usercentrics 4.2.0 → 4.2.1-next-1781526381392

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @walkeros/web-source-cmp-usercentrics
2
2
 
3
+ ## 4.2.1-next-1781526381392
4
+
5
+ ### Patch Changes
6
+
7
+ - ec84331: Use the official Usercentrics events (UC_UI_INITIALIZED,
8
+ UC_UI_CMP_EVENT) and consent getters so a returning visitor's prior choice is
9
+ applied on load and first-visit defaults stay suppressed under explicitOnly.
10
+ The configurable eventName data-layer setting is removed; the source now uses
11
+ the always-emitted official events. Fixes consent-change events being dropped
12
+ on the current Usercentrics Web CMP.
13
+ - Updated dependencies [5cbcd23]
14
+ - @walkeros/core@4.2.1-next-1781526381392
15
+ - @walkeros/collector@4.2.1-next-1781526381392
16
+
3
17
  ## 4.2.0
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  # @walkeros/web-source-cmp-usercentrics
8
8
 
9
- Integrates Usercentrics consent management with walkerOS by listening for a
10
- configured window event and mapping category or service consent state to
11
- walkerOS consent groups.
9
+ Integrates Usercentrics consent management with walkerOS using the official
10
+ Usercentrics events and consent getters, mapping category or service consent
11
+ state to walkerOS consent groups.
12
12
 
13
13
  [Documentation](https://www.walkeros.io/docs/sources/web/cmps/usercentrics)
14
14
  •
@@ -37,6 +37,39 @@ await startFlow({
37
37
  });
38
38
  ```
39
39
 
40
+ ## How it works
41
+
42
+ The source uses Usercentrics' official integration surface, no custom data-layer
43
+ event is required:
44
+
45
+ 1. Already initialized: if the CMP has loaded before the source, consent is read
46
+ statically through the official getters (V2 `UC_UI.getServicesBaseInfo()`, V3
47
+ `__ucCmp.getConsentDetails()`).
48
+ 2. CMP loads after the source: the source listens for `UC_UI_INITIALIZED` and
49
+ reads the current consent state once the CMP signals it is ready.
50
+ 3. User decisions: the source listens for `UC_UI_CMP_EVENT` (consent actions
51
+ `ACCEPT_ALL`, `DENY_ALL`, and `SAVE`) and republishes the updated state.
52
+
53
+ Consent is then mapped via `categoryMap` and published with
54
+ `elb('walker consent', state)`.
55
+
56
+ ## Timing considerations
57
+
58
+ A returning visitor's prior choice is applied on page load, either from the
59
+ static getter read (CMP already initialized) or on `UC_UI_INITIALIZED` (CMP
60
+ loads later). First-visit defaults are suppressed under the default
61
+ `explicitOnly: true`: only a state the user has actively decided is published
62
+ (V3 `consent.type === EXPLICIT`; V2 an `EXPLICIT` entry in the service consent
63
+ history). Set `explicitOnly: false` to publish any consent snapshot, including
64
+ implicit first-visit defaults.
65
+
66
+ ## Settings
67
+
68
+ `explicitOnly` (default `true`) is the cross-version gate for "the user has
69
+ actively decided," applied identically for V2 and V3. There is no configurable
70
+ data-layer event setting: the `eventName` setting has been removed, and the
71
+ source listens to the always-emitted official events.
72
+
40
73
  ## Documentation
41
74
 
42
75
  Full configuration, mapping, and examples live in the docs:
package/dist/dev.d.mts CHANGED
@@ -31,9 +31,20 @@ interface UsercentricsEventDetail {
31
31
  declare global {
32
32
  interface WindowEventMap {
33
33
  ucEvent: CustomEvent<UsercentricsEventDetail>;
34
+ UC_UI_INITIALIZED: Event;
34
35
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
35
36
  }
36
37
  }
38
+ /** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */
39
+ type UsercentricsConsentType = 'explicit' | 'implicit';
40
+ /** A single entry in a V2 service's consent history (getServicesBaseInfo). */
41
+ interface UsercentricsV2ConsentHistoryEntry {
42
+ type: UsercentricsConsentType;
43
+ status: boolean;
44
+ /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */
45
+ action?: string;
46
+ timestamp?: number;
47
+ }
37
48
  /**
38
49
  * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.
39
50
  * Only the fields we use are typed - minimal surface, not a full V2 API mirror.
@@ -41,9 +52,13 @@ declare global {
41
52
  interface UsercentricsV2Service {
42
53
  /** Category slug: 'essential' | 'functional' | 'marketing' | custom */
43
54
  categorySlug: string;
55
+ /** Service display name (used for service-level consent keys) */
56
+ name?: string;
44
57
  /** Consent state for this service */
45
58
  consent: {
46
59
  status: boolean;
60
+ /** Consent decision history; an 'explicit' entry proves a real user decision. */
61
+ history?: UsercentricsV2ConsentHistoryEntry[];
47
62
  };
48
63
  }
49
64
  /**
@@ -55,6 +70,7 @@ interface UsercentricsV2Service {
55
70
  interface UsercentricsV2Api {
56
71
  isInitialized?: () => boolean;
57
72
  getServicesBaseInfo?: () => UsercentricsV2Service[];
73
+ getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;
58
74
  areAllConsentsAccepted?: () => boolean;
59
75
  }
60
76
  /**
@@ -101,8 +117,9 @@ interface UsercentricsV3Api {
101
117
  * `source: 'CMP'` + a decision `type` tells us a user action has been taken.
102
118
  */
103
119
  interface UsercentricsV3CmpEventDetail {
104
- source?: string;
120
+ source?: 'none' | 'button' | 'first' | 'second' | 'embeddings' | '__ucCmp' | string;
105
121
  type?: string;
122
+ abTestVariant?: string;
106
123
  }
107
124
  declare global {
108
125
  interface Window {
@@ -122,71 +139,61 @@ declare global {
122
139
  }
123
140
 
124
141
  /**
125
- * Example Usercentrics consent event detail inputs.
142
+ * Example Usercentrics V2 service inputs.
126
143
  *
127
- * These represent real event.detail payloads from Usercentrics CMP.
128
- */
129
- /**
130
- * Full consent - user accepted all categories (explicit)
144
+ * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:
145
+ * an array of services, each carrying a `categorySlug`, optional display
146
+ * `name`, and a `consent` block with the current `status` plus a decision
147
+ * `history`. The adapter derives the explicit/implicit gate from whether any
148
+ * history entry is `explicit`, and aggregates services into group-level
149
+ * consent via strict AND per `categorySlug`.
131
150
  */
132
- declare const fullConsent$1: UsercentricsEventDetail;
133
151
  /**
134
- * Partial consent - user accepted only essential and functional (explicit)
152
+ * Full consent - every category accepted via an explicit decision
153
+ * (user clicked "Accept all").
135
154
  */
136
- declare const partialConsent: UsercentricsEventDetail;
155
+ declare const servicesFullExplicit: UsercentricsV2Service[];
137
156
  /**
138
- * Minimal consent - user denied everything except essential (explicit)
157
+ * Minimal consent - only essential accepted, others denied via an explicit
158
+ * decision (user clicked "Deny all").
139
159
  */
140
- declare const minimalConsent$1: UsercentricsEventDetail;
160
+ declare const servicesMinimalExplicit: UsercentricsV2Service[];
141
161
  /**
142
- * Implicit consent - page load with default consent state
143
- * (not an explicit user choice)
162
+ * Partial consent - essential and functional accepted, marketing denied,
163
+ * all via an explicit decision (user saved a custom selection).
144
164
  */
145
- declare const implicitConsent: UsercentricsEventDetail;
165
+ declare const servicesPartialExplicit: UsercentricsV2Service[];
146
166
  /**
147
- * Explicit consent with uppercase type field (Usercentrics docs are
148
- * inconsistent about casing - some show 'EXPLICIT', others 'explicit')
167
+ * First-visit implicit state - the CMP reports page-load defaults with only
168
+ * implicit history. The default `explicitOnly` gate suppresses this, so no
169
+ * consent command is emitted.
149
170
  */
150
- declare const fullConsentUpperCase: UsercentricsEventDetail;
151
- /**
152
- * Service-level consent - ucCategory has mixed types (non-boolean values
153
- * indicate individual service-level choice rather than group-level)
154
- */
155
- declare const serviceLevelConsent: UsercentricsEventDetail;
156
- /**
157
- * Non-consent event (should be ignored)
158
- */
159
- declare const nonConsentEvent: UsercentricsEventDetail;
171
+ declare const servicesFirstVisitImplicit: UsercentricsV2Service[];
160
172
 
161
173
  /**
162
174
  * Expected walkerOS consent outputs.
163
175
  *
164
- * These represent the consent state after parsing Usercentrics event details
165
- * with no category mapping configured (pass-through).
176
+ * These represent the consent state emitted via `elb('walker consent', state)`
177
+ * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level
178
+ * consent (no category mapping configured: pass-through by `categorySlug`).
166
179
  */
167
180
  /**
168
- * Full consent - all categories true (group-level)
181
+ * Full consent - all categories granted.
169
182
  */
170
183
  declare const fullConsentMapped: WalkerOS.Consent;
171
184
  /**
172
- * Partial consent - essential and functional true, marketing false
185
+ * Partial consent - essential and functional granted, marketing denied.
173
186
  */
174
187
  declare const partialConsentMapped: WalkerOS.Consent;
175
188
  /**
176
- * Minimal consent - only essential true
189
+ * Minimal consent - only essential granted.
177
190
  */
178
191
  declare const minimalConsentMapped: WalkerOS.Consent;
179
192
  /**
180
- * Full consent with custom category mapping applied
181
- * (essential->functional, functional->functional, marketing->marketing)
193
+ * Full consent with a custom category mapping applied
194
+ * (essential->functional, functional->analytics).
182
195
  */
183
196
  declare const fullConsentCustomMapped: WalkerOS.Consent;
184
- /**
185
- * Service-level consent - individual service booleans + boolean ucCategory entries
186
- * (services normalized: lowercase, spaces to underscores)
187
- * (ucCategory boolean entries mapped through categoryMap)
188
- */
189
- declare const serviceLevelMapped: WalkerOS.Consent;
190
197
 
191
198
  /**
192
199
  * Create a properly typed elb/push function mock
@@ -197,17 +204,32 @@ declare const createMockElbFn: () => Elb.Fn;
197
204
  */
198
205
  declare const noopLogger: Logger.Instance;
199
206
 
207
+ /**
208
+ * Step examples for the Usercentrics V2 path.
209
+ *
210
+ * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test
211
+ * runner attaches it as the V2 API, then drives the official trigger named in
212
+ * `trigger.options.dispatch`:
213
+ * - 'init' (default): UC_UI is present when the source runs, so the static
214
+ * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).
215
+ * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`
216
+ * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.
217
+ */
200
218
  declare const fullConsent: Flow.StepExample;
201
219
  declare const minimalConsent: Flow.StepExample;
220
+ declare const returningVisitor: Flow.StepExample;
221
+ declare const firstVisitImplicit: Flow.StepExample;
222
+ declare const consentChange: Flow.StepExample;
202
223
  declare const categoryMapOverride: Flow.StepExample;
203
- declare const customEventName: Flow.StepExample;
204
224
 
205
225
  declare const step_categoryMapOverride: typeof categoryMapOverride;
206
- declare const step_customEventName: typeof customEventName;
226
+ declare const step_consentChange: typeof consentChange;
227
+ declare const step_firstVisitImplicit: typeof firstVisitImplicit;
207
228
  declare const step_fullConsent: typeof fullConsent;
208
229
  declare const step_minimalConsent: typeof minimalConsent;
230
+ declare const step_returningVisitor: typeof returningVisitor;
209
231
  declare namespace step {
210
- export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
232
+ export { step_categoryMapOverride as categoryMapOverride, step_consentChange as consentChange, step_firstVisitImplicit as firstVisitImplicit, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_returningVisitor as returningVisitor };
211
233
  }
212
234
 
213
235
  interface UsercentricsContent {
@@ -225,26 +247,23 @@ declare const index$1_createMockElbFn: typeof createMockElbFn;
225
247
  declare const index$1_createTrigger: typeof createTrigger;
226
248
  declare const index$1_fullConsentCustomMapped: typeof fullConsentCustomMapped;
227
249
  declare const index$1_fullConsentMapped: typeof fullConsentMapped;
228
- declare const index$1_fullConsentUpperCase: typeof fullConsentUpperCase;
229
- declare const index$1_implicitConsent: typeof implicitConsent;
230
250
  declare const index$1_minimalConsentMapped: typeof minimalConsentMapped;
231
- declare const index$1_nonConsentEvent: typeof nonConsentEvent;
232
251
  declare const index$1_noopLogger: typeof noopLogger;
233
- declare const index$1_partialConsent: typeof partialConsent;
234
252
  declare const index$1_partialConsentMapped: typeof partialConsentMapped;
235
- declare const index$1_serviceLevelConsent: typeof serviceLevelConsent;
236
- declare const index$1_serviceLevelMapped: typeof serviceLevelMapped;
253
+ declare const index$1_servicesFirstVisitImplicit: typeof servicesFirstVisitImplicit;
254
+ declare const index$1_servicesFullExplicit: typeof servicesFullExplicit;
255
+ declare const index$1_servicesMinimalExplicit: typeof servicesMinimalExplicit;
256
+ declare const index$1_servicesPartialExplicit: typeof servicesPartialExplicit;
237
257
  declare const index$1_step: typeof step;
238
258
  declare const index$1_trigger: typeof trigger;
239
259
  declare namespace index$1 {
240
- export { index$1_createMockElbFn as createMockElbFn, index$1_createTrigger as createTrigger, fullConsent$1 as fullConsent, index$1_fullConsentCustomMapped as fullConsentCustomMapped, index$1_fullConsentMapped as fullConsentMapped, index$1_fullConsentUpperCase as fullConsentUpperCase, index$1_implicitConsent as implicitConsent, minimalConsent$1 as minimalConsent, index$1_minimalConsentMapped as minimalConsentMapped, index$1_nonConsentEvent as nonConsentEvent, index$1_noopLogger as noopLogger, index$1_partialConsent as partialConsent, index$1_partialConsentMapped as partialConsentMapped, index$1_serviceLevelConsent as serviceLevelConsent, index$1_serviceLevelMapped as serviceLevelMapped, index$1_step as step, index$1_trigger as trigger };
260
+ export { index$1_createMockElbFn as createMockElbFn, index$1_createTrigger as createTrigger, index$1_fullConsentCustomMapped as fullConsentCustomMapped, index$1_fullConsentMapped as fullConsentMapped, index$1_minimalConsentMapped as minimalConsentMapped, index$1_noopLogger as noopLogger, index$1_partialConsentMapped as partialConsentMapped, index$1_servicesFirstVisitImplicit as servicesFirstVisitImplicit, index$1_servicesFullExplicit as servicesFullExplicit, index$1_servicesMinimalExplicit as servicesMinimalExplicit, index$1_servicesPartialExplicit as servicesPartialExplicit, index$1_step as step, index$1_trigger as trigger };
241
261
  }
242
262
 
243
263
  /**
244
264
  * Usercentrics source settings schema
245
265
  */
246
266
  declare const SettingsSchema: z.ZodObject<{
247
- eventName: z.ZodOptional<z.ZodString>;
248
267
  categoryMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
249
268
  explicitOnly: z.ZodOptional<z.ZodBoolean>;
250
269
  }, z.core.$strip>;
package/dist/dev.d.ts CHANGED
@@ -31,9 +31,20 @@ interface UsercentricsEventDetail {
31
31
  declare global {
32
32
  interface WindowEventMap {
33
33
  ucEvent: CustomEvent<UsercentricsEventDetail>;
34
+ UC_UI_INITIALIZED: Event;
34
35
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
35
36
  }
36
37
  }
38
+ /** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */
39
+ type UsercentricsConsentType = 'explicit' | 'implicit';
40
+ /** A single entry in a V2 service's consent history (getServicesBaseInfo). */
41
+ interface UsercentricsV2ConsentHistoryEntry {
42
+ type: UsercentricsConsentType;
43
+ status: boolean;
44
+ /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */
45
+ action?: string;
46
+ timestamp?: number;
47
+ }
37
48
  /**
38
49
  * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.
39
50
  * Only the fields we use are typed - minimal surface, not a full V2 API mirror.
@@ -41,9 +52,13 @@ declare global {
41
52
  interface UsercentricsV2Service {
42
53
  /** Category slug: 'essential' | 'functional' | 'marketing' | custom */
43
54
  categorySlug: string;
55
+ /** Service display name (used for service-level consent keys) */
56
+ name?: string;
44
57
  /** Consent state for this service */
45
58
  consent: {
46
59
  status: boolean;
60
+ /** Consent decision history; an 'explicit' entry proves a real user decision. */
61
+ history?: UsercentricsV2ConsentHistoryEntry[];
47
62
  };
48
63
  }
49
64
  /**
@@ -55,6 +70,7 @@ interface UsercentricsV2Service {
55
70
  interface UsercentricsV2Api {
56
71
  isInitialized?: () => boolean;
57
72
  getServicesBaseInfo?: () => UsercentricsV2Service[];
73
+ getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;
58
74
  areAllConsentsAccepted?: () => boolean;
59
75
  }
60
76
  /**
@@ -101,8 +117,9 @@ interface UsercentricsV3Api {
101
117
  * `source: 'CMP'` + a decision `type` tells us a user action has been taken.
102
118
  */
103
119
  interface UsercentricsV3CmpEventDetail {
104
- source?: string;
120
+ source?: 'none' | 'button' | 'first' | 'second' | 'embeddings' | '__ucCmp' | string;
105
121
  type?: string;
122
+ abTestVariant?: string;
106
123
  }
107
124
  declare global {
108
125
  interface Window {
@@ -122,71 +139,61 @@ declare global {
122
139
  }
123
140
 
124
141
  /**
125
- * Example Usercentrics consent event detail inputs.
142
+ * Example Usercentrics V2 service inputs.
126
143
  *
127
- * These represent real event.detail payloads from Usercentrics CMP.
128
- */
129
- /**
130
- * Full consent - user accepted all categories (explicit)
144
+ * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:
145
+ * an array of services, each carrying a `categorySlug`, optional display
146
+ * `name`, and a `consent` block with the current `status` plus a decision
147
+ * `history`. The adapter derives the explicit/implicit gate from whether any
148
+ * history entry is `explicit`, and aggregates services into group-level
149
+ * consent via strict AND per `categorySlug`.
131
150
  */
132
- declare const fullConsent$1: UsercentricsEventDetail;
133
151
  /**
134
- * Partial consent - user accepted only essential and functional (explicit)
152
+ * Full consent - every category accepted via an explicit decision
153
+ * (user clicked "Accept all").
135
154
  */
136
- declare const partialConsent: UsercentricsEventDetail;
155
+ declare const servicesFullExplicit: UsercentricsV2Service[];
137
156
  /**
138
- * Minimal consent - user denied everything except essential (explicit)
157
+ * Minimal consent - only essential accepted, others denied via an explicit
158
+ * decision (user clicked "Deny all").
139
159
  */
140
- declare const minimalConsent$1: UsercentricsEventDetail;
160
+ declare const servicesMinimalExplicit: UsercentricsV2Service[];
141
161
  /**
142
- * Implicit consent - page load with default consent state
143
- * (not an explicit user choice)
162
+ * Partial consent - essential and functional accepted, marketing denied,
163
+ * all via an explicit decision (user saved a custom selection).
144
164
  */
145
- declare const implicitConsent: UsercentricsEventDetail;
165
+ declare const servicesPartialExplicit: UsercentricsV2Service[];
146
166
  /**
147
- * Explicit consent with uppercase type field (Usercentrics docs are
148
- * inconsistent about casing - some show 'EXPLICIT', others 'explicit')
167
+ * First-visit implicit state - the CMP reports page-load defaults with only
168
+ * implicit history. The default `explicitOnly` gate suppresses this, so no
169
+ * consent command is emitted.
149
170
  */
150
- declare const fullConsentUpperCase: UsercentricsEventDetail;
151
- /**
152
- * Service-level consent - ucCategory has mixed types (non-boolean values
153
- * indicate individual service-level choice rather than group-level)
154
- */
155
- declare const serviceLevelConsent: UsercentricsEventDetail;
156
- /**
157
- * Non-consent event (should be ignored)
158
- */
159
- declare const nonConsentEvent: UsercentricsEventDetail;
171
+ declare const servicesFirstVisitImplicit: UsercentricsV2Service[];
160
172
 
161
173
  /**
162
174
  * Expected walkerOS consent outputs.
163
175
  *
164
- * These represent the consent state after parsing Usercentrics event details
165
- * with no category mapping configured (pass-through).
176
+ * These represent the consent state emitted via `elb('walker consent', state)`
177
+ * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level
178
+ * consent (no category mapping configured: pass-through by `categorySlug`).
166
179
  */
167
180
  /**
168
- * Full consent - all categories true (group-level)
181
+ * Full consent - all categories granted.
169
182
  */
170
183
  declare const fullConsentMapped: WalkerOS.Consent;
171
184
  /**
172
- * Partial consent - essential and functional true, marketing false
185
+ * Partial consent - essential and functional granted, marketing denied.
173
186
  */
174
187
  declare const partialConsentMapped: WalkerOS.Consent;
175
188
  /**
176
- * Minimal consent - only essential true
189
+ * Minimal consent - only essential granted.
177
190
  */
178
191
  declare const minimalConsentMapped: WalkerOS.Consent;
179
192
  /**
180
- * Full consent with custom category mapping applied
181
- * (essential->functional, functional->functional, marketing->marketing)
193
+ * Full consent with a custom category mapping applied
194
+ * (essential->functional, functional->analytics).
182
195
  */
183
196
  declare const fullConsentCustomMapped: WalkerOS.Consent;
184
- /**
185
- * Service-level consent - individual service booleans + boolean ucCategory entries
186
- * (services normalized: lowercase, spaces to underscores)
187
- * (ucCategory boolean entries mapped through categoryMap)
188
- */
189
- declare const serviceLevelMapped: WalkerOS.Consent;
190
197
 
191
198
  /**
192
199
  * Create a properly typed elb/push function mock
@@ -197,17 +204,32 @@ declare const createMockElbFn: () => Elb.Fn;
197
204
  */
198
205
  declare const noopLogger: Logger.Instance;
199
206
 
207
+ /**
208
+ * Step examples for the Usercentrics V2 path.
209
+ *
210
+ * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test
211
+ * runner attaches it as the V2 API, then drives the official trigger named in
212
+ * `trigger.options.dispatch`:
213
+ * - 'init' (default): UC_UI is present when the source runs, so the static
214
+ * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).
215
+ * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`
216
+ * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.
217
+ */
200
218
  declare const fullConsent: Flow.StepExample;
201
219
  declare const minimalConsent: Flow.StepExample;
220
+ declare const returningVisitor: Flow.StepExample;
221
+ declare const firstVisitImplicit: Flow.StepExample;
222
+ declare const consentChange: Flow.StepExample;
202
223
  declare const categoryMapOverride: Flow.StepExample;
203
- declare const customEventName: Flow.StepExample;
204
224
 
205
225
  declare const step_categoryMapOverride: typeof categoryMapOverride;
206
- declare const step_customEventName: typeof customEventName;
226
+ declare const step_consentChange: typeof consentChange;
227
+ declare const step_firstVisitImplicit: typeof firstVisitImplicit;
207
228
  declare const step_fullConsent: typeof fullConsent;
208
229
  declare const step_minimalConsent: typeof minimalConsent;
230
+ declare const step_returningVisitor: typeof returningVisitor;
209
231
  declare namespace step {
210
- export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
232
+ export { step_categoryMapOverride as categoryMapOverride, step_consentChange as consentChange, step_firstVisitImplicit as firstVisitImplicit, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_returningVisitor as returningVisitor };
211
233
  }
212
234
 
213
235
  interface UsercentricsContent {
@@ -225,26 +247,23 @@ declare const index$1_createMockElbFn: typeof createMockElbFn;
225
247
  declare const index$1_createTrigger: typeof createTrigger;
226
248
  declare const index$1_fullConsentCustomMapped: typeof fullConsentCustomMapped;
227
249
  declare const index$1_fullConsentMapped: typeof fullConsentMapped;
228
- declare const index$1_fullConsentUpperCase: typeof fullConsentUpperCase;
229
- declare const index$1_implicitConsent: typeof implicitConsent;
230
250
  declare const index$1_minimalConsentMapped: typeof minimalConsentMapped;
231
- declare const index$1_nonConsentEvent: typeof nonConsentEvent;
232
251
  declare const index$1_noopLogger: typeof noopLogger;
233
- declare const index$1_partialConsent: typeof partialConsent;
234
252
  declare const index$1_partialConsentMapped: typeof partialConsentMapped;
235
- declare const index$1_serviceLevelConsent: typeof serviceLevelConsent;
236
- declare const index$1_serviceLevelMapped: typeof serviceLevelMapped;
253
+ declare const index$1_servicesFirstVisitImplicit: typeof servicesFirstVisitImplicit;
254
+ declare const index$1_servicesFullExplicit: typeof servicesFullExplicit;
255
+ declare const index$1_servicesMinimalExplicit: typeof servicesMinimalExplicit;
256
+ declare const index$1_servicesPartialExplicit: typeof servicesPartialExplicit;
237
257
  declare const index$1_step: typeof step;
238
258
  declare const index$1_trigger: typeof trigger;
239
259
  declare namespace index$1 {
240
- export { index$1_createMockElbFn as createMockElbFn, index$1_createTrigger as createTrigger, fullConsent$1 as fullConsent, index$1_fullConsentCustomMapped as fullConsentCustomMapped, index$1_fullConsentMapped as fullConsentMapped, index$1_fullConsentUpperCase as fullConsentUpperCase, index$1_implicitConsent as implicitConsent, minimalConsent$1 as minimalConsent, index$1_minimalConsentMapped as minimalConsentMapped, index$1_nonConsentEvent as nonConsentEvent, index$1_noopLogger as noopLogger, index$1_partialConsent as partialConsent, index$1_partialConsentMapped as partialConsentMapped, index$1_serviceLevelConsent as serviceLevelConsent, index$1_serviceLevelMapped as serviceLevelMapped, index$1_step as step, index$1_trigger as trigger };
260
+ export { index$1_createMockElbFn as createMockElbFn, index$1_createTrigger as createTrigger, index$1_fullConsentCustomMapped as fullConsentCustomMapped, index$1_fullConsentMapped as fullConsentMapped, index$1_minimalConsentMapped as minimalConsentMapped, index$1_noopLogger as noopLogger, index$1_partialConsentMapped as partialConsentMapped, index$1_servicesFirstVisitImplicit as servicesFirstVisitImplicit, index$1_servicesFullExplicit as servicesFullExplicit, index$1_servicesMinimalExplicit as servicesMinimalExplicit, index$1_servicesPartialExplicit as servicesPartialExplicit, index$1_step as step, index$1_trigger as trigger };
241
261
  }
242
262
 
243
263
  /**
244
264
  * Usercentrics source settings schema
245
265
  */
246
266
  declare const SettingsSchema: z.ZodObject<{
247
- eventName: z.ZodOptional<z.ZodString>;
248
267
  categoryMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
249
268
  explicitOnly: z.ZodOptional<z.ZodBoolean>;
250
269
  }, z.core.$strip>;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};a(s,{examples:()=>r,schemas:()=>O}),module.exports=(e=s,((e,a,s,r)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of i(a))o.call(e,l)||l===s||t(e,l,{get:()=>a[l],enumerable:!(r=n(a,l))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};a(r,{createMockElbFn:()=>_,createTrigger:()=>x,fullConsent:()=>l,fullConsentCustomMapped:()=>k,fullConsentMapped:()=>y,fullConsentUpperCase:()=>u,implicitConsent:()=>p,minimalConsent:()=>g,minimalConsentMapped:()=>f,nonConsentEvent:()=>v,noopLogger:()=>b,partialConsent:()=>c,partialConsentMapped:()=>d,serviceLevelConsent:()=>m,serviceLevelMapped:()=>C,step:()=>A,trigger:()=>D});var l={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},g={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},p={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},u={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},m={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},v={event:"other_event",type:"explicit"},y={essential:!0,functional:!0,marketing:!0},d={essential:!0,functional:!0,marketing:!1},f={essential:!0,functional:!1,marketing:!1},k={functional:!0,marketing:!0},C={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},w=()=>{},_=()=>()=>Promise.resolve({ok:!0}),b={error:w,warn:w,info:w,debug:w,throw:e=>{throw"string"==typeof e?new Error(e):e},json:w,scope:()=>b},A={};a(A,{categoryMapOverride:()=>h,customEventName:()=>M,fullConsent:()=>E,minimalConsent:()=>S});var E={title:"Full consent",description:"A Usercentrics onAcceptAllServices event emits a walker consent command with essential, functional, and marketing granted.",trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:[["elb","walker consent",{essential:!0,functional:!0,marketing:!0}]]},S={title:"Minimal consent",description:"A Usercentrics onDenyAllServices event emits a walker consent command with only essential granted.",trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:[["elb","walker consent",{essential:!0,functional:!1,marketing:!1}]]},h={title:"Category map override",description:"Custom categoryMap remaps essential to functional and functional to analytics",trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!1}},mapping:{categoryMap:{essential:"functional",functional:"analytics"}},out:[["elb","walker consent",{functional:!0,analytics:!0,marketing:!1}]]},M={title:"Custom event name",description:"Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2",trigger:{type:"consent",options:{eventName:"UC_SDK_EVENT"}},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!0}},mapping:{eventName:"UC_SDK_EVENT"},out:[["elb","walker consent",{essential:!0,functional:!0,marketing:!0}]]},U=require("@walkeros/collector"),x=async e=>{let t;return{get flow(){return t},trigger:(n,i)=>async n=>{var o;if(!t){const n=await(0,U.startFlow)({...e,run:null==(o=e.run)||o});t={collector:n.collector,elb:n.elb}}const a=(null==i?void 0:i.eventName)||"ucEvent";window.dispatchEvent(new CustomEvent(a,{detail:n}))}}},D=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}},O={};a(O,{SettingsSchema:()=>N,settings:()=>P});var j=require("@walkeros/core/dev"),G=require("@walkeros/core/dev"),N=G.z.object({eventName:G.z.string().describe("Window event name to listen for, configured in the Usercentrics admin (Implementation > Data Layer & Events). Use 'UC_SDK_EVENT' for the built-in Browser SDK event. Default: 'ucEvent'.").optional(),categoryMap:G.z.record(G.z.string(),G.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:G.z.boolean().describe("Only process consent_status events where type is 'explicit'. Ignores implicit/default page-load events. Default: true.").optional()}).meta({id:"UsercentricsSettings",title:"Settings",description:"Settings for the Usercentrics CMP source."}),P=(0,j.zodToSchema)(N);//# sourceMappingURL=dev.js.map
1
+ "use strict";var t,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})},a={};o(a,{examples:()=>r,schemas:()=>j}),module.exports=(t=a,((t,o,a,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of s(o))n.call(t,c)||c===a||e(t,c,{get:()=>o[c],enumerable:!(r=i(o,c))||r.enumerable});return t})(e({},"__esModule",{value:!0}),t));var r={};o(r,{createMockElbFn:()=>f,createTrigger:()=>P,fullConsentCustomMapped:()=>m,fullConsentMapped:()=>g,minimalConsentMapped:()=>d,noopLogger:()=>v,partialConsentMapped:()=>y,servicesFirstVisitImplicit:()=>u,servicesFullExplicit:()=>c,servicesMinimalExplicit:()=>l,servicesPartialExplicit:()=>p,step:()=>w,trigger:()=>O});var c=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!0,history:[{type:"explicit",status:!0}]}}],l=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"explicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],p=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],u=[{categorySlug:"essential",consent:{status:!0,history:[{type:"implicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"implicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"implicit",status:!1}]}}],g={essential:!0,functional:!0,marketing:!0},y={essential:!0,functional:!0,marketing:!1},d={essential:!0,functional:!1,marketing:!1},m={functional:!0,analytics:!0,marketing:!0},h=()=>{},f=()=>()=>Promise.resolve({ok:!0}),v={error:h,warn:h,info:h,debug:h,throw:t=>{throw"string"==typeof t?new Error(t):t},json:h,scope:()=>v},w={};o(w,{categoryMapOverride:()=>M,consentChange:()=>x,firstVisitImplicit:()=>S,fullConsent:()=>b,minimalConsent:()=>k,returningVisitor:()=>C});var b={title:"Full consent",description:"Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.",trigger:{type:"consent",options:{dispatch:"init"}},in:c,out:[["elb","walker consent",g]]},k={title:"Minimal consent",description:'A "Deny all" explicit decision leaves only essential granted; functional and marketing are emitted as false.',trigger:{type:"consent",options:{dispatch:"init"}},in:l,out:[["elb","walker consent",d]]},C={title:"Returning visitor static read",description:"When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.",trigger:{type:"consent",options:{dispatch:"init"}},in:p,out:[["elb","walker consent",{essential:!0,functional:!0,marketing:!1}]]},S={title:"First visit implicit (suppressed)",description:"A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.",trigger:{type:"consent",options:{dispatch:"init"}},in:u,out:[]},x={title:"Consent change via CMP event",description:"An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.",trigger:{type:"consent",options:{dispatch:"cmp"}},in:c,out:[["elb","walker consent",g]]},M={title:"Category map override",description:"A custom categoryMap remaps essential to functional and functional to analytics before emitting the walker consent command.",trigger:{type:"consent",options:{dispatch:"init"}},in:c,mapping:{settings:{categoryMap:{essential:"functional",functional:"analytics"}}},out:[["elb","walker consent",m]]},E=require("@walkeros/collector"),P=async t=>{let e;return{get flow(){return e},trigger:(i,s)=>async i=>{var n;if(!e){const i=await(0,E.startFlow)({...t,run:null==(n=t.run)||n});e={collector:i.collector,elb:i.elb}}const o=(null==s?void 0:s.eventName)||"ucEvent";window.dispatchEvent(new CustomEvent(o,{detail:i}))}}},O=(t,e)=>{if(t&&"object"==typeof t)return()=>{e.window.dispatchEvent(new CustomEvent("ucEvent",{detail:t}))}},j={};o(j,{SettingsSchema:()=>A,settings:()=>F});var I=require("@walkeros/core/dev"),z=require("@walkeros/core/dev"),A=z.z.object({categoryMap:z.z.record(z.z.string(),z.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:z.z.boolean().describe("Only publish when the user has actively decided (V3: consent.type EXPLICIT; V2: an EXPLICIT entry in service consent history). Implicit/default page-load states are suppressed. Set false to publish any snapshot including implicit. Default: true.").optional()}).meta({id:"UsercentricsSettings",title:"Settings",description:"Settings for the Usercentrics CMP source."}),F=(0,I.zodToSchema)(A);//# sourceMappingURL=dev.js.map