@walkeros/web-source-cmp-cookiepro 3.0.1 → 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 +6 -4
- package/dist/dev.d.ts +6 -4
- 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 +4 -3
- package/dist/examples/index.d.ts +4 -3
- package/dist/examples/index.js +32 -6
- package/dist/examples/index.mjs +29 -4
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- 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 +24 -7
- 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
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -139,13 +139,15 @@ declare namespace step {
|
|
|
139
139
|
export { step_categoryMapOverride as categoryMapOverride, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_sdkLoadedDetection as sdkLoadedDetection };
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
declare const createTrigger: Trigger.CreateFn<string, void>;
|
|
142
143
|
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
143
|
-
declare const
|
|
144
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
144
145
|
|
|
145
146
|
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
146
147
|
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
147
148
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
148
149
|
declare const index_createMockOneTrustAPI: typeof createMockOneTrustAPI;
|
|
150
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
149
151
|
declare const index_customCategoryConsent: typeof customCategoryConsent;
|
|
150
152
|
declare const index_emptyConsent: typeof emptyConsent;
|
|
151
153
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
@@ -155,10 +157,10 @@ declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
|
155
157
|
declare const index_noopLogger: typeof noopLogger;
|
|
156
158
|
declare const index_partialConsent: typeof partialConsent;
|
|
157
159
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
158
|
-
declare const index_setup: typeof setup;
|
|
159
160
|
declare const index_step: typeof step;
|
|
161
|
+
declare const index_trigger: typeof trigger;
|
|
160
162
|
declare namespace index {
|
|
161
|
-
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockElbFn as createMockElbFn, index_createMockOneTrustAPI as createMockOneTrustAPI, index_customCategoryConsent as customCategoryConsent, index_emptyConsent as emptyConsent, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped,
|
|
163
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockElbFn as createMockElbFn, index_createMockOneTrustAPI as createMockOneTrustAPI, index_createTrigger as createTrigger, index_customCategoryConsent as customCategoryConsent, index_emptyConsent as emptyConsent, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_step as step, index_trigger as trigger };
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
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
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -139,13 +139,15 @@ declare namespace step {
|
|
|
139
139
|
export { step_categoryMapOverride as categoryMapOverride, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_sdkLoadedDetection as sdkLoadedDetection };
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
declare const createTrigger: Trigger.CreateFn<string, void>;
|
|
142
143
|
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
143
|
-
declare const
|
|
144
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
144
145
|
|
|
145
146
|
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
146
147
|
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
147
148
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
148
149
|
declare const index_createMockOneTrustAPI: typeof createMockOneTrustAPI;
|
|
150
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
149
151
|
declare const index_customCategoryConsent: typeof customCategoryConsent;
|
|
150
152
|
declare const index_emptyConsent: typeof emptyConsent;
|
|
151
153
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
@@ -155,10 +157,10 @@ declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
|
155
157
|
declare const index_noopLogger: typeof noopLogger;
|
|
156
158
|
declare const index_partialConsent: typeof partialConsent;
|
|
157
159
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
158
|
-
declare const index_setup: typeof setup;
|
|
159
160
|
declare const index_step: typeof step;
|
|
161
|
+
declare const index_trigger: typeof trigger;
|
|
160
162
|
declare namespace index {
|
|
161
|
-
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockElbFn as createMockElbFn, index_createMockOneTrustAPI as createMockOneTrustAPI, index_customCategoryConsent as customCategoryConsent, index_emptyConsent as emptyConsent, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped,
|
|
163
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockElbFn as createMockElbFn, index_createMockOneTrustAPI as createMockOneTrustAPI, index_createTrigger as createTrigger, index_customCategoryConsent as customCategoryConsent, index_emptyConsent as emptyConsent, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, minimalConsent$1 as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_noopLogger as noopLogger, index_partialConsent as partialConsent, index_partialConsentMapped as partialConsentMapped, index_step as step, index_trigger as trigger };
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
export { index as examples };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";var t,e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};a(i,{examples:()=>s}),module.exports=(t=i,((t,a,i,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of r(a))o.call(t,l)||l===i||e(t,l,{get:()=>a[l],enumerable:!(s=n(a,l))||s.enumerable});return t})(e({},"__esModule",{value:!0}),t));var s={};a(s,{analyticsOnlyConsent:()=>p,analyticsOnlyMapped:()=>O,createMockElbFn:()=>M,createMockOneTrustAPI:()=>v,createTrigger:()=>h,customCategoryConsent:()=>y,emptyConsent:()=>g,fullConsent:()=>l,fullConsentMapped:()=>m,marketingOnlyConsent:()=>u,marketingOnlyMapped:()=>w,minimalConsent:()=>C,minimalConsentMapped:()=>f,noopLogger:()=>b,partialConsent:()=>c,partialConsentMapped:()=>d,step:()=>A,trigger:()=>B});var l=",C0001,C0002,C0003,C0004,C0005,",c=",C0001,C0003,",C=",C0001,",p=",C0001,C0002,",u=",C0001,C0004,",g="",y=",C0001,CUSTOM01,CUSTOM02,",m={functional:!0,analytics:!0,marketing:!0},d={functional:!0,analytics:!1,marketing:!1},f={functional:!0,analytics:!1,marketing:!1},O={functional:!0,analytics:!0,marketing:!1},w={functional:!0,analytics:!1,marketing:!0},k=()=>{},M=()=>()=>Promise.resolve({ok:!0}),b={error:k,warn:k,info:k,debug:k,throw:t=>{throw"string"==typeof t?new Error(t):t},json:k,scope:()=>b},v=(t=!1)=>({IsAlertBoxClosed:()=>t}),A={};a(A,{categoryMapOverride:()=>x,fullConsent:()=>T,minimalConsent:()=>j,sdkLoadedDetection:()=>I});var T={trigger:{type:"consent"},in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},j={trigger:{type:"consent"},in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},x={description:"Custom categoryMap remaps C0002 from analytics to statistics",trigger:{type:"consent"},in:",C0001,C0002,",mapping:{categoryMap:{C0002:"statistics"}},out:{functional:!0,statistics:!0,marketing:!1}},I={description:"Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true",trigger:{type:"consent"},in:",C0001,C0003,C0004,",out:{functional:!0,analytics:!1,marketing:!0}},P=require("@walkeros/collector"),h=async t=>{let e;return{get flow(){return e},trigger:()=>async n=>{var r;const o=window;if(o.OptanonActiveGroups=n,o.OneTrust={IsAlertBoxClosed:()=>!0},!e){const n=await(0,P.startFlow)({...t,run:null==(r=t.run)||r});e={collector:n.collector,elb:n.elb}}}}},B=(t,e)=>{const n=e.window;"string"==typeof t&&(n.OptanonActiveGroups=t,n.OneTrust={IsAlertBoxClosed:()=>!0})};//# 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/
|
|
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","/**\n * Example CookiePro OptanonActiveGroups strings.\n *\n * These represent real consent states from CookiePro/OneTrust CMP.\n * Format: comma-separated active category IDs with leading/trailing commas.\n * Only active groups are listed. Absence means denied.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent = ',C0001,C0002,C0003,C0004,C0005,';\n\n/**\n * Partial consent - necessary + functional only\n */\nexport const partialConsent = ',C0001,C0003,';\n\n/**\n * Minimal consent - only strictly necessary (always active)\n */\nexport const minimalConsent = ',C0001,';\n\n/**\n * Analytics only - necessary + performance\n */\nexport const analyticsOnlyConsent = ',C0001,C0002,';\n\n/**\n * Marketing only - necessary + targeting\n */\nexport const marketingOnlyConsent = ',C0001,C0004,';\n\n/**\n * Empty string - no consent yet or cleared\n */\nexport const emptyConsent = '';\n\n/**\n * Custom category IDs - some installations use custom IDs\n */\nexport const customCategoryConsent = ',C0001,CUSTOM01,CUSTOM02,';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing OptanonActiveGroups\n * and mapping through the default categoryMap.\n *\n * Default map:\n * - C0001 -> functional\n * - C0002 -> analytics\n * - C0003 -> functional\n * - C0004 -> marketing\n * - C0005 -> marketing\n *\n * All mapped walkerOS groups get explicit true/false values.\n * Active groups -> true, absent groups -> false.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent - necessary + functional mapped\n * C0001 -> functional (true), C0003 -> functional (true)\n * analytics and marketing absent -> false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent - only strictly necessary\n * C0001 -> functional (true)\n * analytics and marketing absent -> false\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only - necessary + performance\n * C0001 -> functional (true), C0002 -> analytics (true)\n * marketing absent -> false\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only - necessary + targeting\n * C0001 -> functional (true), C0004 -> marketing (true)\n * analytics absent -> false\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { OneTrustAPI } from '../types';\n\n/**\n * Example environment configurations for CookiePro 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\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\n});\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: ',C0001,C0002,C0003,C0004,C0005,',\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description: 'Custom categoryMap remaps C0002 from analytics to statistics',\n trigger: { type: 'consent' },\n in: ',C0001,C0002,',\n mapping: { categoryMap: { C0002: 'statistics' } },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const sdkLoadedDetection: Flow.StepExample = {\n description:\n 'Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true',\n trigger: { type: 'consent' },\n in: ',C0001,C0003,C0004,',\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nconst createTrigger: Trigger.CreateFn<string, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<string, void> = () => async (content: string) => {\n // Pre-init: set OneTrust globals (source reads these during init)\n const win = window as unknown as Record<string, unknown>;\n win.OptanonActiveGroups = content;\n win.OneTrust = { IsAlertBoxClosed: () => true };\n\n // Lazy startFlow — source checks globals immediately 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\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window as Window & Record<string, unknown>;\n if (typeof input !== 'string') return;\n win.OptanonActiveGroups = input;\n win.OneTrust = { IsAlertBoxClosed: () => true };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":"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","names":["fullConsent","minimalConsent","trigger"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=Object.defineProperty,n=(n,e)=>{for(var a in e)t(n,a,{get:e[a],enumerable:!0})},e={};n(e,{analyticsOnlyConsent:()=>i,analyticsOnlyMapped:()=>u,createMockElbFn:()=>d,createMockOneTrustAPI:()=>k,createTrigger:()=>b,customCategoryConsent:()=>c,emptyConsent:()=>l,fullConsent:()=>a,fullConsentMapped:()=>C,marketingOnlyConsent:()=>s,marketingOnlyMapped:()=>m,minimalConsent:()=>r,minimalConsentMapped:()=>g,noopLogger:()=>f,partialConsent:()=>o,partialConsentMapped:()=>p,step:()=>O,trigger:()=>x});var a=",C0001,C0002,C0003,C0004,C0005,",o=",C0001,C0003,",r=",C0001,",i=",C0001,C0002,",s=",C0001,C0004,",l="",c=",C0001,CUSTOM01,CUSTOM02,",C={functional:!0,analytics:!0,marketing:!0},p={functional:!0,analytics:!1,marketing:!1},g={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!0,marketing:!1},m={functional:!0,analytics:!1,marketing:!0},y=()=>{},d=()=>()=>Promise.resolve({ok:!0}),f={error:y,warn:y,info:y,debug:y,throw:t=>{throw"string"==typeof t?new Error(t):t},json:y,scope:()=>f},k=(t=!1)=>({IsAlertBoxClosed:()=>t}),O={};n(O,{categoryMapOverride:()=>v,fullConsent:()=>w,minimalConsent:()=>M,sdkLoadedDetection:()=>A});var w={trigger:{type:"consent"},in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},M={trigger:{type:"consent"},in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},v={description:"Custom categoryMap remaps C0002 from analytics to statistics",trigger:{type:"consent"},in:",C0001,C0002,",mapping:{categoryMap:{C0002:"statistics"}},out:{functional:!0,statistics:!0,marketing:!1}},A={description:"Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true",trigger:{type:"consent"},in:",C0001,C0003,C0004,",out:{functional:!0,analytics:!1,marketing:!0}};import{startFlow as T}from"@walkeros/collector";var b=async t=>{let n;return{get flow(){return n},trigger:()=>async e=>{var a;const o=window;if(o.OptanonActiveGroups=e,o.OneTrust={IsAlertBoxClosed:()=>!0},!n){const e=await T({...t,run:null==(a=t.run)||a});n={collector:e.collector,elb:e.elb}}}}},x=(t,n)=>{const e=n.window;"string"==typeof t&&(e.OptanonActiveGroups=t,e.OneTrust={IsAlertBoxClosed:()=>!0})};export{e 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/
|
|
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","/**\n * Example CookiePro OptanonActiveGroups strings.\n *\n * These represent real consent states from CookiePro/OneTrust CMP.\n * Format: comma-separated active category IDs with leading/trailing commas.\n * Only active groups are listed. Absence means denied.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent = ',C0001,C0002,C0003,C0004,C0005,';\n\n/**\n * Partial consent - necessary + functional only\n */\nexport const partialConsent = ',C0001,C0003,';\n\n/**\n * Minimal consent - only strictly necessary (always active)\n */\nexport const minimalConsent = ',C0001,';\n\n/**\n * Analytics only - necessary + performance\n */\nexport const analyticsOnlyConsent = ',C0001,C0002,';\n\n/**\n * Marketing only - necessary + targeting\n */\nexport const marketingOnlyConsent = ',C0001,C0004,';\n\n/**\n * Empty string - no consent yet or cleared\n */\nexport const emptyConsent = '';\n\n/**\n * Custom category IDs - some installations use custom IDs\n */\nexport const customCategoryConsent = ',C0001,CUSTOM01,CUSTOM02,';\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after parsing OptanonActiveGroups\n * and mapping through the default categoryMap.\n *\n * Default map:\n * - C0001 -> functional\n * - C0002 -> analytics\n * - C0003 -> functional\n * - C0004 -> marketing\n * - C0005 -> marketing\n *\n * All mapped walkerOS groups get explicit true/false values.\n * Active groups -> true, absent groups -> false.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent - necessary + functional mapped\n * C0001 -> functional (true), C0003 -> functional (true)\n * analytics and marketing absent -> false\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent - only strictly necessary\n * C0001 -> functional (true)\n * analytics and marketing absent -> false\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only - necessary + performance\n * C0001 -> functional (true), C0002 -> analytics (true)\n * marketing absent -> false\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only - necessary + targeting\n * C0001 -> functional (true), C0004 -> marketing (true)\n * analytics absent -> false\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { OneTrustAPI } from '../types';\n\n/**\n * Example environment configurations for CookiePro 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\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\n});\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: ',C0001,C0002,C0003,C0004,C0005,',\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const minimalConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description: 'Custom categoryMap remaps C0002 from analytics to statistics',\n trigger: { type: 'consent' },\n in: ',C0001,C0002,',\n mapping: { categoryMap: { C0002: 'statistics' } },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const sdkLoadedDetection: Flow.StepExample = {\n description:\n 'Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true',\n trigger: { type: 'consent' },\n in: ',C0001,C0003,C0004,',\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\nconst createTrigger: Trigger.CreateFn<string, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<string, void> = () => async (content: string) => {\n // Pre-init: set OneTrust globals (source reads these during init)\n const win = window as unknown as Record<string, unknown>;\n win.OptanonActiveGroups = content;\n win.OneTrust = { IsAlertBoxClosed: () => true };\n\n // Lazy startFlow — source checks globals immediately 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\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n const win = env.window as Window & Record<string, unknown>;\n if (typeof input !== 'string') return;\n win.OptanonActiveGroups = input;\n win.OneTrust = { IsAlertBoxClosed: () => true };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":"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","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
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -139,7 +139,8 @@ declare namespace step {
|
|
|
139
139
|
export { step_categoryMapOverride as categoryMapOverride, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_sdkLoadedDetection as sdkLoadedDetection };
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
declare const createTrigger: Trigger.CreateFn<string, void>;
|
|
142
143
|
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
143
|
-
declare const
|
|
144
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
144
145
|
|
|
145
|
-
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped,
|
|
146
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, createTrigger, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, 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
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -139,7 +139,8 @@ declare namespace step {
|
|
|
139
139
|
export { step_categoryMapOverride as categoryMapOverride, step_fullConsent as fullConsent, step_minimalConsent as minimalConsent, step_sdkLoadedDetection as sdkLoadedDetection };
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
declare const createTrigger: Trigger.CreateFn<string, void>;
|
|
142
143
|
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
143
|
-
declare const
|
|
144
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
144
145
|
|
|
145
|
-
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped,
|
|
146
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, createTrigger, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, step, trigger };
|
package/dist/examples/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(examples_exports, {
|
|
|
24
24
|
analyticsOnlyMapped: () => analyticsOnlyMapped,
|
|
25
25
|
createMockElbFn: () => createMockElbFn,
|
|
26
26
|
createMockOneTrustAPI: () => createMockOneTrustAPI,
|
|
27
|
+
createTrigger: () => createTrigger,
|
|
27
28
|
customCategoryConsent: () => customCategoryConsent,
|
|
28
29
|
emptyConsent: () => emptyConsent,
|
|
29
30
|
fullConsent: () => fullConsent,
|
|
@@ -35,8 +36,8 @@ __export(examples_exports, {
|
|
|
35
36
|
noopLogger: () => noopLogger,
|
|
36
37
|
partialConsent: () => partialConsent,
|
|
37
38
|
partialConsentMapped: () => partialConsentMapped,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
step: () => step_exports,
|
|
40
|
+
trigger: () => trigger
|
|
40
41
|
});
|
|
41
42
|
module.exports = __toCommonJS(examples_exports);
|
|
42
43
|
|
|
@@ -109,6 +110,7 @@ __export(step_exports, {
|
|
|
109
110
|
sdkLoadedDetection: () => sdkLoadedDetection
|
|
110
111
|
});
|
|
111
112
|
var fullConsent2 = {
|
|
113
|
+
trigger: { type: "consent" },
|
|
112
114
|
in: ",C0001,C0002,C0003,C0004,C0005,",
|
|
113
115
|
out: {
|
|
114
116
|
functional: true,
|
|
@@ -117,6 +119,7 @@ var fullConsent2 = {
|
|
|
117
119
|
}
|
|
118
120
|
};
|
|
119
121
|
var minimalConsent2 = {
|
|
122
|
+
trigger: { type: "consent" },
|
|
120
123
|
in: ",C0001,",
|
|
121
124
|
out: {
|
|
122
125
|
functional: true,
|
|
@@ -126,6 +129,7 @@ var minimalConsent2 = {
|
|
|
126
129
|
};
|
|
127
130
|
var categoryMapOverride = {
|
|
128
131
|
description: "Custom categoryMap remaps C0002 from analytics to statistics",
|
|
132
|
+
trigger: { type: "consent" },
|
|
129
133
|
in: ",C0001,C0002,",
|
|
130
134
|
mapping: { categoryMap: { C0002: "statistics" } },
|
|
131
135
|
out: {
|
|
@@ -136,6 +140,7 @@ var categoryMapOverride = {
|
|
|
136
140
|
};
|
|
137
141
|
var sdkLoadedDetection = {
|
|
138
142
|
description: "Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true",
|
|
143
|
+
trigger: { type: "consent" },
|
|
139
144
|
in: ",C0001,C0003,C0004,",
|
|
140
145
|
out: {
|
|
141
146
|
functional: true,
|
|
@@ -144,8 +149,28 @@ var sdkLoadedDetection = {
|
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
|
|
147
|
-
// src/examples/
|
|
148
|
-
var
|
|
152
|
+
// src/examples/trigger.ts
|
|
153
|
+
var import_collector = require("@walkeros/collector");
|
|
154
|
+
var createTrigger = async (config) => {
|
|
155
|
+
let flow;
|
|
156
|
+
const trigger2 = () => async (content) => {
|
|
157
|
+
var _a;
|
|
158
|
+
const win = window;
|
|
159
|
+
win.OptanonActiveGroups = content;
|
|
160
|
+
win.OneTrust = { IsAlertBoxClosed: () => true };
|
|
161
|
+
if (!flow) {
|
|
162
|
+
const result = await (0, import_collector.startFlow)({ ...config, run: (_a = config.run) != null ? _a : true });
|
|
163
|
+
flow = { collector: result.collector, elb: result.elb };
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
get flow() {
|
|
168
|
+
return flow;
|
|
169
|
+
},
|
|
170
|
+
trigger: trigger2
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
var trigger = (input, env) => {
|
|
149
174
|
const win = env.window;
|
|
150
175
|
if (typeof input !== "string") return;
|
|
151
176
|
win.OptanonActiveGroups = input;
|
|
@@ -157,6 +182,7 @@ var setup = (input, env) => {
|
|
|
157
182
|
analyticsOnlyMapped,
|
|
158
183
|
createMockElbFn,
|
|
159
184
|
createMockOneTrustAPI,
|
|
185
|
+
createTrigger,
|
|
160
186
|
customCategoryConsent,
|
|
161
187
|
emptyConsent,
|
|
162
188
|
fullConsent,
|
|
@@ -168,6 +194,6 @@ var setup = (input, env) => {
|
|
|
168
194
|
noopLogger,
|
|
169
195
|
partialConsent,
|
|
170
196
|
partialConsentMapped,
|
|
171
|
-
|
|
172
|
-
|
|
197
|
+
step,
|
|
198
|
+
trigger
|
|
173
199
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -73,6 +73,7 @@ __export(step_exports, {
|
|
|
73
73
|
sdkLoadedDetection: () => sdkLoadedDetection
|
|
74
74
|
});
|
|
75
75
|
var fullConsent2 = {
|
|
76
|
+
trigger: { type: "consent" },
|
|
76
77
|
in: ",C0001,C0002,C0003,C0004,C0005,",
|
|
77
78
|
out: {
|
|
78
79
|
functional: true,
|
|
@@ -81,6 +82,7 @@ var fullConsent2 = {
|
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
84
|
var minimalConsent2 = {
|
|
85
|
+
trigger: { type: "consent" },
|
|
84
86
|
in: ",C0001,",
|
|
85
87
|
out: {
|
|
86
88
|
functional: true,
|
|
@@ -90,6 +92,7 @@ var minimalConsent2 = {
|
|
|
90
92
|
};
|
|
91
93
|
var categoryMapOverride = {
|
|
92
94
|
description: "Custom categoryMap remaps C0002 from analytics to statistics",
|
|
95
|
+
trigger: { type: "consent" },
|
|
93
96
|
in: ",C0001,C0002,",
|
|
94
97
|
mapping: { categoryMap: { C0002: "statistics" } },
|
|
95
98
|
out: {
|
|
@@ -100,6 +103,7 @@ var categoryMapOverride = {
|
|
|
100
103
|
};
|
|
101
104
|
var sdkLoadedDetection = {
|
|
102
105
|
description: "Immediate detection when OneTrust SDK is already loaded with IsAlertBoxClosed() = true",
|
|
106
|
+
trigger: { type: "consent" },
|
|
103
107
|
in: ",C0001,C0003,C0004,",
|
|
104
108
|
out: {
|
|
105
109
|
functional: true,
|
|
@@ -108,8 +112,28 @@ var sdkLoadedDetection = {
|
|
|
108
112
|
}
|
|
109
113
|
};
|
|
110
114
|
|
|
111
|
-
// src/examples/
|
|
112
|
-
|
|
115
|
+
// src/examples/trigger.ts
|
|
116
|
+
import { startFlow } from "@walkeros/collector";
|
|
117
|
+
var createTrigger = async (config) => {
|
|
118
|
+
let flow;
|
|
119
|
+
const trigger2 = () => async (content) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const win = window;
|
|
122
|
+
win.OptanonActiveGroups = content;
|
|
123
|
+
win.OneTrust = { IsAlertBoxClosed: () => true };
|
|
124
|
+
if (!flow) {
|
|
125
|
+
const result = await startFlow({ ...config, run: (_a = config.run) != null ? _a : true });
|
|
126
|
+
flow = { collector: result.collector, elb: result.elb };
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
get flow() {
|
|
131
|
+
return flow;
|
|
132
|
+
},
|
|
133
|
+
trigger: trigger2
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
var trigger = (input, env) => {
|
|
113
137
|
const win = env.window;
|
|
114
138
|
if (typeof input !== "string") return;
|
|
115
139
|
win.OptanonActiveGroups = input;
|
|
@@ -120,6 +144,7 @@ export {
|
|
|
120
144
|
analyticsOnlyMapped,
|
|
121
145
|
createMockElbFn,
|
|
122
146
|
createMockOneTrustAPI,
|
|
147
|
+
createTrigger,
|
|
123
148
|
customCategoryConsent,
|
|
124
149
|
emptyConsent,
|
|
125
150
|
fullConsent,
|
|
@@ -131,6 +156,6 @@ export {
|
|
|
131
156
|
noopLogger,
|
|
132
157
|
partialConsent,
|
|
133
158
|
partialConsentMapped,
|
|
134
|
-
|
|
135
|
-
|
|
159
|
+
step_exports as step,
|
|
160
|
+
trigger
|
|
136
161
|
};
|