@walkeros/web-source-cmp-usercentrics 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +18 -6
- package/dist/dev.d.ts +18 -6
- 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.d.mts +16 -4
- package/dist/examples/index.d.ts +16 -4
- package/dist/examples/index.js +57 -2
- package/dist/examples/index.mjs +60 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +176 -0
- package/package.json +5 -4
package/dist/dev.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Full consent - user accepted all categories (explicit)
|
|
34
34
|
*/
|
|
35
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
35
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
36
36
|
/**
|
|
37
37
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
40
40
|
/**
|
|
41
41
|
* Minimal consent - user denied everything except essential (explicit)
|
|
42
42
|
*/
|
|
43
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
43
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
44
44
|
/**
|
|
45
45
|
* Implicit consent - page load with default consent state
|
|
46
46
|
* (not an explicit user choice)
|
|
@@ -100,13 +100,23 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
100
100
|
*/
|
|
101
101
|
declare const noopLogger: Logger.Instance;
|
|
102
102
|
|
|
103
|
+
declare const fullConsent: Flow.StepExample;
|
|
104
|
+
declare const minimalConsent: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
107
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
108
|
+
declare namespace step {
|
|
109
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
113
|
+
declare const setup: Source.SetupFn;
|
|
114
|
+
|
|
103
115
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
104
|
-
declare const index_fullConsent: typeof fullConsent;
|
|
105
116
|
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
106
117
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
107
118
|
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
108
119
|
declare const index_implicitConsent: typeof implicitConsent;
|
|
109
|
-
declare const index_minimalConsent: typeof minimalConsent;
|
|
110
120
|
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
111
121
|
declare const index_nonConsentEvent: typeof nonConsentEvent;
|
|
112
122
|
declare const index_noopLogger: typeof noopLogger;
|
|
@@ -114,8 +124,10 @@ declare const index_partialConsent: typeof partialConsent;
|
|
|
114
124
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
115
125
|
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
116
126
|
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
127
|
+
declare const index_setup: typeof setup;
|
|
128
|
+
declare const index_step: typeof step;
|
|
117
129
|
declare namespace index {
|
|
118
|
-
export { index_createMockElbFn as createMockElbFn,
|
|
130
|
+
export { index_createMockElbFn as createMockElbFn, fullConsent$1 as fullConsent, index_fullConsentCustomMapped as fullConsentCustomMapped, index_fullConsentMapped as fullConsentMapped, index_fullConsentUpperCase as fullConsentUpperCase, index_implicitConsent as implicitConsent, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_nonConsentEvent as nonConsentEvent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_serviceLevelConsent as serviceLevelConsent, index_serviceLevelMapped as serviceLevelMapped, index_setup as setup, index_step as step };
|
|
119
131
|
}
|
|
120
132
|
|
|
121
133
|
export { index as examples };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Full consent - user accepted all categories (explicit)
|
|
34
34
|
*/
|
|
35
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
35
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
36
36
|
/**
|
|
37
37
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
40
40
|
/**
|
|
41
41
|
* Minimal consent - user denied everything except essential (explicit)
|
|
42
42
|
*/
|
|
43
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
43
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
44
44
|
/**
|
|
45
45
|
* Implicit consent - page load with default consent state
|
|
46
46
|
* (not an explicit user choice)
|
|
@@ -100,13 +100,23 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
100
100
|
*/
|
|
101
101
|
declare const noopLogger: Logger.Instance;
|
|
102
102
|
|
|
103
|
+
declare const fullConsent: Flow.StepExample;
|
|
104
|
+
declare const minimalConsent: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
107
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
108
|
+
declare namespace step {
|
|
109
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
113
|
+
declare const setup: Source.SetupFn;
|
|
114
|
+
|
|
103
115
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
104
|
-
declare const index_fullConsent: typeof fullConsent;
|
|
105
116
|
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
106
117
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
107
118
|
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
108
119
|
declare const index_implicitConsent: typeof implicitConsent;
|
|
109
|
-
declare const index_minimalConsent: typeof minimalConsent;
|
|
110
120
|
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
111
121
|
declare const index_nonConsentEvent: typeof nonConsentEvent;
|
|
112
122
|
declare const index_noopLogger: typeof noopLogger;
|
|
@@ -114,8 +124,10 @@ declare const index_partialConsent: typeof partialConsent;
|
|
|
114
124
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
115
125
|
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
116
126
|
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
127
|
+
declare const index_setup: typeof setup;
|
|
128
|
+
declare const index_step: typeof step;
|
|
117
129
|
declare namespace index {
|
|
118
|
-
export { index_createMockElbFn as createMockElbFn,
|
|
130
|
+
export { index_createMockElbFn as createMockElbFn, fullConsent$1 as fullConsent, index_fullConsentCustomMapped as fullConsentCustomMapped, index_fullConsentMapped as fullConsentMapped, index_fullConsentUpperCase as fullConsentUpperCase, index_implicitConsent as implicitConsent, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_nonConsentEvent as nonConsentEvent, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_serviceLevelConsent as serviceLevelConsent, index_serviceLevelMapped as serviceLevelMapped, index_setup as setup, index_step as step };
|
|
119
131
|
}
|
|
120
132
|
|
|
121
133
|
export { index as examples };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},s={};i(s,{examples:()=>l}),module.exports=(e=s,((e,i,s,l)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let r of o(i))a.call(e,r)||r===s||t(e,r,{get:()=>i[r],enumerable:!(l=n(i,r))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var l={};i(l,{createMockElbFn:()=>_,fullConsent:()=>r,fullConsentCustomMapped:()=>k,fullConsentMapped:()=>
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},s={};i(s,{examples:()=>l}),module.exports=(e=s,((e,i,s,l)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let r of o(i))a.call(e,r)||r===s||t(e,r,{get:()=>i[r],enumerable:!(l=n(i,r))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var l={};i(l,{createMockElbFn:()=>_,fullConsent:()=>r,fullConsentCustomMapped:()=>k,fullConsentMapped:()=>v,fullConsentUpperCase:()=>g,implicitConsent:()=>u,minimalConsent:()=>p,minimalConsentMapped:()=>C,nonConsentEvent:()=>y,noopLogger:()=>b,partialConsent:()=>c,partialConsentMapped:()=>f,serviceLevelConsent:()=>m,serviceLevelMapped:()=>d,setup:()=>x,step:()=>w});var r={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},p={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},u={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},g={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},m={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},y={event:"other_event",type:"explicit"},v={essential:!0,functional:!0,marketing:!0},f={essential:!0,functional:!0,marketing:!1},C={essential:!0,functional:!1,marketing:!1},k={functional:!0,marketing:!0},d={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},A=()=>{},_=()=>()=>Promise.resolve({ok:!0}),b={error:A,warn:A,info:A,debug:A,throw:e=>{throw"string"==typeof e?new Error(e):e},json:A,scope:()=>b},w={};i(w,{fullConsent:()=>G,minimalConsent:()=>j});var G={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},j={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},x=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}};//# 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"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,uBAAgD;AAAA,EAC3D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src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { setup } from './setup';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n },\n out: {\n essential: true,\n functional: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n env.window.dispatchEvent(new CustomEvent('ucEvent', { detail: input }));\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EAC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ist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})},n={};t(n,{createMockElbFn:()=>f,fullConsent:()=>a,fullConsentCustomMapped:()=>m,fullConsentMapped:()=>p,fullConsentUpperCase:()=>l,implicitConsent:()=>s,minimalConsent:()=>o,minimalConsentMapped:()=>u,nonConsentEvent:()=>r,noopLogger:()=>C,partialConsent:()=>i,partialConsentMapped:()=>g,serviceLevelConsent:()=>c,serviceLevelMapped:()=>v,setup:()=>_,step:()=>k});var a={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},i={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},o={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},s={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},l={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},r={event:"other_event",type:"explicit"},p={essential:!0,functional:!0,marketing:!0},g={essential:!0,functional:!0,marketing:!1},u={essential:!0,functional:!1,marketing:!1},m={functional:!0,marketing:!0},v={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},y=()=>{},f=()=>()=>Promise.resolve({ok:!0}),C={error:y,warn:y,info:y,debug:y,throw:e=>{throw"string"==typeof e?new Error(e):e},json:y,scope:()=>C},k={};t(k,{fullConsent:()=>d,minimalConsent:()=>A});var d={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},A={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},_=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}};export{n as examples};//# 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"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM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AO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;","names":[]}
|
|
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/setup.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { setup } from './setup';\n","import type { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n },\n out: {\n essential: true,\n functional: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n env.window.dispatchEvent(new CustomEvent('ucEvent', { detail: input }));\n };\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,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AAc,IAAI,YAAY,WAAW,EAAE,QAAQ,MAAM,CAAC,CAAC;AAAA,EACxE;AACF;","names":["fullConsent","minimalConsent"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Full consent - user accepted all categories (explicit)
|
|
34
34
|
*/
|
|
35
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
35
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
36
36
|
/**
|
|
37
37
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
40
40
|
/**
|
|
41
41
|
* Minimal consent - user denied everything except essential (explicit)
|
|
42
42
|
*/
|
|
43
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
43
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
44
44
|
/**
|
|
45
45
|
* Implicit consent - page load with default consent state
|
|
46
46
|
* (not an explicit user choice)
|
|
@@ -100,4 +100,16 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
100
100
|
*/
|
|
101
101
|
declare const noopLogger: Logger.Instance;
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
declare const fullConsent: Flow.StepExample;
|
|
104
|
+
declare const minimalConsent: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
107
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
108
|
+
declare namespace step {
|
|
109
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
113
|
+
declare const setup: Source.SetupFn;
|
|
114
|
+
|
|
115
|
+
export { createMockElbFn, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, setup, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Full consent - user accepted all categories (explicit)
|
|
34
34
|
*/
|
|
35
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
35
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
36
36
|
/**
|
|
37
37
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
40
40
|
/**
|
|
41
41
|
* Minimal consent - user denied everything except essential (explicit)
|
|
42
42
|
*/
|
|
43
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
43
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
44
44
|
/**
|
|
45
45
|
* Implicit consent - page load with default consent state
|
|
46
46
|
* (not an explicit user choice)
|
|
@@ -100,4 +100,16 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
100
100
|
*/
|
|
101
101
|
declare const noopLogger: Logger.Instance;
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
declare const fullConsent: Flow.StepExample;
|
|
104
|
+
declare const minimalConsent: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
107
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
108
|
+
declare namespace step {
|
|
109
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
113
|
+
declare const setup: Source.SetupFn;
|
|
114
|
+
|
|
115
|
+
export { createMockElbFn, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, setup, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -33,7 +33,9 @@ __export(examples_exports, {
|
|
|
33
33
|
partialConsent: () => partialConsent,
|
|
34
34
|
partialConsentMapped: () => partialConsentMapped,
|
|
35
35
|
serviceLevelConsent: () => serviceLevelConsent,
|
|
36
|
-
serviceLevelMapped: () => serviceLevelMapped
|
|
36
|
+
serviceLevelMapped: () => serviceLevelMapped,
|
|
37
|
+
setup: () => setup,
|
|
38
|
+
step: () => step_exports
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(examples_exports);
|
|
39
41
|
|
|
@@ -152,13 +154,64 @@ var createMockElbFn = () => {
|
|
|
152
154
|
};
|
|
153
155
|
var noopLogger = {
|
|
154
156
|
error: noop,
|
|
157
|
+
warn: noop,
|
|
155
158
|
info: noop,
|
|
156
159
|
debug: noop,
|
|
157
160
|
throw: (message) => {
|
|
158
161
|
throw typeof message === "string" ? new Error(message) : message;
|
|
159
162
|
},
|
|
163
|
+
json: noop,
|
|
160
164
|
scope: () => noopLogger
|
|
161
165
|
};
|
|
166
|
+
|
|
167
|
+
// src/examples/step.ts
|
|
168
|
+
var step_exports = {};
|
|
169
|
+
__export(step_exports, {
|
|
170
|
+
fullConsent: () => fullConsent2,
|
|
171
|
+
minimalConsent: () => minimalConsent2
|
|
172
|
+
});
|
|
173
|
+
var fullConsent2 = {
|
|
174
|
+
in: {
|
|
175
|
+
event: "consent_status",
|
|
176
|
+
type: "explicit",
|
|
177
|
+
action: "onAcceptAllServices",
|
|
178
|
+
ucCategory: {
|
|
179
|
+
essential: true,
|
|
180
|
+
functional: true,
|
|
181
|
+
marketing: true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
out: {
|
|
185
|
+
essential: true,
|
|
186
|
+
functional: true,
|
|
187
|
+
marketing: true
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
var minimalConsent2 = {
|
|
191
|
+
in: {
|
|
192
|
+
event: "consent_status",
|
|
193
|
+
type: "explicit",
|
|
194
|
+
action: "onDenyAllServices",
|
|
195
|
+
ucCategory: {
|
|
196
|
+
essential: true,
|
|
197
|
+
functional: false,
|
|
198
|
+
marketing: false
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
out: {
|
|
202
|
+
essential: true,
|
|
203
|
+
functional: false,
|
|
204
|
+
marketing: false
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/examples/setup.ts
|
|
209
|
+
var setup = (input, env) => {
|
|
210
|
+
if (!input || typeof input !== "object") return;
|
|
211
|
+
return () => {
|
|
212
|
+
env.window.dispatchEvent(new CustomEvent("ucEvent", { detail: input }));
|
|
213
|
+
};
|
|
214
|
+
};
|
|
162
215
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
216
|
0 && (module.exports = {
|
|
164
217
|
createMockElbFn,
|
|
@@ -174,5 +227,7 @@ var noopLogger = {
|
|
|
174
227
|
partialConsent,
|
|
175
228
|
partialConsentMapped,
|
|
176
229
|
serviceLevelConsent,
|
|
177
|
-
serviceLevelMapped
|
|
230
|
+
serviceLevelMapped,
|
|
231
|
+
setup,
|
|
232
|
+
step
|
|
178
233
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/examples/inputs.ts
|
|
2
8
|
var fullConsent = {
|
|
3
9
|
event: "consent_status",
|
|
@@ -113,13 +119,64 @@ var createMockElbFn = () => {
|
|
|
113
119
|
};
|
|
114
120
|
var noopLogger = {
|
|
115
121
|
error: noop,
|
|
122
|
+
warn: noop,
|
|
116
123
|
info: noop,
|
|
117
124
|
debug: noop,
|
|
118
125
|
throw: (message) => {
|
|
119
126
|
throw typeof message === "string" ? new Error(message) : message;
|
|
120
127
|
},
|
|
128
|
+
json: noop,
|
|
121
129
|
scope: () => noopLogger
|
|
122
130
|
};
|
|
131
|
+
|
|
132
|
+
// src/examples/step.ts
|
|
133
|
+
var step_exports = {};
|
|
134
|
+
__export(step_exports, {
|
|
135
|
+
fullConsent: () => fullConsent2,
|
|
136
|
+
minimalConsent: () => minimalConsent2
|
|
137
|
+
});
|
|
138
|
+
var fullConsent2 = {
|
|
139
|
+
in: {
|
|
140
|
+
event: "consent_status",
|
|
141
|
+
type: "explicit",
|
|
142
|
+
action: "onAcceptAllServices",
|
|
143
|
+
ucCategory: {
|
|
144
|
+
essential: true,
|
|
145
|
+
functional: true,
|
|
146
|
+
marketing: true
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
out: {
|
|
150
|
+
essential: true,
|
|
151
|
+
functional: true,
|
|
152
|
+
marketing: true
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var minimalConsent2 = {
|
|
156
|
+
in: {
|
|
157
|
+
event: "consent_status",
|
|
158
|
+
type: "explicit",
|
|
159
|
+
action: "onDenyAllServices",
|
|
160
|
+
ucCategory: {
|
|
161
|
+
essential: true,
|
|
162
|
+
functional: false,
|
|
163
|
+
marketing: false
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
out: {
|
|
167
|
+
essential: true,
|
|
168
|
+
functional: false,
|
|
169
|
+
marketing: false
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/examples/setup.ts
|
|
174
|
+
var setup = (input, env) => {
|
|
175
|
+
if (!input || typeof input !== "object") return;
|
|
176
|
+
return () => {
|
|
177
|
+
env.window.dispatchEvent(new CustomEvent("ucEvent", { detail: input }));
|
|
178
|
+
};
|
|
179
|
+
};
|
|
123
180
|
export {
|
|
124
181
|
createMockElbFn,
|
|
125
182
|
fullConsent,
|
|
@@ -134,5 +191,7 @@ export {
|
|
|
134
191
|
partialConsent,
|
|
135
192
|
partialConsentMapped,
|
|
136
193
|
serviceLevelConsent,
|
|
137
|
-
serviceLevelMapped
|
|
194
|
+
serviceLevelMapped,
|
|
195
|
+
setup,
|
|
196
|
+
step_exports as step
|
|
138
197
|
};
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var SourceUsercentrics=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,
|
|
1
|
+
"use strict";var SourceUsercentrics=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})},a={};i(a,{SourceUsercentrics:()=>l,createMockElbFn:()=>b,default:()=>M,fullConsent:()=>s,fullConsentCustomMapped:()=>m,fullConsentMapped:()=>y,fullConsentUpperCase:()=>p,implicitConsent:()=>u,minimalConsent:()=>c,minimalConsentMapped:()=>d,nonConsentEvent:()=>v,noopLogger:()=>w,partialConsent:()=>r,partialConsentMapped:()=>f,serviceLevelConsent:()=>g,serviceLevelMapped:()=>C,setup:()=>j,sourceUsercentrics:()=>x,step:()=>A});var l={},s={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},r={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},c={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},u={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},p={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},g={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},v={event:"other_event",type:"explicit"},y={essential:!0,functional:!0,marketing:!0},f={essential:!0,functional:!0,marketing:!1},d={essential:!0,functional:!1,marketing:!1},m={functional:!0,marketing:!0},C={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},k=()=>{},b=()=>()=>Promise.resolve({ok:!0}),w={error:k,warn:k,info:k,debug:k,throw:e=>{throw"string"==typeof e?new Error(e):e},json:k,scope:()=>w},A={};i(A,{fullConsent:()=>E,minimalConsent:()=>O});var _,E={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},O={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},j=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}},h=["action","event","type","ucCategory"],x=async e=>{var t,n,o,i,a,l,s,r;const{config:c,env:u}=e,{elb:p}=u,g=null!=(t=u.window)?t:void 0!==globalThis.window?globalThis.window:void 0,v={eventName:null!=(o=null==(n=null==c?void 0:c.settings)?void 0:n.eventName)?o:"ucEvent",categoryMap:null!=(a=null==(i=null==c?void 0:c.settings)?void 0:i.categoryMap)?a:{},explicitOnly:null==(s=null==(l=null==c?void 0:c.settings)?void 0:l.explicitOnly)||s},y={settings:v};let f;if(g){const e=e=>Object.values(e).every(e=>"boolean"==typeof e),t=t=>{const n={};return t.ucCategory&&e(t.ucCategory)?Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"!=typeof t)return;const a=null!=(i=null==(o=v.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}):(t.ucCategory&&Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"==typeof t){const a=null!=(i=null==(o=v.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}}),Object.entries(t).forEach(([e,t])=>{if(h.includes(e))return;if("boolean"!=typeof t)return;const o=e.toLowerCase().replace(/ /g,"_");n[o]=t})),n},n=e=>{var n;if("consent_status"!==e.event)return;if(v.explicitOnly&&"explicit"!==(null==(n=e.type)?void 0:n.toLowerCase()))return;const o=t(e);Object.keys(o).length>0&&p("walker consent",o)},o=null!=(r=v.eventName)?r:"ucEvent";f=e=>{const t=e;t.detail&&n(t.detail)},g.addEventListener(o,f)}return{type:"usercentrics",config:y,push:p,destroy:async e=>{var t;if(g&&f){const e=null!=(t=v.eventName)?t:"ucEvent";g.removeEventListener(e,f)}}}},M=x;return _=a,((i,a,l,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let r of n(a))o.call(i,r)||r===l||e(i,r,{get:()=>a[r],enumerable:!(s=t(a,r))||s.enumerable});return i})(e({},"__esModule",{value:!0}),_)})();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Source, Elb, WalkerOS, Logger } from '@walkeros/core';
|
|
1
|
+
import { Source, Elb, WalkerOS, Logger, Flow } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -104,7 +104,7 @@ declare namespace index {
|
|
|
104
104
|
/**
|
|
105
105
|
* Full consent - user accepted all categories (explicit)
|
|
106
106
|
*/
|
|
107
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
107
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
108
108
|
/**
|
|
109
109
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
110
110
|
*/
|
|
@@ -112,7 +112,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
112
112
|
/**
|
|
113
113
|
* Minimal consent - user denied everything except essential (explicit)
|
|
114
114
|
*/
|
|
115
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
115
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
116
116
|
/**
|
|
117
117
|
* Implicit consent - page load with default consent state
|
|
118
118
|
* (not an explicit user choice)
|
|
@@ -172,6 +172,18 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
172
172
|
*/
|
|
173
173
|
declare const noopLogger: Logger.Instance;
|
|
174
174
|
|
|
175
|
+
declare const fullConsent: Flow.StepExample;
|
|
176
|
+
declare const minimalConsent: Flow.StepExample;
|
|
177
|
+
|
|
178
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
179
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
180
|
+
declare namespace step {
|
|
181
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
185
|
+
declare const setup: Source.SetupFn;
|
|
186
|
+
|
|
175
187
|
/**
|
|
176
188
|
* Usercentrics consent management source for walkerOS.
|
|
177
189
|
*
|
|
@@ -203,4 +215,4 @@ declare const noopLogger: Logger.Instance;
|
|
|
203
215
|
*/
|
|
204
216
|
declare const sourceUsercentrics: Source.Init<Types>;
|
|
205
217
|
|
|
206
|
-
export { index as SourceUsercentrics, createMockElbFn, sourceUsercentrics as default, fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, sourceUsercentrics };
|
|
218
|
+
export { index as SourceUsercentrics, createMockElbFn, sourceUsercentrics as default, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, setup, sourceUsercentrics, step };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Source, Elb, WalkerOS, Logger } from '@walkeros/core';
|
|
1
|
+
import { Source, Elb, WalkerOS, Logger, Flow } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -104,7 +104,7 @@ declare namespace index {
|
|
|
104
104
|
/**
|
|
105
105
|
* Full consent - user accepted all categories (explicit)
|
|
106
106
|
*/
|
|
107
|
-
declare const fullConsent: UsercentricsEventDetail;
|
|
107
|
+
declare const fullConsent$1: UsercentricsEventDetail;
|
|
108
108
|
/**
|
|
109
109
|
* Partial consent - user accepted only essential and functional (explicit)
|
|
110
110
|
*/
|
|
@@ -112,7 +112,7 @@ declare const partialConsent: UsercentricsEventDetail;
|
|
|
112
112
|
/**
|
|
113
113
|
* Minimal consent - user denied everything except essential (explicit)
|
|
114
114
|
*/
|
|
115
|
-
declare const minimalConsent: UsercentricsEventDetail;
|
|
115
|
+
declare const minimalConsent$1: UsercentricsEventDetail;
|
|
116
116
|
/**
|
|
117
117
|
* Implicit consent - page load with default consent state
|
|
118
118
|
* (not an explicit user choice)
|
|
@@ -172,6 +172,18 @@ declare const createMockElbFn: () => Elb.Fn;
|
|
|
172
172
|
*/
|
|
173
173
|
declare const noopLogger: Logger.Instance;
|
|
174
174
|
|
|
175
|
+
declare const fullConsent: Flow.StepExample;
|
|
176
|
+
declare const minimalConsent: Flow.StepExample;
|
|
177
|
+
|
|
178
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
179
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
180
|
+
declare namespace step {
|
|
181
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */
|
|
185
|
+
declare const setup: Source.SetupFn;
|
|
186
|
+
|
|
175
187
|
/**
|
|
176
188
|
* Usercentrics consent management source for walkerOS.
|
|
177
189
|
*
|
|
@@ -203,4 +215,4 @@ declare const noopLogger: Logger.Instance;
|
|
|
203
215
|
*/
|
|
204
216
|
declare const sourceUsercentrics: Source.Init<Types>;
|
|
205
217
|
|
|
206
|
-
export { index as SourceUsercentrics, createMockElbFn, sourceUsercentrics as default, fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, sourceUsercentrics };
|
|
218
|
+
export { index as SourceUsercentrics, createMockElbFn, sourceUsercentrics as default, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, setup, sourceUsercentrics, step };
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var
|
|
1
|
+
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){asyncGeneratorStep(i,r,o,a,u,"next",e)}function u(e){asyncGeneratorStep(i,r,o,a,u,"throw",e)}a(void 0)})}}function _iterable_to_array_limit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}var SourceUsercentrics=function(){var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=function(t,n){for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};o(i,{SourceUsercentrics:function(){return a},createMockElbFn:function(){return h},default:function(){return E},fullConsent:function(){return u},fullConsentCustomMapped:function(){return g},fullConsentMapped:function(){return v},fullConsentUpperCase:function(){return f},implicitConsent:function(){return s},minimalConsent:function(){return c},minimalConsentMapped:function(){return d},nonConsentEvent:function(){return p},noopLogger:function(){return w},partialConsent:function(){return l},partialConsentMapped:function(){return _},serviceLevelConsent:function(){return y},serviceLevelMapped:function(){return m},setup:function(){return j},sourceUsercentrics:function(){return x},step:function(){return C}});var a={},u={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},l={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},c={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},s={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},f={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},y={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},p={event:"other_event",type:"explicit"},v={essential:!0,functional:!0,marketing:!0},_={essential:!0,functional:!0,marketing:!1},d={essential:!0,functional:!1,marketing:!1},g={functional:!0,marketing:!0},m={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},b=function(){},h=function(){return function(){return Promise.resolve({ok:!0})}},w={error:b,warn:b,info:b,debug:b,throw:function(e){throw"string"==typeof e?new Error(e):e},json:b,scope:function(){return w}},C={};o(C,{fullConsent:function(){return A},minimalConsent:function(){return S}});var k,A={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},S={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},j=function(e,t){if(e&&"object"===(void 0===e?"undefined":_type_of(e)))return function(){t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}},O=["action","event","type","ucCategory"],x=function(e){return _async_to_generator(function(){var t,n,r,o,i,a,u,l,c,s,f,y,p,v,_,d,g,m,b;return _ts_generator(this,function(h){return l=e.config,c=e.env,s=c.elb,f=null!==(t=c.window)&&void 0!==t?t:void 0!==globalThis.window?globalThis.window:void 0,y={eventName:null!==(n=null==l||null===(i=l.settings)||void 0===i?void 0:i.eventName)&&void 0!==n?n:"ucEvent",categoryMap:null!==(r=null==l||null===(a=l.settings)||void 0===a?void 0:a.categoryMap)&&void 0!==r?r:{},explicitOnly:null===(o=null==l||null===(u=l.settings)||void 0===u?void 0:u.explicitOnly)||void 0===o||o},p={settings:y},f&&(d=function(e){return Object.values(e).every(function(e){return"boolean"==typeof e})},g=function(e){var t={};return e.ucCategory&&d(e.ucCategory)?Object.entries(e.ucCategory).forEach(function(e){var n,r,o=_sliced_to_array(e,2),i=o[0],a=o[1];if("boolean"==typeof a){var u=null!==(n=null===(r=y.categoryMap)||void 0===r?void 0:r[i])&&void 0!==n?n:i;t[u]=t[u]||a}}):(e.ucCategory&&Object.entries(e.ucCategory).forEach(function(e){var n=_sliced_to_array(e,2),r=n[0],o=n[1];if("boolean"==typeof o){var i,a,u=null!==(i=null===(a=y.categoryMap)||void 0===a?void 0:a[r])&&void 0!==i?i:r;t[u]=t[u]||o}}),Object.entries(e).forEach(function(e){var n=_sliced_to_array(e,2),r=n[0],o=n[1];if(!O.includes(r)&&"boolean"==typeof o){var i=r.toLowerCase().replace(/ /g,"_");t[i]=o}})),t},m=function(e){var t;if("consent_status"===e.event&&(!y.explicitOnly||"explicit"===(null===(t=e.type)||void 0===t?void 0:t.toLowerCase()))){var n=g(e);Object.keys(n).length>0&&s("walker consent",n)}},b=null!==(_=y.eventName)&&void 0!==_?_:"ucEvent",v=function(e){var t=e;t.detail&&m(t.detail)},f.addEventListener(b,v)),[2,{type:"usercentrics",config:p,push:s,destroy:function(e){return _async_to_generator(function(){var e,t;return _ts_generator(this,function(n){return f&&v&&(t=null!==(e=y.eventName)&&void 0!==e?e:"ucEvent",f.removeEventListener(t,v)),[2]})})()}}]})})()},E=x;return k=i,function(o,i,a,u){if(i&&"object"===(void 0===i?"undefined":_type_of(i))||"function"==typeof i){var l=!0,c=!1,s=void 0;try{for(var f,y=function(){var n=f.value;r.call(o,n)||n===a||e(o,n,{get:function(){return i[n]},enumerable:!(u=t(i,n))||u.enumerable})},p=n(i)[Symbol.iterator]();!(l=(f=p.next()).done);l=!0)y()}catch(e){c=!0,s=e}finally{try{l||null==p.return||p.return()}finally{if(c)throw s}}}return o}(e({},"__esModule",{value:!0}),k)}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},l={};a(l,{SourceUsercentrics:()=>s,createMockElbFn:()=>w,default:()=>M,fullConsent:()=>r,fullConsentCustomMapped:()=>C,fullConsentMapped:()=>f,fullConsentUpperCase:()=>g,implicitConsent:()=>p,minimalConsent:()=>u,minimalConsentMapped:()=>m,nonConsentEvent:()=>y,noopLogger:()=>A,partialConsent:()=>c,partialConsentMapped:()=>d,serviceLevelConsent:()=>v,serviceLevelMapped:()=>k,setup:()=>j,sourceUsercentrics:()=>x,step:()=>_}),module.exports=(e=l,((e,a,l,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let r of o(a))i.call(e,r)||r===l||t(e,r,{get:()=>a[r],enumerable:!(s=n(a,r))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={},r={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},u={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},p={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},g={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},v={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},y={event:"other_event",type:"explicit"},f={essential:!0,functional:!0,marketing:!0},d={essential:!0,functional:!0,marketing:!1},m={essential:!0,functional:!1,marketing:!1},C={functional:!0,marketing:!0},k={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},b=()=>{},w=()=>()=>Promise.resolve({ok:!0}),A={error:b,warn:b,info:b,debug:b,throw:e=>{throw"string"==typeof e?new Error(e):e},json:b,scope:()=>A},_={};a(_,{fullConsent:()=>E,minimalConsent:()=>O});var E={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},O={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},j=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}},h=["action","event","type","ucCategory"],x=async e=>{var t,n,o,i,a,l,s,r;const{config:c,env:u}=e,{elb:p}=u,g=null!=(t=u.window)?t:void 0!==globalThis.window?globalThis.window:void 0,v={eventName:null!=(o=null==(n=null==c?void 0:c.settings)?void 0:n.eventName)?o:"ucEvent",categoryMap:null!=(a=null==(i=null==c?void 0:c.settings)?void 0:i.categoryMap)?a:{},explicitOnly:null==(s=null==(l=null==c?void 0:c.settings)?void 0:l.explicitOnly)||s},y={settings:v};let f;if(g){const e=e=>Object.values(e).every(e=>"boolean"==typeof e),t=t=>{const n={};return t.ucCategory&&e(t.ucCategory)?Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"!=typeof t)return;const a=null!=(i=null==(o=v.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}):(t.ucCategory&&Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"==typeof t){const a=null!=(i=null==(o=v.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}}),Object.entries(t).forEach(([e,t])=>{if(h.includes(e))return;if("boolean"!=typeof t)return;const o=e.toLowerCase().replace(/ /g,"_");n[o]=t})),n},n=e=>{var n;if("consent_status"!==e.event)return;if(v.explicitOnly&&"explicit"!==(null==(n=e.type)?void 0:n.toLowerCase()))return;const o=t(e);Object.keys(o).length>0&&p("walker consent",o)},o=null!=(r=v.eventName)?r:"ucEvent";f=e=>{const t=e;t.detail&&n(t.detail)},g.addEventListener(o,f)}return{type:"usercentrics",config:y,push:p,destroy:async e=>{var t;if(g&&f){const e=null!=(t=v.eventName)?t:"ucEvent";g.removeEventListener(e,f)}}}},M=x;//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, UsercentricsEventDetail } from './types';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n// Export examples\nexport * from './examples';\n\n/** Reserved keys in event.detail that are not service names */\nconst RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * This source listens to Usercentrics CMP events and translates\n * consent states to walkerOS consent commands.\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 * eventName: 'ucEvent',\n * categoryMap: {\n * essential: 'functional',\n * functional: 'functional',\n * marketing: '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 } = 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\n const settings: Settings = {\n eventName: config?.settings?.eventName ?? 'ucEvent',\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track listener reference for cleanup\n let consentListener: ((e: Event) => void) | undefined;\n\n // Only setup if in browser environment\n if (actualWindow) {\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 */\n const isGroupLevel = (\n ucCategory: Record<string, boolean | unknown>,\n ): boolean => {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n };\n\n /**\n * Parse consent from Usercentrics event detail.\n *\n * Two modes:\n * 1. Group-level: ucCategory has all booleans -> use ucCategory as consent\n * 2. Service-level: ucCategory has non-booleans -> extract individual\n * service keys from event.detail + boolean entries from ucCategory\n *\n * categoryMap is applied in both modes for ucCategory boolean entries.\n */\n const parseConsent = (\n detail: UsercentricsEventDetail,\n ): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n // Group-level consent: use ucCategory values\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: if ANY source category is true, target group is true\n state[mapped] = state[mapped] || value;\n });\n } else {\n // Service-level consent: extract individual services\n // Include boolean entries from ucCategory (with categoryMap applied)\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = settings.categoryMap?.[key] ?? key;\n state[mapped] = state[mapped] || value;\n }\n });\n }\n\n // Extract service keys (not reserved keys)\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n // Normalize: lowercase, spaces to underscores\n const normalized = key.toLowerCase().replace(/ /g, '_');\n state[normalized] = value;\n });\n }\n\n return state;\n };\n\n /**\n * Handle a Usercentrics consent event.\n */\n const handleConsent = (detail: UsercentricsEventDetail) => {\n // Only process consent_status events\n if (detail.event !== 'consent_status') return;\n\n // Skip implicit consent if explicitOnly is true\n // Use case-insensitive comparison (Usercentrics docs show both 'explicit' and 'EXPLICIT')\n if (settings.explicitOnly && detail.type?.toLowerCase() !== 'explicit')\n return;\n\n const state = parseConsent(detail);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // Listen for Usercentrics consent events\n const eventName = settings.eventName ?? 'ucEvent';\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<UsercentricsEventDetail>;\n if (customEvent.detail) {\n handleConsent(customEvent.detail);\n }\n };\n actualWindow.addEventListener(eventName, consentListener);\n }\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n destroy: async () => {\n if (actualWindow && consentListener) {\n const eventName = settings.eventName ?? 'ucEvent';\n actualWindow.removeEventListener(eventName, consentListener);\n }\n },\n };\n};\n\nexport default sourceUsercentrics;\n","import type { Source, Elb } from '@walkeros/core';\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 }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Window event name to listen for.\n * Configured in Usercentrics admin under Implementation > Data Layer & Events.\n * Can also be set to 'UC_SDK_EVENT' for the built-in Browser SDK event.\n *\n * Default: 'ucEvent'\n */\n eventName?: string;\n\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, OR logic applies:\n * if ANY source category is true, the target group is true.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores events where type !== 'explicit'\n * When false: Processes any consent_status event including implicit/defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,E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AAAA,IACF;AAGA,UAAM,aAAY,cAAS,cAAT,YAAsB;AACxC,sBAAkB,CAAC,MAAa;AAC9B,YAAM,cAAc;AACpB,UAAI,YAAY,QAAQ;AACtB,sBAAc,YAAY,MAAM;AAAA,MAClC;AAAA,IACF;AACA,iBAAa,iBAAiB,WAAW,eAAe;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,YAAY;AA9JzB,UAAAA;AA+JM,UAAI,gBAAgB,iBAAiB;AACnC,cAAM,aAAYA,MAAA,SAAS,cAAT,OAAAA,MAAsB;AACxC,qBAAa,oBAAoB,WAAW,eAAe;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","_b"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, UsercentricsEventDetail } from './types';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n// Export examples\nexport * from './examples';\n\n/** Reserved keys in event.detail that are not service names */\nconst RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * This source listens to Usercentrics CMP events and translates\n * consent states to walkerOS consent commands.\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 * eventName: 'ucEvent',\n * categoryMap: {\n * essential: 'functional',\n * functional: 'functional',\n * marketing: '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 } = 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\n const settings: Settings = {\n eventName: config?.settings?.eventName ?? 'ucEvent',\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track listener reference for cleanup\n let consentListener: ((e: Event) => void) | undefined;\n\n // Only setup if in browser environment\n if (actualWindow) {\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 */\n const isGroupLevel = (\n ucCategory: Record<string, boolean | unknown>,\n ): boolean => {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n };\n\n /**\n * Parse consent from Usercentrics event detail.\n *\n * Two modes:\n * 1. Group-level: ucCategory has all booleans -> use ucCategory as consent\n * 2. Service-level: ucCategory has non-booleans -> extract individual\n * service keys from event.detail + boolean entries from ucCategory\n *\n * categoryMap is applied in both modes for ucCategory boolean entries.\n */\n const parseConsent = (\n detail: UsercentricsEventDetail,\n ): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n // Group-level consent: use ucCategory values\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: if ANY source category is true, target group is true\n state[mapped] = state[mapped] || value;\n });\n } else {\n // Service-level consent: extract individual services\n // Include boolean entries from ucCategory (with categoryMap applied)\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = settings.categoryMap?.[key] ?? key;\n state[mapped] = state[mapped] || value;\n }\n });\n }\n\n // Extract service keys (not reserved keys)\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n // Normalize: lowercase, spaces to underscores\n const normalized = key.toLowerCase().replace(/ /g, '_');\n state[normalized] = value;\n });\n }\n\n return state;\n };\n\n /**\n * Handle a Usercentrics consent event.\n */\n const handleConsent = (detail: UsercentricsEventDetail) => {\n // Only process consent_status events\n if (detail.event !== 'consent_status') return;\n\n // Skip implicit consent if explicitOnly is true\n // Use case-insensitive comparison (Usercentrics docs show both 'explicit' and 'EXPLICIT')\n if (settings.explicitOnly && detail.type?.toLowerCase() !== 'explicit')\n return;\n\n const state = parseConsent(detail);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // Listen for Usercentrics consent events\n const eventName = settings.eventName ?? 'ucEvent';\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<UsercentricsEventDetail>;\n if (customEvent.detail) {\n handleConsent(customEvent.detail);\n }\n };\n actualWindow.addEventListener(eventName, consentListener);\n }\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n destroy: async (_context) => {\n if (actualWindow && consentListener) {\n const eventName = settings.eventName ?? 'ucEvent';\n actualWindow.removeEventListener(eventName, consentListener);\n }\n },\n };\n};\n\nexport default sourceUsercentrics;\n","import type { Source, Elb } from '@walkeros/core';\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 }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Window event name to listen for.\n * Configured in Usercentrics admin under Implementation > Data Layer & Events.\n * Can also be set to 'UC_SDK_EVENT' for the built-in Browser SDK event.\n *\n * Default: 'ucEvent'\n */\n eventName?: string;\n\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, OR logic applies:\n * if ANY source category is true, the target group is true.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores events where type !== 'explicit'\n * When false: Processes any consent_status event including implicit/defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n },\n out: {\n essential: true,\n functional: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n env.window.dispatchEvent(new CustomEvent('ucEvent', { detail: input }));\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,kBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAMO,IAAM,uBAAgD;AAAA,EAC3D,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAM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S,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAGA,UAAM,aAAY,cAAS,cAAT,YAAsB;AACxC,sBAAkB,CAAC,MAAa;AAC9B,YAAM,cAAc;AACpB,UAAI,YAAY,QAAQ;AACtB,sBAAc,YAAY,MAAM;AAAA,MAClC;AAAA,IACF;AACA,iBAAa,iBAAiB,WAAW,eAAe;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,OAAO,aAAa;AA9JjC,UAAAA;AA+JM,UAAI,gBAAgB,iBAAiB;AACnC,cAAM,aAAYA,MAAA,SAAS,cAAT,OAAAA,MAAsB;AACxC,qBAAa,oBAAoB,WAAW,eAAe;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["fullConsent","minimalConsent","_a","_b"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={},
|
|
1
|
+
var e=Object.defineProperty,t={},n={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},o={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},i={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},a={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},l={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},s={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},c={event:"other_event",type:"explicit"},r={essential:!0,functional:!0,marketing:!0},u={essential:!0,functional:!0,marketing:!1},g={essential:!0,functional:!1,marketing:!1},v={functional:!0,marketing:!0},y={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},p=()=>{},f=()=>()=>Promise.resolve({ok:!0}),d={error:p,warn:p,info:p,debug:p,throw:e=>{throw"string"==typeof e?new Error(e):e},json:p,scope:()=>d},m={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(m,{fullConsent:()=>k,minimalConsent:()=>C});var k={in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},C={in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},A=(e,t)=>{if(e&&"object"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent("ucEvent",{detail:e}))}},b=["action","event","type","ucCategory"],w=async e=>{var t,n,o,i,a,l,s,c;const{config:r,env:u}=e,{elb:g}=u,v=null!=(t=u.window)?t:void 0!==globalThis.window?globalThis.window:void 0,y={eventName:null!=(o=null==(n=null==r?void 0:r.settings)?void 0:n.eventName)?o:"ucEvent",categoryMap:null!=(a=null==(i=null==r?void 0:r.settings)?void 0:i.categoryMap)?a:{},explicitOnly:null==(s=null==(l=null==r?void 0:r.settings)?void 0:l.explicitOnly)||s},p={settings:y};let f;if(v){const e=e=>Object.values(e).every(e=>"boolean"==typeof e),t=t=>{const n={};return t.ucCategory&&e(t.ucCategory)?Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"!=typeof t)return;const a=null!=(i=null==(o=y.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}):(t.ucCategory&&Object.entries(t.ucCategory).forEach(([e,t])=>{var o,i;if("boolean"==typeof t){const a=null!=(i=null==(o=y.categoryMap)?void 0:o[e])?i:e;n[a]=n[a]||t}}),Object.entries(t).forEach(([e,t])=>{if(b.includes(e))return;if("boolean"!=typeof t)return;const o=e.toLowerCase().replace(/ /g,"_");n[o]=t})),n},n=e=>{var n;if("consent_status"!==e.event)return;if(y.explicitOnly&&"explicit"!==(null==(n=e.type)?void 0:n.toLowerCase()))return;const o=t(e);Object.keys(o).length>0&&g("walker consent",o)},o=null!=(c=y.eventName)?c:"ucEvent";f=e=>{const t=e;t.detail&&n(t.detail)},v.addEventListener(o,f)}return{type:"usercentrics",config:p,push:g,destroy:async e=>{var t;if(v&&f){const e=null!=(t=y.eventName)?t:"ucEvent";v.removeEventListener(e,f)}}}},_=w;export{t as SourceUsercentrics,f as createMockElbFn,_ as default,n as fullConsent,v as fullConsentCustomMapped,r as fullConsentMapped,l as fullConsentUpperCase,a as implicitConsent,i as minimalConsent,g as minimalConsentMapped,c as nonConsentEvent,d as noopLogger,o as partialConsent,u as partialConsentMapped,s as serviceLevelConsent,y as serviceLevelMapped,A as setup,w as sourceUsercentrics,m as step};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\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 }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Window event name to listen for.\n * Configured in Usercentrics admin under Implementation > Data Layer & Events.\n * Can also be set to 'UC_SDK_EVENT' for the built-in Browser SDK event.\n *\n * Default: 'ucEvent'\n */\n eventName?: string;\n\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, OR logic applies:\n * if ANY source category is true, the target group is true.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores events where type !== 'explicit'\n * When false: Processes any consent_status event including implicit/defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n","import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, UsercentricsEventDetail } from './types';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n// Export examples\nexport * from './examples';\n\n/** Reserved keys in event.detail that are not service names */\nconst RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * This source listens to Usercentrics CMP events and translates\n * consent states to walkerOS consent commands.\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 * eventName: 'ucEvent',\n * categoryMap: {\n * essential: 'functional',\n * functional: 'functional',\n * marketing: '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 } = 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\n const settings: Settings = {\n eventName: config?.settings?.eventName ?? 'ucEvent',\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track listener reference for cleanup\n let consentListener: ((e: Event) => void) | undefined;\n\n // Only setup if in browser environment\n if (actualWindow) {\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 */\n const isGroupLevel = (\n ucCategory: Record<string, boolean | unknown>,\n ): boolean => {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n };\n\n /**\n * Parse consent from Usercentrics event detail.\n *\n * Two modes:\n * 1. Group-level: ucCategory has all booleans -> use ucCategory as consent\n * 2. Service-level: ucCategory has non-booleans -> extract individual\n * service keys from event.detail + boolean entries from ucCategory\n *\n * categoryMap is applied in both modes for ucCategory boolean entries.\n */\n const parseConsent = (\n detail: UsercentricsEventDetail,\n ): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n // Group-level consent: use ucCategory values\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: if ANY source category is true, target group is true\n state[mapped] = state[mapped] || value;\n });\n } else {\n // Service-level consent: extract individual services\n // Include boolean entries from ucCategory (with categoryMap applied)\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = settings.categoryMap?.[key] ?? key;\n state[mapped] = state[mapped] || value;\n }\n });\n }\n\n // Extract service keys (not reserved keys)\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n // Normalize: lowercase, spaces to underscores\n const normalized = key.toLowerCase().replace(/ /g, '_');\n state[normalized] = value;\n });\n }\n\n return state;\n };\n\n /**\n * Handle a Usercentrics consent event.\n */\n const handleConsent = (detail: UsercentricsEventDetail) => {\n // Only process consent_status events\n if (detail.event !== 'consent_status') return;\n\n // Skip implicit consent if explicitOnly is true\n // Use case-insensitive comparison (Usercentrics docs show both 'explicit' and 'EXPLICIT')\n if (settings.explicitOnly && detail.type?.toLowerCase() !== 'explicit')\n return;\n\n const state = parseConsent(detail);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // Listen for Usercentrics consent events\n const eventName = settings.eventName ?? 'ucEvent';\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<UsercentricsEventDetail>;\n if (customEvent.detail) {\n handleConsent(customEvent.detail);\n }\n };\n actualWindow.addEventListener(eventName, consentListener);\n }\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n destroy: async () => {\n if (actualWindow && consentListener) {\n const eventName = settings.eventName ?? 'ucEvent';\n actualWindow.removeEventListener(eventName, consentListener);\n }\n },\n };\n};\n\nexport default sourceUsercentrics;\n"],"mappings":";AAAA;;;ACWO,IAAM,cAAuC;AAAA,EAClD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,IACV,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAKO,IAAM,iBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AAA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B,YAAM,cAAc;AACpB,UAAI,YAAY,QAAQ;AACtB,sBAAc,YAAY,MAAM;AAAA,MAClC;AAAA,IACF;AACA,iBAAa,iBAAiB,WAAW,eAAe;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,YAAY;AA9JzB,UAAAA;AA+JM,UAAI,gBAAgB,iBAAiB;AACnC,cAAM,aAAYA,MAAA,SAAS,cAAT,OAAAA,MAAsB;AACxC,qBAAa,oBAAoB,WAAW,eAAe;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","_b"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\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 }\n}\n\n/**\n * Settings for Usercentrics source\n */\nexport interface Settings {\n /**\n * Window event name to listen for.\n * Configured in Usercentrics admin under Implementation > Data Layer & Events.\n * Can also be set to 'UC_SDK_EVENT' for the built-in Browser SDK event.\n *\n * Default: 'ucEvent'\n */\n eventName?: string;\n\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, OR logic applies:\n * if ANY source category is true, the target group is true.\n *\n * Default: {} (pass through category names as-is)\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores events where type !== 'explicit'\n * When false: Processes any consent_status event including implicit/defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 { UsercentricsEventDetail } from '../types';\n\n/**\n * Example Usercentrics consent event detail inputs.\n *\n * These represent real event.detail payloads from Usercentrics CMP.\n */\n\n/**\n * Full consent - user accepted all categories (explicit)\n */\nexport const fullConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': true,\n};\n\n/**\n * Partial consent - user accepted only essential and functional (explicit)\n */\nexport const partialConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Minimal consent - user denied everything except essential (explicit)\n */\nexport const minimalConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Implicit consent - page load with default consent state\n * (not an explicit user choice)\n */\nexport const implicitConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'implicit',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n 'Google Analytics': false,\n 'Google Ads Remarketing': false,\n};\n\n/**\n * Explicit consent with uppercase type field (Usercentrics docs are\n * inconsistent about casing - some show 'EXPLICIT', others 'explicit')\n */\nexport const fullConsentUpperCase: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'EXPLICIT',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\n/**\n * Service-level consent - ucCategory has mixed types (non-boolean values\n * indicate individual service-level choice rather than group-level)\n */\nexport const serviceLevelConsent: UsercentricsEventDetail = {\n event: 'consent_status',\n type: 'explicit',\n action: 'onUpdateServices',\n ucCategory: {\n essential: true,\n functional: 'partial', // Non-boolean indicates mixed service choices\n marketing: 'partial',\n },\n 'Google Analytics': true,\n 'Google Ads Remarketing': false,\n Hotjar: true,\n};\n\n/**\n * Non-consent event (should be ignored)\n */\nexport const nonConsentEvent: UsercentricsEventDetail = {\n event: 'other_event',\n type: 'explicit',\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing Usercentrics event details\n * with no category mapping configured (pass-through).\n */\n\n/**\n * Full consent - all categories true (group-level)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: true,\n};\n\n/**\n * Partial consent - essential and functional true, marketing false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: true,\n marketing: false,\n};\n\n/**\n * Minimal consent - only essential true\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n essential: true,\n functional: false,\n marketing: false,\n};\n\n/**\n * Full consent with custom category mapping applied\n * (essential->functional, functional->functional, marketing->marketing)\n */\nexport const fullConsentCustomMapped: WalkerOS.Consent = {\n functional: true,\n marketing: true,\n};\n\n/**\n * Service-level consent - individual service booleans + boolean ucCategory entries\n * (services normalized: lowercase, spaces to underscores)\n * (ucCategory boolean entries mapped through categoryMap)\n */\nexport const serviceLevelMapped: WalkerOS.Consent = {\n essential: true,\n google_analytics: true,\n google_ads_remarketing: false,\n hotjar: 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';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onAcceptAllServices',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n in: {\n event: 'consent_status',\n type: 'explicit',\n action: 'onDenyAllServices',\n ucCategory: {\n essential: true,\n functional: false,\n marketing: false,\n },\n },\n out: {\n essential: true,\n functional: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Dispatches ucEvent CustomEvent after source init (trigger pattern). */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n env.window.dispatchEvent(new CustomEvent('ucEvent', { detail: input }));\n };\n};\n","import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, UsercentricsEventDetail } from './types';\n\n// Export types for external usage\nexport * as SourceUsercentrics from './types';\n\n// Export examples\nexport * from './examples';\n\n/** Reserved keys in event.detail that are not service names */\nconst RESERVED_KEYS = ['action', 'event', 'type', 'ucCategory'];\n\n/**\n * Usercentrics consent management source for walkerOS.\n *\n * This source listens to Usercentrics CMP events and translates\n * consent states to walkerOS consent commands.\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 * eventName: 'ucEvent',\n * categoryMap: {\n * essential: 'functional',\n * functional: 'functional',\n * marketing: '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 } = 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\n const settings: Settings = {\n eventName: config?.settings?.eventName ?? 'ucEvent',\n categoryMap: config?.settings?.categoryMap ?? {},\n explicitOnly: config?.settings?.explicitOnly ?? true,\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track listener reference for cleanup\n let consentListener: ((e: Event) => void) | undefined;\n\n // Only setup if in browser environment\n if (actualWindow) {\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 */\n const isGroupLevel = (\n ucCategory: Record<string, boolean | unknown>,\n ): boolean => {\n return Object.values(ucCategory).every((val) => typeof val === 'boolean');\n };\n\n /**\n * Parse consent from Usercentrics event detail.\n *\n * Two modes:\n * 1. Group-level: ucCategory has all booleans -> use ucCategory as consent\n * 2. Service-level: ucCategory has non-booleans -> extract individual\n * service keys from event.detail + boolean entries from ucCategory\n *\n * categoryMap is applied in both modes for ucCategory boolean entries.\n */\n const parseConsent = (\n detail: UsercentricsEventDetail,\n ): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n if (detail.ucCategory && isGroupLevel(detail.ucCategory)) {\n // Group-level consent: use ucCategory values\n Object.entries(detail.ucCategory).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: if ANY source category is true, target group is true\n state[mapped] = state[mapped] || value;\n });\n } else {\n // Service-level consent: extract individual services\n // Include boolean entries from ucCategory (with categoryMap applied)\n if (detail.ucCategory) {\n Object.entries(detail.ucCategory).forEach(([key, value]) => {\n if (typeof value === 'boolean') {\n const mapped = settings.categoryMap?.[key] ?? key;\n state[mapped] = state[mapped] || value;\n }\n });\n }\n\n // Extract service keys (not reserved keys)\n Object.entries(detail).forEach(([key, value]) => {\n if (RESERVED_KEYS.includes(key)) return;\n if (typeof value !== 'boolean') return;\n // Normalize: lowercase, spaces to underscores\n const normalized = key.toLowerCase().replace(/ /g, '_');\n state[normalized] = value;\n });\n }\n\n return state;\n };\n\n /**\n * Handle a Usercentrics consent event.\n */\n const handleConsent = (detail: UsercentricsEventDetail) => {\n // Only process consent_status events\n if (detail.event !== 'consent_status') return;\n\n // Skip implicit consent if explicitOnly is true\n // Use case-insensitive comparison (Usercentrics docs show both 'explicit' and 'EXPLICIT')\n if (settings.explicitOnly && detail.type?.toLowerCase() !== 'explicit')\n return;\n\n const state = parseConsent(detail);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // Listen for Usercentrics consent events\n const eventName = settings.eventName ?? 'ucEvent';\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<UsercentricsEventDetail>;\n if (customEvent.detail) {\n handleConsent(customEvent.detail);\n }\n };\n actualWindow.addEventListener(eventName, consentListener);\n }\n\n return {\n type: 'usercentrics',\n config: fullConfig,\n push: elb,\n destroy: async (_context) => {\n if (actualWindow && consentListener) {\n const eventName = settings.eventName ?? 'ucEvent';\n actualWindow.removeEventListener(eventName, consentListener);\n }\n },\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WAAW,eAAe;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,OAAO,aAAa;AA9JjC,UAAAA;AA+JM,UAAI,gBAAgB,iBAAiB;AACnC,cAAM,aAAYA,MAAA,SAAS,cAAT,OAAAA,MAAsB;AACxC,qBAAa,oBAAoB,WAAW,eAAe;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["fullConsent","minimalConsent","_a","_b"]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$meta": {
|
|
3
|
+
"package": "@walkeros/web-source-cmp-usercentrics",
|
|
4
|
+
"version": "2.1.0",
|
|
5
|
+
"type": "source",
|
|
6
|
+
"platform": "web",
|
|
7
|
+
"renderer": "codebox"
|
|
8
|
+
},
|
|
9
|
+
"schemas": {},
|
|
10
|
+
"examples": {
|
|
11
|
+
"createMockElbFn": {
|
|
12
|
+
"$code": "()=>()=>Promise.resolve({ok:!0})"
|
|
13
|
+
},
|
|
14
|
+
"fullConsent": {
|
|
15
|
+
"event": "consent_status",
|
|
16
|
+
"type": "explicit",
|
|
17
|
+
"action": "onAcceptAllServices",
|
|
18
|
+
"ucCategory": {
|
|
19
|
+
"essential": true,
|
|
20
|
+
"functional": true,
|
|
21
|
+
"marketing": true
|
|
22
|
+
},
|
|
23
|
+
"Google Analytics": true,
|
|
24
|
+
"Google Ads Remarketing": true
|
|
25
|
+
},
|
|
26
|
+
"fullConsentCustomMapped": {
|
|
27
|
+
"functional": true,
|
|
28
|
+
"marketing": true
|
|
29
|
+
},
|
|
30
|
+
"fullConsentMapped": {
|
|
31
|
+
"essential": true,
|
|
32
|
+
"functional": true,
|
|
33
|
+
"marketing": true
|
|
34
|
+
},
|
|
35
|
+
"fullConsentUpperCase": {
|
|
36
|
+
"event": "consent_status",
|
|
37
|
+
"type": "EXPLICIT",
|
|
38
|
+
"action": "onAcceptAllServices",
|
|
39
|
+
"ucCategory": {
|
|
40
|
+
"essential": true,
|
|
41
|
+
"functional": true,
|
|
42
|
+
"marketing": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"implicitConsent": {
|
|
46
|
+
"event": "consent_status",
|
|
47
|
+
"type": "implicit",
|
|
48
|
+
"ucCategory": {
|
|
49
|
+
"essential": true,
|
|
50
|
+
"functional": false,
|
|
51
|
+
"marketing": false
|
|
52
|
+
},
|
|
53
|
+
"Google Analytics": false,
|
|
54
|
+
"Google Ads Remarketing": false
|
|
55
|
+
},
|
|
56
|
+
"minimalConsent": {
|
|
57
|
+
"event": "consent_status",
|
|
58
|
+
"type": "explicit",
|
|
59
|
+
"action": "onDenyAllServices",
|
|
60
|
+
"ucCategory": {
|
|
61
|
+
"essential": true,
|
|
62
|
+
"functional": false,
|
|
63
|
+
"marketing": false
|
|
64
|
+
},
|
|
65
|
+
"Google Analytics": false,
|
|
66
|
+
"Google Ads Remarketing": false
|
|
67
|
+
},
|
|
68
|
+
"minimalConsentMapped": {
|
|
69
|
+
"essential": true,
|
|
70
|
+
"functional": false,
|
|
71
|
+
"marketing": false
|
|
72
|
+
},
|
|
73
|
+
"nonConsentEvent": {
|
|
74
|
+
"event": "other_event",
|
|
75
|
+
"type": "explicit"
|
|
76
|
+
},
|
|
77
|
+
"noopLogger": {
|
|
78
|
+
"error": {
|
|
79
|
+
"$code": "()=>{}"
|
|
80
|
+
},
|
|
81
|
+
"warn": {
|
|
82
|
+
"$code": "()=>{}"
|
|
83
|
+
},
|
|
84
|
+
"info": {
|
|
85
|
+
"$code": "()=>{}"
|
|
86
|
+
},
|
|
87
|
+
"debug": {
|
|
88
|
+
"$code": "()=>{}"
|
|
89
|
+
},
|
|
90
|
+
"throw": {
|
|
91
|
+
"$code": "e=>{throw\"string\"==typeof e?new Error(e):e}"
|
|
92
|
+
},
|
|
93
|
+
"json": {
|
|
94
|
+
"$code": "()=>{}"
|
|
95
|
+
},
|
|
96
|
+
"scope": {
|
|
97
|
+
"$code": "()=>C"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"partialConsent": {
|
|
101
|
+
"event": "consent_status",
|
|
102
|
+
"type": "explicit",
|
|
103
|
+
"action": "onUpdateServices",
|
|
104
|
+
"ucCategory": {
|
|
105
|
+
"essential": true,
|
|
106
|
+
"functional": true,
|
|
107
|
+
"marketing": false
|
|
108
|
+
},
|
|
109
|
+
"Google Analytics": true,
|
|
110
|
+
"Google Ads Remarketing": false
|
|
111
|
+
},
|
|
112
|
+
"partialConsentMapped": {
|
|
113
|
+
"essential": true,
|
|
114
|
+
"functional": true,
|
|
115
|
+
"marketing": false
|
|
116
|
+
},
|
|
117
|
+
"serviceLevelConsent": {
|
|
118
|
+
"event": "consent_status",
|
|
119
|
+
"type": "explicit",
|
|
120
|
+
"action": "onUpdateServices",
|
|
121
|
+
"ucCategory": {
|
|
122
|
+
"essential": true,
|
|
123
|
+
"functional": "partial",
|
|
124
|
+
"marketing": "partial"
|
|
125
|
+
},
|
|
126
|
+
"Google Analytics": true,
|
|
127
|
+
"Google Ads Remarketing": false,
|
|
128
|
+
"Hotjar": true
|
|
129
|
+
},
|
|
130
|
+
"serviceLevelMapped": {
|
|
131
|
+
"essential": true,
|
|
132
|
+
"google_analytics": true,
|
|
133
|
+
"google_ads_remarketing": false,
|
|
134
|
+
"hotjar": true
|
|
135
|
+
},
|
|
136
|
+
"setup": {
|
|
137
|
+
"$code": "(e,t)=>{if(e&&\"object\"==typeof e)return()=>{t.window.dispatchEvent(new CustomEvent(\"ucEvent\",{detail:e}))}}"
|
|
138
|
+
},
|
|
139
|
+
"step": {
|
|
140
|
+
"fullConsent": {
|
|
141
|
+
"in": {
|
|
142
|
+
"event": "consent_status",
|
|
143
|
+
"type": "explicit",
|
|
144
|
+
"action": "onAcceptAllServices",
|
|
145
|
+
"ucCategory": {
|
|
146
|
+
"essential": true,
|
|
147
|
+
"functional": true,
|
|
148
|
+
"marketing": true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"out": {
|
|
152
|
+
"essential": true,
|
|
153
|
+
"functional": true,
|
|
154
|
+
"marketing": true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"minimalConsent": {
|
|
158
|
+
"in": {
|
|
159
|
+
"event": "consent_status",
|
|
160
|
+
"type": "explicit",
|
|
161
|
+
"action": "onDenyAllServices",
|
|
162
|
+
"ucCategory": {
|
|
163
|
+
"essential": true,
|
|
164
|
+
"functional": false,
|
|
165
|
+
"marketing": false
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"out": {
|
|
169
|
+
"essential": true,
|
|
170
|
+
"functional": false,
|
|
171
|
+
"marketing": false
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-source-cmp-usercentrics",
|
|
3
3
|
"description": "Usercentrics consent management source for walkerOS",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"walkerOS": {
|
|
7
7
|
"type": "source",
|
|
8
|
-
"platform": "web"
|
|
8
|
+
"platform": "web",
|
|
9
|
+
"renderer": "codebox"
|
|
9
10
|
},
|
|
10
11
|
"main": "./dist/index.js",
|
|
11
12
|
"module": "./dist/index.mjs",
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"update": "npx npm-check-updates -u && npm update"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@walkeros/core": "^2.
|
|
43
|
-
"@walkeros/collector": "^2.
|
|
43
|
+
"@walkeros/core": "^2.1.1",
|
|
44
|
+
"@walkeros/collector": "^2.1.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {},
|
|
46
47
|
"repository": {
|