@walkeros/web-source-cmp-cookiepro 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +18 -6
- package/dist/dev.d.ts +18 -6
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +16 -4
- package/dist/examples/index.d.ts +16 -4
- package/dist/examples/index.js +39 -2
- package/dist/examples/index.mjs +42 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +94 -0
- package/package.json +5 -4
package/dist/dev.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -10,7 +10,7 @@ import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
|
10
10
|
/**
|
|
11
11
|
* Full consent - user accepted all categories
|
|
12
12
|
*/
|
|
13
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
13
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
14
14
|
/**
|
|
15
15
|
* Partial consent - necessary + functional only
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
18
18
|
/**
|
|
19
19
|
* Minimal consent - only strictly necessary (always active)
|
|
20
20
|
*/
|
|
21
|
-
declare const minimalConsent = ",C0001,";
|
|
21
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
22
22
|
/**
|
|
23
23
|
* Analytics only - necessary + performance
|
|
24
24
|
*/
|
|
@@ -126,23 +126,35 @@ declare const noopLogger: Logger.Instance;
|
|
|
126
126
|
*/
|
|
127
127
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
128
128
|
|
|
129
|
+
declare const fullConsent: Flow.StepExample;
|
|
130
|
+
declare const minimalConsent: Flow.StepExample;
|
|
131
|
+
|
|
132
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
133
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
134
|
+
declare namespace step {
|
|
135
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
139
|
+
declare const setup: Source.SetupFn;
|
|
140
|
+
|
|
129
141
|
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
130
142
|
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
131
143
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
132
144
|
declare const index_createMockOneTrustAPI: typeof createMockOneTrustAPI;
|
|
133
145
|
declare const index_customCategoryConsent: typeof customCategoryConsent;
|
|
134
146
|
declare const index_emptyConsent: typeof emptyConsent;
|
|
135
|
-
declare const index_fullConsent: typeof fullConsent;
|
|
136
147
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
137
148
|
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
138
149
|
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
139
|
-
declare const index_minimalConsent: typeof minimalConsent;
|
|
140
150
|
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
141
151
|
declare const index_noopLogger: typeof noopLogger;
|
|
142
152
|
declare const index_partialConsent: typeof partialConsent;
|
|
143
153
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
154
|
+
declare const index_setup: typeof setup;
|
|
155
|
+
declare const index_step: typeof step;
|
|
144
156
|
declare namespace index {
|
|
145
|
-
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,
|
|
157
|
+
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, index_setup as setup, index_step as step };
|
|
146
158
|
}
|
|
147
159
|
|
|
148
160
|
export { index as examples };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -10,7 +10,7 @@ import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
|
10
10
|
/**
|
|
11
11
|
* Full consent - user accepted all categories
|
|
12
12
|
*/
|
|
13
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
13
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
14
14
|
/**
|
|
15
15
|
* Partial consent - necessary + functional only
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
18
18
|
/**
|
|
19
19
|
* Minimal consent - only strictly necessary (always active)
|
|
20
20
|
*/
|
|
21
|
-
declare const minimalConsent = ",C0001,";
|
|
21
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
22
22
|
/**
|
|
23
23
|
* Analytics only - necessary + performance
|
|
24
24
|
*/
|
|
@@ -126,23 +126,35 @@ declare const noopLogger: Logger.Instance;
|
|
|
126
126
|
*/
|
|
127
127
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
128
128
|
|
|
129
|
+
declare const fullConsent: Flow.StepExample;
|
|
130
|
+
declare const minimalConsent: Flow.StepExample;
|
|
131
|
+
|
|
132
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
133
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
134
|
+
declare namespace step {
|
|
135
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
139
|
+
declare const setup: Source.SetupFn;
|
|
140
|
+
|
|
129
141
|
declare const index_analyticsOnlyConsent: typeof analyticsOnlyConsent;
|
|
130
142
|
declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
131
143
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
132
144
|
declare const index_createMockOneTrustAPI: typeof createMockOneTrustAPI;
|
|
133
145
|
declare const index_customCategoryConsent: typeof customCategoryConsent;
|
|
134
146
|
declare const index_emptyConsent: typeof emptyConsent;
|
|
135
|
-
declare const index_fullConsent: typeof fullConsent;
|
|
136
147
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
137
148
|
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
138
149
|
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
139
|
-
declare const index_minimalConsent: typeof minimalConsent;
|
|
140
150
|
declare const index_minimalConsentMapped: typeof minimalConsentMapped;
|
|
141
151
|
declare const index_noopLogger: typeof noopLogger;
|
|
142
152
|
declare const index_partialConsent: typeof partialConsent;
|
|
143
153
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
154
|
+
declare const index_setup: typeof setup;
|
|
155
|
+
declare const index_step: typeof step;
|
|
144
156
|
declare namespace index {
|
|
145
|
-
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,
|
|
157
|
+
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, index_setup as setup, index_step as step };
|
|
146
158
|
}
|
|
147
159
|
|
|
148
160
|
export { index as examples };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,n=Object.defineProperty,t=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";var e,n=Object.defineProperty,t=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,r=(e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})},i={};r(i,{examples:()=>l}),module.exports=(e=i,((e,r,i,l)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of o(r))a.call(e,s)||s===i||n(e,s,{get:()=>r[s],enumerable:!(l=t(r,s))||l.enumerable});return e})(n({},"__esModule",{value:!0}),e));var l={};r(l,{analyticsOnlyConsent:()=>p,analyticsOnlyMapped:()=>d,createMockElbFn:()=>M,createMockOneTrustAPI:()=>v,customCategoryConsent:()=>y,emptyConsent:()=>m,fullConsent:()=>s,fullConsentMapped:()=>f,marketingOnlyConsent:()=>u,marketingOnlyMapped:()=>k,minimalConsent:()=>c,minimalConsentMapped:()=>O,noopLogger:()=>w,partialConsent:()=>C,partialConsentMapped:()=>g,setup:()=>A,step:()=>j});var s=",C0001,C0002,C0003,C0004,C0005,",C=",C0001,C0003,",c=",C0001,",p=",C0001,C0002,",u=",C0001,C0004,",m="",y=",C0001,CUSTOM01,CUSTOM02,",f={functional:!0,analytics:!0,marketing:!0},g={functional:!0,analytics:!1,marketing:!1},O={functional:!0,analytics:!1,marketing:!1},d={functional:!0,analytics:!0,marketing:!1},k={functional:!0,analytics:!1,marketing:!0},b=()=>{},M=()=>()=>Promise.resolve({ok:!0}),w={error:b,warn:b,info:b,debug:b,throw:e=>{throw"string"==typeof e?new Error(e):e},json:b,scope:()=>w},v=(e=!1)=>({IsAlertBoxClosed:()=>e}),j={};r(j,{fullConsent:()=>P,minimalConsent:()=>x});var P={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},x={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},A=(e,n)=>{const t=n.window;"string"==typeof e&&(t.OptanonActiveGroups=e,t.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"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","export * from './inputs';\nexport * from './outputs';\nexport * from './env';\n","/**\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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\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;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC/DA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;AAKO,IAAM,wBAAwB,CACnC,mBAAmB,WACF;AAAA,EACjB,kBAAkB,MAAM;AAC1B;","names":[]}
|
|
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","/**\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 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 in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\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"],"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,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX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+1 @@
|
|
|
1
|
-
var n=Object.defineProperty,
|
|
1
|
+
var n=Object.defineProperty,t=(t,e)=>{for(var a in e)n(t,a,{get:e[a],enumerable:!0})},e={};t(e,{analyticsOnlyConsent:()=>r,analyticsOnlyMapped:()=>u,createMockElbFn:()=>f,createMockOneTrustAPI:()=>d,customCategoryConsent:()=>C,emptyConsent:()=>l,fullConsent:()=>a,fullConsentMapped:()=>c,marketingOnlyConsent:()=>s,marketingOnlyMapped:()=>y,minimalConsent:()=>i,minimalConsentMapped:()=>m,noopLogger:()=>k,partialConsent:()=>o,partialConsentMapped:()=>p,setup:()=>w,step:()=>O});var a=",C0001,C0002,C0003,C0004,C0005,",o=",C0001,C0003,",i=",C0001,",r=",C0001,C0002,",s=",C0001,C0004,",l="",C=",C0001,CUSTOM01,CUSTOM02,",c={functional:!0,analytics:!0,marketing:!0},p={functional:!0,analytics:!1,marketing:!1},m={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!0,marketing:!1},y={functional:!0,analytics:!1,marketing:!0},g=()=>{},f=()=>()=>Promise.resolve({ok:!0}),k={error:g,warn:g,info:g,debug:g,throw:n=>{throw"string"==typeof n?new Error(n):n},json:g,scope:()=>k},d=(n=!1)=>({IsAlertBoxClosed:()=>n}),O={};t(O,{fullConsent:()=>M,minimalConsent:()=>v});var M={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},v={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},w=(n,t)=>{const e=t.window;"string"==typeof n&&(e.OptanonActiveGroups=n,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"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\n});\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC/DA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;AAKO,IAAM,wBAAwB,CACnC,mBAAmB,WACF;AAAA,EACjB,kBAAkB,MAAM;AAC1B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["export * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { setup } from './setup';\n","/**\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 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 in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\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"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC/DA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,MAAM;AAAA,EACN,OAAO,MAAM;AACf;AAKO,IAAM,wBAAwB,CACnC,mBAAmB,WACF;AAAA,EACjB,kBAAkB,MAAM;AAC1B;;;AC1CA;AAAA;AAAA,qBAAAA;AAAA,EAAA,sBAAAC;AAAA;AAEO,IAAMD,eAAgC;AAAA,EAC3C,IAAI;AAAA,EACJ,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AAEO,IAAMC,kBAAmC;AAAA,EAC9C,IAAI;AAAA,EACJ,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;;;ACfO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,QAAM,MAAM,IAAI;AAChB,MAAI,OAAO,UAAU,SAAU;AAC/B,MAAI,sBAAsB;AAC1B,MAAI,WAAW,EAAE,kBAAkB,MAAM,KAAK;AAChD;","names":["fullConsent","minimalConsent"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -10,7 +10,7 @@ import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
|
10
10
|
/**
|
|
11
11
|
* Full consent - user accepted all categories
|
|
12
12
|
*/
|
|
13
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
13
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
14
14
|
/**
|
|
15
15
|
* Partial consent - necessary + functional only
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
18
18
|
/**
|
|
19
19
|
* Minimal consent - only strictly necessary (always active)
|
|
20
20
|
*/
|
|
21
|
-
declare const minimalConsent = ",C0001,";
|
|
21
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
22
22
|
/**
|
|
23
23
|
* Analytics only - necessary + performance
|
|
24
24
|
*/
|
|
@@ -126,4 +126,16 @@ declare const noopLogger: Logger.Instance;
|
|
|
126
126
|
*/
|
|
127
127
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
declare const fullConsent: Flow.StepExample;
|
|
130
|
+
declare const minimalConsent: Flow.StepExample;
|
|
131
|
+
|
|
132
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
133
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
134
|
+
declare namespace step {
|
|
135
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
139
|
+
declare const setup: Source.SetupFn;
|
|
140
|
+
|
|
141
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, setup, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Logger, Flow, Source } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Example CookiePro OptanonActiveGroups strings.
|
|
@@ -10,7 +10,7 @@ import { WalkerOS, Elb, Logger } from '@walkeros/core';
|
|
|
10
10
|
/**
|
|
11
11
|
* Full consent - user accepted all categories
|
|
12
12
|
*/
|
|
13
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
13
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
14
14
|
/**
|
|
15
15
|
* Partial consent - necessary + functional only
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
18
18
|
/**
|
|
19
19
|
* Minimal consent - only strictly necessary (always active)
|
|
20
20
|
*/
|
|
21
|
-
declare const minimalConsent = ",C0001,";
|
|
21
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
22
22
|
/**
|
|
23
23
|
* Analytics only - necessary + performance
|
|
24
24
|
*/
|
|
@@ -126,4 +126,16 @@ declare const noopLogger: Logger.Instance;
|
|
|
126
126
|
*/
|
|
127
127
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
declare const fullConsent: Flow.StepExample;
|
|
130
|
+
declare const minimalConsent: Flow.StepExample;
|
|
131
|
+
|
|
132
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
133
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
134
|
+
declare namespace step {
|
|
135
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
139
|
+
declare const setup: Source.SetupFn;
|
|
140
|
+
|
|
141
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, setup, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -34,7 +34,9 @@ __export(examples_exports, {
|
|
|
34
34
|
minimalConsentMapped: () => minimalConsentMapped,
|
|
35
35
|
noopLogger: () => noopLogger,
|
|
36
36
|
partialConsent: () => partialConsent,
|
|
37
|
-
partialConsentMapped: () => partialConsentMapped
|
|
37
|
+
partialConsentMapped: () => partialConsentMapped,
|
|
38
|
+
setup: () => setup,
|
|
39
|
+
step: () => step_exports
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(examples_exports);
|
|
40
42
|
|
|
@@ -85,16 +87,49 @@ var createMockElbFn = () => {
|
|
|
85
87
|
};
|
|
86
88
|
var noopLogger = {
|
|
87
89
|
error: noop,
|
|
90
|
+
warn: noop,
|
|
88
91
|
info: noop,
|
|
89
92
|
debug: noop,
|
|
90
93
|
throw: (message) => {
|
|
91
94
|
throw typeof message === "string" ? new Error(message) : message;
|
|
92
95
|
},
|
|
96
|
+
json: noop,
|
|
93
97
|
scope: () => noopLogger
|
|
94
98
|
};
|
|
95
99
|
var createMockOneTrustAPI = (isAlertBoxClosed = false) => ({
|
|
96
100
|
IsAlertBoxClosed: () => isAlertBoxClosed
|
|
97
101
|
});
|
|
102
|
+
|
|
103
|
+
// src/examples/step.ts
|
|
104
|
+
var step_exports = {};
|
|
105
|
+
__export(step_exports, {
|
|
106
|
+
fullConsent: () => fullConsent2,
|
|
107
|
+
minimalConsent: () => minimalConsent2
|
|
108
|
+
});
|
|
109
|
+
var fullConsent2 = {
|
|
110
|
+
in: ",C0001,C0002,C0003,C0004,C0005,",
|
|
111
|
+
out: {
|
|
112
|
+
functional: true,
|
|
113
|
+
analytics: true,
|
|
114
|
+
marketing: true
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var minimalConsent2 = {
|
|
118
|
+
in: ",C0001,",
|
|
119
|
+
out: {
|
|
120
|
+
functional: true,
|
|
121
|
+
analytics: false,
|
|
122
|
+
marketing: false
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/examples/setup.ts
|
|
127
|
+
var setup = (input, env) => {
|
|
128
|
+
const win = env.window;
|
|
129
|
+
if (typeof input !== "string") return;
|
|
130
|
+
win.OptanonActiveGroups = input;
|
|
131
|
+
win.OneTrust = { IsAlertBoxClosed: () => true };
|
|
132
|
+
};
|
|
98
133
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
134
|
0 && (module.exports = {
|
|
100
135
|
analyticsOnlyConsent,
|
|
@@ -111,5 +146,7 @@ var createMockOneTrustAPI = (isAlertBoxClosed = false) => ({
|
|
|
111
146
|
minimalConsentMapped,
|
|
112
147
|
noopLogger,
|
|
113
148
|
partialConsent,
|
|
114
|
-
partialConsentMapped
|
|
149
|
+
partialConsentMapped,
|
|
150
|
+
setup,
|
|
151
|
+
step
|
|
115
152
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/examples/inputs.ts
|
|
2
8
|
var fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
3
9
|
var partialConsent = ",C0001,C0003,";
|
|
@@ -45,16 +51,49 @@ var createMockElbFn = () => {
|
|
|
45
51
|
};
|
|
46
52
|
var noopLogger = {
|
|
47
53
|
error: noop,
|
|
54
|
+
warn: noop,
|
|
48
55
|
info: noop,
|
|
49
56
|
debug: noop,
|
|
50
57
|
throw: (message) => {
|
|
51
58
|
throw typeof message === "string" ? new Error(message) : message;
|
|
52
59
|
},
|
|
60
|
+
json: noop,
|
|
53
61
|
scope: () => noopLogger
|
|
54
62
|
};
|
|
55
63
|
var createMockOneTrustAPI = (isAlertBoxClosed = false) => ({
|
|
56
64
|
IsAlertBoxClosed: () => isAlertBoxClosed
|
|
57
65
|
});
|
|
66
|
+
|
|
67
|
+
// src/examples/step.ts
|
|
68
|
+
var step_exports = {};
|
|
69
|
+
__export(step_exports, {
|
|
70
|
+
fullConsent: () => fullConsent2,
|
|
71
|
+
minimalConsent: () => minimalConsent2
|
|
72
|
+
});
|
|
73
|
+
var fullConsent2 = {
|
|
74
|
+
in: ",C0001,C0002,C0003,C0004,C0005,",
|
|
75
|
+
out: {
|
|
76
|
+
functional: true,
|
|
77
|
+
analytics: true,
|
|
78
|
+
marketing: true
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var minimalConsent2 = {
|
|
82
|
+
in: ",C0001,",
|
|
83
|
+
out: {
|
|
84
|
+
functional: true,
|
|
85
|
+
analytics: false,
|
|
86
|
+
marketing: false
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// src/examples/setup.ts
|
|
91
|
+
var setup = (input, env) => {
|
|
92
|
+
const win = env.window;
|
|
93
|
+
if (typeof input !== "string") return;
|
|
94
|
+
win.OptanonActiveGroups = input;
|
|
95
|
+
win.OneTrust = { IsAlertBoxClosed: () => true };
|
|
96
|
+
};
|
|
58
97
|
export {
|
|
59
98
|
analyticsOnlyConsent,
|
|
60
99
|
analyticsOnlyMapped,
|
|
@@ -70,5 +109,7 @@ export {
|
|
|
70
109
|
minimalConsentMapped,
|
|
71
110
|
noopLogger,
|
|
72
111
|
partialConsent,
|
|
73
|
-
partialConsentMapped
|
|
112
|
+
partialConsentMapped,
|
|
113
|
+
setup,
|
|
114
|
+
step_exports as step
|
|
74
115
|
};
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var SourceCookiePro=(()=>{var
|
|
1
|
+
"use strict";var SourceCookiePro=(()=>{var n=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})},a={};r(a,{DEFAULT_CATEGORY_MAP:()=>j,SourceCookiePro:()=>l,analyticsOnlyConsent:()=>u,analyticsOnlyMapped:()=>O,createMockElbFn:()=>k,createMockOneTrustAPI:()=>w,customCategoryConsent:()=>g,default:()=>x,emptyConsent:()=>C,fullConsent:()=>i,fullConsentMapped:()=>y,marketingOnlyConsent:()=>p,marketingOnlyMapped:()=>m,minimalConsent:()=>c,minimalConsentMapped:()=>f,noopLogger:()=>b,partialConsent:()=>s,partialConsentMapped:()=>d,setup:()=>P,sourceCookiePro:()=>E,step:()=>M});var l={},i=",C0001,C0002,C0003,C0004,C0005,",s=",C0001,C0003,",c=",C0001,",u=",C0001,C0002,",p=",C0001,C0004,",C="",g=",C0001,CUSTOM01,CUSTOM02,",y={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},m={functional:!0,analytics:!1,marketing:!0},v=()=>{},k=()=>()=>Promise.resolve({ok:!0}),b={error:v,warn:v,info:v,debug:v,throw:n=>{throw"string"==typeof n?new Error(n):n},json:v,scope:()=>b},w=(n=!1)=>({IsAlertBoxClosed:()=>n}),M={};r(M,{fullConsent:()=>h,minimalConsent:()=>A});var T,h={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},A={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},P=(n,e)=>{const t=e.window;"string"==typeof n&&(t.OptanonActiveGroups=n,t.OneTrust={IsAlertBoxClosed:()=>!0})},j={C0001:"functional",C0002:"analytics",C0003:"functional",C0004:"marketing",C0005:"marketing"},E=async n=>{var e,t,o,r,a,l,i,s;const{config:c,env:u}=n,{elb:p}=u,C=null!=(e=u.window)?e:void 0!==globalThis.window?globalThis.window:void 0,g={...j,...null!=(o=null==(t=null==c?void 0:c.settings)?void 0:t.categoryMap)?o:{}},y={};Object.entries(g).forEach(([n,e])=>{y[n.toLowerCase()]=e});const d={categoryMap:g,explicitOnly:null==(a=null==(r=null==c?void 0:c.settings)?void 0:r.explicitOnly)||a,globalName:null!=(i=null==(l=null==c?void 0:c.settings)?void 0:l.globalName)?i:"OneTrust"},f={settings:d};let O,m,v=!1;if(C){const n=null!=(s=d.globalName)?s:"OneTrust",e=new Set(Object.values(y)),t=n=>{const t={};return e.forEach(n=>{t[n]=!1}),n.split(",").filter(n=>n.length>0).forEach(n=>{const e=y[n.toLowerCase()];e&&(t[e]=!0)}),t},o=()=>{const e=C.OptanonActiveGroups;if(null==e)return;if(d.explicitOnly){const e=C[n];if((null==e?void 0:e.IsAlertBoxClosed)&&!e.IsAlertBoxClosed())return}const o=t(e);Object.keys(o).length>0&&p("walker consent",o)},r=C[n];r&&void 0!==C.OptanonActiveGroups&&o(),r||(m=C.OptanonWrapper,v=!0,C.OptanonWrapper=()=>{m&&m(),o(),C.OptanonWrapper=m,v=!1}),O=()=>{o()},C.addEventListener("OneTrustGroupsUpdated",O)}return{type:"cookiepro",config:f,push:p,destroy:async n=>{C&&O&&C.removeEventListener("OneTrustGroupsUpdated",O),C&&v&&(C.OptanonWrapper=m)}}},x=E;return T=a,((r,a,l,i)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of t(a))o.call(r,s)||s===l||n(r,s,{get:()=>a[s],enumerable:!(i=e(a,s))||i.enumerable});return r})(n({},"__esModule",{value:!0}),T)})();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Source, Elb, WalkerOS, Logger } from '@walkeros/core';
|
|
1
|
+
import { Source, Elb, WalkerOS, Logger, Flow } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* OneTrust global API interface.
|
|
@@ -117,7 +117,7 @@ declare namespace index {
|
|
|
117
117
|
/**
|
|
118
118
|
* Full consent - user accepted all categories
|
|
119
119
|
*/
|
|
120
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
120
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
121
121
|
/**
|
|
122
122
|
* Partial consent - necessary + functional only
|
|
123
123
|
*/
|
|
@@ -125,7 +125,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
125
125
|
/**
|
|
126
126
|
* Minimal consent - only strictly necessary (always active)
|
|
127
127
|
*/
|
|
128
|
-
declare const minimalConsent = ",C0001,";
|
|
128
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
129
129
|
/**
|
|
130
130
|
* Analytics only - necessary + performance
|
|
131
131
|
*/
|
|
@@ -201,6 +201,18 @@ declare const noopLogger: Logger.Instance;
|
|
|
201
201
|
*/
|
|
202
202
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
203
203
|
|
|
204
|
+
declare const fullConsent: Flow.StepExample;
|
|
205
|
+
declare const minimalConsent: Flow.StepExample;
|
|
206
|
+
|
|
207
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
208
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
209
|
+
declare namespace step {
|
|
210
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
214
|
+
declare const setup: Source.SetupFn;
|
|
215
|
+
|
|
204
216
|
/**
|
|
205
217
|
* Default category mapping from CookiePro/OneTrust to walkerOS consent groups.
|
|
206
218
|
*
|
|
@@ -248,4 +260,4 @@ declare const DEFAULT_CATEGORY_MAP: Record<string, string>;
|
|
|
248
260
|
*/
|
|
249
261
|
declare const sourceCookiePro: Source.Init<Types>;
|
|
250
262
|
|
|
251
|
-
export { DEFAULT_CATEGORY_MAP, index as SourceCookiePro, analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, sourceCookiePro as default, emptyConsent, fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, sourceCookiePro };
|
|
263
|
+
export { DEFAULT_CATEGORY_MAP, index as SourceCookiePro, analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, sourceCookiePro as default, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, setup, sourceCookiePro, step };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Source, Elb, WalkerOS, Logger } from '@walkeros/core';
|
|
1
|
+
import { Source, Elb, WalkerOS, Logger, Flow } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* OneTrust global API interface.
|
|
@@ -117,7 +117,7 @@ declare namespace index {
|
|
|
117
117
|
/**
|
|
118
118
|
* Full consent - user accepted all categories
|
|
119
119
|
*/
|
|
120
|
-
declare const fullConsent = ",C0001,C0002,C0003,C0004,C0005,";
|
|
120
|
+
declare const fullConsent$1 = ",C0001,C0002,C0003,C0004,C0005,";
|
|
121
121
|
/**
|
|
122
122
|
* Partial consent - necessary + functional only
|
|
123
123
|
*/
|
|
@@ -125,7 +125,7 @@ declare const partialConsent = ",C0001,C0003,";
|
|
|
125
125
|
/**
|
|
126
126
|
* Minimal consent - only strictly necessary (always active)
|
|
127
127
|
*/
|
|
128
|
-
declare const minimalConsent = ",C0001,";
|
|
128
|
+
declare const minimalConsent$1 = ",C0001,";
|
|
129
129
|
/**
|
|
130
130
|
* Analytics only - necessary + performance
|
|
131
131
|
*/
|
|
@@ -201,6 +201,18 @@ declare const noopLogger: Logger.Instance;
|
|
|
201
201
|
*/
|
|
202
202
|
declare const createMockOneTrustAPI: (isAlertBoxClosed?: boolean) => OneTrustAPI;
|
|
203
203
|
|
|
204
|
+
declare const fullConsent: Flow.StepExample;
|
|
205
|
+
declare const minimalConsent: Flow.StepExample;
|
|
206
|
+
|
|
207
|
+
declare const step_fullConsent: typeof fullConsent;
|
|
208
|
+
declare const step_minimalConsent: typeof minimalConsent;
|
|
209
|
+
declare namespace step {
|
|
210
|
+
export { step_fullConsent as fullConsent, step_minimalConsent as minimalConsent };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Sets OptanonActiveGroups and OneTrust globals before source init. */
|
|
214
|
+
declare const setup: Source.SetupFn;
|
|
215
|
+
|
|
204
216
|
/**
|
|
205
217
|
* Default category mapping from CookiePro/OneTrust to walkerOS consent groups.
|
|
206
218
|
*
|
|
@@ -248,4 +260,4 @@ declare const DEFAULT_CATEGORY_MAP: Record<string, string>;
|
|
|
248
260
|
*/
|
|
249
261
|
declare const sourceCookiePro: Source.Init<Types>;
|
|
250
262
|
|
|
251
|
-
export { DEFAULT_CATEGORY_MAP, index as SourceCookiePro, analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, sourceCookiePro as default, emptyConsent, fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, sourceCookiePro };
|
|
263
|
+
export { DEFAULT_CATEGORY_MAP, index as SourceCookiePro, analyticsOnlyConsent, analyticsOnlyMapped, createMockElbFn, createMockOneTrustAPI, customCategoryConsent, sourceCookiePro as default, emptyConsent, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent$1 as minimalConsent, minimalConsentMapped, noopLogger, partialConsent, partialConsentMapped, setup, sourceCookiePro, step };
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function _array_with_holes(n){if(Array.isArray(n))return n}function asyncGeneratorStep(n,t,e,r,o,a
|
|
1
|
+
"use strict";function _array_like_to_array(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function _array_with_holes(n){if(Array.isArray(n))return n}function asyncGeneratorStep(n,t,e,r,o,i,a){try{var u=n[i](a),l=u.value}catch(n){return void e(n)}u.done?t(l):Promise.resolve(l).then(r,o)}function _async_to_generator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(n){asyncGeneratorStep(i,r,o,a,u,"next",n)}function u(n){asyncGeneratorStep(i,r,o,a,u,"throw",n)}a(void 0)})}}function _define_property(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function _iterable_to_array_limit(n,t){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var r,o,i=[],a=!0,u=!1;try{for(e=e.call(n);!(a=(r=e.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(n){u=!0,o=n}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e).filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.forEach(function(t){_define_property(n,t,e[t])})}return n}function _sliced_to_array(n,t){return _array_with_holes(n)||_iterable_to_array_limit(n,t)||_unsupported_iterable_to_array(n,t)||_non_iterable_rest()}function _type_of(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function _unsupported_iterable_to_array(n,t){if(n){if("string"==typeof n)return _array_like_to_array(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_array_like_to_array(n,t):void 0}}function _ts_generator(n,t){var e,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:l(0)}),u(a,"throw",{value:l(1)}),u(a,"return",{value:l(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function l(u){return function(l){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(e=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(n,i)}catch(n){u=[6,n],r=0}finally{e=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}var SourceCookiePro=function(){var n=Object.defineProperty,t=Object.getOwnPropertyDescriptor,e=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=function(t,e){for(var r in e)n(t,r,{get:e[r],enumerable:!0})},i={};o(i,{DEFAULT_CATEGORY_MAP:function(){return P},SourceCookiePro:function(){return a},analyticsOnlyConsent:function(){return f},analyticsOnlyMapped:function(){return b},createMockElbFn:function(){return C},createMockOneTrustAPI:function(){return O},customCategoryConsent:function(){return y},default:function(){return T},emptyConsent:function(){return p},fullConsent:function(){return u},fullConsentMapped:function(){return _},marketingOnlyConsent:function(){return s},marketingOnlyMapped:function(){return g},minimalConsent:function(){return c},minimalConsentMapped:function(){return v},noopLogger:function(){return h},partialConsent:function(){return l},partialConsentMapped:function(){return d},setup:function(){return A},sourceCookiePro:function(){return M},step:function(){return w}});var a={},u=",C0001,C0002,C0003,C0004,C0005,",l=",C0001,C0003,",c=",C0001,",f=",C0001,C0002,",s=",C0001,C0004,",p="",y=",C0001,CUSTOM01,CUSTOM02,",_={functional:!0,analytics:!0,marketing:!0},d={functional:!0,analytics:!1,marketing:!1},v={functional:!0,analytics:!1,marketing:!1},b={functional:!0,analytics:!0,marketing:!1},g={functional:!0,analytics:!1,marketing:!0},m=function(){},C=function(){return function(){return Promise.resolve({ok:!0})}},h={error:m,warn:m,info:m,debug:m,throw:function(n){throw"string"==typeof n?new Error(n):n},json:m,scope:function(){return h}},O=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{IsAlertBoxClosed:function(){return n}}},w={};o(w,{fullConsent:function(){return j},minimalConsent:function(){return S}});var k,j={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},S={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},A=function(n,t){var e=t.window;"string"==typeof n&&(e.OptanonActiveGroups=n,e.OneTrust={IsAlertBoxClosed:function(){return!0}})},P={C0001:"functional",C0002:"analytics",C0003:"functional",C0004:"marketing",C0005:"marketing"},M=function(n){return _async_to_generator(function(){var t,e,r,o,i,a,u,l,c,f,s,p,y,_,d,v,b,g,m,C,h,O,w,k;return _ts_generator(this,function(j){return l=n.config,c=n.env,f=c.elb,s=null!==(t=c.window)&&void 0!==t?t:void 0!==globalThis.window?globalThis.window:void 0,p=_object_spread({},P,null!==(e=null==l||null===(i=l.settings)||void 0===i?void 0:i.categoryMap)&&void 0!==e?e:{}),y={},Object.entries(p).forEach(function(n){var t=_sliced_to_array(n,2),e=t[0],r=t[1];y[e.toLowerCase()]=r}),_={categoryMap:p,explicitOnly:null===(r=null==l||null===(a=l.settings)||void 0===a?void 0:a.explicitOnly)||void 0===r||r,globalName:null!==(o=null==l||null===(u=l.settings)||void 0===u?void 0:u.globalName)&&void 0!==o?o:"OneTrust"},d={settings:_},g=!1,s&&(C=null!==(m=_.globalName)&&void 0!==m?m:"OneTrust",h=new Set(Object.values(y)),O=function(n){var t={};return h.forEach(function(n){t[n]=!1}),n.split(",").filter(function(n){return n.length>0}).forEach(function(n){var e=y[n.toLowerCase()];e&&(t[e]=!0)}),t},w=function(){var n=s.OptanonActiveGroups;if(null!=n){if(_.explicitOnly){var t=s[C];if((null==t?void 0:t.IsAlertBoxClosed)&&!t.IsAlertBoxClosed())return}var e=O(n);Object.keys(e).length>0&&f("walker consent",e)}},(k=s[C])&&void 0!==s.OptanonActiveGroups&&w(),k||(b=s.OptanonWrapper,g=!0,s.OptanonWrapper=function(){b&&b(),w(),s.OptanonWrapper=b,g=!1}),v=function(){w()},s.addEventListener("OneTrustGroupsUpdated",v)),[2,{type:"cookiepro",config:d,push:f,destroy:function(n){return _async_to_generator(function(){return _ts_generator(this,function(n){return s&&v&&s.removeEventListener("OneTrustGroupsUpdated",v),s&&g&&(s.OptanonWrapper=b),[2]})})()}}]})})()},T=M;return k=i,function(o,i,a,u){if(i&&"object"===(void 0===i?"undefined":_type_of(i))||"function"==typeof i){var l=!0,c=!1,f=void 0;try{for(var s,p=function(){var e=s.value;r.call(o,e)||e===a||n(o,e,{get:function(){return i[e]},enumerable:!(u=t(i,e))||u.enumerable})},y=e(i)[Symbol.iterator]();!(l=(s=y.next()).done);l=!0)p()}catch(n){c=!0,f=n}finally{try{l||null==y.return||y.return()}finally{if(c)throw f}}}return o}(n({},"__esModule",{value:!0}),k)}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e
|
|
1
|
+
"use strict";var n,e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(n,t)=>{for(var o in t)e(n,o,{get:t[o],enumerable:!0})},l={};a(l,{DEFAULT_CATEGORY_MAP:()=>E,SourceCookiePro:()=>i,analyticsOnlyConsent:()=>u,analyticsOnlyMapped:()=>m,createMockElbFn:()=>k,createMockOneTrustAPI:()=>M,customCategoryConsent:()=>d,default:()=>x,emptyConsent:()=>g,fullConsent:()=>s,fullConsentMapped:()=>y,marketingOnlyConsent:()=>C,marketingOnlyMapped:()=>v,minimalConsent:()=>p,minimalConsentMapped:()=>O,noopLogger:()=>w,partialConsent:()=>c,partialConsentMapped:()=>f,setup:()=>j,sourceCookiePro:()=>P,step:()=>T}),module.exports=(n=l,((n,a,l,i)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of o(a))r.call(n,s)||s===l||e(n,s,{get:()=>a[s],enumerable:!(i=t(a,s))||i.enumerable});return n})(e({},"__esModule",{value:!0}),n));var i={},s=",C0001,C0002,C0003,C0004,C0005,",c=",C0001,C0003,",p=",C0001,",u=",C0001,C0002,",C=",C0001,C0004,",g="",d=",C0001,CUSTOM01,CUSTOM02,",y={functional:!0,analytics:!0,marketing:!0},f={functional:!0,analytics:!1,marketing:!1},O={functional:!0,analytics:!1,marketing:!1},m={functional:!0,analytics:!0,marketing:!1},v={functional:!0,analytics:!1,marketing:!0},b=()=>{},k=()=>()=>Promise.resolve({ok:!0}),w={error:b,warn:b,info:b,debug:b,throw:n=>{throw"string"==typeof n?new Error(n):n},json:b,scope:()=>w},M=(n=!1)=>({IsAlertBoxClosed:()=>n}),T={};a(T,{fullConsent:()=>h,minimalConsent:()=>A});var h={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},A={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},j=(n,e)=>{const t=e.window;"string"==typeof n&&(t.OptanonActiveGroups=n,t.OneTrust={IsAlertBoxClosed:()=>!0})},E={C0001:"functional",C0002:"analytics",C0003:"functional",C0004:"marketing",C0005:"marketing"},P=async n=>{var e,t,o,r,a,l,i,s;const{config:c,env:p}=n,{elb:u}=p,C=null!=(e=p.window)?e:void 0!==globalThis.window?globalThis.window:void 0,g={...E,...null!=(o=null==(t=null==c?void 0:c.settings)?void 0:t.categoryMap)?o:{}},d={};Object.entries(g).forEach(([n,e])=>{d[n.toLowerCase()]=e});const y={categoryMap:g,explicitOnly:null==(a=null==(r=null==c?void 0:c.settings)?void 0:r.explicitOnly)||a,globalName:null!=(i=null==(l=null==c?void 0:c.settings)?void 0:l.globalName)?i:"OneTrust"},f={settings:y};let O,m,v=!1;if(C){const n=null!=(s=y.globalName)?s:"OneTrust",e=new Set(Object.values(d)),t=n=>{const t={};return e.forEach(n=>{t[n]=!1}),n.split(",").filter(n=>n.length>0).forEach(n=>{const e=d[n.toLowerCase()];e&&(t[e]=!0)}),t},o=()=>{const e=C.OptanonActiveGroups;if(null==e)return;if(y.explicitOnly){const e=C[n];if((null==e?void 0:e.IsAlertBoxClosed)&&!e.IsAlertBoxClosed())return}const o=t(e);Object.keys(o).length>0&&u("walker consent",o)},r=C[n];r&&void 0!==C.OptanonActiveGroups&&o(),r||(m=C.OptanonWrapper,v=!0,C.OptanonWrapper=()=>{m&&m(),o(),C.OptanonWrapper=m,v=!1}),O=()=>{o()},C.addEventListener("OneTrustGroupsUpdated",O)}return{type:"cookiepro",config:f,push:u,destroy:async n=>{C&&O&&C.removeEventListener("OneTrustGroupsUpdated",O),C&&v&&(C.OptanonWrapper=m)}}},x=P;//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, OneTrustAPI } from './types';\n\n// Export types for external usage\nexport * as SourceCookiePro from './types';\n\n// Export examples\nexport * from './examples';\n\n/**\n * Default category mapping from CookiePro/OneTrust to walkerOS consent groups.\n *\n * Keys use OneTrust's standard uppercase IDs (as shown in CookiePro dashboard).\n * Lookups are case-insensitive (normalized during init).\n *\n * Maps OneTrust's standard category IDs to walkerOS convention:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n C0001: 'functional',\n C0002: 'analytics',\n C0003: 'functional',\n C0004: 'marketing',\n C0005: 'marketing',\n};\n\n/**\n * CookiePro/OneTrust consent management source for walkerOS.\n *\n * This source listens to CookiePro/OneTrust CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * Three detection paths:\n * 1. Already loaded: window.OneTrust + window.OptanonActiveGroups\n * 2. Init: Wraps OptanonWrapper (preserves existing)\n * 3. Change: OneTrustGroupsUpdated window event\n *\n * @example\n * ```typescript\n * import { sourceCookiePro } from '@walkeros/web-source-cmp-cookiepro';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookiePro,\n * config: {\n * settings: {\n * categoryMap: {\n * C0002: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookiePro: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults (user overrides win)\n const mergedCategoryMap = {\n ...DEFAULT_CATEGORY_MAP,\n ...(config?.settings?.categoryMap ?? {}),\n };\n\n // Build normalized (lowercase) lookup map for case-insensitive matching\n const normalizedMap: Record<string, string> = {};\n Object.entries(mergedCategoryMap).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n const settings: Settings = {\n categoryMap: mergedCategoryMap, // Preserves original casing for config\n explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'OneTrust',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track references for cleanup\n let eventListener: (() => void) | undefined;\n let originalOptanonWrapper: (() => void) | undefined;\n let wrappedOptanonWrapper = false;\n\n if (actualWindow) {\n const globalName = settings.globalName ?? 'OneTrust';\n\n /**\n * Collect all unique walkerOS group names from the normalizedMap.\n * Used to set explicit false for absent groups.\n */\n const allMappedGroups = new Set(Object.values(normalizedMap));\n\n /**\n * Parse OptanonActiveGroups string into walkerOS consent state.\n *\n * OptanonActiveGroups format: \",C0001,C0003,\" (comma-separated, leading/trailing commas)\n * Only active groups are listed. Absence means denied.\n * Uses case-insensitive comparison for category IDs via normalizedMap.\n * Only mapped categories produce consent entries (unmapped IDs are ignored).\n * Sets explicit false for all mapped groups not in the active list.\n */\n const parseActiveGroups = (activeGroups: string): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n // Initialize all mapped groups to false\n allMappedGroups.forEach((group) => {\n state[group] = false;\n });\n\n // Set active groups to true (case-insensitive via normalizedMap)\n activeGroups\n .split(',')\n .filter((id) => id.length > 0)\n .forEach((id) => {\n const mapped = normalizedMap[id.toLowerCase()];\n if (mapped) {\n state[mapped] = true;\n }\n });\n\n return state;\n };\n\n /**\n * Handle consent by reading current OptanonActiveGroups from window.\n * Checks explicitOnly against IsAlertBoxClosed when available.\n */\n const handleConsent = () => {\n const activeGroups = actualWindow.OptanonActiveGroups;\n if (activeGroups === undefined || activeGroups === null) return;\n\n // Check explicit consent if required\n if (settings.explicitOnly) {\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp?.IsAlertBoxClosed && !cmp.IsAlertBoxClosed()) return;\n }\n\n const state = parseActiveGroups(activeGroups);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // --- Detection path 1: Already loaded ---\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp && actualWindow.OptanonActiveGroups !== undefined) {\n handleConsent();\n }\n\n // --- Detection path 2: OptanonWrapper ---\n // Only wrap if SDK is not yet loaded (no already-loaded path).\n // Self-unwraps after first call -- the event listener handles all\n // subsequent changes, avoiding double-firing.\n if (!cmp) {\n originalOptanonWrapper = actualWindow.OptanonWrapper;\n wrappedOptanonWrapper = true;\n\n actualWindow.OptanonWrapper = () => {\n // Call original wrapper if it existed\n if (originalOptanonWrapper) originalOptanonWrapper();\n handleConsent();\n // Self-unwrap: restore original after first call (SDK init).\n // The OneTrustGroupsUpdated listener handles all future changes.\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n wrappedOptanonWrapper = false;\n };\n }\n\n // --- Detection path 3: OneTrustGroupsUpdated event ---\n eventListener = () => {\n handleConsent();\n };\n actualWindow.addEventListener('OneTrustGroupsUpdated', eventListener);\n }\n\n return {\n type: 'cookiepro',\n config: fullConfig,\n push: elb,\n destroy: async () => {\n // Remove event listener\n if (actualWindow && eventListener) {\n actualWindow.removeEventListener(\n 'OneTrustGroupsUpdated',\n eventListener,\n );\n }\n // Restore original OptanonWrapper\n if (actualWindow && wrappedOptanonWrapper) {\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n }\n },\n };\n};\n\nexport default sourceCookiePro;\n","import type { Source, Elb } from '@walkeros/core';\n\n/**\n * OneTrust global API interface.\n *\n * Represents the subset of the OneTrust SDK we interact with.\n * The full SDK is much larger, but we only need consent-related methods.\n */\nexport interface OneTrustAPI {\n /** Returns true if user has made an explicit consent choice */\n IsAlertBoxClosed: () => boolean;\n /** Register a callback for consent changes (callback receives event with detail: string[]) */\n OnConsentChanged?: (fn: (event: { detail: string[] }) => void) => void;\n}\n\ndeclare global {\n interface Window {\n /** OneTrust SDK global object */\n OneTrust?: OneTrustAPI;\n /** Comma-separated string of active consent category IDs (e.g. \",C0001,C0003,\") */\n OptanonActiveGroups?: string;\n /** OneTrust callback function, called on SDK load and consent changes */\n OptanonWrapper?: () => void;\n /** CookiePro legacy alias for OneTrust */\n Optanon?: unknown;\n [key: string]: OneTrustAPI | unknown;\n }\n\n interface WindowEventMap {\n /** event.detail is an array of active group ID strings (e.g. [\"C0001\", \"C0002\"]) */\n OneTrustGroupsUpdated: CustomEvent<string[]>;\n }\n}\n\n/**\n * Settings for CookiePro/OneTrust source\n */\nexport interface Settings {\n /**\n * Map CookiePro category IDs to walkerOS consent groups.\n * Keys: CookiePro category IDs (e.g. 'C0001', 'C0002')\n * Values: walkerOS consent group names\n *\n * Comparison is case-insensitive (keys are normalized to lowercase during init).\n *\n * Default provides sensible mapping for standard OneTrust categories:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Checks OneTrust.IsAlertBoxClosed() -- only processes\n * consent if user has actively interacted with the banner.\n * When false: Processes any consent state including defaults.\n *\n * Default: true\n */\n explicitOnly?: boolean;\n\n /**\n * Custom name for window.OneTrust object.\n * Some implementations use a different global name.\n *\n * Default: 'OneTrust'\n */\n globalName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for CookiePro source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookiePro source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","/**\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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YA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C,QAAI,OAAO,aAAa,wBAAwB,QAAW;AACzD,oBAAc;AAAA,IAChB;AAMA,QAAI,CAAC,KAAK;AACR,+BAAyB,aAAa;AACtC,8BAAwB;AAExB,mBAAa,iBAAiB,MAAM;AAElC,YAAI,uBAAwB,wBAAuB;AACnD,sBAAc;AAGd,qBAAa,iBAAiB;AAC9B,gCAAwB;AAAA,MAC1B;AAAA,IACF;AAGA,oBAAgB,MAAM;AACpB,oBAAc;AAAA,IAChB;AACA,iBAAa,iBAAiB,yBAAyB,aAAa;AAAA,EACtE;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,YAAY;AAEnB,UAAI,gBAAgB,eAAe;AACjC,qBAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEA,UAAI,gBAAgB,uBAAuB;AACzC,qBAAa,iBAAiB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["cmp"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, OneTrustAPI } from './types';\n\n// Export types for external usage\nexport * as SourceCookiePro from './types';\n\n// Export examples\nexport * from './examples';\n\n/**\n * Default category mapping from CookiePro/OneTrust to walkerOS consent groups.\n *\n * Keys use OneTrust's standard uppercase IDs (as shown in CookiePro dashboard).\n * Lookups are case-insensitive (normalized during init).\n *\n * Maps OneTrust's standard category IDs to walkerOS convention:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n C0001: 'functional',\n C0002: 'analytics',\n C0003: 'functional',\n C0004: 'marketing',\n C0005: 'marketing',\n};\n\n/**\n * CookiePro/OneTrust consent management source for walkerOS.\n *\n * This source listens to CookiePro/OneTrust CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * Three detection paths:\n * 1. Already loaded: window.OneTrust + window.OptanonActiveGroups\n * 2. Init: Wraps OptanonWrapper (preserves existing)\n * 3. Change: OneTrustGroupsUpdated window event\n *\n * @example\n * ```typescript\n * import { sourceCookiePro } from '@walkeros/web-source-cmp-cookiepro';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookiePro,\n * config: {\n * settings: {\n * categoryMap: {\n * C0002: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookiePro: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults (user overrides win)\n const mergedCategoryMap = {\n ...DEFAULT_CATEGORY_MAP,\n ...(config?.settings?.categoryMap ?? {}),\n };\n\n // Build normalized (lowercase) lookup map for case-insensitive matching\n const normalizedMap: Record<string, string> = {};\n Object.entries(mergedCategoryMap).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n const settings: Settings = {\n categoryMap: mergedCategoryMap, // Preserves original casing for config\n explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'OneTrust',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track references for cleanup\n let eventListener: (() => void) | undefined;\n let originalOptanonWrapper: (() => void) | undefined;\n let wrappedOptanonWrapper = false;\n\n if (actualWindow) {\n const globalName = settings.globalName ?? 'OneTrust';\n\n /**\n * Collect all unique walkerOS group names from the normalizedMap.\n * Used to set explicit false for absent groups.\n */\n const allMappedGroups = new Set(Object.values(normalizedMap));\n\n /**\n * Parse OptanonActiveGroups string into walkerOS consent state.\n *\n * OptanonActiveGroups format: \",C0001,C0003,\" (comma-separated, leading/trailing commas)\n * Only active groups are listed. Absence means denied.\n * Uses case-insensitive comparison for category IDs via normalizedMap.\n * Only mapped categories produce consent entries (unmapped IDs are ignored).\n * Sets explicit false for all mapped groups not in the active list.\n */\n const parseActiveGroups = (activeGroups: string): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n // Initialize all mapped groups to false\n allMappedGroups.forEach((group) => {\n state[group] = false;\n });\n\n // Set active groups to true (case-insensitive via normalizedMap)\n activeGroups\n .split(',')\n .filter((id) => id.length > 0)\n .forEach((id) => {\n const mapped = normalizedMap[id.toLowerCase()];\n if (mapped) {\n state[mapped] = true;\n }\n });\n\n return state;\n };\n\n /**\n * Handle consent by reading current OptanonActiveGroups from window.\n * Checks explicitOnly against IsAlertBoxClosed when available.\n */\n const handleConsent = () => {\n const activeGroups = actualWindow.OptanonActiveGroups;\n if (activeGroups === undefined || activeGroups === null) return;\n\n // Check explicit consent if required\n if (settings.explicitOnly) {\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp?.IsAlertBoxClosed && !cmp.IsAlertBoxClosed()) return;\n }\n\n const state = parseActiveGroups(activeGroups);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // --- Detection path 1: Already loaded ---\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp && actualWindow.OptanonActiveGroups !== undefined) {\n handleConsent();\n }\n\n // --- Detection path 2: OptanonWrapper ---\n // Only wrap if SDK is not yet loaded (no already-loaded path).\n // Self-unwraps after first call -- the event listener handles all\n // subsequent changes, avoiding double-firing.\n if (!cmp) {\n originalOptanonWrapper = actualWindow.OptanonWrapper;\n wrappedOptanonWrapper = true;\n\n actualWindow.OptanonWrapper = () => {\n // Call original wrapper if it existed\n if (originalOptanonWrapper) originalOptanonWrapper();\n handleConsent();\n // Self-unwrap: restore original after first call (SDK init).\n // The OneTrustGroupsUpdated listener handles all future changes.\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n wrappedOptanonWrapper = false;\n };\n }\n\n // --- Detection path 3: OneTrustGroupsUpdated event ---\n eventListener = () => {\n handleConsent();\n };\n actualWindow.addEventListener('OneTrustGroupsUpdated', eventListener);\n }\n\n return {\n type: 'cookiepro',\n config: fullConfig,\n push: elb,\n destroy: async (_context) => {\n // Remove event listener\n if (actualWindow && eventListener) {\n actualWindow.removeEventListener(\n 'OneTrustGroupsUpdated',\n eventListener,\n );\n }\n // Restore original OptanonWrapper\n if (actualWindow && wrappedOptanonWrapper) {\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n }\n },\n };\n};\n\nexport default sourceCookiePro;\n","import type { Source, Elb } from '@walkeros/core';\n\n/**\n * OneTrust global API interface.\n *\n * Represents the subset of the OneTrust SDK we interact with.\n * The full SDK is much larger, but we only need consent-related methods.\n */\nexport interface OneTrustAPI {\n /** Returns true if user has made an explicit consent choice */\n IsAlertBoxClosed: () => boolean;\n /** Register a callback for consent changes (callback receives event with detail: string[]) */\n OnConsentChanged?: (fn: (event: { detail: string[] }) => void) => void;\n}\n\ndeclare global {\n interface Window {\n /** OneTrust SDK global object */\n OneTrust?: OneTrustAPI;\n /** Comma-separated string of active consent category IDs (e.g. \",C0001,C0003,\") */\n OptanonActiveGroups?: string;\n /** OneTrust callback function, called on SDK load and consent changes */\n OptanonWrapper?: () => void;\n /** CookiePro legacy alias for OneTrust */\n Optanon?: unknown;\n [key: string]: OneTrustAPI | unknown;\n }\n\n interface WindowEventMap {\n /** event.detail is an array of active group ID strings (e.g. [\"C0001\", \"C0002\"]) */\n OneTrustGroupsUpdated: CustomEvent<string[]>;\n }\n}\n\n/**\n * Settings for CookiePro/OneTrust source\n */\nexport interface Settings {\n /**\n * Map CookiePro category IDs to walkerOS consent groups.\n * Keys: CookiePro category IDs (e.g. 'C0001', 'C0002')\n * Values: walkerOS consent group names\n *\n * Comparison is case-insensitive (keys are normalized to lowercase during init).\n *\n * Default provides sensible mapping for standard OneTrust categories:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Checks OneTrust.IsAlertBoxClosed() -- only processes\n * consent if user has actively interacted with the banner.\n * When false: Processes any consent state including defaults.\n *\n * Default: true\n */\n explicitOnly?: boolean;\n\n /**\n * Custom name for window.OneTrust object.\n * Some implementations use a different global name.\n *\n * Default: 'OneTrust'\n */\n globalName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for CookiePro source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookiePro source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","/**\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 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 in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,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UAAI,SAAS,cAAc;AACzB,cAAMC,OAAM,aAAa,UAAU;AACnC,aAAIA,QAAA,gBAAAA,KAAK,qBAAoB,CAACA,KAAI,iBAAiB,EAAG;AAAA,MACxD;AAEA,YAAM,QAAQ,kBAAkB,YAAY;AAG5C,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAGA,UAAM,MAAM,aAAa,UAAU;AACnC,QAAI,OAAO,aAAa,wBAAwB,QAAW;AACzD,oBAAc;AAAA,IAChB;AAMA,QAAI,CAAC,KAAK;AACR,+BAAyB,aAAa;AACtC,8BAAwB;AAExB,mBAAa,iBAAiB,MAAM;AAElC,YAAI,uBAAwB,wBAAuB;AACnD,sBAAc;AAGd,qBAAa,iBAAiB;AAC9B,gCAAwB;AAAA,MAC1B;AAAA,IACF;AAGA,oBAAgB,MAAM;AACpB,oBAAc;AAAA,IAChB;AACA,iBAAa,iBAAiB,yBAAyB,aAAa;AAAA,EACtE;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,OAAO,aAAa;AAE3B,UAAI,gBAAgB,eAAe;AACjC,qBAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEA,UAAI,gBAAgB,uBAAuB;AACzC,qBAAa,iBAAiB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["fullConsent","minimalConsent","cmp"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n={},
|
|
1
|
+
var n=Object.defineProperty,t={},e=",C0001,C0002,C0003,C0004,C0005,",o=",C0001,C0003,",l=",C0001,",a=",C0001,C0002,",i=",C0001,C0004,",r="",s=",C0001,CUSTOM01,CUSTOM02,",c={functional:!0,analytics:!0,marketing:!0},u={functional:!0,analytics:!1,marketing:!1},p={functional:!0,analytics:!1,marketing:!1},C={functional:!0,analytics:!0,marketing:!1},d={functional:!0,analytics:!1,marketing:!0},g=()=>{},f=()=>()=>Promise.resolve({ok:!0}),v={error:g,warn:g,info:g,debug:g,throw:n=>{throw"string"==typeof n?new Error(n):n},json:g,scope:()=>v},y=(n=!1)=>({IsAlertBoxClosed:()=>n}),O={};((t,e)=>{for(var o in e)n(t,o,{get:e[o],enumerable:!0})})(O,{fullConsent:()=>m,minimalConsent:()=>w});var m={in:",C0001,C0002,C0003,C0004,C0005,",out:{functional:!0,analytics:!0,marketing:!0}},w={in:",C0001,",out:{functional:!0,analytics:!1,marketing:!1}},k=(n,t)=>{const e=t.window;"string"==typeof n&&(e.OptanonActiveGroups=n,e.OneTrust={IsAlertBoxClosed:()=>!0})},b={C0001:"functional",C0002:"analytics",C0003:"functional",C0004:"marketing",C0005:"marketing"},h=async n=>{var t,e,o,l,a,i,r,s;const{config:c,env:u}=n,{elb:p}=u,C=null!=(t=u.window)?t:void 0!==globalThis.window?globalThis.window:void 0,d={...b,...null!=(o=null==(e=null==c?void 0:c.settings)?void 0:e.categoryMap)?o:{}},g={};Object.entries(d).forEach(([n,t])=>{g[n.toLowerCase()]=t});const f={categoryMap:d,explicitOnly:null==(a=null==(l=null==c?void 0:c.settings)?void 0:l.explicitOnly)||a,globalName:null!=(r=null==(i=null==c?void 0:c.settings)?void 0:i.globalName)?r:"OneTrust"},v={settings:f};let y,O,m=!1;if(C){const n=null!=(s=f.globalName)?s:"OneTrust",t=new Set(Object.values(g)),e=n=>{const e={};return t.forEach(n=>{e[n]=!1}),n.split(",").filter(n=>n.length>0).forEach(n=>{const t=g[n.toLowerCase()];t&&(e[t]=!0)}),e},o=()=>{const t=C.OptanonActiveGroups;if(null==t)return;if(f.explicitOnly){const t=C[n];if((null==t?void 0:t.IsAlertBoxClosed)&&!t.IsAlertBoxClosed())return}const o=e(t);Object.keys(o).length>0&&p("walker consent",o)},l=C[n];l&&void 0!==C.OptanonActiveGroups&&o(),l||(O=C.OptanonWrapper,m=!0,C.OptanonWrapper=()=>{O&&O(),o(),C.OptanonWrapper=O,m=!1}),y=()=>{o()},C.addEventListener("OneTrustGroupsUpdated",y)}return{type:"cookiepro",config:v,push:p,destroy:async n=>{C&&y&&C.removeEventListener("OneTrustGroupsUpdated",y),C&&m&&(C.OptanonWrapper=O)}}},T=h;export{b as DEFAULT_CATEGORY_MAP,t as SourceCookiePro,a as analyticsOnlyConsent,C as analyticsOnlyMapped,f as createMockElbFn,y as createMockOneTrustAPI,s as customCategoryConsent,T as default,r as emptyConsent,e as fullConsent,c as fullConsentMapped,i as marketingOnlyConsent,d as marketingOnlyMapped,l as minimalConsent,p as minimalConsentMapped,v as noopLogger,o as partialConsent,u as partialConsentMapped,k as setup,h as sourceCookiePro,O as step};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\n\n/**\n * OneTrust global API interface.\n *\n * Represents the subset of the OneTrust SDK we interact with.\n * The full SDK is much larger, but we only need consent-related methods.\n */\nexport interface OneTrustAPI {\n /** Returns true if user has made an explicit consent choice */\n IsAlertBoxClosed: () => boolean;\n /** Register a callback for consent changes (callback receives event with detail: string[]) */\n OnConsentChanged?: (fn: (event: { detail: string[] }) => void) => void;\n}\n\ndeclare global {\n interface Window {\n /** OneTrust SDK global object */\n OneTrust?: OneTrustAPI;\n /** Comma-separated string of active consent category IDs (e.g. \",C0001,C0003,\") */\n OptanonActiveGroups?: string;\n /** OneTrust callback function, called on SDK load and consent changes */\n OptanonWrapper?: () => void;\n /** CookiePro legacy alias for OneTrust */\n Optanon?: unknown;\n [key: string]: OneTrustAPI | unknown;\n }\n\n interface WindowEventMap {\n /** event.detail is an array of active group ID strings (e.g. [\"C0001\", \"C0002\"]) */\n OneTrustGroupsUpdated: CustomEvent<string[]>;\n }\n}\n\n/**\n * Settings for CookiePro/OneTrust source\n */\nexport interface Settings {\n /**\n * Map CookiePro category IDs to walkerOS consent groups.\n * Keys: CookiePro category IDs (e.g. 'C0001', 'C0002')\n * Values: walkerOS consent group names\n *\n * Comparison is case-insensitive (keys are normalized to lowercase during init).\n *\n * Default provides sensible mapping for standard OneTrust categories:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Checks OneTrust.IsAlertBoxClosed() -- only processes\n * consent if user has actively interacted with the banner.\n * When false: Processes any consent state including defaults.\n *\n * Default: true\n */\n explicitOnly?: boolean;\n\n /**\n * Custom name for window.OneTrust object.\n * Some implementations use a different global name.\n *\n * Default: 'OneTrust'\n */\n globalName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for CookiePro source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookiePro source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","/**\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 info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n scope: () => noopLogger,\n};\n\n/**\n * Create a mock OneTrust API object\n */\nexport const createMockOneTrustAPI = (\n isAlertBoxClosed = false,\n): OneTrustAPI => ({\n IsAlertBoxClosed: () => isAlertBoxClosed,\n});\n","import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, OneTrustAPI } from './types';\n\n// Export types for external usage\nexport * as SourceCookiePro from './types';\n\n// Export examples\nexport * from './examples';\n\n/**\n * Default category mapping from CookiePro/OneTrust to walkerOS consent groups.\n *\n * Keys use OneTrust's standard uppercase IDs (as shown in CookiePro dashboard).\n * Lookups are case-insensitive (normalized during init).\n *\n * Maps OneTrust's standard category IDs to walkerOS convention:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n C0001: 'functional',\n C0002: 'analytics',\n C0003: 'functional',\n C0004: 'marketing',\n C0005: 'marketing',\n};\n\n/**\n * CookiePro/OneTrust consent management source for walkerOS.\n *\n * This source listens to CookiePro/OneTrust CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * Three detection paths:\n * 1. Already loaded: window.OneTrust + window.OptanonActiveGroups\n * 2. Init: Wraps OptanonWrapper (preserves existing)\n * 3. Change: OneTrustGroupsUpdated window event\n *\n * @example\n * ```typescript\n * import { sourceCookiePro } from '@walkeros/web-source-cmp-cookiepro';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookiePro,\n * config: {\n * settings: {\n * categoryMap: {\n * C0002: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookiePro: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults (user overrides win)\n const mergedCategoryMap = {\n ...DEFAULT_CATEGORY_MAP,\n ...(config?.settings?.categoryMap ?? {}),\n };\n\n // Build normalized (lowercase) lookup map for case-insensitive matching\n const normalizedMap: Record<string, string> = {};\n Object.entries(mergedCategoryMap).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n const settings: Settings = {\n categoryMap: mergedCategoryMap, // Preserves original casing for config\n explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'OneTrust',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track references for cleanup\n let eventListener: (() => void) | undefined;\n let originalOptanonWrapper: (() => void) | undefined;\n let wrappedOptanonWrapper = false;\n\n if (actualWindow) {\n const globalName = settings.globalName ?? 'OneTrust';\n\n /**\n * Collect all unique walkerOS group names from the normalizedMap.\n * Used to set explicit false for absent groups.\n */\n const allMappedGroups = new Set(Object.values(normalizedMap));\n\n /**\n * Parse OptanonActiveGroups string into walkerOS consent state.\n *\n * OptanonActiveGroups format: \",C0001,C0003,\" (comma-separated, leading/trailing commas)\n * Only active groups are listed. Absence means denied.\n * Uses case-insensitive comparison for category IDs via normalizedMap.\n * Only mapped categories produce consent entries (unmapped IDs are ignored).\n * Sets explicit false for all mapped groups not in the active list.\n */\n const parseActiveGroups = (activeGroups: string): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n // Initialize all mapped groups to false\n allMappedGroups.forEach((group) => {\n state[group] = false;\n });\n\n // Set active groups to true (case-insensitive via normalizedMap)\n activeGroups\n .split(',')\n .filter((id) => id.length > 0)\n .forEach((id) => {\n const mapped = normalizedMap[id.toLowerCase()];\n if (mapped) {\n state[mapped] = true;\n }\n });\n\n return state;\n };\n\n /**\n * Handle consent by reading current OptanonActiveGroups from window.\n * Checks explicitOnly against IsAlertBoxClosed when available.\n */\n const handleConsent = () => {\n const activeGroups = actualWindow.OptanonActiveGroups;\n if (activeGroups === undefined || activeGroups === null) return;\n\n // Check explicit consent if required\n if (settings.explicitOnly) {\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp?.IsAlertBoxClosed && !cmp.IsAlertBoxClosed()) return;\n }\n\n const state = parseActiveGroups(activeGroups);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // --- Detection path 1: Already loaded ---\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp && actualWindow.OptanonActiveGroups !== undefined) {\n handleConsent();\n }\n\n // --- Detection path 2: OptanonWrapper ---\n // Only wrap if SDK is not yet loaded (no already-loaded path).\n // Self-unwraps after first call -- the event listener handles all\n // subsequent changes, avoiding double-firing.\n if (!cmp) {\n originalOptanonWrapper = actualWindow.OptanonWrapper;\n wrappedOptanonWrapper = true;\n\n actualWindow.OptanonWrapper = () => {\n // Call original wrapper if it existed\n if (originalOptanonWrapper) originalOptanonWrapper();\n handleConsent();\n // Self-unwrap: restore original after first call (SDK init).\n // The OneTrustGroupsUpdated listener handles all future changes.\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n wrappedOptanonWrapper = false;\n };\n }\n\n // --- Detection path 3: OneTrustGroupsUpdated event ---\n eventListener = () => {\n handleConsent();\n };\n actualWindow.addEventListener('OneTrustGroupsUpdated', eventListener);\n }\n\n return {\n type: 'cookiepro',\n config: fullConfig,\n push: elb,\n destroy: async () => {\n // Remove event listener\n if (actualWindow && eventListener) {\n actualWindow.removeEventListener(\n 'OneTrustGroupsUpdated',\n eventListener,\n );\n }\n // Restore original OptanonWrapper\n if (actualWindow && wrappedOptanonWrapper) {\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n }\n },\n };\n};\n\nexport default sourceCookiePro;\n"],"mappings":";AAAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;AAAA,EACnD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;;;AC/DA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,MACV,QAAQ,QAAQ;AAAA,IACd,IAAI;AAAA,EACN,CAAC;AACH,SAAO;AACT;AAKO,IAAM,aAA8B;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,YAA4B;AAClC,UAAM,OAAO,YAAY,WAAW,IAAI,MAAM,OAAO,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,MAAM;AACf;AAKO,IAAM,wBAAwB,CACnC,mBAAmB,WACF;AAAA,EACjB,kBAAkB,MAAM;AAC1B;;;AClBO,IAAM,uBAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;AAiCO,IAAM,kBAAsC,OAAO,YAAY;AA7DtE;A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D,UAAI,SAAS,cAAc;AACzB,cAAMA,OAAM,aAAa,UAAU;AACnC,aAAIA,QAAA,gBAAAA,KAAK,qBAAoB,CAACA,KAAI,iBAAiB,EAAG;AAAA,MACxD;AAEA,YAAM,QAAQ,kBAAkB,YAAY;AAG5C,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAGA,UAAM,MAAM,aAAa,UAAU;AACnC,QAAI,OAAO,aAAa,wBAAwB,QAAW;AACzD,oBAAc;AAAA,IAChB;AAMA,QAAI,CAAC,KAAK;AACR,+BAAyB,aAAa;AACtC,8BAAwB;AAExB,mBAAa,iBAAiB,MAAM;AAElC,YAAI,uBAAwB,wBAAuB;AACnD,sBAAc;AAGd,qBAAa,iBAAiB;AAC9B,gCAAwB;AAAA,MAC1B;AAAA,IACF;AAGA,oBAAgB,MAAM;AACpB,oBAAc;AAAA,IAChB;AACA,iBAAa,iBAAiB,yBAAyB,aAAa;AAAA,EACtE;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,YAAY;AAEnB,UAAI,gBAAgB,eAAe;AACjC,qBAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEA,UAAI,gBAAgB,uBAAuB;AACzC,qBAAa,iBAAiB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["cmp"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\n\n/**\n * OneTrust global API interface.\n *\n * Represents the subset of the OneTrust SDK we interact with.\n * The full SDK is much larger, but we only need consent-related methods.\n */\nexport interface OneTrustAPI {\n /** Returns true if user has made an explicit consent choice */\n IsAlertBoxClosed: () => boolean;\n /** Register a callback for consent changes (callback receives event with detail: string[]) */\n OnConsentChanged?: (fn: (event: { detail: string[] }) => void) => void;\n}\n\ndeclare global {\n interface Window {\n /** OneTrust SDK global object */\n OneTrust?: OneTrustAPI;\n /** Comma-separated string of active consent category IDs (e.g. \",C0001,C0003,\") */\n OptanonActiveGroups?: string;\n /** OneTrust callback function, called on SDK load and consent changes */\n OptanonWrapper?: () => void;\n /** CookiePro legacy alias for OneTrust */\n Optanon?: unknown;\n [key: string]: OneTrustAPI | unknown;\n }\n\n interface WindowEventMap {\n /** event.detail is an array of active group ID strings (e.g. [\"C0001\", \"C0002\"]) */\n OneTrustGroupsUpdated: CustomEvent<string[]>;\n }\n}\n\n/**\n * Settings for CookiePro/OneTrust source\n */\nexport interface Settings {\n /**\n * Map CookiePro category IDs to walkerOS consent groups.\n * Keys: CookiePro category IDs (e.g. 'C0001', 'C0002')\n * Values: walkerOS consent group names\n *\n * Comparison is case-insensitive (keys are normalized to lowercase during init).\n *\n * Default provides sensible mapping for standard OneTrust categories:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Checks OneTrust.IsAlertBoxClosed() -- only processes\n * consent if user has actively interacted with the banner.\n * When false: Processes any consent state including defaults.\n *\n * Default: true\n */\n explicitOnly?: boolean;\n\n /**\n * Custom name for window.OneTrust object.\n * Some implementations use a different global name.\n *\n * Default: 'OneTrust'\n */\n globalName?: string;\n}\n\n/**\n * User input settings (all optional)\n */\nexport type InitSettings = Partial<Settings>;\n\n/**\n * No mapping configuration for this source\n */\nexport interface Mapping {}\n\n/**\n * Push function type - uses elb for consent commands\n */\nexport type Push = Elb.Fn;\n\n/**\n * Environment interface for CookiePro source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookiePro source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","/**\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 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 in: ',C0001,',\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets OptanonActiveGroups and OneTrust globals before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\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","import type { Source, WalkerOS } from '@walkeros/core';\nimport type { Types, Settings, OneTrustAPI } from './types';\n\n// Export types for external usage\nexport * as SourceCookiePro from './types';\n\n// Export examples\nexport * from './examples';\n\n/**\n * Default category mapping from CookiePro/OneTrust to walkerOS consent groups.\n *\n * Keys use OneTrust's standard uppercase IDs (as shown in CookiePro dashboard).\n * Lookups are case-insensitive (normalized during init).\n *\n * Maps OneTrust's standard category IDs to walkerOS convention:\n * - C0001 (Strictly Necessary) -> functional\n * - C0002 (Performance) -> analytics\n * - C0003 (Functional) -> functional\n * - C0004 (Targeting) -> marketing\n * - C0005 (Social Media) -> marketing\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n C0001: 'functional',\n C0002: 'analytics',\n C0003: 'functional',\n C0004: 'marketing',\n C0005: 'marketing',\n};\n\n/**\n * CookiePro/OneTrust consent management source for walkerOS.\n *\n * This source listens to CookiePro/OneTrust CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * Three detection paths:\n * 1. Already loaded: window.OneTrust + window.OptanonActiveGroups\n * 2. Init: Wraps OptanonWrapper (preserves existing)\n * 3. Change: OneTrustGroupsUpdated window event\n *\n * @example\n * ```typescript\n * import { sourceCookiePro } from '@walkeros/web-source-cmp-cookiepro';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookiePro,\n * config: {\n * settings: {\n * categoryMap: {\n * C0002: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookiePro: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults (user overrides win)\n const mergedCategoryMap = {\n ...DEFAULT_CATEGORY_MAP,\n ...(config?.settings?.categoryMap ?? {}),\n };\n\n // Build normalized (lowercase) lookup map for case-insensitive matching\n const normalizedMap: Record<string, string> = {};\n Object.entries(mergedCategoryMap).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n const settings: Settings = {\n categoryMap: mergedCategoryMap, // Preserves original casing for config\n explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'OneTrust',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Track references for cleanup\n let eventListener: (() => void) | undefined;\n let originalOptanonWrapper: (() => void) | undefined;\n let wrappedOptanonWrapper = false;\n\n if (actualWindow) {\n const globalName = settings.globalName ?? 'OneTrust';\n\n /**\n * Collect all unique walkerOS group names from the normalizedMap.\n * Used to set explicit false for absent groups.\n */\n const allMappedGroups = new Set(Object.values(normalizedMap));\n\n /**\n * Parse OptanonActiveGroups string into walkerOS consent state.\n *\n * OptanonActiveGroups format: \",C0001,C0003,\" (comma-separated, leading/trailing commas)\n * Only active groups are listed. Absence means denied.\n * Uses case-insensitive comparison for category IDs via normalizedMap.\n * Only mapped categories produce consent entries (unmapped IDs are ignored).\n * Sets explicit false for all mapped groups not in the active list.\n */\n const parseActiveGroups = (activeGroups: string): WalkerOS.Consent => {\n const state: WalkerOS.Consent = {};\n\n // Initialize all mapped groups to false\n allMappedGroups.forEach((group) => {\n state[group] = false;\n });\n\n // Set active groups to true (case-insensitive via normalizedMap)\n activeGroups\n .split(',')\n .filter((id) => id.length > 0)\n .forEach((id) => {\n const mapped = normalizedMap[id.toLowerCase()];\n if (mapped) {\n state[mapped] = true;\n }\n });\n\n return state;\n };\n\n /**\n * Handle consent by reading current OptanonActiveGroups from window.\n * Checks explicitOnly against IsAlertBoxClosed when available.\n */\n const handleConsent = () => {\n const activeGroups = actualWindow.OptanonActiveGroups;\n if (activeGroups === undefined || activeGroups === null) return;\n\n // Check explicit consent if required\n if (settings.explicitOnly) {\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp?.IsAlertBoxClosed && !cmp.IsAlertBoxClosed()) return;\n }\n\n const state = parseActiveGroups(activeGroups);\n\n // Only call if we have consent state to report\n if (Object.keys(state).length > 0) {\n elb('walker consent', state);\n }\n };\n\n // --- Detection path 1: Already loaded ---\n const cmp = actualWindow[globalName] as OneTrustAPI | undefined;\n if (cmp && actualWindow.OptanonActiveGroups !== undefined) {\n handleConsent();\n }\n\n // --- Detection path 2: OptanonWrapper ---\n // Only wrap if SDK is not yet loaded (no already-loaded path).\n // Self-unwraps after first call -- the event listener handles all\n // subsequent changes, avoiding double-firing.\n if (!cmp) {\n originalOptanonWrapper = actualWindow.OptanonWrapper;\n wrappedOptanonWrapper = true;\n\n actualWindow.OptanonWrapper = () => {\n // Call original wrapper if it existed\n if (originalOptanonWrapper) originalOptanonWrapper();\n handleConsent();\n // Self-unwrap: restore original after first call (SDK init).\n // The OneTrustGroupsUpdated listener handles all future changes.\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n wrappedOptanonWrapper = false;\n };\n }\n\n // --- Detection path 3: OneTrustGroupsUpdated event ---\n eventListener = () => {\n handleConsent();\n };\n actualWindow.addEventListener('OneTrustGroupsUpdated', eventListener);\n }\n\n return {\n type: 'cookiepro',\n config: fullConfig,\n push: elb,\n destroy: async (_context) => {\n // Remove event listener\n if (actualWindow && eventListener) {\n actualWindow.removeEventListener(\n 'OneTrustGroupsUpdated',\n eventListener,\n );\n }\n // Restore original OptanonWrapper\n if (actualWindow && wrappedOptanonWrapper) {\n actualWindow.OptanonWrapper = originalOptanonWrapper;\n }\n },\n };\n};\n\nexport default sourceCookiePro;\n"],"mappings":";;;;;;;AAAA;;;ACWO,IAAM,cAAc;AAKpB,IAAM,iBAAiB;AAKvB,IAAM,iBAAiB;AAKvB,IAAM,uBAAuB;AAK7B,IAAM,uBAAuB;AAK7B,IAAM,eAAe;AAKrB,IAAM,wBAAwB;;;ACnB9B,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,uBAAyC;AAAA,EACpD,YAAY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F,CAAC;AAEH,aAAO;AAAA,IACT;AAMA,UAAM,gBAAgB,MAAM;AAC1B,YAAM,eAAe,aAAa;AAClC,UAAI,iBAAiB,UAAa,iBAAiB,KAAM;AAGzD,UAAI,SAAS,cAAc;AACzB,cAAMC,OAAM,aAAa,UAAU;AACnC,aAAIA,QAAA,gBAAAA,KAAK,qBAAoB,CAACA,KAAI,iBAAiB,EAAG;AAAA,MACxD;AAEA,YAAM,QAAQ,kBAAkB,YAAY;AAG5C,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAGA,UAAM,MAAM,aAAa,UAAU;AACnC,QAAI,OAAO,aAAa,wBAAwB,QAAW;AACzD,oBAAc;AAAA,IAChB;AAMA,QAAI,CAAC,KAAK;AACR,+BAAyB,aAAa;AACtC,8BAAwB;AAExB,mBAAa,iBAAiB,MAAM;AAElC,YAAI,uBAAwB,wBAAuB;AACnD,sBAAc;AAGd,qBAAa,iBAAiB;AAC9B,gCAAwB;AAAA,MAC1B;AAAA,IACF;AAGA,oBAAgB,MAAM;AACpB,oBAAc;AAAA,IAChB;AACA,iBAAa,iBAAiB,yBAAyB,aAAa;AAAA,EACtE;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,OAAO,aAAa;AAE3B,UAAI,gBAAgB,eAAe;AACjC,qBAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAEA,UAAI,gBAAgB,uBAAuB;AACzC,qBAAa,iBAAiB;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["fullConsent","minimalConsent","cmp"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$meta": {
|
|
3
|
+
"package": "@walkeros/web-source-cmp-cookiepro",
|
|
4
|
+
"version": "2.1.0",
|
|
5
|
+
"type": "source",
|
|
6
|
+
"platform": "web",
|
|
7
|
+
"renderer": "codebox"
|
|
8
|
+
},
|
|
9
|
+
"schemas": {},
|
|
10
|
+
"examples": {
|
|
11
|
+
"analyticsOnlyConsent": ",C0001,C0002,",
|
|
12
|
+
"analyticsOnlyMapped": {
|
|
13
|
+
"functional": true,
|
|
14
|
+
"analytics": true,
|
|
15
|
+
"marketing": false
|
|
16
|
+
},
|
|
17
|
+
"createMockElbFn": {
|
|
18
|
+
"$code": "()=>()=>Promise.resolve({ok:!0})"
|
|
19
|
+
},
|
|
20
|
+
"createMockOneTrustAPI": {
|
|
21
|
+
"$code": "(n=!1)=>({IsAlertBoxClosed:()=>n})"
|
|
22
|
+
},
|
|
23
|
+
"customCategoryConsent": ",C0001,CUSTOM01,CUSTOM02,",
|
|
24
|
+
"emptyConsent": "",
|
|
25
|
+
"fullConsent": ",C0001,C0002,C0003,C0004,C0005,",
|
|
26
|
+
"fullConsentMapped": {
|
|
27
|
+
"functional": true,
|
|
28
|
+
"analytics": true,
|
|
29
|
+
"marketing": true
|
|
30
|
+
},
|
|
31
|
+
"marketingOnlyConsent": ",C0001,C0004,",
|
|
32
|
+
"marketingOnlyMapped": {
|
|
33
|
+
"functional": true,
|
|
34
|
+
"analytics": false,
|
|
35
|
+
"marketing": true
|
|
36
|
+
},
|
|
37
|
+
"minimalConsent": ",C0001,",
|
|
38
|
+
"minimalConsentMapped": {
|
|
39
|
+
"functional": true,
|
|
40
|
+
"analytics": false,
|
|
41
|
+
"marketing": false
|
|
42
|
+
},
|
|
43
|
+
"noopLogger": {
|
|
44
|
+
"error": {
|
|
45
|
+
"$code": "()=>{}"
|
|
46
|
+
},
|
|
47
|
+
"warn": {
|
|
48
|
+
"$code": "()=>{}"
|
|
49
|
+
},
|
|
50
|
+
"info": {
|
|
51
|
+
"$code": "()=>{}"
|
|
52
|
+
},
|
|
53
|
+
"debug": {
|
|
54
|
+
"$code": "()=>{}"
|
|
55
|
+
},
|
|
56
|
+
"throw": {
|
|
57
|
+
"$code": "n=>{throw\"string\"==typeof n?new Error(n):n}"
|
|
58
|
+
},
|
|
59
|
+
"json": {
|
|
60
|
+
"$code": "()=>{}"
|
|
61
|
+
},
|
|
62
|
+
"scope": {
|
|
63
|
+
"$code": "()=>k"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"partialConsent": ",C0001,C0003,",
|
|
67
|
+
"partialConsentMapped": {
|
|
68
|
+
"functional": true,
|
|
69
|
+
"analytics": false,
|
|
70
|
+
"marketing": false
|
|
71
|
+
},
|
|
72
|
+
"setup": {
|
|
73
|
+
"$code": "(n,t)=>{const e=t.window;\"string\"==typeof n&&(e.OptanonActiveGroups=n,e.OneTrust={IsAlertBoxClosed:()=>!0})}"
|
|
74
|
+
},
|
|
75
|
+
"step": {
|
|
76
|
+
"fullConsent": {
|
|
77
|
+
"in": ",C0001,C0002,C0003,C0004,C0005,",
|
|
78
|
+
"out": {
|
|
79
|
+
"functional": true,
|
|
80
|
+
"analytics": true,
|
|
81
|
+
"marketing": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"minimalConsent": {
|
|
85
|
+
"in": ",C0001,",
|
|
86
|
+
"out": {
|
|
87
|
+
"functional": true,
|
|
88
|
+
"analytics": false,
|
|
89
|
+
"marketing": false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-source-cmp-cookiepro",
|
|
3
3
|
"description": "CookiePro/OneTrust consent management source for walkerOS",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"walkerOS": {
|
|
7
7
|
"type": "source",
|
|
8
|
-
"platform": "web"
|
|
8
|
+
"platform": "web",
|
|
9
|
+
"renderer": "codebox"
|
|
9
10
|
},
|
|
10
11
|
"main": "./dist/index.js",
|
|
11
12
|
"module": "./dist/index.mjs",
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"update": "npx npm-check-updates -u && npm update"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@walkeros/core": "^2.
|
|
43
|
-
"@walkeros/collector": "^2.
|
|
43
|
+
"@walkeros/core": "^2.1.1",
|
|
44
|
+
"@walkeros/collector": "^2.1.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {},
|
|
46
47
|
"repository": {
|