@walkeros/web-source-cmp-usercentrics 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -0
- package/dist/dev.d.mts +121 -0
- package/dist/dev.d.ts +121 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +103 -0
- package/dist/examples/index.d.ts +103 -0
- package/dist/examples/index.js +178 -0
- package/dist/examples/index.mjs +138 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +206 -0
- package/dist/index.d.ts +206 -0
- package/dist/index.es5.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { Source, Elb, WalkerOS, Logger } from '@walkeros/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usercentrics consent event detail structure.
|
|
5
|
+
*
|
|
6
|
+
* Fired as event.detail on the configured window event (e.g. 'ucEvent').
|
|
7
|
+
* Contains both category-level (ucCategory) and service-level consent.
|
|
8
|
+
*/
|
|
9
|
+
interface UsercentricsEventDetail {
|
|
10
|
+
/** Always 'consent_status' for consent events */
|
|
11
|
+
event: string;
|
|
12
|
+
/** 'explicit' when user actively chose, 'implicit' for page-load defaults (casing may vary) */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Action taken: 'onAcceptAllServices', 'onDenyAllServices', 'onUpdateServices' */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** Category-level consent booleans (e.g. { marketing: true, functional: false }) */
|
|
17
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
18
|
+
/** Service-level consent as top-level keys (e.g. 'Google Analytics': true) */
|
|
19
|
+
[service: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface WindowEventMap {
|
|
23
|
+
ucEvent: CustomEvent<UsercentricsEventDetail>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Settings for Usercentrics source
|
|
28
|
+
*/
|
|
29
|
+
interface Settings {
|
|
30
|
+
/**
|
|
31
|
+
* Window event name to listen for.
|
|
32
|
+
* Configured in Usercentrics admin under Implementation > Data Layer & Events.
|
|
33
|
+
* Can also be set to 'UC_SDK_EVENT' for the built-in Browser SDK event.
|
|
34
|
+
*
|
|
35
|
+
* Default: 'ucEvent'
|
|
36
|
+
*/
|
|
37
|
+
eventName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Map Usercentrics categories to walkerOS consent groups.
|
|
40
|
+
* Keys: Usercentrics category names (from ucCategory)
|
|
41
|
+
* Values: walkerOS consent group names
|
|
42
|
+
*
|
|
43
|
+
* Applied in both group-level and service-level consent modes.
|
|
44
|
+
* When multiple source categories map to the same group, OR logic applies:
|
|
45
|
+
* if ANY source category is true, the target group is true.
|
|
46
|
+
*
|
|
47
|
+
* Default: {} (pass through category names as-is)
|
|
48
|
+
*/
|
|
49
|
+
categoryMap?: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Only process explicit consent (user made a choice).
|
|
52
|
+
* When true: Ignores events where type !== 'explicit'
|
|
53
|
+
* When false: Processes any consent_status event including implicit/defaults
|
|
54
|
+
*
|
|
55
|
+
* Default: true
|
|
56
|
+
*/
|
|
57
|
+
explicitOnly?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* User input settings (all optional)
|
|
61
|
+
*/
|
|
62
|
+
type InitSettings = Partial<Settings>;
|
|
63
|
+
/**
|
|
64
|
+
* No mapping configuration for this source
|
|
65
|
+
*/
|
|
66
|
+
interface Mapping {
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Push function type - uses elb for consent commands
|
|
70
|
+
*/
|
|
71
|
+
type Push = Elb.Fn;
|
|
72
|
+
/**
|
|
73
|
+
* Environment interface for Usercentrics source
|
|
74
|
+
*/
|
|
75
|
+
interface Env extends Source.BaseEnv {
|
|
76
|
+
window?: Window & typeof globalThis;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Types bundle for Usercentrics source
|
|
80
|
+
*/
|
|
81
|
+
type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;
|
|
82
|
+
/**
|
|
83
|
+
* Config type alias
|
|
84
|
+
*/
|
|
85
|
+
type Config = Source.Config<Types>;
|
|
86
|
+
|
|
87
|
+
type index_Config = Config;
|
|
88
|
+
type index_Env = Env;
|
|
89
|
+
type index_InitSettings = InitSettings;
|
|
90
|
+
type index_Mapping = Mapping;
|
|
91
|
+
type index_Push = Push;
|
|
92
|
+
type index_Settings = Settings;
|
|
93
|
+
type index_Types = Types;
|
|
94
|
+
type index_UsercentricsEventDetail = UsercentricsEventDetail;
|
|
95
|
+
declare namespace index {
|
|
96
|
+
export type { index_Config as Config, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_Push as Push, index_Settings as Settings, index_Types as Types, index_UsercentricsEventDetail as UsercentricsEventDetail };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Example Usercentrics consent event detail inputs.
|
|
101
|
+
*
|
|
102
|
+
* These represent real event.detail payloads from Usercentrics CMP.
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* Full consent - user accepted all categories (explicit)
|
|
106
|
+
*/
|
|
107
|
+
declare const fullConsent: UsercentricsEventDetail;
|
|
108
|
+
/**
|
|
109
|
+
* Partial consent - user accepted only essential and functional (explicit)
|
|
110
|
+
*/
|
|
111
|
+
declare const partialConsent: UsercentricsEventDetail;
|
|
112
|
+
/**
|
|
113
|
+
* Minimal consent - user denied everything except essential (explicit)
|
|
114
|
+
*/
|
|
115
|
+
declare const minimalConsent: UsercentricsEventDetail;
|
|
116
|
+
/**
|
|
117
|
+
* Implicit consent - page load with default consent state
|
|
118
|
+
* (not an explicit user choice)
|
|
119
|
+
*/
|
|
120
|
+
declare const implicitConsent: UsercentricsEventDetail;
|
|
121
|
+
/**
|
|
122
|
+
* Explicit consent with uppercase type field (Usercentrics docs are
|
|
123
|
+
* inconsistent about casing - some show 'EXPLICIT', others 'explicit')
|
|
124
|
+
*/
|
|
125
|
+
declare const fullConsentUpperCase: UsercentricsEventDetail;
|
|
126
|
+
/**
|
|
127
|
+
* Service-level consent - ucCategory has mixed types (non-boolean values
|
|
128
|
+
* indicate individual service-level choice rather than group-level)
|
|
129
|
+
*/
|
|
130
|
+
declare const serviceLevelConsent: UsercentricsEventDetail;
|
|
131
|
+
/**
|
|
132
|
+
* Non-consent event (should be ignored)
|
|
133
|
+
*/
|
|
134
|
+
declare const nonConsentEvent: UsercentricsEventDetail;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Expected walkerOS consent outputs.
|
|
138
|
+
*
|
|
139
|
+
* These represent the consent state after parsing Usercentrics event details
|
|
140
|
+
* with no category mapping configured (pass-through).
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* Full consent - all categories true (group-level)
|
|
144
|
+
*/
|
|
145
|
+
declare const fullConsentMapped: WalkerOS.Consent;
|
|
146
|
+
/**
|
|
147
|
+
* Partial consent - essential and functional true, marketing false
|
|
148
|
+
*/
|
|
149
|
+
declare const partialConsentMapped: WalkerOS.Consent;
|
|
150
|
+
/**
|
|
151
|
+
* Minimal consent - only essential true
|
|
152
|
+
*/
|
|
153
|
+
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
154
|
+
/**
|
|
155
|
+
* Full consent with custom category mapping applied
|
|
156
|
+
* (essential->functional, functional->functional, marketing->marketing)
|
|
157
|
+
*/
|
|
158
|
+
declare const fullConsentCustomMapped: WalkerOS.Consent;
|
|
159
|
+
/**
|
|
160
|
+
* Service-level consent - individual service booleans + boolean ucCategory entries
|
|
161
|
+
* (services normalized: lowercase, spaces to underscores)
|
|
162
|
+
* (ucCategory boolean entries mapped through categoryMap)
|
|
163
|
+
*/
|
|
164
|
+
declare const serviceLevelMapped: WalkerOS.Consent;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Create a properly typed elb/push function mock
|
|
168
|
+
*/
|
|
169
|
+
declare const createMockElbFn: () => Elb.Fn;
|
|
170
|
+
/**
|
|
171
|
+
* Simple no-op logger for demo purposes
|
|
172
|
+
*/
|
|
173
|
+
declare const noopLogger: Logger.Instance;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Usercentrics consent management source for walkerOS.
|
|
177
|
+
*
|
|
178
|
+
* This source listens to Usercentrics CMP events and translates
|
|
179
|
+
* consent states to walkerOS consent commands.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';
|
|
184
|
+
*
|
|
185
|
+
* await startFlow({
|
|
186
|
+
* sources: {
|
|
187
|
+
* consent: {
|
|
188
|
+
* code: sourceUsercentrics,
|
|
189
|
+
* config: {
|
|
190
|
+
* settings: {
|
|
191
|
+
* eventName: 'ucEvent',
|
|
192
|
+
* categoryMap: {
|
|
193
|
+
* essential: 'functional',
|
|
194
|
+
* functional: 'functional',
|
|
195
|
+
* marketing: 'marketing',
|
|
196
|
+
* },
|
|
197
|
+
* },
|
|
198
|
+
* },
|
|
199
|
+
* },
|
|
200
|
+
* },
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare const sourceUsercentrics: Source.Init<Types>;
|
|
205
|
+
|
|
206
|
+
export { index as SourceUsercentrics, createMockElbFn, sourceUsercentrics as default, fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, sourceUsercentrics };
|
|
@@ -0,0 +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 l=e[i](a),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).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,l,"next",e)}function l(e){asyncGeneratorStep(i,r,o,a,l,"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,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(l)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),l=Object.defineProperty;return l(a,"next",{value:u(0)}),l(a,"throw",{value:u(1)}),l(a,"return",{value:u(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function u(l){return function(u){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}}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})}(o,{SourceUsercentrics:function(){return a},createMockElbFn:function(){return h},default:function(){return A},fullConsent:function(){return l},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 u},partialConsentMapped:function(){return _},serviceLevelConsent:function(){return y},serviceLevelMapped:function(){return b},sourceUsercentrics:function(){return k}});var i,a={},l={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},u={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},b={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},m=function(){},h=function(){return function(){return Promise.resolve({ok:!0})}},w={error:m,info:m,debug:m,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return w}},C=["action","event","type","ucCategory"],k=function(e){return _async_to_generator(function(){var t,n,r,o,i,a,l,u,c,s,f,y,p,v,_,d,g,b,m;return _ts_generator(this,function(h){return u=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==u||null===(i=u.settings)||void 0===i?void 0:i.eventName)&&void 0!==n?n:"ucEvent",categoryMap:null!==(r=null==u||null===(a=u.settings)||void 0===a?void 0:a.categoryMap)&&void 0!==r?r:{},explicitOnly:null===(o=null==u||null===(l=u.settings)||void 0===l?void 0:l.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 l=null!==(n=null===(r=y.categoryMap)||void 0===r?void 0:r[i])&&void 0!==n?n:i;t[l]=t[l]||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,l=null!==(i=null===(a=y.categoryMap)||void 0===a?void 0:a[r])&&void 0!==i?i:r;t[l]=t[l]||o}}),Object.entries(e).forEach(function(e){var n=_sliced_to_array(e,2),r=n[0],o=n[1];if(!C.includes(r)&&"boolean"==typeof o){var i=r.toLowerCase().replace(/ /g,"_");t[i]=o}})),t},b=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)}},m=null!==(_=y.eventName)&&void 0!==_?_:"ucEvent",v=function(e){var t=e;t.detail&&b(t.detail)},f.addEventListener(m,v)),[2,{type:"usercentrics",config:p,push:s,destroy:function(){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]})})()}}]})})()},A=k;return i=o,function(o,i,a,l){if(i&&"object"===(void 0===i?"undefined":_type_of(i))||"function"==typeof i){var u=!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:!(l=t(i,n))||l.enumerable})},p=n(i)[Symbol.iterator]();!(u=(f=p.next()).done);u=!0)y()}catch(e){c=!0,s=e}finally{try{u||null==p.return||p.return()}finally{if(c)throw s}}}return o}(e({},"__esModule",{value:!0}),i)}();
|
package/dist/index.js
ADDED
|
@@ -0,0 +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})})(i,{SourceUsercentrics:()=>l,createMockElbFn:()=>k,default:()=>_,fullConsent:()=>r,fullConsentCustomMapped:()=>m,fullConsentMapped:()=>y,fullConsentUpperCase:()=>g,implicitConsent:()=>u,minimalConsent:()=>c,minimalConsentMapped:()=>d,nonConsentEvent:()=>v,noopLogger:()=>w,partialConsent:()=>s,partialConsentMapped:()=>f,serviceLevelConsent:()=>p,serviceLevelMapped:()=>C,sourceUsercentrics:()=>O}),module.exports=(e=i,((e,i,l,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of o(i))a.call(e,s)||s===l||t(e,s,{get:()=>i[s],enumerable:!(r=n(i,s))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var l={},r={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},s={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},g={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},p={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},b=()=>{},k=()=>()=>Promise.resolve({ok:!0}),w={error:b,info:b,debug:b,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>w},A=["action","event","type","ucCategory"],O=async e=>{var t,n,o,a,i,l,r,s;const{config:c,env:u}=e,{elb:g}=u,p=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!=(i=null==(a=null==c?void 0:c.settings)?void 0:a.categoryMap)?i:{},explicitOnly:null==(r=null==(l=null==c?void 0:c.settings)?void 0:l.explicitOnly)||r},y={settings:v};let f;if(p){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,a;if("boolean"!=typeof t)return;const i=null!=(a=null==(o=v.categoryMap)?void 0:o[e])?a:e;n[i]=n[i]||t}):(t.ucCategory&&Object.entries(t.ucCategory).forEach(([e,t])=>{var o,a;if("boolean"==typeof t){const i=null!=(a=null==(o=v.categoryMap)?void 0:o[e])?a:e;n[i]=n[i]||t}}),Object.entries(t).forEach(([e,t])=>{if(A.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&&g("walker consent",o)},o=null!=(s=v.eventName)?s:"ucEvent";f=e=>{const t=e;t.detail&&n(t.detail)},p.addEventListener(o,f)}return{type:"usercentrics",config:y,push:g,destroy:async()=>{var e;if(p&&f){const t=null!=(e=v.eventName)?e:"ucEvent";p.removeEventListener(t,f)}}}},_=O;//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,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,I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,CAAC,CAAC,KAAK,KAAK,MAAM;AAC/C,cAAI,cAAc,SAAS,GAAG,EAAG;AACjC,cAAI,OAAO,UAAU,UAAW;AAEhC,gBAAM,aAAa,IAAI,YAAY,EAAE,QAAQ,MAAM,GAAG;AACtD,gBAAM,UAAU,IAAI;AAAA,QACtB,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT;AAKA,UAAM,gBAAgB,CAAC,WAAoC;AA9H/D,UAAAD;AAgIM,UAAI,OAAO,UAAU,iBAAkB;AAIvC,UAAI,SAAS,kBAAgBA,MAAA,OAAO,SAAP,gBAAAA,IAAa,mBAAkB;AAC1D;AAEF,YAAM,QAAQ,aAAa,MAAM;AAGjC,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,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,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"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={},t={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},n={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},i={event:"consent_status",type:"implicit",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},a={event:"consent_status",type:"EXPLICIT",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},l={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:"partial",marketing:"partial"},"Google Analytics":!0,"Google Ads Remarketing":!1,Hotjar:!0},s={event:"other_event",type:"explicit"},c={essential:!0,functional:!0,marketing:!0},r={essential:!0,functional:!0,marketing:!1},u={essential:!0,functional:!1,marketing:!1},g={functional:!0,marketing:!0},v={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},y=()=>{},p=()=>()=>Promise.resolve({ok:!0}),d={error:y,info:y,debug:y,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>d},f=["action","event","type","ucCategory"],m=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 d;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(f.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";d=e=>{const t=e;t.detail&&n(t.detail)},v.addEventListener(o,d)}return{type:"usercentrics",config:p,push:g,destroy:async()=>{var e;if(v&&d){const t=null!=(e=y.eventName)?e:"ucEvent";v.removeEventListener(t,d)}}}},k=m;export{e as SourceUsercentrics,p as createMockElbFn,k as default,t as fullConsent,g as fullConsentCustomMapped,c as fullConsentMapped,a as fullConsentUpperCase,i as implicitConsent,o as minimalConsent,u as minimalConsentMapped,s as nonConsentEvent,d as noopLogger,n as partialConsent,r as partialConsentMapped,l as serviceLevelConsent,v as serviceLevelMapped,m as sourceUsercentrics};//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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,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AC,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"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@walkeros/web-source-cmp-usercentrics",
|
|
3
|
+
"description": "Usercentrics consent management source for walkerOS",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"walkerOS": {
|
|
7
|
+
"type": "source",
|
|
8
|
+
"platform": "web"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./examples": {
|
|
20
|
+
"types": "./dist/examples/index.d.ts",
|
|
21
|
+
"import": "./dist/examples/index.mjs",
|
|
22
|
+
"require": "./dist/examples/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./dev": {
|
|
25
|
+
"types": "./dist/dev.d.ts",
|
|
26
|
+
"import": "./dist/dev.mjs",
|
|
27
|
+
"require": "./dist/dev.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/**"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup --silent",
|
|
35
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
36
|
+
"dev": "jest --watchAll --colors",
|
|
37
|
+
"lint": "tsc && eslint \"**/*.ts*\"",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"update": "npx npm-check-updates -u && npm update"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@walkeros/core": "1.0.0",
|
|
43
|
+
"@walkeros/collector": "1.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {},
|
|
46
|
+
"repository": {
|
|
47
|
+
"url": "git+https://github.com/elbwalker/walkerOS.git",
|
|
48
|
+
"directory": "packages/web/sources/cmps/usercentrics"
|
|
49
|
+
},
|
|
50
|
+
"author": "elbwalker <hello@elbwalker.com>",
|
|
51
|
+
"homepage": "https://github.com/elbwalker/walkerOS#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/elbwalker/walkerOS/issues"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"walker",
|
|
57
|
+
"walkerOS",
|
|
58
|
+
"walkerOS-source",
|
|
59
|
+
"source",
|
|
60
|
+
"web",
|
|
61
|
+
"usercentrics",
|
|
62
|
+
"consent",
|
|
63
|
+
"cmp"
|
|
64
|
+
],
|
|
65
|
+
"funding": [
|
|
66
|
+
{
|
|
67
|
+
"type": "GitHub Sponsors",
|
|
68
|
+
"url": "https://github.com/sponsors/elbwalker"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|