@walkeros/web-source-cmp-usercentrics 3.0.2 → 4.0.0-next-1773967844643
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 +14 -5
- package/dist/dev.d.ts +14 -5
- 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 +12 -4
- package/dist/examples/index.d.ts +12 -4
- package/dist/examples/index.js +34 -7
- package/dist/examples/index.mjs +31 -5
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -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 +25 -5
- package/package.json +6 -4
package/dist/dev.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger, Flow,
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -113,10 +113,19 @@ declare namespace step {
|
|
|
113
113
|
export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
interface UsercentricsContent {
|
|
117
|
+
event: string;
|
|
118
|
+
type: string;
|
|
119
|
+
action?: string;
|
|
120
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
121
|
+
[service: string]: unknown;
|
|
122
|
+
}
|
|
123
|
+
declare const createTrigger: Trigger.CreateFn<UsercentricsContent, void>;
|
|
124
|
+
/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */
|
|
125
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void | (() => void);
|
|
118
126
|
|
|
119
127
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
128
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
120
129
|
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
121
130
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
122
131
|
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
@@ -128,10 +137,10 @@ declare const index_partialConsent: typeof partialConsent;
|
|
|
128
137
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
129
138
|
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
130
139
|
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
131
|
-
declare const index_setup: typeof setup;
|
|
132
140
|
declare const index_step: typeof step;
|
|
141
|
+
declare const index_trigger: typeof trigger;
|
|
133
142
|
declare namespace index {
|
|
134
|
-
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,
|
|
143
|
+
export { index_createMockElbFn as createMockElbFn, index_createTrigger as createTrigger, 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_step as step, index_trigger as trigger };
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
export { index as examples };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger, Flow,
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -113,10 +113,19 @@ declare namespace step {
|
|
|
113
113
|
export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
interface UsercentricsContent {
|
|
117
|
+
event: string;
|
|
118
|
+
type: string;
|
|
119
|
+
action?: string;
|
|
120
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
121
|
+
[service: string]: unknown;
|
|
122
|
+
}
|
|
123
|
+
declare const createTrigger: Trigger.CreateFn<UsercentricsContent, void>;
|
|
124
|
+
/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */
|
|
125
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void | (() => void);
|
|
118
126
|
|
|
119
127
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
128
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
120
129
|
declare const index_fullConsentCustomMapped: typeof fullConsentCustomMapped;
|
|
121
130
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
122
131
|
declare const index_fullConsentUpperCase: typeof fullConsentUpperCase;
|
|
@@ -128,10 +137,10 @@ declare const index_partialConsent: typeof partialConsent;
|
|
|
128
137
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
129
138
|
declare const index_serviceLevelConsent: typeof serviceLevelConsent;
|
|
130
139
|
declare const index_serviceLevelMapped: typeof serviceLevelMapped;
|
|
131
|
-
declare const index_setup: typeof setup;
|
|
132
140
|
declare const index_step: typeof step;
|
|
141
|
+
declare const index_trigger: typeof trigger;
|
|
133
142
|
declare namespace index {
|
|
134
|
-
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,
|
|
143
|
+
export { index_createMockElbFn as createMockElbFn, index_createTrigger as createTrigger, 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_step as step, index_trigger as trigger };
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
export { index as examples };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},s={};i(s,{examples:()=>r}),module.exports=(e=s,((e,i,s,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of a(i))o.call(e,l)||l===s||t(e,l,{get:()=>i[l],enumerable:!(r=n(i,l))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};i(r,{createMockElbFn:()=>A,createTrigger:()=>j,fullConsent:()=>l,fullConsentCustomMapped:()=>d,fullConsentMapped:()=>v,fullConsentUpperCase:()=>p,implicitConsent:()=>u,minimalConsent:()=>g,minimalConsentMapped:()=>C,nonConsentEvent:()=>y,noopLogger:()=>E,partialConsent:()=>c,partialConsentMapped:()=>f,serviceLevelConsent:()=>m,serviceLevelMapped:()=>k,step:()=>w,trigger:()=>N});var l={event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0},"Google Analytics":!0,"Google Ads Remarketing":!0},c={event:"consent_status",type:"explicit",action:"onUpdateServices",ucCategory:{essential:!0,functional:!0,marketing:!1},"Google Analytics":!0,"Google Ads Remarketing":!1},g={event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1},"Google Analytics":!1,"Google Ads Remarketing":!1},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}},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},d={functional:!0,marketing:!0},k={essential:!0,google_analytics:!0,google_ads_remarketing:!1,hotjar:!0},_=()=>{},A=()=>()=>Promise.resolve({ok:!0}),E={error:_,warn:_,info:_,debug:_,throw:e=>{throw"string"==typeof e?new Error(e):e},json:_,scope:()=>E},w={};i(w,{categoryMapOverride:()=>S,customEventName:()=>G,fullConsent:()=>b,minimalConsent:()=>x});var b={trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},x={trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},S={description:"Custom categoryMap remaps essential to functional and functional to analytics",trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!1}},mapping:{categoryMap:{essential:"functional",functional:"analytics"}},out:{functional:!0,analytics:!0,marketing:!1}},G={description:"Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2",trigger:{type:"consent",options:{eventName:"UC_SDK_EVENT"}},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!0}},mapping:{eventName:"UC_SDK_EVENT"},out:{essential:!0,functional:!0,marketing:!0}},M=require("@walkeros/collector"),j=async e=>{let t;return{get flow(){return t},trigger:(n,a)=>async n=>{var o;if(!t){const n=await(0,M.startFlow)({...e,run:null==(o=e.run)||o});t={collector:n.collector,elb:n.elb}}const i=(null==a?void 0:a.eventName)||"ucEvent";window.dispatchEvent(new CustomEvent(i,{detail:n}))}}},N=(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","../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\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps essential to functional and functional to analytics',\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n },\n mapping: {\n categoryMap: { essential: 'functional', functional: 'analytics' },\n },\n out: {\n functional: true,\n analytics: true,\n marketing: false,\n },\n};\n\nexport const customEventName: Flow.StepExample = {\n description: 'Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2',\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n mapping: { eventName: 'UC_SDK_EVENT' },\n out: {\n essential: true,\n functional: true,\n marketing: true,\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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W;AAAA,EACb;AACF;AAEO,IAAM,sBAAwC;AAAA,EACnD,aACE;AAAA,EACF,IAAI;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,aAAa,EAAE,WAAW,cAAc,YAAY,YAAY;AAAA,EAClE;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,aAAa;AAAA,EACb,IAAI;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS,EAAE,WAAW,eAAe;AAAA,EACrC,KAAK;AAAA,IACH,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;;;AC1EO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,SAAO,MAAM;AACX,QAAI,OAAO,cAAc,IAAI,YAAY,WAAW,EAAE,QAAQ,MAAM,CAAC,CAAC;AAAA,EACxE;AACF;","names":["fullConsent","minimalConsent"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"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 { createTrigger, trigger } from './trigger';\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 trigger: { type: 'consent' },\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 trigger: { type: 'consent' },\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\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps essential to functional and functional to analytics',\n trigger: { type: 'consent' },\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n },\n mapping: {\n categoryMap: { essential: 'functional', functional: 'analytics' },\n },\n out: {\n functional: true,\n analytics: true,\n marketing: false,\n },\n};\n\nexport const customEventName: Flow.StepExample = {\n description: 'Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2',\n trigger: { type: 'consent', options: { eventName: 'UC_SDK_EVENT' } },\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n mapping: { eventName: 'UC_SDK_EVENT' },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface UsercentricsContent {\n event: string;\n type: string;\n action?: string;\n ucCategory?: Record<string, boolean | unknown>;\n [service: string]: unknown;\n}\n\nconst createTrigger: Trigger.CreateFn<UsercentricsContent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsContent, void> =\n (type?: string, opts?: unknown) => async (content: UsercentricsContent) => {\n // Lazy startFlow — source registers ucEvent listener during init\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Dispatch the CMP event — source's listener catches it\n const eventName =\n (opts as { eventName?: string })?.eventName || 'ucEvent';\n window.dispatchEvent(new CustomEvent(eventName, { detail: content }));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */\nconst trigger = (\n input: unknown,\n env: Record<string, unknown>,\n): void | (() => void) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n (env.window as Window).dispatchEvent(\n new CustomEvent('ucEvent', { detail: input }),\n );\n };\n};\n\nexport { createTrigger, trigger };\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;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,I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;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS,EAAE,WAAW,eAAe;AAAA,EACrC,KAAK;AAAA,IACH,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;;;AChFA,uBAA0B;AAU1B,IAAM,gBAA6D,OACjE,WACG;AACH,MAAI;AAEJ,QAAMC,WACJ,CAAC,MAAe,SAAmB,OAAO,YAAiC;AAjB/E;AAmBM,QAAI,CAAC,MAAM;AACT,YAAM,SAAS,UAAM,4BAAU,EAAE,GAAG,QAAQ,MAAK,YAAO,QAAP,YAAc,KAAK,CAAC;AACrE,aAAO,EAAE,WAAW,OAAO,WAAW,KAAK,OAAO,IAAI;AAAA,IACxD;AAGA,UAAM,aACH,6BAAiC,cAAa;AACjD,WAAO,cAAc,IAAI,YAAY,WAAW,EAAE,QAAQ,QAAQ,CAAC,CAAC;AAAA,EACtE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA,SAAAA;AAAA,EACF;AACF;AAGA,IAAM,UAAU,CACd,OACA,QACwB;AACxB,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,SAAO,MAAM;AACX,IAAC,IAAI,OAAkB;AAAA,MACrB,IAAI,YAAY,WAAW,EAAE,QAAQ,MAAM,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;","names":["fullConsent","minimalConsent","trigger"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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:()=>
|
|
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,createTrigger:()=>x,fullConsent:()=>a,fullConsentCustomMapped:()=>m,fullConsentMapped:()=>g,fullConsentUpperCase:()=>l,implicitConsent:()=>s,minimalConsent:()=>o,minimalConsentMapped:()=>u,nonConsentEvent:()=>r,noopLogger:()=>C,partialConsent:()=>i,partialConsentMapped:()=>p,serviceLevelConsent:()=>c,serviceLevelMapped:()=>v,step:()=>d,trigger:()=>S});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"},g={essential:!0,functional:!0,marketing:!0},p={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},d={};t(d,{categoryMapOverride:()=>A,customEventName:()=>E,fullConsent:()=>k,minimalConsent:()=>_});var k={trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onAcceptAllServices",ucCategory:{essential:!0,functional:!0,marketing:!0}},out:{essential:!0,functional:!0,marketing:!0}},_={trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",action:"onDenyAllServices",ucCategory:{essential:!0,functional:!1,marketing:!1}},out:{essential:!0,functional:!1,marketing:!1}},A={description:"Custom categoryMap remaps essential to functional and functional to analytics",trigger:{type:"consent"},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!1}},mapping:{categoryMap:{essential:"functional",functional:"analytics"}},out:{functional:!0,analytics:!0,marketing:!1}},E={description:"Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2",trigger:{type:"consent",options:{eventName:"UC_SDK_EVENT"}},in:{event:"consent_status",type:"explicit",ucCategory:{essential:!0,functional:!0,marketing:!0}},mapping:{eventName:"UC_SDK_EVENT"},out:{essential:!0,functional:!0,marketing:!0}};import{startFlow as w}from"@walkeros/collector";var x=async e=>{let t;return{get flow(){return t},trigger:(n,a)=>async n=>{var i;if(!t){const n=await w({...e,run:null==(i=e.run)||i});t={collector:n.collector,elb:n.elb}}const o=(null==a?void 0:a.eventName)||"ucEvent";window.dispatchEvent(new CustomEvent(o,{detail:n}))}}},S=(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","../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\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps essential to functional and functional to analytics',\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n },\n mapping: {\n categoryMap: { essential: 'functional', functional: 'analytics' },\n },\n out: {\n functional: true,\n analytics: true,\n marketing: false,\n },\n};\n\nexport const customEventName: Flow.StepExample = {\n description: 'Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2',\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n mapping: { eventName: 'UC_SDK_EVENT' },\n out: {\n essential: true,\n functional: true,\n marketing: true,\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,MAAM;AAAA,EACN,QAAQ;AAAA,EAC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AA,MACZ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,aAAa,EAAE,WAAW,cAAc,YAAY,YAAY;AAAA,EAClE;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,aAAa;AAAA,EACb,IAAI;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,SAAS,EAAE,WAAW,eAAe;AAAA,EACrC,KAAK;AAAA,IACH,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;;;AC1EO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,SAAO,MAAM;AACX,QAAI,OAAO,cAAc,IAAI,YAAY,WAAW,EAAE,QAAQ,MAAM,CAAC,CAAC;AAAA,EACxE;AACF;","names":["fullConsent","minimalConsent"]}
|
|
1
|
+
{"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\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 trigger: { type: 'consent' },\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 trigger: { type: 'consent' },\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\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps essential to functional and functional to analytics',\n trigger: { type: 'consent' },\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: false,\n },\n },\n mapping: {\n categoryMap: { essential: 'functional', functional: 'analytics' },\n },\n out: {\n functional: true,\n analytics: true,\n marketing: false,\n },\n};\n\nexport const customEventName: Flow.StepExample = {\n description: 'Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2',\n trigger: { type: 'consent', options: { eventName: 'UC_SDK_EVENT' } },\n in: {\n event: 'consent_status',\n type: 'explicit',\n ucCategory: {\n essential: true,\n functional: true,\n marketing: true,\n },\n },\n mapping: { eventName: 'UC_SDK_EVENT' },\n out: {\n essential: true,\n functional: true,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface UsercentricsContent {\n event: string;\n type: string;\n action?: string;\n ucCategory?: Record<string, boolean | unknown>;\n [service: string]: unknown;\n}\n\nconst createTrigger: Trigger.CreateFn<UsercentricsContent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<UsercentricsContent, void> =\n (type?: string, opts?: unknown) => async (content: UsercentricsContent) => {\n // Lazy startFlow — source registers ucEvent listener during init\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Dispatch the CMP event — source's listener catches it\n const eventName =\n (opts as { eventName?: string })?.eventName || 'ucEvent';\n window.dispatchEvent(new CustomEvent(eventName, { detail: content }));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */\nconst trigger = (\n input: unknown,\n env: Record<string, unknown>,\n): void | (() => void) => {\n if (!input || typeof input !== 'object') return;\n return () => {\n (env.window as Window).dispatchEvent(\n new CustomEvent('ucEvent', { detail: input }),\n );\n };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":";;;;;;;AAAA;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,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;AAMO,IAAM,sBAA+C;AAAA,EAC1D,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BAAiB;AAU1B,IAAM,gBAA6D,OACjE,WACG;AACH,MAAI;AAEJ,QAAMC,WACJ,CAAC,MAAe,SAAmB,OAAO,YAAiC;AAjB/E;AAmBM,QAAI,CAAC,MAAM;AACT,YAAM,SAAS,MAAM,UAAU,EAAE,GAAG,QAAQ,MAAK,YAAO,QAAP,YAAc,KAAK,CAAC;AACrE,aAAO,EAAE,WAAW,OAAO,WAAW,KAAK,OAAO,IAAI;AAAA,IACxD;AAGA,UAAM,aACH,6BAAiC,cAAa;AACjD,WAAO,cAAc,IAAI,YAAY,WAAW,EAAE,QAAQ,QAAQ,CAAC,CAAC;AAAA,EACtE;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA,SAAAA;AAAA,EACF;AACF;AAGA,IAAM,UAAU,CACd,OACA,QACwB;AACxB,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,SAAO,MAAM;AACX,IAAC,IAAI,OAAkB;AAAA,MACrB,IAAI,YAAY,WAAW,EAAE,QAAQ,MAAM,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;","names":["fullConsent","minimalConsent","trigger"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger, Flow,
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -113,7 +113,15 @@ declare namespace step {
|
|
|
113
113
|
export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
interface UsercentricsContent {
|
|
117
|
+
event: string;
|
|
118
|
+
type: string;
|
|
119
|
+
action?: string;
|
|
120
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
121
|
+
[service: string]: unknown;
|
|
122
|
+
}
|
|
123
|
+
declare const createTrigger: Trigger.CreateFn<UsercentricsContent, void>;
|
|
124
|
+
/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */
|
|
125
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void | (() => void);
|
|
118
126
|
|
|
119
|
-
export { createMockElbFn, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped,
|
|
127
|
+
export { createMockElbFn, createTrigger, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, step, trigger };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger, Flow,
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Usercentrics consent event detail structure.
|
|
@@ -113,7 +113,15 @@ declare namespace step {
|
|
|
113
113
|
export { step_categoryMapOverride as categoryMapOverride, step_customEventName as customEventName, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
interface UsercentricsContent {
|
|
117
|
+
event: string;
|
|
118
|
+
type: string;
|
|
119
|
+
action?: string;
|
|
120
|
+
ucCategory?: Record<string, boolean | unknown>;
|
|
121
|
+
[service: string]: unknown;
|
|
122
|
+
}
|
|
123
|
+
declare const createTrigger: Trigger.CreateFn<UsercentricsContent, void>;
|
|
124
|
+
/** Dispatches ucEvent CustomEvent after source init (post-init trigger). */
|
|
125
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void | (() => void);
|
|
118
126
|
|
|
119
|
-
export { createMockElbFn, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped,
|
|
127
|
+
export { createMockElbFn, createTrigger, fullConsent$1 as fullConsent, fullConsentCustomMapped, fullConsentMapped, fullConsentUpperCase, implicitConsent, minimalConsent$1 as minimalConsent, minimalConsentMapped, nonConsentEvent, noopLogger, partialConsent, partialConsentMapped, serviceLevelConsent, serviceLevelMapped, step, trigger };
|
package/dist/examples/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var examples_exports = {};
|
|
22
22
|
__export(examples_exports, {
|
|
23
23
|
createMockElbFn: () => createMockElbFn,
|
|
24
|
+
createTrigger: () => createTrigger,
|
|
24
25
|
fullConsent: () => fullConsent,
|
|
25
26
|
fullConsentCustomMapped: () => fullConsentCustomMapped,
|
|
26
27
|
fullConsentMapped: () => fullConsentMapped,
|
|
@@ -34,8 +35,8 @@ __export(examples_exports, {
|
|
|
34
35
|
partialConsentMapped: () => partialConsentMapped,
|
|
35
36
|
serviceLevelConsent: () => serviceLevelConsent,
|
|
36
37
|
serviceLevelMapped: () => serviceLevelMapped,
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
step: () => step_exports,
|
|
39
|
+
trigger: () => trigger
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(examples_exports);
|
|
41
42
|
|
|
@@ -173,6 +174,7 @@ __export(step_exports, {
|
|
|
173
174
|
minimalConsent: () => minimalConsent2
|
|
174
175
|
});
|
|
175
176
|
var fullConsent2 = {
|
|
177
|
+
trigger: { type: "consent" },
|
|
176
178
|
in: {
|
|
177
179
|
event: "consent_status",
|
|
178
180
|
type: "explicit",
|
|
@@ -190,6 +192,7 @@ var fullConsent2 = {
|
|
|
190
192
|
}
|
|
191
193
|
};
|
|
192
194
|
var minimalConsent2 = {
|
|
195
|
+
trigger: { type: "consent" },
|
|
193
196
|
in: {
|
|
194
197
|
event: "consent_status",
|
|
195
198
|
type: "explicit",
|
|
@@ -208,6 +211,7 @@ var minimalConsent2 = {
|
|
|
208
211
|
};
|
|
209
212
|
var categoryMapOverride = {
|
|
210
213
|
description: "Custom categoryMap remaps essential to functional and functional to analytics",
|
|
214
|
+
trigger: { type: "consent" },
|
|
211
215
|
in: {
|
|
212
216
|
event: "consent_status",
|
|
213
217
|
type: "explicit",
|
|
@@ -228,6 +232,7 @@ var categoryMapOverride = {
|
|
|
228
232
|
};
|
|
229
233
|
var customEventName = {
|
|
230
234
|
description: "Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2",
|
|
235
|
+
trigger: { type: "consent", options: { eventName: "UC_SDK_EVENT" } },
|
|
231
236
|
in: {
|
|
232
237
|
event: "consent_status",
|
|
233
238
|
type: "explicit",
|
|
@@ -245,16 +250,38 @@ var customEventName = {
|
|
|
245
250
|
}
|
|
246
251
|
};
|
|
247
252
|
|
|
248
|
-
// src/examples/
|
|
249
|
-
var
|
|
253
|
+
// src/examples/trigger.ts
|
|
254
|
+
var import_collector = require("@walkeros/collector");
|
|
255
|
+
var createTrigger = async (config) => {
|
|
256
|
+
let flow;
|
|
257
|
+
const trigger2 = (type, opts) => async (content) => {
|
|
258
|
+
var _a;
|
|
259
|
+
if (!flow) {
|
|
260
|
+
const result = await (0, import_collector.startFlow)({ ...config, run: (_a = config.run) != null ? _a : true });
|
|
261
|
+
flow = { collector: result.collector, elb: result.elb };
|
|
262
|
+
}
|
|
263
|
+
const eventName = (opts == null ? void 0 : opts.eventName) || "ucEvent";
|
|
264
|
+
window.dispatchEvent(new CustomEvent(eventName, { detail: content }));
|
|
265
|
+
};
|
|
266
|
+
return {
|
|
267
|
+
get flow() {
|
|
268
|
+
return flow;
|
|
269
|
+
},
|
|
270
|
+
trigger: trigger2
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
var trigger = (input, env) => {
|
|
250
274
|
if (!input || typeof input !== "object") return;
|
|
251
275
|
return () => {
|
|
252
|
-
env.window.dispatchEvent(
|
|
276
|
+
env.window.dispatchEvent(
|
|
277
|
+
new CustomEvent("ucEvent", { detail: input })
|
|
278
|
+
);
|
|
253
279
|
};
|
|
254
280
|
};
|
|
255
281
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
282
|
0 && (module.exports = {
|
|
257
283
|
createMockElbFn,
|
|
284
|
+
createTrigger,
|
|
258
285
|
fullConsent,
|
|
259
286
|
fullConsentCustomMapped,
|
|
260
287
|
fullConsentMapped,
|
|
@@ -268,6 +295,6 @@ var setup = (input, env) => {
|
|
|
268
295
|
partialConsentMapped,
|
|
269
296
|
serviceLevelConsent,
|
|
270
297
|
serviceLevelMapped,
|
|
271
|
-
|
|
272
|
-
|
|
298
|
+
step,
|
|
299
|
+
trigger
|
|
273
300
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -138,6 +138,7 @@ __export(step_exports, {
|
|
|
138
138
|
minimalConsent: () => minimalConsent2
|
|
139
139
|
});
|
|
140
140
|
var fullConsent2 = {
|
|
141
|
+
trigger: { type: "consent" },
|
|
141
142
|
in: {
|
|
142
143
|
event: "consent_status",
|
|
143
144
|
type: "explicit",
|
|
@@ -155,6 +156,7 @@ var fullConsent2 = {
|
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
var minimalConsent2 = {
|
|
159
|
+
trigger: { type: "consent" },
|
|
158
160
|
in: {
|
|
159
161
|
event: "consent_status",
|
|
160
162
|
type: "explicit",
|
|
@@ -173,6 +175,7 @@ var minimalConsent2 = {
|
|
|
173
175
|
};
|
|
174
176
|
var categoryMapOverride = {
|
|
175
177
|
description: "Custom categoryMap remaps essential to functional and functional to analytics",
|
|
178
|
+
trigger: { type: "consent" },
|
|
176
179
|
in: {
|
|
177
180
|
event: "consent_status",
|
|
178
181
|
type: "explicit",
|
|
@@ -193,6 +196,7 @@ var categoryMapOverride = {
|
|
|
193
196
|
};
|
|
194
197
|
var customEventName = {
|
|
195
198
|
description: "Using UC_SDK_EVENT instead of ucEvent for Usercentrics SDK v2",
|
|
199
|
+
trigger: { type: "consent", options: { eventName: "UC_SDK_EVENT" } },
|
|
196
200
|
in: {
|
|
197
201
|
event: "consent_status",
|
|
198
202
|
type: "explicit",
|
|
@@ -210,15 +214,37 @@ var customEventName = {
|
|
|
210
214
|
}
|
|
211
215
|
};
|
|
212
216
|
|
|
213
|
-
// src/examples/
|
|
214
|
-
|
|
217
|
+
// src/examples/trigger.ts
|
|
218
|
+
import { startFlow } from "@walkeros/collector";
|
|
219
|
+
var createTrigger = async (config) => {
|
|
220
|
+
let flow;
|
|
221
|
+
const trigger2 = (type, opts) => async (content) => {
|
|
222
|
+
var _a;
|
|
223
|
+
if (!flow) {
|
|
224
|
+
const result = await startFlow({ ...config, run: (_a = config.run) != null ? _a : true });
|
|
225
|
+
flow = { collector: result.collector, elb: result.elb };
|
|
226
|
+
}
|
|
227
|
+
const eventName = (opts == null ? void 0 : opts.eventName) || "ucEvent";
|
|
228
|
+
window.dispatchEvent(new CustomEvent(eventName, { detail: content }));
|
|
229
|
+
};
|
|
230
|
+
return {
|
|
231
|
+
get flow() {
|
|
232
|
+
return flow;
|
|
233
|
+
},
|
|
234
|
+
trigger: trigger2
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
var trigger = (input, env) => {
|
|
215
238
|
if (!input || typeof input !== "object") return;
|
|
216
239
|
return () => {
|
|
217
|
-
env.window.dispatchEvent(
|
|
240
|
+
env.window.dispatchEvent(
|
|
241
|
+
new CustomEvent("ucEvent", { detail: input })
|
|
242
|
+
);
|
|
218
243
|
};
|
|
219
244
|
};
|
|
220
245
|
export {
|
|
221
246
|
createMockElbFn,
|
|
247
|
+
createTrigger,
|
|
222
248
|
fullConsent,
|
|
223
249
|
fullConsentCustomMapped,
|
|
224
250
|
fullConsentMapped,
|
|
@@ -232,6 +258,6 @@ export {
|
|
|
232
258
|
partialConsentMapped,
|
|
233
259
|
serviceLevelConsent,
|
|
234
260
|
serviceLevelMapped,
|
|
235
|
-
|
|
236
|
-
|
|
261
|
+
step_exports as step,
|
|
262
|
+
trigger
|
|
237
263
|
};
|