@walkeros/web-source-cmp-usercentrics 4.9.0-next-1793116456867 → 4.9.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @walkeros/web-source-cmp-usercentrics
2
2
 
3
- ## 4.9.0-next-1793116456867
3
+ ## 4.9.0
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -14,19 +14,36 @@
14
14
  group instead of `marketing`, so a step for social media cookies requires
15
15
  `social`. CookieFirst and Usercentrics match `categoryMap` keys
16
16
  case-insensitively, like the other CMP sources.
17
+ - 1306d8a: The Usercentrics source no longer declares a `ucEvent` window event
18
+ type it never listens to, and its docs name the events it reads,
19
+ `UC_UI_INITIALIZED` and `UC_UI_CMP_EVENT`. The CookieFirst example mock of
20
+ `elb` is typed without a cast.
21
+ - 1306d8a: The Fetch `path` setting is described as a single route path that
22
+ `paths` overrides, and it is no longer marked deprecated. The Criteo
23
+ Quickstart uses a numeric `partnerId` placeholder. Type docs now say that an
24
+ open breaker fails events with `breaker-open` and that server bundles target
25
+ Node 20. Example env mocks are typed without casts.
26
+ - Updated dependencies [a67546d]
17
27
  - Updated dependencies [5313635]
18
28
  - Updated dependencies [5313635]
19
29
  - Updated dependencies [34fd225]
30
+ - Updated dependencies [1306d8a]
31
+ - Updated dependencies [1306d8a]
20
32
  - Updated dependencies [34fd225]
21
33
  - Updated dependencies [5313635]
34
+ - Updated dependencies [1306d8a]
35
+ - Updated dependencies [fa46337]
22
36
  - Updated dependencies [5313635]
23
37
  - Updated dependencies [5313635]
24
38
  - Updated dependencies [5313635]
25
39
  - Updated dependencies [5313635]
26
40
  - Updated dependencies [34fd225]
41
+ - Updated dependencies [fa46337]
42
+ - Updated dependencies [1306d8a]
43
+ - Updated dependencies [1fb57b0]
27
44
  - Updated dependencies [5313635]
28
- - @walkeros/collector@4.9.0-next-1793116456867
29
- - @walkeros/core@4.9.0-next-1793116456867
45
+ - @walkeros/core@4.9.0
46
+ - @walkeros/collector@4.9.0
30
47
 
31
48
  ## 4.8.2
32
49
 
package/dist/dev.d.mts CHANGED
@@ -10,27 +10,8 @@ declare module '@walkeros/core' {
10
10
  };
11
11
  }
12
12
  }
13
- /**
14
- * Usercentrics consent event detail structure.
15
- *
16
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
17
- * Contains both category-level (ucCategory) and service-level consent.
18
- */
19
- interface UsercentricsEventDetail {
20
- /** Always 'consent_status' for consent events */
21
- event: string;
22
- /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
23
- type: string;
24
- /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
25
- action?: string;
26
- /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
27
- ucCategory?: Record<string, boolean | unknown>;
28
- /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
29
- [service: string]: unknown;
30
- }
31
13
  declare global {
32
14
  interface WindowEventMap {
33
- ucEvent: CustomEvent<UsercentricsEventDetail>;
34
15
  UC_UI_INITIALIZED: Event;
35
16
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
36
17
  }
package/dist/dev.d.ts CHANGED
@@ -10,27 +10,8 @@ declare module '@walkeros/core' {
10
10
  };
11
11
  }
12
12
  }
13
- /**
14
- * Usercentrics consent event detail structure.
15
- *
16
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
17
- * Contains both category-level (ucCategory) and service-level consent.
18
- */
19
- interface UsercentricsEventDetail {
20
- /** Always 'consent_status' for consent events */
21
- event: string;
22
- /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
23
- type: string;
24
- /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
25
- action?: string;
26
- /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
27
- ucCategory?: Record<string, boolean | unknown>;
28
- /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
29
- [service: string]: unknown;
30
- }
31
13
  declare global {
32
14
  interface WindowEventMap {
33
- ucEvent: CustomEvent<UsercentricsEventDetail>;
34
15
  UC_UI_INITIALIZED: Event;
35
16
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
36
17
  }
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\nexport * as schemas from './schemas';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { UsercentricsV2Service } from '../types';\n\n/**\n * Example Usercentrics V2 service inputs.\n *\n * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:\n * an array of services, each carrying a `categorySlug`, optional display\n * `name`, and a `consent` block with the current `status` plus a decision\n * `history`. The adapter derives the explicit/implicit gate from whether any\n * history entry is `explicit`, and aggregates services into group-level\n * consent via strict AND per `categorySlug`.\n */\n\n/**\n * Full consent - every category accepted via an explicit decision\n * (user clicked \"Accept all\").\n */\nexport const servicesFullExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n];\n\n/**\n * Minimal consent - only essential accepted, others denied via an explicit\n * decision (user clicked \"Deny all\").\n */\nexport const servicesMinimalExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * Partial consent - essential and functional accepted, marketing denied,\n * all via an explicit decision (user saved a custom selection).\n */\nexport const servicesPartialExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * First-visit implicit state - the CMP reports page-load defaults with only\n * implicit history. The default `explicitOnly` gate suppresses this, so no\n * consent command is emitted.\n */\nexport const servicesFirstVisitImplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'implicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n];\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state emitted via `elb('walker consent', state)`\n * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level\n * consent (no category mapping configured: pass-through by `categorySlug`).\n */\n\n/**\n * Full consent - all categories granted.\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional granted, marketing denied.\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential granted.\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with a custom category mapping applied\n * (functional->analytics; essential keeps its own name).\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n essential: true,\n analytics: true,\n marketing: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\nimport {\n servicesFullExplicit,\n servicesMinimalExplicit,\n servicesPartialExplicit,\n servicesFirstVisitImplicit,\n} from './inputs';\nimport {\n fullConsentMapped,\n minimalConsentMapped,\n fullConsentCustomMapped,\n} from './outputs';\n\n/**\n * Step examples for the Usercentrics V2 path.\n *\n * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test\n * runner attaches it as the V2 API, then drives the official trigger named in\n * `trigger.options.dispatch`:\n * - 'init' (default): UC_UI is present when the source runs, so the static\n * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).\n * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`\n * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.\n */\n\nexport const fullConsent: Flow.StepExample = {\n title: 'Full consent',\n description:\n 'Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const minimalConsent: Flow.StepExample = {\n title: 'Minimal consent',\n description:\n 'A \"Deny all\" explicit decision leaves only essential granted; functional and marketing are emitted as false.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesMinimalExplicit,\n out: [['elb', 'walker consent', minimalConsentMapped]],\n};\n\nexport const returningVisitor: Flow.StepExample = {\n title: 'Returning visitor static read',\n description:\n 'When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesPartialExplicit,\n out: [\n [\n 'elb',\n 'walker consent',\n {\n essential: true,\n functional: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const firstVisitImplicit: Flow.StepExample = {\n title: 'First visit implicit (suppressed)',\n description:\n 'A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFirstVisitImplicit,\n out: [],\n};\n\nexport const consentChange: Flow.StepExample = {\n title: 'Consent change via CMP event',\n description:\n 'An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.',\n trigger: { type: 'consent', options: { dispatch: 'cmp' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\n description:\n 'A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n mapping: {\n settings: {\n categoryMap: { functional: 'analytics' },\n },\n },\n out: [['elb', 'walker consent', fullConsentCustomMapped]],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { UsercentricsV2Api, UsercentricsV2Service } from '../types';\n\n/**\n * `content` is what `window.UC_UI.getServicesBaseInfo()` returns. The\n * `dispatch` option picks the official path the source reacts to:\n * - 'init' (default): UC_UI is attached before the source runs, so the\n * static read at init publishes the snapshot.\n * - 'cmp': UC_UI is attached after init, then a `UC_UI_CMP_EVENT`\n * ACCEPT_ALL decision makes the source re-read and publish.\n */\nconst createTrigger: Trigger.CreateFn<UsercentricsV2Service[], void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsV2Service[], void> =\n (_type?: string, opts?: unknown) =>\n async (content: UsercentricsV2Service[]) => {\n const dispatch =\n opts &&\n typeof opts === 'object' &&\n 'dispatch' in opts &&\n opts.dispatch === 'cmp'\n ? 'cmp'\n : 'init';\n const ucUi: UsercentricsV2Api = {\n isInitialized: () => true,\n getServicesBaseInfo: () => content,\n };\n\n if (dispatch === 'init') window.UC_UI = ucUi;\n\n // Lazy startFlow: the source attaches its listeners and does the\n // static read during init.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n if (dispatch === 'cmp') {\n window.UC_UI = ucUi;\n window.dispatchEvent(\n new CustomEvent('UC_UI_CMP_EVENT', {\n detail: { source: 'button', type: 'ACCEPT_ALL' },\n }),\n );\n }\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Attaches the services as the V2 `UC_UI` API before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window;\n if (!Array.isArray(input) || !isWindow(win)) return;\n win.UC_UI = {\n isInitialized: () => true,\n getServicesBaseInfo: () => input,\n };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Usercentrics source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n explicitOnly: z\n .boolean()\n .describe(\n '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.',\n )\n .optional(),\n\n apiVersion: z\n .enum(['auto', 'v2', 'v3'])\n .describe(\n \"Which Usercentrics API to use. 'auto' uses V3 (window.__ucCmp) when present, else V2 (window.UC_UI), and listens for both while neither is loaded. Default: 'auto'.\",\n )\n .optional(),\n\n v3EventName: z\n .string()\n .describe(\n \"Window event the V3 adapter listens to for consent decisions, replacing UC_UI_CMP_EVENT. Only events whose detail.type is ACCEPT_ALL, DENY_ALL or SAVE are processed. Default: 'UC_UI_CMP_EVENT'.\",\n )\n .optional(),\n })\n .meta({\n id: 'UsercentricsSettings',\n title: 'Settings',\n description: 'Settings for the Usercentrics CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,uBAAgD;AAAA,EAC3D;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AACF;AAMO,IAAM,0BAAmD;AAAA,EAC9D;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;A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AI;AAAA,IACxD;AAEA,QAAI,aAAa,OAAO;AACtB,aAAO,QAAQ;AACf,aAAO;AAAA,QACL,IAAI,YAAY,mBAAmB;AAAA,UACjC,QAAQ,EAAE,QAAQ,UAAU,MAAM,aAAa;AAAA,QACjD,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA,SAAAA;AAAA,EACF;AACF;AAGA,IAAM,UAAU,CAAC,OAAgB,QAAuC;AACtE,QAAM,MAAM,IAAI;AAChB,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC,SAAS,GAAG,EAAG;AAC7C,MAAI,QAAQ;AAAA,IACV,eAAe,MAAM;AAAA,IACrB,qBAAqB,MAAM;AAAA,EAC7B;AACF;AAEA,SAAS,SAAS,OAAiC;AACjD,SACE,OAAO,UAAU,YAAY,UAAU,QAAQ,sBAAsB;AAEzE;;;ACzEA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,cAA4B;;;ACA5B,iBAAkB;AAKX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,aAAa,aACV,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,cAAc,aACX,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,aACT,KAAK,CAAC,QAAQ,MAAM,IAAI,CAAC,EACzB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,aAAa,aACV,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADhCI,IAAM,eAAW,yBAAY,cAAc;","names":["trigger","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\nexport * as schemas from './schemas';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { UsercentricsV2Service } from '../types';\n\n/**\n * Example Usercentrics V2 service inputs.\n *\n * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:\n * an array of services, each carrying a `categorySlug`, optional display\n * `name`, and a `consent` block with the current `status` plus a decision\n * `history`. The adapter derives the explicit/implicit gate from whether any\n * history entry is `explicit`, and aggregates services into group-level\n * consent via strict AND per `categorySlug`.\n */\n\n/**\n * Full consent - every category accepted via an explicit decision\n * (user clicked \"Accept all\").\n */\nexport const servicesFullExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n];\n\n/**\n * Minimal consent - only essential accepted, others denied via an explicit\n * decision (user clicked \"Deny all\").\n */\nexport const servicesMinimalExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * Partial consent - essential and functional accepted, marketing denied,\n * all via an explicit decision (user saved a custom selection).\n */\nexport const servicesPartialExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * First-visit implicit state - the CMP reports page-load defaults with only\n * implicit history. The default `explicitOnly` gate suppresses this, so no\n * consent command is emitted.\n */\nexport const servicesFirstVisitImplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'implicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n];\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state emitted via `elb('walker consent', state)`\n * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level\n * consent (no category mapping configured: pass-through by `categorySlug`).\n */\n\n/**\n * Full consent - all categories granted.\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional granted, marketing denied.\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential granted.\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with a custom category mapping applied\n * (functional->analytics; essential keeps its own name).\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n essential: true,\n analytics: true,\n marketing: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\nimport {\n servicesFullExplicit,\n servicesMinimalExplicit,\n servicesPartialExplicit,\n servicesFirstVisitImplicit,\n} from './inputs';\nimport {\n fullConsentMapped,\n minimalConsentMapped,\n fullConsentCustomMapped,\n} from './outputs';\n\n/**\n * Step examples for the Usercentrics V2 path.\n *\n * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test\n * runner attaches it as the V2 API, then drives the official trigger named in\n * `trigger.options.dispatch`:\n * - 'init' (default): UC_UI is present when the source runs, so the static\n * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).\n * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`\n * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.\n */\n\nexport const fullConsent: Flow.StepExample = {\n title: 'Full consent',\n description:\n 'Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const minimalConsent: Flow.StepExample = {\n title: 'Minimal consent',\n description:\n 'A \"Deny all\" explicit decision leaves only essential granted; functional and marketing are emitted as false.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesMinimalExplicit,\n out: [['elb', 'walker consent', minimalConsentMapped]],\n};\n\nexport const returningVisitor: Flow.StepExample = {\n title: 'Returning visitor static read',\n description:\n 'When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesPartialExplicit,\n out: [\n [\n 'elb',\n 'walker consent',\n {\n essential: true,\n functional: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const firstVisitImplicit: Flow.StepExample = {\n title: 'First visit implicit (suppressed)',\n description:\n 'A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFirstVisitImplicit,\n out: [],\n};\n\nexport const consentChange: Flow.StepExample = {\n title: 'Consent change via CMP event',\n description:\n 'An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.',\n trigger: { type: 'consent', options: { dispatch: 'cmp' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\n description:\n 'A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n mapping: {\n settings: {\n categoryMap: { functional: 'analytics' },\n },\n },\n out: [['elb', 'walker consent', fullConsentCustomMapped]],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { UsercentricsV2Api, UsercentricsV2Service } from '../types';\n\n/**\n * `content` is what `window.UC_UI.getServicesBaseInfo()` returns. The\n * `dispatch` option picks the official path the source reacts to:\n * - 'init' (default): UC_UI is attached before the source runs, so the\n * static read at init publishes the snapshot.\n * - 'cmp': UC_UI is attached after init, then a `UC_UI_CMP_EVENT`\n * ACCEPT_ALL decision makes the source re-read and publish.\n */\nconst createTrigger: Trigger.CreateFn<UsercentricsV2Service[], void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsV2Service[], void> =\n (_type?: string, opts?: unknown) =>\n async (content: UsercentricsV2Service[]) => {\n const dispatch =\n opts &&\n typeof opts === 'object' &&\n 'dispatch' in opts &&\n opts.dispatch === 'cmp'\n ? 'cmp'\n : 'init';\n const ucUi: UsercentricsV2Api = {\n isInitialized: () => true,\n getServicesBaseInfo: () => content,\n };\n\n if (dispatch === 'init') window.UC_UI = ucUi;\n\n // Lazy startFlow: the source attaches its listeners and does the\n // static read during init.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n if (dispatch === 'cmp') {\n window.UC_UI = ucUi;\n window.dispatchEvent(\n new CustomEvent('UC_UI_CMP_EVENT', {\n detail: { source: 'button', type: 'ACCEPT_ALL' },\n }),\n );\n }\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Attaches the services as the V2 `UC_UI` API before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window;\n if (!Array.isArray(input) || !isWindow(win)) return;\n win.UC_UI = {\n isInitialized: () => true,\n getServicesBaseInfo: () => input,\n };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Usercentrics source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n explicitOnly: z\n .boolean()\n .describe(\n '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.',\n )\n .optional(),\n\n apiVersion: z\n .enum(['auto', 'v2', 'v3'])\n .describe(\n \"Which Usercentrics API to use. 'auto' uses V3 (window.__ucCmp) when present, else V2 (window.UC_UI), and listens for both while neither is loaded. Default: 'auto'.\",\n )\n .optional(),\n\n v3EventName: z\n .string()\n .describe(\n \"Window event the V3 adapter listens to for consent decisions, replacing UC_UI_CMP_EVENT. Only events whose detail.type is ACCEPT_ALL, DENY_ALL or SAVE are processed. Default: 'UC_UI_CMP_EVENT'.\",\n )\n .optional(),\n })\n .meta({\n id: 'UsercentricsSettings',\n title: 'Settings',\n description: 'Settings for the Usercentrics CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,uBAAgD;AAAA,EAC3D;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AACF;AAMO,IAAM,0BAAmD;AAAA,EAC9D;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,OAAO,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,MAAM,CAAC,EAAE;AAAA,EAC3E;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,OAAO,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,MAAM,CAAC,EAAE;AAAA,EAC3E;AACF;AAMO,IAAM,0BAAmD;AAAA,EA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AAGA,IAAM,UAAU,CAAC,OAAgB,QAAuC;AACtE,QAAM,MAAM,IAAI;AAChB,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC,SAAS,GAAG,EAAG;AAC7C,MAAI,QAAQ;AAAA,IACV,eAAe,MAAM;AAAA,IACrB,qBAAqB,MAAM;AAAA,EAC7B;AACF;AAEA,SAAS,SAAS,OAAiC;AACjD,SACE,OAAO,UAAU,YAAY,UAAU,QAAQ,sBAAsB;AAEzE;;;ACzEA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,cAA4B;;;ACA5B,iBAAkB;AAKX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,aAAa,aACV,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,cAAc,aACX,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,aACT,KAAK,CAAC,QAAQ,MAAM,IAAI,CAAC,EACzB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,aAAa,aACV,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADhCI,IAAM,eAAW,yBAAY,cAAc;","names":["trigger","import_dev"]}
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { UsercentricsV2Service } from '../types';\n\n/**\n * Example Usercentrics V2 service inputs.\n *\n * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:\n * an array of services, each carrying a `categorySlug`, optional display\n * `name`, and a `consent` block with the current `status` plus a decision\n * `history`. The adapter derives the explicit/implicit gate from whether any\n * history entry is `explicit`, and aggregates services into group-level\n * consent via strict AND per `categorySlug`.\n */\n\n/**\n * Full consent - every category accepted via an explicit decision\n * (user clicked \"Accept all\").\n */\nexport const servicesFullExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n];\n\n/**\n * Minimal consent - only essential accepted, others denied via an explicit\n * decision (user clicked \"Deny all\").\n */\nexport const servicesMinimalExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * Partial consent - essential and functional accepted, marketing denied,\n * all via an explicit decision (user saved a custom selection).\n */\nexport const servicesPartialExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * First-visit implicit state - the CMP reports page-load defaults with only\n * implicit history. The default `explicitOnly` gate suppresses this, so no\n * consent command is emitted.\n */\nexport const servicesFirstVisitImplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'implicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n];\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state emitted via `elb('walker consent', state)`\n * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level\n * consent (no category mapping configured: pass-through by `categorySlug`).\n */\n\n/**\n * Full consent - all categories granted.\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional granted, marketing denied.\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential granted.\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with a custom category mapping applied\n * (functional->analytics; essential keeps its own name).\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n essential: true,\n analytics: true,\n marketing: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\nimport {\n servicesFullExplicit,\n servicesMinimalExplicit,\n servicesPartialExplicit,\n servicesFirstVisitImplicit,\n} from './inputs';\nimport {\n fullConsentMapped,\n minimalConsentMapped,\n fullConsentCustomMapped,\n} from './outputs';\n\n/**\n * Step examples for the Usercentrics V2 path.\n *\n * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test\n * runner attaches it as the V2 API, then drives the official trigger named in\n * `trigger.options.dispatch`:\n * - 'init' (default): UC_UI is present when the source runs, so the static\n * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).\n * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`\n * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.\n */\n\nexport const fullConsent: Flow.StepExample = {\n title: 'Full consent',\n description:\n 'Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const minimalConsent: Flow.StepExample = {\n title: 'Minimal consent',\n description:\n 'A \"Deny all\" explicit decision leaves only essential granted; functional and marketing are emitted as false.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesMinimalExplicit,\n out: [['elb', 'walker consent', minimalConsentMapped]],\n};\n\nexport const returningVisitor: Flow.StepExample = {\n title: 'Returning visitor static read',\n description:\n 'When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesPartialExplicit,\n out: [\n [\n 'elb',\n 'walker consent',\n {\n essential: true,\n functional: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const firstVisitImplicit: Flow.StepExample = {\n title: 'First visit implicit (suppressed)',\n description:\n 'A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFirstVisitImplicit,\n out: [],\n};\n\nexport const consentChange: Flow.StepExample = {\n title: 'Consent change via CMP event',\n description:\n 'An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.',\n trigger: { type: 'consent', options: { dispatch: 'cmp' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\n description:\n 'A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n mapping: {\n settings: {\n categoryMap: { functional: 'analytics' },\n },\n },\n out: [['elb', 'walker consent', fullConsentCustomMapped]],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { UsercentricsV2Api, UsercentricsV2Service } from '../types';\n\n/**\n * `content` is what `window.UC_UI.getServicesBaseInfo()` returns. The\n * `dispatch` option picks the official path the source reacts to:\n * - 'init' (default): UC_UI is attached before the source runs, so the\n * static read at init publishes the snapshot.\n * - 'cmp': UC_UI is attached after init, then a `UC_UI_CMP_EVENT`\n * ACCEPT_ALL decision makes the source re-read and publish.\n */\nconst createTrigger: Trigger.CreateFn<UsercentricsV2Service[], void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsV2Service[], void> =\n (_type?: string, opts?: unknown) =>\n async (content: UsercentricsV2Service[]) => {\n const dispatch =\n opts &&\n typeof opts === 'object' &&\n 'dispatch' in opts &&\n opts.dispatch === 'cmp'\n ? 'cmp'\n : 'init';\n const ucUi: UsercentricsV2Api = {\n isInitialized: () => true,\n getServicesBaseInfo: () => content,\n };\n\n if (dispatch === 'init') window.UC_UI = ucUi;\n\n // Lazy startFlow: the source attaches its listeners and does the\n // static read during init.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n if (dispatch === 'cmp') {\n window.UC_UI = ucUi;\n window.dispatchEvent(\n new CustomEvent('UC_UI_CMP_EVENT', {\n detail: { source: 'button', type: 'ACCEPT_ALL' },\n }),\n );\n }\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Attaches the services as the V2 `UC_UI` API before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window;\n if (!Array.isArray(input) || !isWindow(win)) return;\n win.UC_UI = {\n isInitialized: () => true,\n getServicesBaseInfo: () => input,\n };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Usercentrics source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n explicitOnly: z\n .boolean()\n .describe(\n '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.',\n )\n .optional(),\n\n apiVersion: z\n .enum(['auto', 'v2', 'v3'])\n .describe(\n \"Which Usercentrics API to use. 'auto' uses V3 (window.__ucCmp) when present, else V2 (window.UC_UI), and listens for both while neither is loaded. Default: 'auto'.\",\n )\n .optional(),\n\n v3EventName: z\n .string()\n .describe(\n \"Window event the V3 adapter listens to for consent decisions, replacing UC_UI_CMP_EVENT. Only events whose detail.type is ACCEPT_ALL, DENY_ALL or SAVE are processed. Default: 'UC_UI_CMP_EVENT'.\",\n )\n .optional(),\n })\n .meta({\n id: 'UsercentricsSettings',\n title: 'Settings',\n description: 'Settings for the Usercentrics CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,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A5B,SAAS,SAAS;AAKX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,aAAa,EACV,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,cAAc,EACX,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,EACT,KAAK,CAAC,QAAQ,MAAM,IAAI,CAAC,EACzB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,aAAa,EACV,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADhCI,IAAM,WAAW,YAAY,cAAc;","names":["trigger"]}
1
+ {"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { UsercentricsV2Service } from '../types';\n\n/**\n * Example Usercentrics V2 service inputs.\n *\n * These mirror the shape returned by `window.UC_UI.getServicesBaseInfo()`:\n * an array of services, each carrying a `categorySlug`, optional display\n * `name`, and a `consent` block with the current `status` plus a decision\n * `history`. The adapter derives the explicit/implicit gate from whether any\n * history entry is `explicit`, and aggregates services into group-level\n * consent via strict AND per `categorySlug`.\n */\n\n/**\n * Full consent - every category accepted via an explicit decision\n * (user clicked \"Accept all\").\n */\nexport const servicesFullExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n];\n\n/**\n * Minimal consent - only essential accepted, others denied via an explicit\n * decision (user clicked \"Deny all\").\n */\nexport const servicesMinimalExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * Partial consent - essential and functional accepted, marketing denied,\n * all via an explicit decision (user saved a custom selection).\n */\nexport const servicesPartialExplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: true, history: [{ type: 'explicit', status: true }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'explicit', status: false }] },\n },\n];\n\n/**\n * First-visit implicit state - the CMP reports page-load defaults with only\n * implicit history. The default `explicitOnly` gate suppresses this, so no\n * consent command is emitted.\n */\nexport const servicesFirstVisitImplicit: UsercentricsV2Service[] = [\n {\n categorySlug: 'essential',\n consent: { status: true, history: [{ type: 'implicit', status: true }] },\n },\n {\n categorySlug: 'functional',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n {\n categorySlug: 'marketing',\n consent: { status: false, history: [{ type: 'implicit', status: false }] },\n },\n];\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state emitted via `elb('walker consent', state)`\n * after the V2 adapter aggregates `getServicesBaseInfo()` into group-level\n * consent (no category mapping configured: pass-through by `categorySlug`).\n */\n\n/**\n * Full consent - all categories granted.\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional granted, marketing denied.\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential granted.\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with a custom category mapping applied\n * (functional->analytics; essential keeps its own name).\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n essential: true,\n analytics: true,\n marketing: true,\n};\n","import type { Elb, Logger } from '@walkeros/core';\n\n/**\n * Example environment configurations for Usercentrics source testing.\n */\n\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn: Elb.Fn = () => Promise.resolve({ ok: true });\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\nimport {\n servicesFullExplicit,\n servicesMinimalExplicit,\n servicesPartialExplicit,\n servicesFirstVisitImplicit,\n} from './inputs';\nimport {\n fullConsentMapped,\n minimalConsentMapped,\n fullConsentCustomMapped,\n} from './outputs';\n\n/**\n * Step examples for the Usercentrics V2 path.\n *\n * `in` is the array returned by `window.UC_UI.getServicesBaseInfo()`. The test\n * runner attaches it as the V2 API, then drives the official trigger named in\n * `trigger.options.dispatch`:\n * - 'init' (default): UC_UI is present when the source runs, so the static\n * read at init emits the snapshot (also the `UC_UI_INITIALIZED` path).\n * - 'cmp': UC_UI is attached only after init, then a `UC_UI_CMP_EVENT`\n * decision (ACCEPT_ALL) re-reads and emits — the consent-change path.\n */\n\nexport const fullConsent: Flow.StepExample = {\n title: 'Full consent',\n description:\n 'Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const minimalConsent: Flow.StepExample = {\n title: 'Minimal consent',\n description:\n 'A \"Deny all\" explicit decision leaves only essential granted; functional and marketing are emitted as false.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesMinimalExplicit,\n out: [['elb', 'walker consent', minimalConsentMapped]],\n};\n\nexport const returningVisitor: Flow.StepExample = {\n title: 'Returning visitor static read',\n description:\n 'When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesPartialExplicit,\n out: [\n [\n 'elb',\n 'walker consent',\n {\n essential: true,\n functional: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const firstVisitImplicit: Flow.StepExample = {\n title: 'First visit implicit (suppressed)',\n description:\n 'A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFirstVisitImplicit,\n out: [],\n};\n\nexport const consentChange: Flow.StepExample = {\n title: 'Consent change via CMP event',\n description:\n 'An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.',\n trigger: { type: 'consent', options: { dispatch: 'cmp' } },\n in: servicesFullExplicit,\n out: [['elb', 'walker consent', fullConsentMapped]],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\n description:\n 'A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.',\n trigger: { type: 'consent', options: { dispatch: 'init' } },\n in: servicesFullExplicit,\n mapping: {\n settings: {\n categoryMap: { functional: 'analytics' },\n },\n },\n out: [['elb', 'walker consent', fullConsentCustomMapped]],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { UsercentricsV2Api, UsercentricsV2Service } from '../types';\n\n/**\n * `content` is what `window.UC_UI.getServicesBaseInfo()` returns. The\n * `dispatch` option picks the official path the source reacts to:\n * - 'init' (default): UC_UI is attached before the source runs, so the\n * static read at init publishes the snapshot.\n * - 'cmp': UC_UI is attached after init, then a `UC_UI_CMP_EVENT`\n * ACCEPT_ALL decision makes the source re-read and publish.\n */\nconst createTrigger: Trigger.CreateFn<UsercentricsV2Service[], void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsV2Service[], void> =\n (_type?: string, opts?: unknown) =>\n async (content: UsercentricsV2Service[]) => {\n const dispatch =\n opts &&\n typeof opts === 'object' &&\n 'dispatch' in opts &&\n opts.dispatch === 'cmp'\n ? 'cmp'\n : 'init';\n const ucUi: UsercentricsV2Api = {\n isInitialized: () => true,\n getServicesBaseInfo: () => content,\n };\n\n if (dispatch === 'init') window.UC_UI = ucUi;\n\n // Lazy startFlow: the source attaches its listeners and does the\n // static read during init.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n if (dispatch === 'cmp') {\n window.UC_UI = ucUi;\n window.dispatchEvent(\n new CustomEvent('UC_UI_CMP_EVENT', {\n detail: { source: 'button', type: 'ACCEPT_ALL' },\n }),\n );\n }\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Attaches the services as the V2 `UC_UI` API before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window;\n if (!Array.isArray(input) || !isWindow(win)) return;\n win.UC_UI = {\n isInitialized: () => true,\n getServicesBaseInfo: () => input,\n };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Usercentrics source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n explicitOnly: z\n .boolean()\n .describe(\n '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.',\n )\n .optional(),\n\n apiVersion: z\n .enum(['auto', 'v2', 'v3'])\n .describe(\n \"Which Usercentrics API to use. 'auto' uses V3 (window.__ucCmp) when present, else V2 (window.UC_UI), and listens for both while neither is loaded. Default: 'auto'.\",\n )\n .optional(),\n\n v3EventName: z\n .string()\n .describe(\n \"Window event the V3 adapter listens to for consent decisions, replacing UC_UI_CMP_EVENT. Only events whose detail.type is ACCEPT_ALL, DENY_ALL or SAVE are processed. Default: 'UC_UI_CMP_EVENT'.\",\n )\n .optional(),\n })\n .meta({\n id: 'UsercentricsSettings',\n title: 'Settings',\n description: 'Settings for the Usercentrics CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,uBAAgD;AAAA,EAC3D;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,SAAS,EAAE,QAAQ,MAAM,SAAS,CAAC,EAAE,MAAM,YAAY,QAAQ,KAAK,CAAC,EAAE;AAAA,EACzE;AACF;AA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EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADhCI,IAAM,WAAW,YAAY,cAAc;","names":["trigger"]}
@@ -8,27 +8,8 @@ declare module '@walkeros/core' {
8
8
  };
9
9
  }
10
10
  }
11
- /**
12
- * Usercentrics consent event detail structure.
13
- *
14
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
15
- * Contains both category-level (ucCategory) and service-level consent.
16
- */
17
- interface UsercentricsEventDetail {
18
- /** Always 'consent_status' for consent events */
19
- event: string;
20
- /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
21
- type: string;
22
- /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
23
- action?: string;
24
- /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
25
- ucCategory?: Record<string, boolean | unknown>;
26
- /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
27
- [service: string]: unknown;
28
- }
29
11
  declare global {
30
12
  interface WindowEventMap {
31
- ucEvent: CustomEvent<UsercentricsEventDetail>;
32
13
  UC_UI_INITIALIZED: Event;
33
14
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
34
15
  }
@@ -8,27 +8,8 @@ declare module '@walkeros/core' {
8
8
  };
9
9
  }
10
10
  }
11
- /**
12
- * Usercentrics consent event detail structure.
13
- *
14
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
15
- * Contains both category-level (ucCategory) and service-level consent.
16
- */
17
- interface UsercentricsEventDetail {
18
- /** Always 'consent_status' for consent events */
19
- event: string;
20
- /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
21
- type: string;
22
- /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
23
- action?: string;
24
- /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
25
- ucCategory?: Record<string, boolean | unknown>;
26
- /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
27
- [service: string]: unknown;
28
- }
29
11
  declare global {
30
12
  interface WindowEventMap {
31
- ucEvent: CustomEvent<UsercentricsEventDetail>;
32
13
  UC_UI_INITIALIZED: Event;
33
14
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
34
15
  }
@@ -120,9 +120,7 @@ var fullConsentCustomMapped = {
120
120
  var noop = () => {
121
121
  };
122
122
  var createMockElbFn = () => {
123
- const fn = (() => Promise.resolve({
124
- ok: true
125
- }));
123
+ const fn = () => Promise.resolve({ ok: true });
126
124
  return fn;
127
125
  };
128
126
  var noopLogger = {
@@ -88,9 +88,7 @@ var fullConsentCustomMapped = {
88
88
  var noop = () => {
89
89
  };
90
90
  var createMockElbFn = () => {
91
- const fn = (() => Promise.resolve({
92
- ok: true
93
- }));
91
+ const fn = () => Promise.resolve({ ok: true });
94
92
  return fn;
95
93
  };
96
94
  var noopLogger = {
package/dist/index.d.mts CHANGED
@@ -9,10 +9,11 @@ declare module '@walkeros/core' {
9
9
  }
10
10
  }
11
11
  /**
12
- * Usercentrics consent event detail structure.
12
+ * Usercentrics consent detail structure.
13
13
  *
14
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
15
- * Contains both category-level (ucCategory) and service-level consent.
14
+ * Built by the V2 and V3 adapters from the CMP's API and passed to the
15
+ * consent parser. Contains both category-level (ucCategory) and
16
+ * service-level consent.
16
17
  */
17
18
  interface UsercentricsEventDetail {
18
19
  /** Always 'consent_status' for consent events */
@@ -28,7 +29,6 @@ interface UsercentricsEventDetail {
28
29
  }
29
30
  declare global {
30
31
  interface WindowEventMap {
31
- ucEvent: CustomEvent<UsercentricsEventDetail>;
32
32
  UC_UI_INITIALIZED: Event;
33
33
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
34
34
  }
@@ -236,9 +236,10 @@ declare namespace index {
236
236
  * Usercentrics consent management source for walkerOS.
237
237
  *
238
238
  * Listens to Usercentrics CMP events and translates consent states to
239
- * walkerOS consent commands. Supports both the legacy V2 API
240
- * (`window.UC_UI` + `ucEvent`) and the current V3 API
241
- * (`window.__ucCmp` + `UC_UI_CMP_EVENT`).
239
+ * walkerOS consent commands. Supports both the V2 API (`window.UC_UI`) and
240
+ * the V3 API (`window.__ucCmp`): each reads consent on `UC_UI_INITIALIZED`
241
+ * and on `UC_UI_CMP_EVENT` decisions (V3 listens to `v3EventName` instead
242
+ * when it is set).
242
243
  *
243
244
  * @example
244
245
  * ```typescript
package/dist/index.d.ts CHANGED
@@ -9,10 +9,11 @@ declare module '@walkeros/core' {
9
9
  }
10
10
  }
11
11
  /**
12
- * Usercentrics consent event detail structure.
12
+ * Usercentrics consent detail structure.
13
13
  *
14
- * Fired as event.detail on the configured window event (e.g. 'ucEvent').
15
- * Contains both category-level (ucCategory) and service-level consent.
14
+ * Built by the V2 and V3 adapters from the CMP's API and passed to the
15
+ * consent parser. Contains both category-level (ucCategory) and
16
+ * service-level consent.
16
17
  */
17
18
  interface UsercentricsEventDetail {
18
19
  /** Always 'consent_status' for consent events */
@@ -28,7 +29,6 @@ interface UsercentricsEventDetail {
28
29
  }
29
30
  declare global {
30
31
  interface WindowEventMap {
31
- ucEvent: CustomEvent<UsercentricsEventDetail>;
32
32
  UC_UI_INITIALIZED: Event;
33
33
  UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;
34
34
  }
@@ -236,9 +236,10 @@ declare namespace index {
236
236
  * Usercentrics consent management source for walkerOS.
237
237
  *
238
238
  * Listens to Usercentrics CMP events and translates consent states to
239
- * walkerOS consent commands. Supports both the legacy V2 API
240
- * (`window.UC_UI` + `ucEvent`) and the current V3 API
241
- * (`window.__ucCmp` + `UC_UI_CMP_EVENT`).
239
+ * walkerOS consent commands. Supports both the V2 API (`window.UC_UI`) and
240
+ * the V3 API (`window.__ucCmp`): each reads consent on `UC_UI_INITIALIZED`
241
+ * and on `UC_UI_CMP_EVENT` decisions (V3 listens to `v3EventName` instead
242
+ * when it is set).
242
243
  *
243
244
  * @example
244
245
  * ```typescript
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/lib/parseConsent.ts","../src/lib/v2.ts","../src/lib/v3.ts","../src/types/index.ts"],"sourcesContent":["import type { Source } from '@walkeros/core';\nimport type { Types, Settings } from './types';\nimport { setupV2Adapter } from './lib/v2';\nimport { setupV3Adapter } from './lib/v3';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * Listens to Usercentrics CMP events and translates consent states to\n * walkerOS consent commands. Supports both the legacy V2 API\n * (`window.UC_UI` + `ucEvent`) and the current V3 API\n * (`window.__ucCmp` + `UC_UI_CMP_EVENT`).\n *\n * @example\n * ```typescript\n * import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceUsercentrics,\n * config: {\n * settings: {\n * categoryMap: {\n * statistics: 'analytics',\n * advertising: 'marketing',\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceUsercentrics: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb, logger } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults so adapters always see a fully-resolved Settings\n const settings: Settings = {\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n apiVersion: config?.settings?.apiVersion ?? 'auto',\n v3EventName: config?.settings?.v3EventName ?? 'UC_UI_CMP_EVENT',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n const cleanups: Array<() => void> = [];\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and, critically, no `elb('walker consent')`\n // emit during construction. Emitting from the factory races source merge\n // order and can leave a later `require:[\"consent\"]` source parked.\n const init = async (): Promise<void> => {\n if (!actualWindow) return;\n\n const adapterCtx = { window: actualWindow, elb, settings, logger };\n const apiVersion = settings.apiVersion ?? 'auto';\n\n if (apiVersion === 'v2') {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else if (apiVersion === 'v3') {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else {\n // auto: detect which API is present\n if (actualWindow.__ucCmp) {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else if (actualWindow.UC_UI) {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else {\n // Neither loaded yet — attach both listeners so whichever loads later is caught.\n cleanups.push(setupV2Adapter(adapterCtx));\n cleanups.push(await setupV3Adapter(adapterCtx));\n }\n }\n };\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n init,\n destroy: async () => {\n cleanups.forEach((fn) => fn());\n },\n };\n};\n\nexport default sourceUsercentrics;\n","import type { WalkerOS } from '@walkeros/core';\nimport type { UsercentricsEventDetail, Settings } from '../types';\n\n/** Reserved keys in event.detail that are not service names */\nexport const RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Determine if ucCategory represents group-level consent.\n * Group-level: all values are booleans.\n * Service-level: some values are non-boolean (e.g., 'partial').\n */\nexport function isGroupLevel(\n ucCategory: Record<string, boolean | unknown>,\n): boolean {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n}\n\n/**\n * Merge an incoming consent signal into the accumulating state using strict\n * AND semantics: absent key initialises from the incoming value; present key\n * becomes `true` only if both existing and incoming are `true`. Any single\n * `false` anywhere in the merge chain revokes consent for that key.\n *\n * This matches the consent rule of thumb: any deny signal denies. Permissive\n * (OR) and \"last-wins\" semantics are both unsafe for a privacy primitive.\n */\nfunction mergeConsent(\n state: WalkerOS.Consent,\n key: string,\n value: boolean,\n): void {\n state[key] = state[key] === undefined ? value : Boolean(state[key]) && value;\n}\n\n/**\n * Look a category up in categoryMap case-insensitively; a category without an\n * entry keeps its own name.\n */\nfunction mapCategory(settings: Settings, category: string): string {\n const map = settings.categoryMap ?? {};\n const lower = category.toLowerCase();\n const key = Object.keys(map).find((entry) => entry.toLowerCase() === lower);\n return key === undefined ? category : map[key];\n}\n\n/**\n * Parse consent from Usercentrics event detail.\n *\n * Group-level: ucCategory values are all booleans → use them directly.\n * Service-level: ucCategory has non-booleans → mix boolean ucCategory entries\n * with top-level service keys from event.detail.\n *\n * categoryMap is applied in both modes to ucCategory boolean entries.\n * Strict AND: if multiple source categories map to the same target group,\n * the target is `true` only when ALL contributing sources are `true`.\n */\nexport function parseConsent(\n detail: UsercentricsEventDetail,\n settings: Settings,\n): WalkerOS.Consent {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = mapCategory(settings, category);\n mergeConsent(state, mapped, value);\n });\n } else {\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = mapCategory(settings, key);\n mergeConsent(state, mapped, value);\n }\n });\n }\n\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n const normalized = key.toLowerCase().replace(/ /g, '_');\n mergeConsent(state, normalized, value);\n });\n }\n\n return state;\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV2Service,\n UsercentricsV3CmpEventDetail,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V2AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\n/**\n * V3 CMP event `type` values that signal a real user decision. Other event\n * types (e.g. CMP_SHOWN, VIEW_CHANGED) carry no consent decision and are\n * ignored so the adapter only re-reads after an actual choice.\n */\nconst V2_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Aggregate V2 service array into a group-level ucCategory object using strict\n * AND logic. A category is `true` only if EVERY service in that category is\n * accepted. Any single denied service denies the whole category — this\n * matches the consent rule of thumb: any deny signal denies.\n */\nfunction aggregateByCategory(\n services: UsercentricsV2Service[],\n): Record<string, boolean> {\n const categories: Record<string, boolean> = {};\n services.forEach((service) => {\n const category = service.categorySlug;\n const status = service.consent?.status ?? false;\n categories[category] =\n categories[category] === undefined\n ? status\n : categories[category] && status;\n });\n return categories;\n}\n\n/**\n * Whether any service carries an `explicit` entry in its consent history. An\n * explicit entry is Usercentrics' own proof that the user actively decided\n * (vs an implicit page-load default), so it correctly surfaces returning\n * visitors whose stored decision was explicit.\n */\nexport function hasExplicitDecision(\n services: UsercentricsV2Service[],\n): boolean {\n return services.some((s) =>\n (s.consent.history ?? []).some((h) => h.type?.toLowerCase() === 'explicit'),\n );\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from the V2 services array. The\n * `type` is derived from Usercentrics' own consent history: `explicit` when any\n * service records an explicit decision, `implicit` otherwise. Per-service name\n * keys are surfaced so parseConsent can map service-level consent.\n */\nexport function buildDetailFromServices(\n services: UsercentricsV2Service[],\n): UsercentricsEventDetail {\n const detail: UsercentricsEventDetail = {\n event: 'consent_status',\n type: hasExplicitDecision(services) ? 'explicit' : 'implicit',\n ucCategory: aggregateByCategory(services),\n };\n services.forEach((s) => {\n if (s.name) detail[s.name] = s.consent.status;\n });\n return detail;\n}\n\n/**\n * Set up the V2 adapter using Usercentrics' official events and getter.\n *\n * A single gated `read()` is reused by all triggers: the official\n * `UC_UI_INITIALIZED` lifecycle event, the official `UC_UI_CMP_EVENT` decision\n * events (filtered to real decisions), and a static read at setup time for the\n * common case where the CMP is already initialized when the source runs.\n *\n * Returns a cleanup function that removes both event listeners.\n */\nexport function setupV2Adapter(ctx: V2AdapterContext): () => void {\n const { window: win, elb, settings, logger } = ctx;\n\n const read = (): void => {\n const api = win.UC_UI;\n if (!api?.getServicesBaseInfo) return;\n // isInitialized is optional on the V2 API; only honor it when present.\n // Hard-gating on it would suppress all consent on deployments that expose\n // getServicesBaseInfo without isInitialized.\n if (api.isInitialized && !api.isInitialized()) return;\n const services = api.getServicesBaseInfo();\n if (!services.length) return;\n const detail = buildDetailFromServices(services);\n logger.debug('consent read', detail);\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) elb('walker consent', state);\n };\n\n const onInitialized = (): void => read();\n const onCmpEvent = (e: Event): void => {\n const detail = (e as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n if (!detail?.type || !V2_DECISION_TYPES.has(detail.type)) return;\n read();\n };\n\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n win.addEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n\n read(); // static read: CMP already initialized when source runs\n\n return () => {\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n win.removeEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n };\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV3Api,\n UsercentricsV3CategoryState,\n UsercentricsV3CmpEventDetail,\n UsercentricsV3ConsentDetails,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V3AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\nconst V3_DEFAULT_EVENT_NAME = 'UC_UI_CMP_EVENT';\n\n/**\n * V3 CMP event types that represent a user consent decision. Presentation\n * events like `CMP_SHOWN` or `UI_INITIALIZED` must NOT trigger a consent\n * publish — they carry no user decision.\n */\nconst V3_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Map a V3 CategoryData.state value to a walkerOS boolean using strict\n * semantics: only fully-accepted categories are `true`. Any partial or\n * denied state (including future/unknown states) resolves to `false`.\n *\n * This matches the consent rule of thumb: any deny signal denies.\n */\nfunction categoryStateToBoolean(state: UsercentricsV3CategoryState): boolean {\n return state === 'ALL_ACCEPTED';\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from V3 ConsentDetails.\n * Translates V3's structured consent state into the shape parseConsent expects.\n */\nfunction buildDetailFromV3(\n details: UsercentricsV3ConsentDetails,\n): UsercentricsEventDetail {\n const ucCategory: Record<string, boolean> = {};\n Object.entries(details.categories).forEach(([slug, category]) => {\n ucCategory[slug] = categoryStateToBoolean(category.state);\n });\n\n return {\n event: 'consent_status',\n type: details.consent.type === 'EXPLICIT' ? 'explicit' : 'implicit',\n ucCategory,\n };\n}\n\n/**\n * Set up the V3 adapter: registers a listener on the V3 consent event AND\n * (if __ucCmp is already initialized) performs a static read.\n *\n * Both paths re-fetch getConsentDetails() because the event payload does\n * not include consent state.\n *\n * Returns a cleanup function that removes the event listener.\n */\nexport async function setupV3Adapter(\n ctx: V3AdapterContext,\n): Promise<() => void> {\n const { window: win, elb, settings, logger } = ctx;\n const eventName = settings.v3EventName ?? V3_DEFAULT_EVENT_NAME;\n\n const publishConsent = async (cmp: UsercentricsV3Api): Promise<void> => {\n const details = await cmp.getConsentDetails();\n const detail = buildDetailFromV3(details);\n logger.debug('event received', detail);\n\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n const listener = (event: Event): void => {\n const cmp = win.__ucCmp;\n if (!cmp) return;\n const detail = (event as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n // Filter to decision events only: the CMP emits a broad set of events\n // (CMP_SHOWN, UI_INITIALIZED, VIEW_CHANGED, …) on this bus. Without\n // filtering, every view toggle would re-publish consent. The decision\n // `type` is the only reliable signal; `detail.source` is one of\n // none|button|first|second|embeddings|__ucCmp and must NOT be gated on.\n if (!detail?.type || !V3_DECISION_TYPES.has(detail.type)) return;\n publishConsent(cmp).catch(() => {\n // Swallow — a failed V3 fetch should not break the page.\n });\n };\n win.addEventListener(eventName, listener);\n\n // When the source loads BEFORE __ucCmp, no UC_UI_CMP_EVENT fires for a\n // choice made in a prior session. UC_UI_INITIALIZED signals the CMP is ready,\n // so perform the static read then to publish any already-made decision.\n const onInitialized = (): void => {\n const cmp = win.__ucCmp;\n if (cmp) publishConsent(cmp).catch(() => {});\n };\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n\n // Static check: if __ucCmp is already initialized, fetch now.\n // Wrapped in try/catch so transient API failures during setup don't\n // reject setupV3Adapter() and tear down the whole flow — the listener\n // stays registered and will pick up the next real event.\n const cmp = win.__ucCmp;\n if (cmp) {\n try {\n const initialized = await cmp.isInitialized();\n if (initialized) {\n await publishConsent(cmp);\n }\n } catch (err) {\n logger.warn('v3 static consent read failed', err);\n }\n }\n\n return () => {\n win.removeEventListener(eventName, listener);\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n };\n}\n","import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n usercentrics: { type: 'usercentrics'; platform?: 'web' };\n }\n}\n\n/**\n * Usercentrics consent event detail structure.\n *\n * Fired as event.detail on the configured window event (e.g. 'ucEvent').\n * Contains both category-level (ucCategory) and service-level consent.\n */\nexport interface UsercentricsEventDetail {\n /** Always 'consent_status' for consent events */\n event: string;\n /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */\n type: string;\n /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */\n action?: string;\n /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */\n ucCategory?: Record<string, boolean | unknown>;\n /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */\n [service: string]: unknown;\n}\n\ndeclare global {\n interface WindowEventMap {\n ucEvent: CustomEvent<UsercentricsEventDetail>;\n UC_UI_INITIALIZED: Event;\n UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;\n }\n}\n\n/** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */\nexport type UsercentricsConsentType = 'explicit' | 'implicit';\n\n/** A single entry in a V2 service's consent history (getServicesBaseInfo). */\nexport interface UsercentricsV2ConsentHistoryEntry {\n type: UsercentricsConsentType;\n status: boolean;\n /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */\n action?: string;\n timestamp?: number;\n}\n\n/**\n * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.\n * Only the fields we use are typed - minimal surface, not a full V2 API mirror.\n */\nexport interface UsercentricsV2Service {\n /** Category slug: 'essential' | 'functional' | 'marketing' | custom */\n categorySlug: string;\n /** Service display name (used for service-level consent keys) */\n name?: string;\n /** Consent state for this service */\n consent: {\n status: boolean;\n /** Consent decision history; an 'explicit' entry proves a real user decision. */\n history?: UsercentricsV2ConsentHistoryEntry[];\n };\n}\n\n/**\n * Usercentrics V2 window API (`window.UC_UI`).\n *\n * Methods are synchronous (unlike V3). All methods are optional because\n * Usercentrics does not guarantee every deployment exposes every method.\n */\nexport interface UsercentricsV2Api {\n isInitialized?: () => boolean;\n getServicesBaseInfo?: () => UsercentricsV2Service[];\n getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;\n areAllConsentsAccepted?: () => boolean;\n}\n\n/**\n * Usercentrics V3 category state. The SDK may add future states; we handle\n * unknowns conservatively as non-accepting.\n */\nexport type UsercentricsV3CategoryState =\n | 'ALL_ACCEPTED'\n | 'ALL_DENIED'\n | 'SOME_ACCEPTED'\n | 'NO_STATE'\n | string;\n\n/**\n * Minimal V3 CategoryData - only fields the adapter reads.\n */\nexport interface UsercentricsV3CategoryData {\n state: UsercentricsV3CategoryState;\n name: string;\n}\n\n/**\n * Minimal V3 ConsentData - only the `type` field is used to distinguish\n * explicit vs implicit consent. Other fields (status, version, etc.) exist on\n * the real SDK but are not read by this adapter.\n */\nexport interface UsercentricsV3ConsentData {\n type: 'EXPLICIT' | 'IMPLICIT' | string;\n}\n\n/**\n * Minimal V3 ConsentDetails - only the fields the adapter reads.\n * The real SDK also exposes `services`, but the adapter currently operates\n * at category level only.\n */\nexport interface UsercentricsV3ConsentDetails {\n consent: UsercentricsV3ConsentData;\n categories: Record<string, UsercentricsV3CategoryData>;\n}\n\n/**\n * Usercentrics V3 window API (`window.__ucCmp`).\n *\n * Only the methods this adapter calls are typed - the real SDK surface is\n * much wider but we intentionally keep this narrow.\n */\nexport interface UsercentricsV3Api {\n isInitialized: () => Promise<boolean>;\n getConsentDetails: () => Promise<UsercentricsV3ConsentDetails>;\n}\n\n/**\n * V3 CMP event detail. Fired on `UC_UI_CMP_EVENT` (or custom name).\n * `source: 'CMP'` + a decision `type` tells us a user action has been taken.\n */\nexport interface UsercentricsV3CmpEventDetail {\n source?:\n | 'none'\n | 'button'\n | 'first'\n | 'second'\n | 'embeddings'\n | '__ucCmp'\n | string;\n type?: string;\n abTestVariant?: string;\n}\n\ndeclare global {\n interface Window {\n /**\n * Usercentrics V2 CMP API. Attached once the V2 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n UC_UI?: UsercentricsV2Api;\n /**\n * Usercentrics V3 CMP API. Attached once the V3 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n __ucCmp?: UsercentricsV3Api;\n }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Map Usercentrics categories to walkerOS consent groups.\n * Keys: Usercentrics category names (from ucCategory)\n * Values: walkerOS consent group names\n *\n * Applied in both group-level and service-level consent modes.\n * When multiple source categories map to the same group, strict AND logic\n * applies: ALL contributing source categories must be true for the target\n * group to be true. Any single false denies consent.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only publish when the user has actively decided. V3: consent.type ===\n * EXPLICIT. V2: an EXPLICIT entry exists in service consent history.\n * Implicit/default page-load states are suppressed. Set false to publish any\n * consent snapshot including implicit. Default: true.\n */\n explicitOnly?: boolean;\n\n /**\n * Which Usercentrics API to target.\n * - 'auto' (default): detect at init. If `window.__ucCmp` is present, use V3.\n * If only `window.UC_UI` is present, use V2. If neither is present yet,\n * register listeners for both so late-loading CMPs are still caught.\n * - 'v2': force legacy `window.UC_UI` path.\n * - 'v3': force current `window.__ucCmp` path.\n */\n apiVersion?: 'auto' | 'v2' | 'v3';\n\n /**\n * V3 window event name to listen for consent changes.\n *\n * Usercentrics V3 hardcodes its built-in event names (`UC_UI_CMP_EVENT`,\n * `UC_UI_INITIALIZED`, `UC_UI_VIEW_CHANGED`, `UC_CONSENT`) - they cannot be\n * renamed. However, the Usercentrics admin dashboard (Implementation >\n * Data Layer & Events) lets admins configure an ADDITIONAL custom window\n * event. Use this setting to point at that custom event name if\n * configured; otherwise leave as default.\n *\n * Default: 'UC_UI_CMP_EVENT'\n */\n v3EventName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for Usercentrics source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for Usercentrics source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,gBAAgB,CAAC,UAAU,SAAS,QAAQ,YAAY;AAO9D,SAAS,aACd,YACS;AACT,SAAO,OAAO,OAAO,UAAU,EAAE,MAAM,CAAC,QAAQ,OAAO,QAAQ,SAAS;AAC1E;AAWA,SAAS,aACP,OACA,KACA,OACM;AACN,QAAM,GAAG,IAAI,MAAM,GAAG,MAAM,SAAY,QAAQ,QAAQ,MAAM,GAAG,CA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AkB,eAAlB,YAAgC;AAAA,IAC5C,cAAa,4CAAQ,aAAR,mBAAkB,gBAAlB,YAAiC;AAAA,EAChD;AAEA,QAAM,aAAmC,EAAE,SAAS;AACpD,QAAM,WAA8B,CAAC;AAOrC,QAAM,OAAO,YAA2B;AA9D1C,QAAAC;AA+DI,QAAI,CAAC,aAAc;AAEnB,UAAM,aAAa,EAAE,QAAQ,cAAc,KAAK,UAAU,OAAO;AACjE,UAAM,cAAaA,MAAA,SAAS,eAAT,OAAAA,MAAuB;AAE1C,QAAI,eAAe,MAAM;AACvB,eAAS,KAAK,eAAe,UAAU,CAAC;AAAA,IAC1C,WAAW,eAAe,MAAM;AAC9B,eAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,IAChD,OAAO;AAEL,UAAI,aAAa,SAAS;AACxB,iBAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,MAChD,WAAW,aAAa,OAAO;AAC7B,iBAAS,KAAK,eAAe,UAAU,CAAC;AAAA,MAC1C,OAAO;AAEL,iBAAS,KAAK,eAAe,UAAU,CAAC;AACxC,iBAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA,SAAS,YAAY;AACnB,eAAS,QAAQ,CAAC,OAAO,GAAG,CAAC;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","cmp","_a"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/lib/parseConsent.ts","../src/lib/v2.ts","../src/lib/v3.ts","../src/types/index.ts"],"sourcesContent":["import type { Source } from '@walkeros/core';\nimport type { Types, Settings } from './types';\nimport { setupV2Adapter } from './lib/v2';\nimport { setupV3Adapter } from './lib/v3';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * Listens to Usercentrics CMP events and translates consent states to\n * walkerOS consent commands. Supports both the V2 API (`window.UC_UI`) and\n * the V3 API (`window.__ucCmp`): each reads consent on `UC_UI_INITIALIZED`\n * and on `UC_UI_CMP_EVENT` decisions (V3 listens to `v3EventName` instead\n * when it is set).\n *\n * @example\n * ```typescript\n * import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceUsercentrics,\n * config: {\n * settings: {\n * categoryMap: {\n * statistics: 'analytics',\n * advertising: 'marketing',\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceUsercentrics: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb, logger } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults so adapters always see a fully-resolved Settings\n const settings: Settings = {\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n apiVersion: config?.settings?.apiVersion ?? 'auto',\n v3EventName: config?.settings?.v3EventName ?? 'UC_UI_CMP_EVENT',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n const cleanups: Array<() => void> = [];\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and, critically, no `elb('walker consent')`\n // emit during construction. Emitting from the factory races source merge\n // order and can leave a later `require:[\"consent\"]` source parked.\n const init = async (): Promise<void> => {\n if (!actualWindow) return;\n\n const adapterCtx = { window: actualWindow, elb, settings, logger };\n const apiVersion = settings.apiVersion ?? 'auto';\n\n if (apiVersion === 'v2') {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else if (apiVersion === 'v3') {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else {\n // auto: detect which API is present\n if (actualWindow.__ucCmp) {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else if (actualWindow.UC_UI) {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else {\n // Neither loaded yet: attach both listeners so whichever loads later is caught.\n cleanups.push(setupV2Adapter(adapterCtx));\n cleanups.push(await setupV3Adapter(adapterCtx));\n }\n }\n };\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n init,\n destroy: async () => {\n cleanups.forEach((fn) => fn());\n },\n };\n};\n\nexport default sourceUsercentrics;\n","import type { WalkerOS } from '@walkeros/core';\nimport type { UsercentricsEventDetail, Settings } from '../types';\n\n/** Reserved keys in event.detail that are not service names */\nexport const RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Determine if ucCategory represents group-level consent.\n * Group-level: all values are booleans.\n * Service-level: some values are non-boolean (e.g., 'partial').\n */\nexport function isGroupLevel(\n ucCategory: Record<string, boolean | unknown>,\n): boolean {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n}\n\n/**\n * Merge an incoming consent signal into the accumulating state using strict\n * AND semantics: absent key initialises from the incoming value; present key\n * becomes `true` only if both existing and incoming are `true`. Any single\n * `false` anywhere in the merge chain revokes consent for that key.\n *\n * This matches the consent rule of thumb: any deny signal denies. Permissive\n * (OR) and \"last-wins\" semantics are both unsafe for a privacy primitive.\n */\nfunction mergeConsent(\n state: WalkerOS.Consent,\n key: string,\n value: boolean,\n): void {\n state[key] = state[key] === undefined ? value : Boolean(state[key]) && value;\n}\n\n/**\n * Look a category up in categoryMap case-insensitively; a category without an\n * entry keeps its own name.\n */\nfunction mapCategory(settings: Settings, category: string): string {\n const map = settings.categoryMap ?? {};\n const lower = category.toLowerCase();\n const key = Object.keys(map).find((entry) => entry.toLowerCase() === lower);\n return key === undefined ? category : map[key];\n}\n\n/**\n * Parse consent from Usercentrics event detail.\n *\n * Group-level: ucCategory values are all booleans → use them directly.\n * Service-level: ucCategory has non-booleans → mix boolean ucCategory entries\n * with top-level service keys from event.detail.\n *\n * categoryMap is applied in both modes to ucCategory boolean entries.\n * Strict AND: if multiple source categories map to the same target group,\n * the target is `true` only when ALL contributing sources are `true`.\n */\nexport function parseConsent(\n detail: UsercentricsEventDetail,\n settings: Settings,\n): WalkerOS.Consent {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = mapCategory(settings, category);\n mergeConsent(state, mapped, value);\n });\n } else {\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = mapCategory(settings, key);\n mergeConsent(state, mapped, value);\n }\n });\n }\n\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n const normalized = key.toLowerCase().replace(/ /g, '_');\n mergeConsent(state, normalized, value);\n });\n }\n\n return state;\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV2Service,\n UsercentricsV3CmpEventDetail,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V2AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\n/**\n * V3 CMP event `type` values that signal a real user decision. Other event\n * types (e.g. CMP_SHOWN, VIEW_CHANGED) carry no consent decision and are\n * ignored so the adapter only re-reads after an actual choice.\n */\nconst V2_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Aggregate V2 service array into a group-level ucCategory object using strict\n * AND logic. A category is `true` only if EVERY service in that category is\n * accepted. Any single denied service denies the whole category — this\n * matches the consent rule of thumb: any deny signal denies.\n */\nfunction aggregateByCategory(\n services: UsercentricsV2Service[],\n): Record<string, boolean> {\n const categories: Record<string, boolean> = {};\n services.forEach((service) => {\n const category = service.categorySlug;\n const status = service.consent?.status ?? false;\n categories[category] =\n categories[category] === undefined\n ? status\n : categories[category] && status;\n });\n return categories;\n}\n\n/**\n * Whether any service carries an `explicit` entry in its consent history. An\n * explicit entry is Usercentrics' own proof that the user actively decided\n * (vs an implicit page-load default), so it correctly surfaces returning\n * visitors whose stored decision was explicit.\n */\nexport function hasExplicitDecision(\n services: UsercentricsV2Service[],\n): boolean {\n return services.some((s) =>\n (s.consent.history ?? []).some((h) => h.type?.toLowerCase() === 'explicit'),\n );\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from the V2 services array. The\n * `type` is derived from Usercentrics' own consent history: `explicit` when any\n * service records an explicit decision, `implicit` otherwise. Per-service name\n * keys are surfaced so parseConsent can map service-level consent.\n */\nexport function buildDetailFromServices(\n services: UsercentricsV2Service[],\n): UsercentricsEventDetail {\n const detail: UsercentricsEventDetail = {\n event: 'consent_status',\n type: hasExplicitDecision(services) ? 'explicit' : 'implicit',\n ucCategory: aggregateByCategory(services),\n };\n services.forEach((s) => {\n if (s.name) detail[s.name] = s.consent.status;\n });\n return detail;\n}\n\n/**\n * Set up the V2 adapter using Usercentrics' official events and getter.\n *\n * A single gated `read()` is reused by all triggers: the official\n * `UC_UI_INITIALIZED` lifecycle event, the official `UC_UI_CMP_EVENT` decision\n * events (filtered to real decisions), and a static read at setup time for the\n * common case where the CMP is already initialized when the source runs.\n *\n * Returns a cleanup function that removes both event listeners.\n */\nexport function setupV2Adapter(ctx: V2AdapterContext): () => void {\n const { window: win, elb, settings, logger } = ctx;\n\n const read = (): void => {\n const api = win.UC_UI;\n if (!api?.getServicesBaseInfo) return;\n // isInitialized is optional on the V2 API; only honor it when present.\n // Hard-gating on it would suppress all consent on deployments that expose\n // getServicesBaseInfo without isInitialized.\n if (api.isInitialized && !api.isInitialized()) return;\n const services = api.getServicesBaseInfo();\n if (!services.length) return;\n const detail = buildDetailFromServices(services);\n logger.debug('consent read', detail);\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) elb('walker consent', state);\n };\n\n const onInitialized = (): void => read();\n const onCmpEvent = (e: Event): void => {\n const detail = (e as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n if (!detail?.type || !V2_DECISION_TYPES.has(detail.type)) return;\n read();\n };\n\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n win.addEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n\n read(); // static read: CMP already initialized when source runs\n\n return () => {\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n win.removeEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n };\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV3Api,\n UsercentricsV3CategoryState,\n UsercentricsV3CmpEventDetail,\n UsercentricsV3ConsentDetails,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V3AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\nconst V3_DEFAULT_EVENT_NAME = 'UC_UI_CMP_EVENT';\n\n/**\n * V3 CMP event types that represent a user consent decision. Presentation\n * events like `CMP_SHOWN` or `UI_INITIALIZED` must NOT trigger a consent\n * publish — they carry no user decision.\n */\nconst V3_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Map a V3 CategoryData.state value to a walkerOS boolean using strict\n * semantics: only fully-accepted categories are `true`. Any partial or\n * denied state (including future/unknown states) resolves to `false`.\n *\n * This matches the consent rule of thumb: any deny signal denies.\n */\nfunction categoryStateToBoolean(state: UsercentricsV3CategoryState): boolean {\n return state === 'ALL_ACCEPTED';\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from V3 ConsentDetails.\n * Translates V3's structured consent state into the shape parseConsent expects.\n */\nfunction buildDetailFromV3(\n details: UsercentricsV3ConsentDetails,\n): UsercentricsEventDetail {\n const ucCategory: Record<string, boolean> = {};\n Object.entries(details.categories).forEach(([slug, category]) => {\n ucCategory[slug] = categoryStateToBoolean(category.state);\n });\n\n return {\n event: 'consent_status',\n type: details.consent.type === 'EXPLICIT' ? 'explicit' : 'implicit',\n ucCategory,\n };\n}\n\n/**\n * Set up the V3 adapter: registers a listener on the V3 consent event AND\n * (if __ucCmp is already initialized) performs a static read.\n *\n * Both paths re-fetch getConsentDetails() because the event payload does\n * not include consent state.\n *\n * Returns a cleanup function that removes the event listener.\n */\nexport async function setupV3Adapter(\n ctx: V3AdapterContext,\n): Promise<() => void> {\n const { window: win, elb, settings, logger } = ctx;\n const eventName = settings.v3EventName ?? V3_DEFAULT_EVENT_NAME;\n\n const publishConsent = async (cmp: UsercentricsV3Api): Promise<void> => {\n const details = await cmp.getConsentDetails();\n const detail = buildDetailFromV3(details);\n logger.debug('event received', detail);\n\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n const listener = (event: Event): void => {\n const cmp = win.__ucCmp;\n if (!cmp) return;\n const detail = (event as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n // Filter to decision events only: the CMP emits a broad set of events\n // (CMP_SHOWN, UI_INITIALIZED, VIEW_CHANGED, …) on this bus. Without\n // filtering, every view toggle would re-publish consent. The decision\n // `type` is the only reliable signal; `detail.source` is one of\n // none|button|first|second|embeddings|__ucCmp and must NOT be gated on.\n if (!detail?.type || !V3_DECISION_TYPES.has(detail.type)) return;\n publishConsent(cmp).catch(() => {\n // Swallow — a failed V3 fetch should not break the page.\n });\n };\n win.addEventListener(eventName, listener);\n\n // When the source loads BEFORE __ucCmp, no UC_UI_CMP_EVENT fires for a\n // choice made in a prior session. UC_UI_INITIALIZED signals the CMP is ready,\n // so perform the static read then to publish any already-made decision.\n const onInitialized = (): void => {\n const cmp = win.__ucCmp;\n if (cmp) publishConsent(cmp).catch(() => {});\n };\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n\n // Static check: if __ucCmp is already initialized, fetch now.\n // Wrapped in try/catch so transient API failures during setup don't\n // reject setupV3Adapter() and tear down the whole flow — the listener\n // stays registered and will pick up the next real event.\n const cmp = win.__ucCmp;\n if (cmp) {\n try {\n const initialized = await cmp.isInitialized();\n if (initialized) {\n await publishConsent(cmp);\n }\n } catch (err) {\n logger.warn('v3 static consent read failed', err);\n }\n }\n\n return () => {\n win.removeEventListener(eventName, listener);\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n };\n}\n","import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n usercentrics: { type: 'usercentrics'; platform?: 'web' };\n }\n}\n\n/**\n * Usercentrics consent detail structure.\n *\n * Built by the V2 and V3 adapters from the CMP's API and passed to the\n * consent parser. Contains both category-level (ucCategory) and\n * service-level consent.\n */\nexport interface UsercentricsEventDetail {\n /** Always 'consent_status' for consent events */\n event: string;\n /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */\n type: string;\n /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */\n action?: string;\n /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */\n ucCategory?: Record<string, boolean | unknown>;\n /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */\n [service: string]: unknown;\n}\n\ndeclare global {\n interface WindowEventMap {\n UC_UI_INITIALIZED: Event;\n UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;\n }\n}\n\n/** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */\nexport type UsercentricsConsentType = 'explicit' | 'implicit';\n\n/** A single entry in a V2 service's consent history (getServicesBaseInfo). */\nexport interface UsercentricsV2ConsentHistoryEntry {\n type: UsercentricsConsentType;\n status: boolean;\n /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */\n action?: string;\n timestamp?: number;\n}\n\n/**\n * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.\n * Only the fields we use are typed - minimal surface, not a full V2 API mirror.\n */\nexport interface UsercentricsV2Service {\n /** Category slug: 'essential' | 'functional' | 'marketing' | custom */\n categorySlug: string;\n /** Service display name (used for service-level consent keys) */\n name?: string;\n /** Consent state for this service */\n consent: {\n status: boolean;\n /** Consent decision history; an 'explicit' entry proves a real user decision. */\n history?: UsercentricsV2ConsentHistoryEntry[];\n };\n}\n\n/**\n * Usercentrics V2 window API (`window.UC_UI`).\n *\n * Methods are synchronous (unlike V3). All methods are optional because\n * Usercentrics does not guarantee every deployment exposes every method.\n */\nexport interface UsercentricsV2Api {\n isInitialized?: () => boolean;\n getServicesBaseInfo?: () => UsercentricsV2Service[];\n getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;\n areAllConsentsAccepted?: () => boolean;\n}\n\n/**\n * Usercentrics V3 category state. The SDK may add future states; we handle\n * unknowns conservatively as non-accepting.\n */\nexport type UsercentricsV3CategoryState =\n | 'ALL_ACCEPTED'\n | 'ALL_DENIED'\n | 'SOME_ACCEPTED'\n | 'NO_STATE'\n | string;\n\n/**\n * Minimal V3 CategoryData - only fields the adapter reads.\n */\nexport interface UsercentricsV3CategoryData {\n state: UsercentricsV3CategoryState;\n name: string;\n}\n\n/**\n * Minimal V3 ConsentData - only the `type` field is used to distinguish\n * explicit vs implicit consent. Other fields (status, version, etc.) exist on\n * the real SDK but are not read by this adapter.\n */\nexport interface UsercentricsV3ConsentData {\n type: 'EXPLICIT' | 'IMPLICIT' | string;\n}\n\n/**\n * Minimal V3 ConsentDetails - only the fields the adapter reads.\n * The real SDK also exposes `services`, but the adapter currently operates\n * at category level only.\n */\nexport interface UsercentricsV3ConsentDetails {\n consent: UsercentricsV3ConsentData;\n categories: Record<string, UsercentricsV3CategoryData>;\n}\n\n/**\n * Usercentrics V3 window API (`window.__ucCmp`).\n *\n * Only the methods this adapter calls are typed - the real SDK surface is\n * much wider but we intentionally keep this narrow.\n */\nexport interface UsercentricsV3Api {\n isInitialized: () => Promise<boolean>;\n getConsentDetails: () => Promise<UsercentricsV3ConsentDetails>;\n}\n\n/**\n * V3 CMP event detail. Fired on `UC_UI_CMP_EVENT` (or custom name).\n * `source: 'CMP'` + a decision `type` tells us a user action has been taken.\n */\nexport interface UsercentricsV3CmpEventDetail {\n source?:\n | 'none'\n | 'button'\n | 'first'\n | 'second'\n | 'embeddings'\n | '__ucCmp'\n | string;\n type?: string;\n abTestVariant?: string;\n}\n\ndeclare global {\n interface Window {\n /**\n * Usercentrics V2 CMP API. Attached once the V2 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n UC_UI?: UsercentricsV2Api;\n /**\n * Usercentrics V3 CMP API. Attached once the V3 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n __ucCmp?: UsercentricsV3Api;\n }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Map Usercentrics categories to walkerOS consent groups.\n * Keys: Usercentrics category names (from ucCategory)\n * Values: walkerOS consent group names\n *\n * Applied in both group-level and service-level consent modes.\n * When multiple source categories map to the same group, strict AND logic\n * applies: ALL contributing source categories must be true for the target\n * group to be true. Any single false denies consent.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only publish when the user has actively decided. V3: consent.type ===\n * EXPLICIT. V2: an EXPLICIT entry exists in service consent history.\n * Implicit/default page-load states are suppressed. Set false to publish any\n * consent snapshot including implicit. Default: true.\n */\n explicitOnly?: boolean;\n\n /**\n * Which Usercentrics API to target.\n * - 'auto' (default): detect at init. If `window.__ucCmp` is present, use V3.\n * If only `window.UC_UI` is present, use V2. If neither is present yet,\n * register listeners for both so late-loading CMPs are still caught.\n * - 'v2': force legacy `window.UC_UI` path.\n * - 'v3': force current `window.__ucCmp` path.\n */\n apiVersion?: 'auto' | 'v2' | 'v3';\n\n /**\n * V3 window event name to listen for consent changes.\n *\n * Usercentrics V3 hardcodes its built-in event names (`UC_UI_CMP_EVENT`,\n * `UC_UI_INITIALIZED`, `UC_UI_VIEW_CHANGED`, `UC_CONSENT`) - they cannot be\n * renamed. However, the Usercentrics admin dashboard (Implementation >\n * Data Layer & Events) lets admins configure an ADDITIONAL custom window\n * event. Use this setting to point at that custom event name if\n * configured; otherwise leave as default.\n *\n * Default: 'UC_UI_CMP_EVENT'\n */\n v3EventName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for Usercentrics source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for Usercentrics source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,gBAAgB,CAAC,UAAU,SAAS,QAAQ,YAAY;AAO9D,SAAS,aACd,YACS;AACT,SAAO,OAAO,OAAO,UAAU,EAAE,MAAM,CAAC,QAAQ,OAAO,QAAQ,SAAS;AAC1E;AAWA,SAAS,aACP,OACA,KACA,OACM;AACN,QAAM,GAAG,IAAI,MAAM,GAAG,MAAM,SAAY,QAAQ,QAAQ,MAAM,GAAG,CAAC,KAAK;AACzE;AAMA,SAAS,YAAY,UAAoB,UAA0B;AAtCnE;AAuCE,QAAM,OAAM,cAAS,gBAAT,YAAwB,CAAC;AACrC,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,MAAM,OAAO,KAAK,GAAG,EAAE,KAAK,CAAC,UAAU,MAAM,YAAY,MAAM,KAAK;AAC1E,SAAO,QAAQ,SAAY,WAAW,IAAI,GAAG;AAC/C;AAaO,SAAS,aACd,QACA,UACk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,SAAS,eAAT,OAAAA,MAAuB;AAE1C,QAAI,eAAe,MAAM;AACvB,eAAS,KAAK,eAAe,UAAU,CAAC;AAAA,IAC1C,WAAW,eAAe,MAAM;AAC9B,eAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,IAChD,OAAO;AAEL,UAAI,aAAa,SAAS;AACxB,iBAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,MAChD,WAAW,aAAa,OAAO;AAC7B,iBAAS,KAAK,eAAe,UAAU,CAAC;AAAA,MAC1C,OAAO;AAEL,iBAAS,KAAK,eAAe,UAAU,CAAC;AACxC,iBAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA,SAAS,YAAY;AACnB,eAAS,QAAQ,CAAC,OAAO,GAAG,CAAC;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","cmp","_a"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/parseConsent.ts","../src/lib/v2.ts","../src/lib/v3.ts","../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { WalkerOS } from '@walkeros/core';\nimport type { UsercentricsEventDetail, Settings } from '../types';\n\n/** Reserved keys in event.detail that are not service names */\nexport const RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Determine if ucCategory represents group-level consent.\n * Group-level: all values are booleans.\n * Service-level: some values are non-boolean (e.g., 'partial').\n */\nexport function isGroupLevel(\n ucCategory: Record<string, boolean | unknown>,\n): boolean {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n}\n\n/**\n * Merge an incoming consent signal into the accumulating state using strict\n * AND semantics: absent key initialises from the incoming value; present key\n * becomes `true` only if both existing and incoming are `true`. Any single\n * `false` anywhere in the merge chain revokes consent for that key.\n *\n * This matches the consent rule of thumb: any deny signal denies. Permissive\n * (OR) and \"last-wins\" semantics are both unsafe for a privacy primitive.\n */\nfunction mergeConsent(\n state: WalkerOS.Consent,\n key: string,\n value: boolean,\n): void {\n state[key] = state[key] === undefined ? value : Boolean(state[key]) && value;\n}\n\n/**\n * Look a category up in categoryMap case-insensitively; a category without an\n * entry keeps its own name.\n */\nfunction mapCategory(settings: Settings, category: string): string {\n const map = settings.categoryMap ?? {};\n const lower = category.toLowerCase();\n const key = Object.keys(map).find((entry) => entry.toLowerCase() === lower);\n return key === undefined ? category : map[key];\n}\n\n/**\n * Parse consent from Usercentrics event detail.\n *\n * Group-level: ucCategory values are all booleans → use them directly.\n * Service-level: ucCategory has non-booleans → mix boolean ucCategory entries\n * with top-level service keys from event.detail.\n *\n * categoryMap is applied in both modes to ucCategory boolean entries.\n * Strict AND: if multiple source categories map to the same target group,\n * the target is `true` only when ALL contributing sources are `true`.\n */\nexport function parseConsent(\n detail: UsercentricsEventDetail,\n settings: Settings,\n): WalkerOS.Consent {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = mapCategory(settings, category);\n mergeConsent(state, mapped, value);\n });\n } else {\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = mapCategory(settings, key);\n mergeConsent(state, mapped, value);\n }\n });\n }\n\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n const normalized = key.toLowerCase().replace(/ /g, '_');\n mergeConsent(state, normalized, value);\n });\n }\n\n return state;\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV2Service,\n UsercentricsV3CmpEventDetail,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V2AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\n/**\n * V3 CMP event `type` values that signal a real user decision. Other event\n * types (e.g. CMP_SHOWN, VIEW_CHANGED) carry no consent decision and are\n * ignored so the adapter only re-reads after an actual choice.\n */\nconst V2_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Aggregate V2 service array into a group-level ucCategory object using strict\n * AND logic. A category is `true` only if EVERY service in that category is\n * accepted. Any single denied service denies the whole category — this\n * matches the consent rule of thumb: any deny signal denies.\n */\nfunction aggregateByCategory(\n services: UsercentricsV2Service[],\n): Record<string, boolean> {\n const categories: Record<string, boolean> = {};\n services.forEach((service) => {\n const category = service.categorySlug;\n const status = service.consent?.status ?? false;\n categories[category] =\n categories[category] === undefined\n ? status\n : categories[category] && status;\n });\n return categories;\n}\n\n/**\n * Whether any service carries an `explicit` entry in its consent history. An\n * explicit entry is Usercentrics' own proof that the user actively decided\n * (vs an implicit page-load default), so it correctly surfaces returning\n * visitors whose stored decision was explicit.\n */\nexport function hasExplicitDecision(\n services: UsercentricsV2Service[],\n): boolean {\n return services.some((s) =>\n (s.consent.history ?? []).some((h) => h.type?.toLowerCase() === 'explicit'),\n );\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from the V2 services array. The\n * `type` is derived from Usercentrics' own consent history: `explicit` when any\n * service records an explicit decision, `implicit` otherwise. Per-service name\n * keys are surfaced so parseConsent can map service-level consent.\n */\nexport function buildDetailFromServices(\n services: UsercentricsV2Service[],\n): UsercentricsEventDetail {\n const detail: UsercentricsEventDetail = {\n event: 'consent_status',\n type: hasExplicitDecision(services) ? 'explicit' : 'implicit',\n ucCategory: aggregateByCategory(services),\n };\n services.forEach((s) => {\n if (s.name) detail[s.name] = s.consent.status;\n });\n return detail;\n}\n\n/**\n * Set up the V2 adapter using Usercentrics' official events and getter.\n *\n * A single gated `read()` is reused by all triggers: the official\n * `UC_UI_INITIALIZED` lifecycle event, the official `UC_UI_CMP_EVENT` decision\n * events (filtered to real decisions), and a static read at setup time for the\n * common case where the CMP is already initialized when the source runs.\n *\n * Returns a cleanup function that removes both event listeners.\n */\nexport function setupV2Adapter(ctx: V2AdapterContext): () => void {\n const { window: win, elb, settings, logger } = ctx;\n\n const read = (): void => {\n const api = win.UC_UI;\n if (!api?.getServicesBaseInfo) return;\n // isInitialized is optional on the V2 API; only honor it when present.\n // Hard-gating on it would suppress all consent on deployments that expose\n // getServicesBaseInfo without isInitialized.\n if (api.isInitialized && !api.isInitialized()) return;\n const services = api.getServicesBaseInfo();\n if (!services.length) return;\n const detail = buildDetailFromServices(services);\n logger.debug('consent read', detail);\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) elb('walker consent', state);\n };\n\n const onInitialized = (): void => read();\n const onCmpEvent = (e: Event): void => {\n const detail = (e as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n if (!detail?.type || !V2_DECISION_TYPES.has(detail.type)) return;\n read();\n };\n\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n win.addEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n\n read(); // static read: CMP already initialized when source runs\n\n return () => {\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n win.removeEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n };\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV3Api,\n UsercentricsV3CategoryState,\n UsercentricsV3CmpEventDetail,\n UsercentricsV3ConsentDetails,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V3AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\nconst V3_DEFAULT_EVENT_NAME = 'UC_UI_CMP_EVENT';\n\n/**\n * V3 CMP event types that represent a user consent decision. Presentation\n * events like `CMP_SHOWN` or `UI_INITIALIZED` must NOT trigger a consent\n * publish — they carry no user decision.\n */\nconst V3_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Map a V3 CategoryData.state value to a walkerOS boolean using strict\n * semantics: only fully-accepted categories are `true`. Any partial or\n * denied state (including future/unknown states) resolves to `false`.\n *\n * This matches the consent rule of thumb: any deny signal denies.\n */\nfunction categoryStateToBoolean(state: UsercentricsV3CategoryState): boolean {\n return state === 'ALL_ACCEPTED';\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from V3 ConsentDetails.\n * Translates V3's structured consent state into the shape parseConsent expects.\n */\nfunction buildDetailFromV3(\n details: UsercentricsV3ConsentDetails,\n): UsercentricsEventDetail {\n const ucCategory: Record<string, boolean> = {};\n Object.entries(details.categories).forEach(([slug, category]) => {\n ucCategory[slug] = categoryStateToBoolean(category.state);\n });\n\n return {\n event: 'consent_status',\n type: details.consent.type === 'EXPLICIT' ? 'explicit' : 'implicit',\n ucCategory,\n };\n}\n\n/**\n * Set up the V3 adapter: registers a listener on the V3 consent event AND\n * (if __ucCmp is already initialized) performs a static read.\n *\n * Both paths re-fetch getConsentDetails() because the event payload does\n * not include consent state.\n *\n * Returns a cleanup function that removes the event listener.\n */\nexport async function setupV3Adapter(\n ctx: V3AdapterContext,\n): Promise<() => void> {\n const { window: win, elb, settings, logger } = ctx;\n const eventName = settings.v3EventName ?? V3_DEFAULT_EVENT_NAME;\n\n const publishConsent = async (cmp: UsercentricsV3Api): Promise<void> => {\n const details = await cmp.getConsentDetails();\n const detail = buildDetailFromV3(details);\n logger.debug('event received', detail);\n\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n const listener = (event: Event): void => {\n const cmp = win.__ucCmp;\n if (!cmp) return;\n const detail = (event as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n // Filter to decision events only: the CMP emits a broad set of events\n // (CMP_SHOWN, UI_INITIALIZED, VIEW_CHANGED, …) on this bus. Without\n // filtering, every view toggle would re-publish consent. The decision\n // `type` is the only reliable signal; `detail.source` is one of\n // none|button|first|second|embeddings|__ucCmp and must NOT be gated on.\n if (!detail?.type || !V3_DECISION_TYPES.has(detail.type)) return;\n publishConsent(cmp).catch(() => {\n // Swallow — a failed V3 fetch should not break the page.\n });\n };\n win.addEventListener(eventName, listener);\n\n // When the source loads BEFORE __ucCmp, no UC_UI_CMP_EVENT fires for a\n // choice made in a prior session. UC_UI_INITIALIZED signals the CMP is ready,\n // so perform the static read then to publish any already-made decision.\n const onInitialized = (): void => {\n const cmp = win.__ucCmp;\n if (cmp) publishConsent(cmp).catch(() => {});\n };\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n\n // Static check: if __ucCmp is already initialized, fetch now.\n // Wrapped in try/catch so transient API failures during setup don't\n // reject setupV3Adapter() and tear down the whole flow — the listener\n // stays registered and will pick up the next real event.\n const cmp = win.__ucCmp;\n if (cmp) {\n try {\n const initialized = await cmp.isInitialized();\n if (initialized) {\n await publishConsent(cmp);\n }\n } catch (err) {\n logger.warn('v3 static consent read failed', err);\n }\n }\n\n return () => {\n win.removeEventListener(eventName, listener);\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n };\n}\n","import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n usercentrics: { type: 'usercentrics'; platform?: 'web' };\n }\n}\n\n/**\n * Usercentrics consent event detail structure.\n *\n * Fired as event.detail on the configured window event (e.g. 'ucEvent').\n * Contains both category-level (ucCategory) and service-level consent.\n */\nexport interface UsercentricsEventDetail {\n /** Always 'consent_status' for consent events */\n event: string;\n /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */\n type: string;\n /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */\n action?: string;\n /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */\n ucCategory?: Record<string, boolean | unknown>;\n /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */\n [service: string]: unknown;\n}\n\ndeclare global {\n interface WindowEventMap {\n ucEvent: CustomEvent<UsercentricsEventDetail>;\n UC_UI_INITIALIZED: Event;\n UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;\n }\n}\n\n/** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */\nexport type UsercentricsConsentType = 'explicit' | 'implicit';\n\n/** A single entry in a V2 service's consent history (getServicesBaseInfo). */\nexport interface UsercentricsV2ConsentHistoryEntry {\n type: UsercentricsConsentType;\n status: boolean;\n /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */\n action?: string;\n timestamp?: number;\n}\n\n/**\n * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.\n * Only the fields we use are typed - minimal surface, not a full V2 API mirror.\n */\nexport interface UsercentricsV2Service {\n /** Category slug: 'essential' | 'functional' | 'marketing' | custom */\n categorySlug: string;\n /** Service display name (used for service-level consent keys) */\n name?: string;\n /** Consent state for this service */\n consent: {\n status: boolean;\n /** Consent decision history; an 'explicit' entry proves a real user decision. */\n history?: UsercentricsV2ConsentHistoryEntry[];\n };\n}\n\n/**\n * Usercentrics V2 window API (`window.UC_UI`).\n *\n * Methods are synchronous (unlike V3). All methods are optional because\n * Usercentrics does not guarantee every deployment exposes every method.\n */\nexport interface UsercentricsV2Api {\n isInitialized?: () => boolean;\n getServicesBaseInfo?: () => UsercentricsV2Service[];\n getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;\n areAllConsentsAccepted?: () => boolean;\n}\n\n/**\n * Usercentrics V3 category state. The SDK may add future states; we handle\n * unknowns conservatively as non-accepting.\n */\nexport type UsercentricsV3CategoryState =\n | 'ALL_ACCEPTED'\n | 'ALL_DENIED'\n | 'SOME_ACCEPTED'\n | 'NO_STATE'\n | string;\n\n/**\n * Minimal V3 CategoryData - only fields the adapter reads.\n */\nexport interface UsercentricsV3CategoryData {\n state: UsercentricsV3CategoryState;\n name: string;\n}\n\n/**\n * Minimal V3 ConsentData - only the `type` field is used to distinguish\n * explicit vs implicit consent. Other fields (status, version, etc.) exist on\n * the real SDK but are not read by this adapter.\n */\nexport interface UsercentricsV3ConsentData {\n type: 'EXPLICIT' | 'IMPLICIT' | string;\n}\n\n/**\n * Minimal V3 ConsentDetails - only the fields the adapter reads.\n * The real SDK also exposes `services`, but the adapter currently operates\n * at category level only.\n */\nexport interface UsercentricsV3ConsentDetails {\n consent: UsercentricsV3ConsentData;\n categories: Record<string, UsercentricsV3CategoryData>;\n}\n\n/**\n * Usercentrics V3 window API (`window.__ucCmp`).\n *\n * Only the methods this adapter calls are typed - the real SDK surface is\n * much wider but we intentionally keep this narrow.\n */\nexport interface UsercentricsV3Api {\n isInitialized: () => Promise<boolean>;\n getConsentDetails: () => Promise<UsercentricsV3ConsentDetails>;\n}\n\n/**\n * V3 CMP event detail. Fired on `UC_UI_CMP_EVENT` (or custom name).\n * `source: 'CMP'` + a decision `type` tells us a user action has been taken.\n */\nexport interface UsercentricsV3CmpEventDetail {\n source?:\n | 'none'\n | 'button'\n | 'first'\n | 'second'\n | 'embeddings'\n | '__ucCmp'\n | string;\n type?: string;\n abTestVariant?: string;\n}\n\ndeclare global {\n interface Window {\n /**\n * Usercentrics V2 CMP API. Attached once the V2 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n UC_UI?: UsercentricsV2Api;\n /**\n * Usercentrics V3 CMP API. Attached once the V3 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n __ucCmp?: UsercentricsV3Api;\n }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Map Usercentrics categories to walkerOS consent groups.\n * Keys: Usercentrics category names (from ucCategory)\n * Values: walkerOS consent group names\n *\n * Applied in both group-level and service-level consent modes.\n * When multiple source categories map to the same group, strict AND logic\n * applies: ALL contributing source categories must be true for the target\n * group to be true. Any single false denies consent.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only publish when the user has actively decided. V3: consent.type ===\n * EXPLICIT. V2: an EXPLICIT entry exists in service consent history.\n * Implicit/default page-load states are suppressed. Set false to publish any\n * consent snapshot including implicit. Default: true.\n */\n explicitOnly?: boolean;\n\n /**\n * Which Usercentrics API to target.\n * - 'auto' (default): detect at init. If `window.__ucCmp` is present, use V3.\n * If only `window.UC_UI` is present, use V2. If neither is present yet,\n * register listeners for both so late-loading CMPs are still caught.\n * - 'v2': force legacy `window.UC_UI` path.\n * - 'v3': force current `window.__ucCmp` path.\n */\n apiVersion?: 'auto' | 'v2' | 'v3';\n\n /**\n * V3 window event name to listen for consent changes.\n *\n * Usercentrics V3 hardcodes its built-in event names (`UC_UI_CMP_EVENT`,\n * `UC_UI_INITIALIZED`, `UC_UI_VIEW_CHANGED`, `UC_CONSENT`) - they cannot be\n * renamed. However, the Usercentrics admin dashboard (Implementation >\n * Data Layer & Events) lets admins configure an ADDITIONAL custom window\n * event. Use this setting to point at that custom event name if\n * configured; otherwise leave as default.\n *\n * Default: 'UC_UI_CMP_EVENT'\n */\n v3EventName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for Usercentrics source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for Usercentrics source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","import type { Source } from '@walkeros/core';\nimport type { Types, Settings } from './types';\nimport { setupV2Adapter } from './lib/v2';\nimport { setupV3Adapter } from './lib/v3';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * Listens to Usercentrics CMP events and translates consent states to\n * walkerOS consent commands. Supports both the legacy V2 API\n * (`window.UC_UI` + `ucEvent`) and the current V3 API\n * (`window.__ucCmp` + `UC_UI_CMP_EVENT`).\n *\n * @example\n * ```typescript\n * import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceUsercentrics,\n * config: {\n * settings: {\n * categoryMap: {\n * statistics: 'analytics',\n * advertising: 'marketing',\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceUsercentrics: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb, logger } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults so adapters always see a fully-resolved Settings\n const settings: Settings = {\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n apiVersion: config?.settings?.apiVersion ?? 'auto',\n v3EventName: config?.settings?.v3EventName ?? 'UC_UI_CMP_EVENT',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n const cleanups: Array<() => void> = [];\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and, critically, no `elb('walker consent')`\n // emit during construction. Emitting from the factory races source merge\n // order and can leave a later `require:[\"consent\"]` source parked.\n const init = async (): Promise<void> => {\n if (!actualWindow) return;\n\n const adapterCtx = { window: actualWindow, elb, settings, logger };\n const apiVersion = settings.apiVersion ?? 'auto';\n\n if (apiVersion === 'v2') {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else if (apiVersion === 'v3') {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else {\n // auto: detect which API is present\n if (actualWindow.__ucCmp) {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else if (actualWindow.UC_UI) {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else {\n // Neither loaded yet — attach both listeners so whichever loads later is caught.\n cleanups.push(setupV2Adapter(adapterCtx));\n cleanups.push(await setupV3Adapter(adapterCtx));\n }\n }\n };\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n init,\n destroy: async () => {\n cleanups.forEach((fn) => fn());\n },\n };\n};\n\nexport default sourceUsercentrics;\n"],"mappings":";AAIO,IAAM,gBAAgB,CAAC,UAAU,SAAS,QAAQ,YAAY;AAO9D,SAAS,aACd,YACS;AACT,SAAO,OAAO,OAAO,UAAU,EAAE,MAAM,CAAC,QAAQ,OAAO,QAAQ,SAAS;AAC1E;AAWA,SAAS,aACP,OACA,KACA,OACM;AACN,QAAM,GAAG,IAAI,MAAM,GAAG,MAAM,SAAY,QAAQ,QAAQ,MAAM,GAAG,CAAC,KAAK;AACzE;AAMA,SAAS,YAAY,UAAoB,UAA0B;AAtCnE;AAuCE,QAAM,OAAM,cAAS,gBAAT,YAAwB,CAAC;AACrC,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,MAAM,OAAO,KAAK,GAAG,EAAE,KAAK,CAAC,UAAU,MAAM,YAAY,MAAM,KAAK;AAC1E,SAAO,QAAQ,SAAY,WAAW,IAAI,GAAG;AAC/C;AAaO,SAAS,aACd,QACA,UACkB;AAClB,QAAM,QAA0B,CAAC;AAEjC,MAAI,OAAO,cAAc,aAAa,OAAO,UAAU,GAAG;AACxD,WAAO,QAAQ,OAAO,UAAU,EAAE,QAAQ,CAAC,CAAC,UAAU,KAAK,MAAM;AAC/D,UAAI,OAAO,UAAU,UAAW;AAChC,YAAM,SAAS,YAAY,UAAU,QAAQ;AAC7C,mBAAa,OAAO,QAAQ,KAAK;AAAA,IACnC,CAAC;AAAA,EACH,OAAO;AACL,QAAI,OAAO,YAAY;AACrB,aAAO,QAAQ,OAAO,UAAU,EAAE,QAAQ,CAAC,CAA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,CAAC;AACxC,iBAAS,KAAK,MAAM,eAAe,UAAU,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA,SAAS,YAAY;AACnB,eAAS,QAAQ,CAAC,OAAO,GAAG,CAAC;AAAA,IAC/B;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","cmp","_a"]}
1
+ {"version":3,"sources":["../src/lib/parseConsent.ts","../src/lib/v2.ts","../src/lib/v3.ts","../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { WalkerOS } from '@walkeros/core';\nimport type { UsercentricsEventDetail, Settings } from '../types';\n\n/** Reserved keys in event.detail that are not service names */\nexport const RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Determine if ucCategory represents group-level consent.\n * Group-level: all values are booleans.\n * Service-level: some values are non-boolean (e.g., 'partial').\n */\nexport function isGroupLevel(\n ucCategory: Record<string, boolean | unknown>,\n): boolean {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n}\n\n/**\n * Merge an incoming consent signal into the accumulating state using strict\n * AND semantics: absent key initialises from the incoming value; present key\n * becomes `true` only if both existing and incoming are `true`. Any single\n * `false` anywhere in the merge chain revokes consent for that key.\n *\n * This matches the consent rule of thumb: any deny signal denies. Permissive\n * (OR) and \"last-wins\" semantics are both unsafe for a privacy primitive.\n */\nfunction mergeConsent(\n state: WalkerOS.Consent,\n key: string,\n value: boolean,\n): void {\n state[key] = state[key] === undefined ? value : Boolean(state[key]) && value;\n}\n\n/**\n * Look a category up in categoryMap case-insensitively; a category without an\n * entry keeps its own name.\n */\nfunction mapCategory(settings: Settings, category: string): string {\n const map = settings.categoryMap ?? {};\n const lower = category.toLowerCase();\n const key = Object.keys(map).find((entry) => entry.toLowerCase() === lower);\n return key === undefined ? category : map[key];\n}\n\n/**\n * Parse consent from Usercentrics event detail.\n *\n * Group-level: ucCategory values are all booleans → use them directly.\n * Service-level: ucCategory has non-booleans → mix boolean ucCategory entries\n * with top-level service keys from event.detail.\n *\n * categoryMap is applied in both modes to ucCategory boolean entries.\n * Strict AND: if multiple source categories map to the same target group,\n * the target is `true` only when ALL contributing sources are `true`.\n */\nexport function parseConsent(\n detail: UsercentricsEventDetail,\n settings: Settings,\n): WalkerOS.Consent {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = mapCategory(settings, category);\n mergeConsent(state, mapped, value);\n });\n } else {\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = mapCategory(settings, key);\n mergeConsent(state, mapped, value);\n }\n });\n }\n\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n const normalized = key.toLowerCase().replace(/ /g, '_');\n mergeConsent(state, normalized, value);\n });\n }\n\n return state;\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV2Service,\n UsercentricsV3CmpEventDetail,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V2AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\n/**\n * V3 CMP event `type` values that signal a real user decision. Other event\n * types (e.g. CMP_SHOWN, VIEW_CHANGED) carry no consent decision and are\n * ignored so the adapter only re-reads after an actual choice.\n */\nconst V2_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Aggregate V2 service array into a group-level ucCategory object using strict\n * AND logic. A category is `true` only if EVERY service in that category is\n * accepted. Any single denied service denies the whole category — this\n * matches the consent rule of thumb: any deny signal denies.\n */\nfunction aggregateByCategory(\n services: UsercentricsV2Service[],\n): Record<string, boolean> {\n const categories: Record<string, boolean> = {};\n services.forEach((service) => {\n const category = service.categorySlug;\n const status = service.consent?.status ?? false;\n categories[category] =\n categories[category] === undefined\n ? status\n : categories[category] && status;\n });\n return categories;\n}\n\n/**\n * Whether any service carries an `explicit` entry in its consent history. An\n * explicit entry is Usercentrics' own proof that the user actively decided\n * (vs an implicit page-load default), so it correctly surfaces returning\n * visitors whose stored decision was explicit.\n */\nexport function hasExplicitDecision(\n services: UsercentricsV2Service[],\n): boolean {\n return services.some((s) =>\n (s.consent.history ?? []).some((h) => h.type?.toLowerCase() === 'explicit'),\n );\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from the V2 services array. The\n * `type` is derived from Usercentrics' own consent history: `explicit` when any\n * service records an explicit decision, `implicit` otherwise. Per-service name\n * keys are surfaced so parseConsent can map service-level consent.\n */\nexport function buildDetailFromServices(\n services: UsercentricsV2Service[],\n): UsercentricsEventDetail {\n const detail: UsercentricsEventDetail = {\n event: 'consent_status',\n type: hasExplicitDecision(services) ? 'explicit' : 'implicit',\n ucCategory: aggregateByCategory(services),\n };\n services.forEach((s) => {\n if (s.name) detail[s.name] = s.consent.status;\n });\n return detail;\n}\n\n/**\n * Set up the V2 adapter using Usercentrics' official events and getter.\n *\n * A single gated `read()` is reused by all triggers: the official\n * `UC_UI_INITIALIZED` lifecycle event, the official `UC_UI_CMP_EVENT` decision\n * events (filtered to real decisions), and a static read at setup time for the\n * common case where the CMP is already initialized when the source runs.\n *\n * Returns a cleanup function that removes both event listeners.\n */\nexport function setupV2Adapter(ctx: V2AdapterContext): () => void {\n const { window: win, elb, settings, logger } = ctx;\n\n const read = (): void => {\n const api = win.UC_UI;\n if (!api?.getServicesBaseInfo) return;\n // isInitialized is optional on the V2 API; only honor it when present.\n // Hard-gating on it would suppress all consent on deployments that expose\n // getServicesBaseInfo without isInitialized.\n if (api.isInitialized && !api.isInitialized()) return;\n const services = api.getServicesBaseInfo();\n if (!services.length) return;\n const detail = buildDetailFromServices(services);\n logger.debug('consent read', detail);\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) elb('walker consent', state);\n };\n\n const onInitialized = (): void => read();\n const onCmpEvent = (e: Event): void => {\n const detail = (e as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n if (!detail?.type || !V2_DECISION_TYPES.has(detail.type)) return;\n read();\n };\n\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n win.addEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n\n read(); // static read: CMP already initialized when source runs\n\n return () => {\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n win.removeEventListener('UC_UI_CMP_EVENT', onCmpEvent);\n };\n}\n","import type { Elb, Logger } from '@walkeros/core';\nimport type {\n Settings,\n UsercentricsEventDetail,\n UsercentricsV3Api,\n UsercentricsV3CategoryState,\n UsercentricsV3CmpEventDetail,\n UsercentricsV3ConsentDetails,\n} from '../types';\nimport { parseConsent } from './parseConsent';\n\nexport interface V3AdapterContext {\n window: Window & typeof globalThis;\n elb: Elb.Fn;\n settings: Settings;\n logger: Logger.Instance;\n}\n\nconst V3_DEFAULT_EVENT_NAME = 'UC_UI_CMP_EVENT';\n\n/**\n * V3 CMP event types that represent a user consent decision. Presentation\n * events like `CMP_SHOWN` or `UI_INITIALIZED` must NOT trigger a consent\n * publish — they carry no user decision.\n */\nconst V3_DECISION_TYPES: ReadonlySet<string> = new Set([\n 'ACCEPT_ALL',\n 'DENY_ALL',\n 'SAVE',\n]);\n\n/**\n * Map a V3 CategoryData.state value to a walkerOS boolean using strict\n * semantics: only fully-accepted categories are `true`. Any partial or\n * denied state (including future/unknown states) resolves to `false`.\n *\n * This matches the consent rule of thumb: any deny signal denies.\n */\nfunction categoryStateToBoolean(state: UsercentricsV3CategoryState): boolean {\n return state === 'ALL_ACCEPTED';\n}\n\n/**\n * Build a synthetic UsercentricsEventDetail from V3 ConsentDetails.\n * Translates V3's structured consent state into the shape parseConsent expects.\n */\nfunction buildDetailFromV3(\n details: UsercentricsV3ConsentDetails,\n): UsercentricsEventDetail {\n const ucCategory: Record<string, boolean> = {};\n Object.entries(details.categories).forEach(([slug, category]) => {\n ucCategory[slug] = categoryStateToBoolean(category.state);\n });\n\n return {\n event: 'consent_status',\n type: details.consent.type === 'EXPLICIT' ? 'explicit' : 'implicit',\n ucCategory,\n };\n}\n\n/**\n * Set up the V3 adapter: registers a listener on the V3 consent event AND\n * (if __ucCmp is already initialized) performs a static read.\n *\n * Both paths re-fetch getConsentDetails() because the event payload does\n * not include consent state.\n *\n * Returns a cleanup function that removes the event listener.\n */\nexport async function setupV3Adapter(\n ctx: V3AdapterContext,\n): Promise<() => void> {\n const { window: win, elb, settings, logger } = ctx;\n const eventName = settings.v3EventName ?? V3_DEFAULT_EVENT_NAME;\n\n const publishConsent = async (cmp: UsercentricsV3Api): Promise<void> => {\n const details = await cmp.getConsentDetails();\n const detail = buildDetailFromV3(details);\n logger.debug('event received', detail);\n\n if (settings.explicitOnly && detail.type !== 'explicit') return;\n\n const state = parseConsent(detail, settings);\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n const listener = (event: Event): void => {\n const cmp = win.__ucCmp;\n if (!cmp) return;\n const detail = (event as CustomEvent<UsercentricsV3CmpEventDetail>).detail;\n // Filter to decision events only: the CMP emits a broad set of events\n // (CMP_SHOWN, UI_INITIALIZED, VIEW_CHANGED, …) on this bus. Without\n // filtering, every view toggle would re-publish consent. The decision\n // `type` is the only reliable signal; `detail.source` is one of\n // none|button|first|second|embeddings|__ucCmp and must NOT be gated on.\n if (!detail?.type || !V3_DECISION_TYPES.has(detail.type)) return;\n publishConsent(cmp).catch(() => {\n // Swallow — a failed V3 fetch should not break the page.\n });\n };\n win.addEventListener(eventName, listener);\n\n // When the source loads BEFORE __ucCmp, no UC_UI_CMP_EVENT fires for a\n // choice made in a prior session. UC_UI_INITIALIZED signals the CMP is ready,\n // so perform the static read then to publish any already-made decision.\n const onInitialized = (): void => {\n const cmp = win.__ucCmp;\n if (cmp) publishConsent(cmp).catch(() => {});\n };\n win.addEventListener('UC_UI_INITIALIZED', onInitialized);\n\n // Static check: if __ucCmp is already initialized, fetch now.\n // Wrapped in try/catch so transient API failures during setup don't\n // reject setupV3Adapter() and tear down the whole flow — the listener\n // stays registered and will pick up the next real event.\n const cmp = win.__ucCmp;\n if (cmp) {\n try {\n const initialized = await cmp.isInitialized();\n if (initialized) {\n await publishConsent(cmp);\n }\n } catch (err) {\n logger.warn('v3 static consent read failed', err);\n }\n }\n\n return () => {\n win.removeEventListener(eventName, listener);\n win.removeEventListener('UC_UI_INITIALIZED', onInitialized);\n };\n}\n","import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n usercentrics: { type: 'usercentrics'; platform?: 'web' };\n }\n}\n\n/**\n * Usercentrics consent detail structure.\n *\n * Built by the V2 and V3 adapters from the CMP's API and passed to the\n * consent parser. Contains both category-level (ucCategory) and\n * service-level consent.\n */\nexport interface UsercentricsEventDetail {\n /** Always 'consent_status' for consent events */\n event: string;\n /** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */\n type: string;\n /** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */\n action?: string;\n /** Category-level consent booleans (e.g. { marketing: true, functional: false }) */\n ucCategory?: Record<string, boolean | unknown>;\n /** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */\n [service: string]: unknown;\n}\n\ndeclare global {\n interface WindowEventMap {\n UC_UI_INITIALIZED: Event;\n UC_UI_CMP_EVENT: CustomEvent<UsercentricsV3CmpEventDetail>;\n }\n}\n\n/** Usercentrics CONSENT_TYPE values (history entry type / V3 consent type). */\nexport type UsercentricsConsentType = 'explicit' | 'implicit';\n\n/** A single entry in a V2 service's consent history (getServicesBaseInfo). */\nexport interface UsercentricsV2ConsentHistoryEntry {\n type: UsercentricsConsentType;\n status: boolean;\n /** CONSENT_ACTION, e.g. 'onAcceptAllServices' | 'onInitialPageLoad'. Not read for the gate. */\n action?: string;\n timestamp?: number;\n}\n\n/**\n * Usercentrics V2 service info shape returned by `UC_UI.getServicesBaseInfo()`.\n * Only the fields we use are typed - minimal surface, not a full V2 API mirror.\n */\nexport interface UsercentricsV2Service {\n /** Category slug: 'essential' | 'functional' | 'marketing' | custom */\n categorySlug: string;\n /** Service display name (used for service-level consent keys) */\n name?: string;\n /** Consent state for this service */\n consent: {\n status: boolean;\n /** Consent decision history; an 'explicit' entry proves a real user decision. */\n history?: UsercentricsV2ConsentHistoryEntry[];\n };\n}\n\n/**\n * Usercentrics V2 window API (`window.UC_UI`).\n *\n * Methods are synchronous (unlike V3). All methods are optional because\n * Usercentrics does not guarantee every deployment exposes every method.\n */\nexport interface UsercentricsV2Api {\n isInitialized?: () => boolean;\n getServicesBaseInfo?: () => UsercentricsV2Service[];\n getServicesFullInfo?: () => Promise<UsercentricsV2Service[]>;\n areAllConsentsAccepted?: () => boolean;\n}\n\n/**\n * Usercentrics V3 category state. The SDK may add future states; we handle\n * unknowns conservatively as non-accepting.\n */\nexport type UsercentricsV3CategoryState =\n | 'ALL_ACCEPTED'\n | 'ALL_DENIED'\n | 'SOME_ACCEPTED'\n | 'NO_STATE'\n | string;\n\n/**\n * Minimal V3 CategoryData - only fields the adapter reads.\n */\nexport interface UsercentricsV3CategoryData {\n state: UsercentricsV3CategoryState;\n name: string;\n}\n\n/**\n * Minimal V3 ConsentData - only the `type` field is used to distinguish\n * explicit vs implicit consent. Other fields (status, version, etc.) exist on\n * the real SDK but are not read by this adapter.\n */\nexport interface UsercentricsV3ConsentData {\n type: 'EXPLICIT' | 'IMPLICIT' | string;\n}\n\n/**\n * Minimal V3 ConsentDetails - only the fields the adapter reads.\n * The real SDK also exposes `services`, but the adapter currently operates\n * at category level only.\n */\nexport interface UsercentricsV3ConsentDetails {\n consent: UsercentricsV3ConsentData;\n categories: Record<string, UsercentricsV3CategoryData>;\n}\n\n/**\n * Usercentrics V3 window API (`window.__ucCmp`).\n *\n * Only the methods this adapter calls are typed - the real SDK surface is\n * much wider but we intentionally keep this narrow.\n */\nexport interface UsercentricsV3Api {\n isInitialized: () => Promise<boolean>;\n getConsentDetails: () => Promise<UsercentricsV3ConsentDetails>;\n}\n\n/**\n * V3 CMP event detail. Fired on `UC_UI_CMP_EVENT` (or custom name).\n * `source: 'CMP'` + a decision `type` tells us a user action has been taken.\n */\nexport interface UsercentricsV3CmpEventDetail {\n source?:\n | 'none'\n | 'button'\n | 'first'\n | 'second'\n | 'embeddings'\n | '__ucCmp'\n | string;\n type?: string;\n abTestVariant?: string;\n}\n\ndeclare global {\n interface Window {\n /**\n * Usercentrics V2 CMP API. Attached once the V2 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n UC_UI?: UsercentricsV2Api;\n /**\n * Usercentrics V3 CMP API. Attached once the V3 Browser SDK is\n * initialized. Optional because the SDK loads asynchronously - guard\n * with a truthiness check before access.\n */\n __ucCmp?: UsercentricsV3Api;\n }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Map Usercentrics categories to walkerOS consent groups.\n * Keys: Usercentrics category names (from ucCategory)\n * Values: walkerOS consent group names\n *\n * Applied in both group-level and service-level consent modes.\n * When multiple source categories map to the same group, strict AND logic\n * applies: ALL contributing source categories must be true for the target\n * group to be true. Any single false denies consent.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only publish when the user has actively decided. V3: consent.type ===\n * EXPLICIT. V2: an EXPLICIT entry exists in service consent history.\n * Implicit/default page-load states are suppressed. Set false to publish any\n * consent snapshot including implicit. Default: true.\n */\n explicitOnly?: boolean;\n\n /**\n * Which Usercentrics API to target.\n * - 'auto' (default): detect at init. If `window.__ucCmp` is present, use V3.\n * If only `window.UC_UI` is present, use V2. If neither is present yet,\n * register listeners for both so late-loading CMPs are still caught.\n * - 'v2': force legacy `window.UC_UI` path.\n * - 'v3': force current `window.__ucCmp` path.\n */\n apiVersion?: 'auto' | 'v2' | 'v3';\n\n /**\n * V3 window event name to listen for consent changes.\n *\n * Usercentrics V3 hardcodes its built-in event names (`UC_UI_CMP_EVENT`,\n * `UC_UI_INITIALIZED`, `UC_UI_VIEW_CHANGED`, `UC_CONSENT`) - they cannot be\n * renamed. However, the Usercentrics admin dashboard (Implementation >\n * Data Layer & Events) lets admins configure an ADDITIONAL custom window\n * event. Use this setting to point at that custom event name if\n * configured; otherwise leave as default.\n *\n * Default: 'UC_UI_CMP_EVENT'\n */\n v3EventName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for Usercentrics source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for Usercentrics source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","import type { Source } from '@walkeros/core';\nimport type { Types, Settings } from './types';\nimport { setupV2Adapter } from './lib/v2';\nimport { setupV3Adapter } from './lib/v3';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * Listens to Usercentrics CMP events and translates consent states to\n * walkerOS consent commands. Supports both the V2 API (`window.UC_UI`) and\n * the V3 API (`window.__ucCmp`): each reads consent on `UC_UI_INITIALIZED`\n * and on `UC_UI_CMP_EVENT` decisions (V3 listens to `v3EventName` instead\n * when it is set).\n *\n * @example\n * ```typescript\n * import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceUsercentrics,\n * config: {\n * settings: {\n * categoryMap: {\n * statistics: 'analytics',\n * advertising: 'marketing',\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceUsercentrics: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb, logger } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults so adapters always see a fully-resolved Settings\n const settings: Settings = {\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n apiVersion: config?.settings?.apiVersion ?? 'auto',\n v3EventName: config?.settings?.v3EventName ?? 'UC_UI_CMP_EVENT',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n const cleanups: Array<() => void> = [];\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and, critically, no `elb('walker consent')`\n // emit during construction. Emitting from the factory races source merge\n // order and can leave a later `require:[\"consent\"]` source parked.\n const init = async (): Promise<void> => {\n if (!actualWindow) return;\n\n const adapterCtx = { window: actualWindow, elb, settings, logger };\n const apiVersion = settings.apiVersion ?? 'auto';\n\n if (apiVersion === 'v2') {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else if (apiVersion === 'v3') {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else {\n // auto: detect which API is present\n if (actualWindow.__ucCmp) {\n cleanups.push(await setupV3Adapter(adapterCtx));\n } else if (actualWindow.UC_UI) {\n cleanups.push(setupV2Adapter(adapterCtx));\n } else {\n // Neither loaded yet: attach both listeners so whichever loads later is caught.\n cleanups.push(setupV2Adapter(adapterCtx));\n cleanups.push(await setupV3Adapter(adapterCtx));\n }\n }\n };\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n init,\n destroy: async () => {\n cleanups.forEach((fn) => fn());\n },\n };\n};\n\nexport default sourceUsercentrics;\n"],"mappings":";AAIO,IAAM,gBAAgB,CAAC,UAAU,SAAS,QAAQ,YAAY;A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mp-usercentrics",
4
- "version": "4.9.0-next-1793116456867",
4
+ "version": "4.9.0",
5
5
  "type": "source",
6
6
  "platform": [
7
7
  "web"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-source-cmp-usercentrics",
3
3
  "description": "Usercentrics consent management source for walkerOS",
4
- "version": "4.9.0-next-1793116456867",
4
+ "version": "4.9.0",
5
5
  "license": "MIT",
6
6
  "walkerOS": {
7
7
  "type": "source",
@@ -46,8 +46,8 @@
46
46
  "update": "npx npm-check-updates -u && npm update"
47
47
  },
48
48
  "dependencies": {
49
- "@walkeros/collector": "4.9.0-next-1793116456867",
50
- "@walkeros/core": "4.9.0-next-1793116456867"
49
+ "@walkeros/collector": "4.9.0",
50
+ "@walkeros/core": "4.9.0"
51
51
  },
52
52
  "repository": {
53
53
  "url": "git+https://github.com/elbwalker/walkerOS.git",