@walkeros/web-source-cmp-usercentrics 4.9.0 → 4.10.0-next-1794522704623
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 +10 -0
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +1 -0
- package/dist/examples/index.mjs +1 -0
- package/dist/walkerOS.json +5 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @walkeros/web-source-cmp-usercentrics
|
|
2
2
|
|
|
3
|
+
## 4.10.0-next-1794522704623
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [61030f8]
|
|
8
|
+
- Updated dependencies [61030f8]
|
|
9
|
+
- Updated dependencies [61030f8]
|
|
10
|
+
- @walkeros/core@4.10.0-next-1794522704623
|
|
11
|
+
- @walkeros/collector@4.10.0-next-1794522704623
|
|
12
|
+
|
|
3
13
|
## 4.9.0
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})},
|
|
1
|
+
"use strict";var t,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})},a={};o(a,{examples:()=>r,schemas:()=>U}),module.exports=(t=a,((t,o,a,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of s(o))n.call(t,c)||c===a||e(t,c,{get:()=>o[c],enumerable:!(r=i(o,c))||r.enumerable});return t})(e({},"__esModule",{value:!0}),t));var r={};o(r,{createMockElbFn:()=>f,createTrigger:()=>I,fullConsentCustomMapped:()=>h,fullConsentMapped:()=>g,minimalConsentMapped:()=>d,noopLogger:()=>v,partialConsentMapped:()=>y,servicesFirstVisitImplicit:()=>u,servicesFullExplicit:()=>c,servicesMinimalExplicit:()=>l,servicesPartialExplicit:()=>p,step:()=>w,trigger:()=>P});var c=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!0,history:[{type:"explicit",status:!0}]}}],l=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"explicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],p=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],u=[{categorySlug:"essential",consent:{status:!0,history:[{type:"implicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"implicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"implicit",status:!1}]}}],g={essential:!0,functional:!0,marketing:!0},y={essential:!0,functional:!0,marketing:!1},d={essential:!0,functional:!1,marketing:!1},h={essential:!0,analytics:!0,marketing:!0},m=()=>{},f=()=>()=>Promise.resolve({ok:!0}),v={error:m,warn:m,info:m,debug:m,throw:t=>{throw"string"==typeof t?new Error(t):t},json:m,mask:t=>t,scope:()=>v},w={};o(w,{categoryMapOverride:()=>S,consentChange:()=>_,firstVisitImplicit:()=>E,fullConsent:()=>C,minimalConsent:()=>b,returningVisitor:()=>k});var C={title:"Full consent",description:"Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.",trigger:{type:"consent",options:{dispatch:"init"}},in:c,out:[["elb","walker consent",g]]},b={title:"Minimal consent",description:'A "Deny all" explicit decision leaves only essential granted; functional and marketing are emitted as false.',trigger:{type:"consent",options:{dispatch:"init"}},in:l,out:[["elb","walker consent",d]]},k={title:"Returning visitor static read",description:"When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.",trigger:{type:"consent",options:{dispatch:"init"}},in:p,out:[["elb","walker consent",{essential:!0,functional:!0,marketing:!1}]]},E={title:"First visit implicit (suppressed)",description:"A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.",trigger:{type:"consent",options:{dispatch:"init"}},in:u,out:[]},_={title:"Consent change via CMP event",description:"An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.",trigger:{type:"consent",options:{dispatch:"cmp"}},in:c,out:[["elb","walker consent",g]]},S={title:"Category map override",description:"A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.",trigger:{type:"consent",options:{dispatch:"init"}},in:c,mapping:{settings:{categoryMap:{functional:"analytics"}}},out:[["elb","walker consent",h]]},M=require("@walkeros/collector"),I=async t=>{let e;return{get flow(){return e},trigger:(i,s)=>async i=>{var n;const o=s&&"object"==typeof s&&"dispatch"in s&&"cmp"===s.dispatch?"cmp":"init",a={isInitialized:()=>!0,getServicesBaseInfo:()=>i};if("init"===o&&(window.UC_UI=a),!e){const i=await(0,M.startFlow)({...t,run:null==(n=t.run)||n});e={collector:i.collector,elb:i.elb}}"cmp"===o&&(window.UC_UI=a,window.dispatchEvent(new CustomEvent("UC_UI_CMP_EVENT",{detail:{source:"button",type:"ACCEPT_ALL"}})))}}},P=(t,e)=>{const i=e.window;var s;Array.isArray(t)&&("object"==typeof(s=i)&&null!==s&&"addEventListener"in s)&&(i.UC_UI={isInitialized:()=>!0,getServicesBaseInfo:()=>t})};var U={};o(U,{SettingsSchema:()=>V,settings:()=>O});var x=require("@walkeros/core/dev"),A=require("@walkeros/core/dev"),V=A.z.object({categoryMap:A.z.record(A.z.string(),A.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:A.z.boolean().describe("Only publish when the user has actively decided (V3: consent.type EXPLICIT; V2: an EXPLICIT entry in service consent history). Implicit/default page-load states are suppressed. Set false to publish any snapshot including implicit. Default: true.").optional(),apiVersion:A.z.enum(["auto","v2","v3"]).describe("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'.").optional(),v3EventName:A.z.string().describe("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'.").optional()}).meta({id:"UsercentricsSettings",title:"Settings",description:"Settings for the Usercentrics CMP source."}),O=(0,x.zodToSchema)(V);//# sourceMappingURL=dev.js.map
|
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: 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;A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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 mask: (text: string) => text,\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,EAC9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IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADhCI,IAAM,eAAW,yBAAY,cAAc;","names":["trigger","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,i)=>{for(var s in i)t(e,s,{get:i[s],enumerable:!0})},i={};e(i,{createMockElbFn:()=>g,createTrigger:()=>
|
|
1
|
+
var t=Object.defineProperty,e=(e,i)=>{for(var s in i)t(e,s,{get:i[s],enumerable:!0})},i={};e(i,{createMockElbFn:()=>g,createTrigger:()=>b,fullConsentCustomMapped:()=>p,fullConsentMapped:()=>r,minimalConsentMapped:()=>l,noopLogger:()=>d,partialConsentMapped:()=>c,servicesFirstVisitImplicit:()=>a,servicesFullExplicit:()=>s,servicesMinimalExplicit:()=>n,servicesPartialExplicit:()=>o,step:()=>y,trigger:()=>E});var s=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!0,history:[{type:"explicit",status:!0}]}}],n=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"explicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],o=[{categorySlug:"essential",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"functional",consent:{status:!0,history:[{type:"explicit",status:!0}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"explicit",status:!1}]}}],a=[{categorySlug:"essential",consent:{status:!0,history:[{type:"implicit",status:!0}]}},{categorySlug:"functional",consent:{status:!1,history:[{type:"implicit",status:!1}]}},{categorySlug:"marketing",consent:{status:!1,history:[{type:"implicit",status:!1}]}}],r={essential:!0,functional:!0,marketing:!0},c={essential:!0,functional:!0,marketing:!1},l={essential:!0,functional:!1,marketing:!1},p={essential:!0,analytics:!0,marketing:!0},u=()=>{},g=()=>()=>Promise.resolve({ok:!0}),d={error:u,warn:u,info:u,debug:u,throw:t=>{throw"string"==typeof t?new Error(t):t},json:u,mask:t=>t,scope:()=>d},y={};e(y,{categoryMapOverride:()=>C,consentChange:()=>w,firstVisitImplicit:()=>v,fullConsent:()=>h,minimalConsent:()=>m,returningVisitor:()=>f});var h={title:"Full consent",description:"Usercentrics reports every category accepted via an explicit decision; the source emits a walker consent command granting essential, functional, and marketing.",trigger:{type:"consent",options:{dispatch:"init"}},in:s,out:[["elb","walker consent",r]]},m={title:"Minimal consent",description:'A "Deny all" explicit decision leaves only essential granted; functional and marketing are emitted as false.',trigger:{type:"consent",options:{dispatch:"init"}},in:n,out:[["elb","walker consent",l]]},f={title:"Returning visitor static read",description:"When the CMP is already initialized with a stored explicit decision, the static read at init re-publishes that choice without any further event.",trigger:{type:"consent",options:{dispatch:"init"}},in:o,out:[["elb","walker consent",{essential:!0,functional:!0,marketing:!1}]]},v={title:"First visit implicit (suppressed)",description:"A first-visit snapshot carrying only implicit history is suppressed by the default explicitOnly gate, so no consent command is emitted.",trigger:{type:"consent",options:{dispatch:"init"}},in:a,out:[]},w={title:"Consent change via CMP event",description:"An ACCEPT_ALL decision fires UC_UI_CMP_EVENT; the source re-reads the services and emits the updated consent.",trigger:{type:"consent",options:{dispatch:"cmp"}},in:s,out:[["elb","walker consent",r]]},C={title:"Category map override",description:"A custom categoryMap reports the functional category as the analytics group before emitting the walker consent command; essential keeps its own name.",trigger:{type:"consent",options:{dispatch:"init"}},in:s,mapping:{settings:{categoryMap:{functional:"analytics"}}},out:[["elb","walker consent",p]]};import{startFlow as k}from"@walkeros/collector";var b=async t=>{let e;return{get flow(){return e},trigger:(i,s)=>async i=>{var n;const o=s&&"object"==typeof s&&"dispatch"in s&&"cmp"===s.dispatch?"cmp":"init",a={isInitialized:()=>!0,getServicesBaseInfo:()=>i};if("init"===o&&(window.UC_UI=a),!e){const i=await k({...t,run:null==(n=t.run)||n});e={collector:i.collector,elb:i.elb}}"cmp"===o&&(window.UC_UI=a,window.dispatchEvent(new CustomEvent("UC_UI_CMP_EVENT",{detail:{source:"button",type:"ACCEPT_ALL"}})))}}},E=(t,e)=>{const i=e.window;var s;Array.isArray(t)&&("object"==typeof(s=i)&&null!==s&&"addEventListener"in s)&&(i.UC_UI={isInitialized:()=>!0,getServicesBaseInfo:()=>t})};var S={};e(S,{SettingsSchema:()=>M,settings:()=>U});import{zodToSchema as _}from"@walkeros/core/dev";import{z as I}from"@walkeros/core/dev";var M=I.object({categoryMap:I.record(I.string(),I.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:I.boolean().describe("Only publish when the user has actively decided (V3: consent.type EXPLICIT; V2: an EXPLICIT entry in service consent history). Implicit/default page-load states are suppressed. Set false to publish any snapshot including implicit. Default: true.").optional(),apiVersion:I.enum(["auto","v2","v3"]).describe("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'.").optional(),v3EventName:I.string().describe("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'.").optional()}).meta({id:"UsercentricsSettings",title:"Settings",description:"Settings for the Usercentrics CMP source."}),U=_(M);export{i as examples,S as schemas};//# sourceMappingURL=dev.mjs.map
|
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: 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;;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mB;;;ACA5B,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 mask: (text: string) => text,\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,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P;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"]}
|
package/dist/examples/index.js
CHANGED
package/dist/examples/index.mjs
CHANGED
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-source-cmp-usercentrics",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.10.0-next-1794522704623",
|
|
5
5
|
"type": "source",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"$code": "()=>()=>Promise.resolve({ok:!0})"
|
|
55
55
|
},
|
|
56
56
|
"createTrigger": {
|
|
57
|
-
"$code": "async t=>{let e;return{get flow(){return e},trigger:(i,s)=>async i=>{var n;const o=s&&\"object\"==typeof s&&\"dispatch\"in s&&\"cmp\"===s.dispatch?\"cmp\":\"init\",a={isInitialized:()=>!0,getServicesBaseInfo:()=>i};if(\"init\"===o&&(window.UC_UI=a),!e){const i=await
|
|
57
|
+
"$code": "async t=>{let e;return{get flow(){return e},trigger:(i,s)=>async i=>{var n;const o=s&&\"object\"==typeof s&&\"dispatch\"in s&&\"cmp\"===s.dispatch?\"cmp\":\"init\",a={isInitialized:()=>!0,getServicesBaseInfo:()=>i};if(\"init\"===o&&(window.UC_UI=a),!e){const i=await k({...t,run:null==(n=t.run)||n});e={collector:i.collector,elb:i.elb}}\"cmp\"===o&&(window.UC_UI=a,window.dispatchEvent(new CustomEvent(\"UC_UI_CMP_EVENT\",{detail:{source:\"button\",type:\"ACCEPT_ALL\"}})))}}}"
|
|
58
58
|
},
|
|
59
59
|
"fullConsentCustomMapped": {
|
|
60
60
|
"essential": true,
|
|
@@ -90,6 +90,9 @@
|
|
|
90
90
|
"json": {
|
|
91
91
|
"$code": "()=>{}"
|
|
92
92
|
},
|
|
93
|
+
"mask": {
|
|
94
|
+
"$code": "t=>t"
|
|
95
|
+
},
|
|
93
96
|
"scope": {
|
|
94
97
|
"$code": "()=>d"
|
|
95
98
|
}
|
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.
|
|
4
|
+
"version": "4.10.0-next-1794522704623",
|
|
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.
|
|
50
|
-
"@walkeros/core": "4.
|
|
49
|
+
"@walkeros/collector": "4.10.0-next-1794522704623",
|
|
50
|
+
"@walkeros/core": "4.10.0-next-1794522704623"
|
|
51
51
|
},
|
|
52
52
|
"repository": {
|
|
53
53
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|