@walkeros/web-source-cmp-cookiefirst 3.0.1 → 4.0.0-next-1773967844643
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +25 -16
- package/dist/dev.d.ts +25 -16
- 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 +23 -15
- package/dist/examples/index.d.ts +23 -15
- package/dist/examples/index.js +33 -6
- package/dist/examples/index.mjs +30 -4
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +24 -17
- package/dist/index.d.ts +24 -17
- 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 +23 -6
- package/package.json +6 -4
package/dist/dev.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Source, Logger, Flow } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Source, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CookieFirst consent object structure
|
|
5
5
|
*/
|
|
6
|
-
interface CookieFirstConsent {
|
|
6
|
+
interface CookieFirstConsent$1 {
|
|
7
7
|
necessary?: boolean;
|
|
8
8
|
functional?: boolean;
|
|
9
9
|
performance?: boolean;
|
|
@@ -14,7 +14,7 @@ interface CookieFirstConsent {
|
|
|
14
14
|
* CookieFirst global API interface
|
|
15
15
|
*/
|
|
16
16
|
interface CookieFirstAPI {
|
|
17
|
-
consent: CookieFirstConsent | null;
|
|
17
|
+
consent: CookieFirstConsent$1 | null;
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
}
|
|
24
24
|
interface WindowEventMap {
|
|
25
25
|
cf_init: Event;
|
|
26
|
-
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent$1>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,28 +35,28 @@ declare global {
|
|
|
35
35
|
/**
|
|
36
36
|
* Full consent - user accepted all categories
|
|
37
37
|
*/
|
|
38
|
-
declare const fullConsent$1: CookieFirstConsent;
|
|
38
|
+
declare const fullConsent$1: CookieFirstConsent$1;
|
|
39
39
|
/**
|
|
40
40
|
* Partial consent - user accepted only necessary and functional
|
|
41
41
|
*/
|
|
42
|
-
declare const partialConsent$1: CookieFirstConsent;
|
|
42
|
+
declare const partialConsent$1: CookieFirstConsent$1;
|
|
43
43
|
/**
|
|
44
44
|
* Minimal consent - user accepted only necessary (required)
|
|
45
45
|
*/
|
|
46
|
-
declare const minimalConsent: CookieFirstConsent;
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent$1;
|
|
47
47
|
/**
|
|
48
48
|
* No consent - user hasn't made a choice yet
|
|
49
49
|
* CookieFirst returns null when no explicit choice has been made
|
|
50
50
|
*/
|
|
51
|
-
declare const noConsent: CookieFirstConsent | null;
|
|
51
|
+
declare const noConsent: CookieFirstConsent$1 | null;
|
|
52
52
|
/**
|
|
53
53
|
* Analytics only - user accepted performance tracking
|
|
54
54
|
*/
|
|
55
|
-
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent$1;
|
|
56
56
|
/**
|
|
57
57
|
* Marketing only - user accepted advertising
|
|
58
58
|
*/
|
|
59
|
-
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent$1;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Expected walkerOS consent outputs.
|
|
@@ -107,11 +107,11 @@ interface CookieFirstEnv extends Source.BaseEnv {
|
|
|
107
107
|
/**
|
|
108
108
|
* Create a mock CookieFirst API object
|
|
109
109
|
*/
|
|
110
|
-
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent$1 | null) => CookieFirstAPI;
|
|
111
111
|
/**
|
|
112
112
|
* Create a mock window object with CookieFirst
|
|
113
113
|
*/
|
|
114
|
-
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent$1 | null) => Partial<Window> & {
|
|
115
115
|
CookieFirst: CookieFirstAPI;
|
|
116
116
|
};
|
|
117
117
|
/**
|
|
@@ -135,8 +135,16 @@ declare namespace step {
|
|
|
135
135
|
export { step_categoryMapOverride as categoryMapOverride, step_cfInitDetection as cfInitDetection, step_fullConsent as fullConsent, step_partialConsent as partialConsent };
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
interface CookieFirstConsent {
|
|
139
|
+
necessary?: boolean;
|
|
140
|
+
functional?: boolean;
|
|
141
|
+
performance?: boolean;
|
|
142
|
+
advertising?: boolean;
|
|
143
|
+
[category: string]: boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
declare const createTrigger: Trigger.CreateFn<CookieFirstConsent, void>;
|
|
146
|
+
/** Sets window.CookieFirst.consent before source init (legacy). */
|
|
147
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
140
148
|
|
|
141
149
|
/**
|
|
142
150
|
* CookieFirst source examples for testing and documentation.
|
|
@@ -147,6 +155,7 @@ declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
|
147
155
|
declare const index_createMockCookieFirstAPI: typeof createMockCookieFirstAPI;
|
|
148
156
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
149
157
|
declare const index_createMockWindow: typeof createMockWindow;
|
|
158
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
150
159
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
151
160
|
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
152
161
|
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
@@ -156,10 +165,10 @@ declare const index_mockEnv: typeof mockEnv;
|
|
|
156
165
|
declare const index_noConsent: typeof noConsent;
|
|
157
166
|
declare const index_noopLogger: typeof noopLogger;
|
|
158
167
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
159
|
-
declare const index_setup: typeof setup;
|
|
160
168
|
declare const index_step: typeof step;
|
|
169
|
+
declare const index_trigger: typeof trigger;
|
|
161
170
|
declare namespace index {
|
|
162
|
-
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, partialConsent$1 as partialConsent, index_partialConsentMapped as partialConsentMapped,
|
|
171
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, index_createTrigger as createTrigger, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, partialConsent$1 as partialConsent, index_partialConsentMapped as partialConsentMapped, index_step as step, index_trigger as trigger };
|
|
163
172
|
}
|
|
164
173
|
|
|
165
174
|
export { index as examples };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Source, Logger, Flow } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Source, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CookieFirst consent object structure
|
|
5
5
|
*/
|
|
6
|
-
interface CookieFirstConsent {
|
|
6
|
+
interface CookieFirstConsent$1 {
|
|
7
7
|
necessary?: boolean;
|
|
8
8
|
functional?: boolean;
|
|
9
9
|
performance?: boolean;
|
|
@@ -14,7 +14,7 @@ interface CookieFirstConsent {
|
|
|
14
14
|
* CookieFirst global API interface
|
|
15
15
|
*/
|
|
16
16
|
interface CookieFirstAPI {
|
|
17
|
-
consent: CookieFirstConsent | null;
|
|
17
|
+
consent: CookieFirstConsent$1 | null;
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
}
|
|
24
24
|
interface WindowEventMap {
|
|
25
25
|
cf_init: Event;
|
|
26
|
-
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent$1>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,28 +35,28 @@ declare global {
|
|
|
35
35
|
/**
|
|
36
36
|
* Full consent - user accepted all categories
|
|
37
37
|
*/
|
|
38
|
-
declare const fullConsent$1: CookieFirstConsent;
|
|
38
|
+
declare const fullConsent$1: CookieFirstConsent$1;
|
|
39
39
|
/**
|
|
40
40
|
* Partial consent - user accepted only necessary and functional
|
|
41
41
|
*/
|
|
42
|
-
declare const partialConsent$1: CookieFirstConsent;
|
|
42
|
+
declare const partialConsent$1: CookieFirstConsent$1;
|
|
43
43
|
/**
|
|
44
44
|
* Minimal consent - user accepted only necessary (required)
|
|
45
45
|
*/
|
|
46
|
-
declare const minimalConsent: CookieFirstConsent;
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent$1;
|
|
47
47
|
/**
|
|
48
48
|
* No consent - user hasn't made a choice yet
|
|
49
49
|
* CookieFirst returns null when no explicit choice has been made
|
|
50
50
|
*/
|
|
51
|
-
declare const noConsent: CookieFirstConsent | null;
|
|
51
|
+
declare const noConsent: CookieFirstConsent$1 | null;
|
|
52
52
|
/**
|
|
53
53
|
* Analytics only - user accepted performance tracking
|
|
54
54
|
*/
|
|
55
|
-
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent$1;
|
|
56
56
|
/**
|
|
57
57
|
* Marketing only - user accepted advertising
|
|
58
58
|
*/
|
|
59
|
-
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent$1;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Expected walkerOS consent outputs.
|
|
@@ -107,11 +107,11 @@ interface CookieFirstEnv extends Source.BaseEnv {
|
|
|
107
107
|
/**
|
|
108
108
|
* Create a mock CookieFirst API object
|
|
109
109
|
*/
|
|
110
|
-
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent$1 | null) => CookieFirstAPI;
|
|
111
111
|
/**
|
|
112
112
|
* Create a mock window object with CookieFirst
|
|
113
113
|
*/
|
|
114
|
-
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent$1 | null) => Partial<Window> & {
|
|
115
115
|
CookieFirst: CookieFirstAPI;
|
|
116
116
|
};
|
|
117
117
|
/**
|
|
@@ -135,8 +135,16 @@ declare namespace step {
|
|
|
135
135
|
export { step_categoryMapOverride as categoryMapOverride, step_cfInitDetection as cfInitDetection, step_fullConsent as fullConsent, step_partialConsent as partialConsent };
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
interface CookieFirstConsent {
|
|
139
|
+
necessary?: boolean;
|
|
140
|
+
functional?: boolean;
|
|
141
|
+
performance?: boolean;
|
|
142
|
+
advertising?: boolean;
|
|
143
|
+
[category: string]: boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
declare const createTrigger: Trigger.CreateFn<CookieFirstConsent, void>;
|
|
146
|
+
/** Sets window.CookieFirst.consent before source init (legacy). */
|
|
147
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
140
148
|
|
|
141
149
|
/**
|
|
142
150
|
* CookieFirst source examples for testing and documentation.
|
|
@@ -147,6 +155,7 @@ declare const index_analyticsOnlyMapped: typeof analyticsOnlyMapped;
|
|
|
147
155
|
declare const index_createMockCookieFirstAPI: typeof createMockCookieFirstAPI;
|
|
148
156
|
declare const index_createMockElbFn: typeof createMockElbFn;
|
|
149
157
|
declare const index_createMockWindow: typeof createMockWindow;
|
|
158
|
+
declare const index_createTrigger: typeof createTrigger;
|
|
150
159
|
declare const index_fullConsentMapped: typeof fullConsentMapped;
|
|
151
160
|
declare const index_marketingOnlyConsent: typeof marketingOnlyConsent;
|
|
152
161
|
declare const index_marketingOnlyMapped: typeof marketingOnlyMapped;
|
|
@@ -156,10 +165,10 @@ declare const index_mockEnv: typeof mockEnv;
|
|
|
156
165
|
declare const index_noConsent: typeof noConsent;
|
|
157
166
|
declare const index_noopLogger: typeof noopLogger;
|
|
158
167
|
declare const index_partialConsentMapped: typeof partialConsentMapped;
|
|
159
|
-
declare const index_setup: typeof setup;
|
|
160
168
|
declare const index_step: typeof step;
|
|
169
|
+
declare const index_trigger: typeof trigger;
|
|
161
170
|
declare namespace index {
|
|
162
|
-
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, partialConsent$1 as partialConsent, index_partialConsentMapped as partialConsentMapped,
|
|
171
|
+
export { index_analyticsOnlyConsent as analyticsOnlyConsent, index_analyticsOnlyMapped as analyticsOnlyMapped, index_createMockCookieFirstAPI as createMockCookieFirstAPI, index_createMockElbFn as createMockElbFn, index_createMockWindow as createMockWindow, index_createTrigger as createTrigger, fullConsent$1 as fullConsent, index_fullConsentMapped as fullConsentMapped, index_marketingOnlyConsent as marketingOnlyConsent, index_marketingOnlyMapped as marketingOnlyMapped, index_minimalConsent as minimalConsent, index_minimalConsentMapped as minimalConsentMapped, index_mockEnv as mockEnv, index_noConsent as noConsent, index_noopLogger as noopLogger, partialConsent$1 as partialConsent, index_partialConsentMapped as partialConsentMapped, index_step as step, index_trigger as trigger };
|
|
163
172
|
}
|
|
164
173
|
|
|
165
174
|
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,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},o={};i(o,{examples:()=>c}),module.exports=(e=o,((e,i,o,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of r(i))a.call(e,s)||s===o||n(e,s,{get:()=>i[s],enumerable:!(c=t(i,s))||c.enumerable});return e})(n({},"__esModule",{value:!0}),e));var c={};i(c,{analyticsOnlyConsent:()=>u,analyticsOnlyMapped:()=>v,createMockCookieFirstAPI:()=>M,createMockElbFn:()=>C,createMockWindow:()=>O,createTrigger:()=>x,fullConsent:()=>s,fullConsentMapped:()=>y,marketingOnlyConsent:()=>f,marketingOnlyMapped:()=>k,minimalConsent:()=>p,minimalConsentMapped:()=>d,mockEnv:()=>E,noConsent:()=>g,noopLogger:()=>b,partialConsent:()=>l,partialConsentMapped:()=>m,step:()=>j,trigger:()=>D});var s={necessary:!0,functional:!0,performance:!0,advertising:!0},l={necessary:!0,functional:!0,performance:!1,advertising:!1},p={necessary:!0,functional:!1,performance:!1,advertising:!1},g=null,u={necessary:!0,functional:!1,performance:!0,advertising:!1},f={necessary:!0,functional:!1,performance:!1,advertising:!0},y={functional:!0,analytics:!0,marketing:!0},m={functional:!0,analytics:!1,marketing:!1},d={functional:!0,analytics:!1,marketing:!1},v={functional:!0,analytics:!0,marketing:!1},k={functional:!0,analytics:!1,marketing:!0},w=()=>{},C=()=>()=>Promise.resolve({ok:!0}),b={error:w,warn:w,info:w,debug:w,throw:e=>{throw"string"==typeof e?new Error(e):e},json:w,scope:()=>b},M=(e=null)=>({consent:e}),O=(e=null)=>({CookieFirst:M(e),addEventListener:w,removeEventListener:w}),E={get push(){return C()},get command(){return C()},get elb(){return C()},get window(){return O()},logger:b},j={};i(j,{categoryMapOverride:()=>F,cfInitDetection:()=>_,fullConsent:()=>P,partialConsent:()=>h});var P={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:{functional:!0,analytics:!0,marketing:!0}},h={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:{functional:!0,analytics:!1,marketing:!1}},F={description:"Custom categoryMap remaps performance to statistics instead of analytics",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!0,advertising:!1},mapping:{settings:{categoryMap:{performance:"statistics"}}},out:{functional:!0,statistics:!0,marketing:!1}},_={description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:{functional:!0,analytics:!1,marketing:!0}},L=require("@walkeros/collector"),x=async e=>{let n;return{get flow(){return n},trigger:()=>async t=>{var r;if(window.CookieFirst={consent:t},!n){const t=await(0,L.startFlow)({...e,run:null==(r=e.run)||r});n={collector:t.collector,elb:t.elb}}window.dispatchEvent(new Event("cf_init"))}}},D=(e,n)=>{e&&"object"==typeof e&&(n.window.CookieFirst={consent:e})};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { setup } from './setup';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\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 { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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 * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets window.CookieFirst.consent before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\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;AAAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,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;;;AC9CA,IAAM,OAAO,MAAM;AAAC;A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,IACX,WAAW;AAAA,EACb;AACF;AAEO,IAAM,sBAAwC;AAAA,EACnD,aACE;AAAA,EACF,IAAI;AAAA,IACF,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,aAAa;AAAA,QACX,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,aAAa;AAAA,EACb,IAAI;AAAA,IACF,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;;;AC/DO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,EAAC,IAAI,OAAmC,cAAc,EAAE,SAAS,MAAM;AACzE;","names":["fullConsent","partialConsent"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\n","/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\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 { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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 * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n"],"mapp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ullConsent","partialConsent","trigger"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty,e=(e,t)=>{for(var
|
|
1
|
+
var n=Object.defineProperty,e=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},t={};e(t,{analyticsOnlyConsent:()=>s,analyticsOnlyMapped:()=>f,createMockCookieFirstAPI:()=>v,createMockElbFn:()=>y,createMockWindow:()=>k,createTrigger:()=>F,fullConsent:()=>r,fullConsentMapped:()=>l,marketingOnlyConsent:()=>c,marketingOnlyMapped:()=>u,minimalConsent:()=>i,minimalConsentMapped:()=>p,mockEnv:()=>C,noConsent:()=>o,noopLogger:()=>d,partialConsent:()=>a,partialConsentMapped:()=>g,step:()=>w,trigger:()=>P});var r={necessary:!0,functional:!0,performance:!0,advertising:!0},a={necessary:!0,functional:!0,performance:!1,advertising:!1},i={necessary:!0,functional:!1,performance:!1,advertising:!1},o=null,s={necessary:!0,functional:!1,performance:!0,advertising:!1},c={necessary:!0,functional:!1,performance:!1,advertising:!0},l={functional:!0,analytics:!0,marketing:!0},g={functional:!0,analytics:!1,marketing:!1},p={functional:!0,analytics:!1,marketing:!1},f={functional:!0,analytics:!0,marketing:!1},u={functional:!0,analytics:!1,marketing:!0},m=()=>{},y=()=>()=>Promise.resolve({ok:!0}),d={error:m,warn:m,info:m,debug:m,throw:n=>{throw"string"==typeof n?new Error(n):n},json:m,scope:()=>d},v=(n=null)=>({consent:n}),k=(n=null)=>({CookieFirst:v(n),addEventListener:m,removeEventListener:m}),C={get push(){return y()},get command(){return y()},get elb(){return y()},get window(){return k()},logger:d},w={};e(w,{categoryMapOverride:()=>E,cfInitDetection:()=>O,fullConsent:()=>M,partialConsent:()=>b});var M={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:{functional:!0,analytics:!0,marketing:!0}},b={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:{functional:!0,analytics:!1,marketing:!1}},E={description:"Custom categoryMap remaps performance to statistics instead of analytics",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!0,advertising:!1},mapping:{settings:{categoryMap:{performance:"statistics"}}},out:{functional:!0,statistics:!0,marketing:!1}},O={description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:{functional:!0,analytics:!1,marketing:!0}};import{startFlow as h}from"@walkeros/collector";var F=async n=>{let e;return{get flow(){return e},trigger:()=>async t=>{var r;if(window.CookieFirst={consent:t},!e){const t=await h({...n,run:null==(r=n.run)||r});e={collector:t.collector,elb:t.elb}}window.dispatchEvent(new Event("cf_init"))}}},P=(n,e)=>{n&&"object"==typeof n&&(e.window.CookieFirst={consent:n})};export{t as examples};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/setup.ts"],"sourcesContent":["/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { setup } from './setup';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\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 { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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 * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Source } from '@walkeros/core';\n\n/** Sets window.CookieFirst.consent before source init. */\nexport const setup: Source.SetupFn = (input, env) => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAOO,IAAM,sBAAwC;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IAAMC,kBAAmC;AAAA,EAC9C,IAAI;AAAA,IACF,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;AAEO,IAAM,sBAAwC;AAAA,EACnD,aACE;AAAA,EACF,IAAI;AAAA,IACF,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,aAAa;AAAA,QACX,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAEO,IAAM,kBAAoC;AAAA,EAC/C,aAAa;AAAA,EACb,IAAI;AAAA,IACF,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,WAAW;AAAA,EACb;AACF;;;AC/DO,IAAM,QAAwB,CAAC,OAAO,QAAQ;AACnD,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AACzC,EAAC,IAAI,OAAmC,cAAc,EAAE,SAAS,MAAM;AACzE;","names":["fullConsent","partialConsent"]}
|
|
1
|
+
{"version":3,"sources":["../src/examples/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts"],"sourcesContent":["/**\n * CookieFirst source examples for testing and documentation.\n */\n\nexport * from './inputs';\nexport * from './outputs';\nexport * from './env';\nexport * as step from './step';\nexport { createTrigger, trigger } from './trigger';\n","import type { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\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 { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\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 * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,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;;;AC9CA,IAAM,OAAO,MAAM;AAAC;AAKb,IAAM,kBAAkB,MAAc;AAC3C,QAAM,MAAM,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UAAU,SAAU;AACzC,EAAC,IAAI,OAAmC,cAAc,EAAE,SAAS,MAAM;AACzE;","names":["fullConsent","partialConsent","trigger"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Source, Logger, Flow } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Source, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CookieFirst consent object structure
|
|
5
5
|
*/
|
|
6
|
-
interface CookieFirstConsent {
|
|
6
|
+
interface CookieFirstConsent$1 {
|
|
7
7
|
necessary?: boolean;
|
|
8
8
|
functional?: boolean;
|
|
9
9
|
performance?: boolean;
|
|
@@ -14,7 +14,7 @@ interface CookieFirstConsent {
|
|
|
14
14
|
* CookieFirst global API interface
|
|
15
15
|
*/
|
|
16
16
|
interface CookieFirstAPI {
|
|
17
|
-
consent: CookieFirstConsent | null;
|
|
17
|
+
consent: CookieFirstConsent$1 | null;
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
}
|
|
24
24
|
interface WindowEventMap {
|
|
25
25
|
cf_init: Event;
|
|
26
|
-
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent$1>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,28 +35,28 @@ declare global {
|
|
|
35
35
|
/**
|
|
36
36
|
* Full consent - user accepted all categories
|
|
37
37
|
*/
|
|
38
|
-
declare const fullConsent$1: CookieFirstConsent;
|
|
38
|
+
declare const fullConsent$1: CookieFirstConsent$1;
|
|
39
39
|
/**
|
|
40
40
|
* Partial consent - user accepted only necessary and functional
|
|
41
41
|
*/
|
|
42
|
-
declare const partialConsent$1: CookieFirstConsent;
|
|
42
|
+
declare const partialConsent$1: CookieFirstConsent$1;
|
|
43
43
|
/**
|
|
44
44
|
* Minimal consent - user accepted only necessary (required)
|
|
45
45
|
*/
|
|
46
|
-
declare const minimalConsent: CookieFirstConsent;
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent$1;
|
|
47
47
|
/**
|
|
48
48
|
* No consent - user hasn't made a choice yet
|
|
49
49
|
* CookieFirst returns null when no explicit choice has been made
|
|
50
50
|
*/
|
|
51
|
-
declare const noConsent: CookieFirstConsent | null;
|
|
51
|
+
declare const noConsent: CookieFirstConsent$1 | null;
|
|
52
52
|
/**
|
|
53
53
|
* Analytics only - user accepted performance tracking
|
|
54
54
|
*/
|
|
55
|
-
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent$1;
|
|
56
56
|
/**
|
|
57
57
|
* Marketing only - user accepted advertising
|
|
58
58
|
*/
|
|
59
|
-
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent$1;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Expected walkerOS consent outputs.
|
|
@@ -107,11 +107,11 @@ interface CookieFirstEnv extends Source.BaseEnv {
|
|
|
107
107
|
/**
|
|
108
108
|
* Create a mock CookieFirst API object
|
|
109
109
|
*/
|
|
110
|
-
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent$1 | null) => CookieFirstAPI;
|
|
111
111
|
/**
|
|
112
112
|
* Create a mock window object with CookieFirst
|
|
113
113
|
*/
|
|
114
|
-
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent$1 | null) => Partial<Window> & {
|
|
115
115
|
CookieFirst: CookieFirstAPI;
|
|
116
116
|
};
|
|
117
117
|
/**
|
|
@@ -135,7 +135,15 @@ declare namespace step {
|
|
|
135
135
|
export { step_categoryMapOverride as categoryMapOverride, step_cfInitDetection as cfInitDetection, step_fullConsent as fullConsent, step_partialConsent as partialConsent };
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
interface CookieFirstConsent {
|
|
139
|
+
necessary?: boolean;
|
|
140
|
+
functional?: boolean;
|
|
141
|
+
performance?: boolean;
|
|
142
|
+
advertising?: boolean;
|
|
143
|
+
[category: string]: boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
declare const createTrigger: Trigger.CreateFn<CookieFirstConsent, void>;
|
|
146
|
+
/** Sets window.CookieFirst.consent before source init (legacy). */
|
|
147
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
140
148
|
|
|
141
|
-
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockCookieFirstAPI, createMockElbFn, createMockWindow, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, mockEnv, noConsent, noopLogger, partialConsent$1 as partialConsent, partialConsentMapped,
|
|
149
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockCookieFirstAPI, createMockElbFn, createMockWindow, createTrigger, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, mockEnv, noConsent, noopLogger, partialConsent$1 as partialConsent, partialConsentMapped, step, trigger };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WalkerOS, Elb, Source, Logger, Flow } from '@walkeros/core';
|
|
1
|
+
import { WalkerOS, Elb, Source, Logger, Flow, Trigger } from '@walkeros/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CookieFirst consent object structure
|
|
5
5
|
*/
|
|
6
|
-
interface CookieFirstConsent {
|
|
6
|
+
interface CookieFirstConsent$1 {
|
|
7
7
|
necessary?: boolean;
|
|
8
8
|
functional?: boolean;
|
|
9
9
|
performance?: boolean;
|
|
@@ -14,7 +14,7 @@ interface CookieFirstConsent {
|
|
|
14
14
|
* CookieFirst global API interface
|
|
15
15
|
*/
|
|
16
16
|
interface CookieFirstAPI {
|
|
17
|
-
consent: CookieFirstConsent | null;
|
|
17
|
+
consent: CookieFirstConsent$1 | null;
|
|
18
18
|
}
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
}
|
|
24
24
|
interface WindowEventMap {
|
|
25
25
|
cf_init: Event;
|
|
26
|
-
cf_consent: CustomEvent<CookieFirstConsent>;
|
|
26
|
+
cf_consent: CustomEvent<CookieFirstConsent$1>;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,28 +35,28 @@ declare global {
|
|
|
35
35
|
/**
|
|
36
36
|
* Full consent - user accepted all categories
|
|
37
37
|
*/
|
|
38
|
-
declare const fullConsent$1: CookieFirstConsent;
|
|
38
|
+
declare const fullConsent$1: CookieFirstConsent$1;
|
|
39
39
|
/**
|
|
40
40
|
* Partial consent - user accepted only necessary and functional
|
|
41
41
|
*/
|
|
42
|
-
declare const partialConsent$1: CookieFirstConsent;
|
|
42
|
+
declare const partialConsent$1: CookieFirstConsent$1;
|
|
43
43
|
/**
|
|
44
44
|
* Minimal consent - user accepted only necessary (required)
|
|
45
45
|
*/
|
|
46
|
-
declare const minimalConsent: CookieFirstConsent;
|
|
46
|
+
declare const minimalConsent: CookieFirstConsent$1;
|
|
47
47
|
/**
|
|
48
48
|
* No consent - user hasn't made a choice yet
|
|
49
49
|
* CookieFirst returns null when no explicit choice has been made
|
|
50
50
|
*/
|
|
51
|
-
declare const noConsent: CookieFirstConsent | null;
|
|
51
|
+
declare const noConsent: CookieFirstConsent$1 | null;
|
|
52
52
|
/**
|
|
53
53
|
* Analytics only - user accepted performance tracking
|
|
54
54
|
*/
|
|
55
|
-
declare const analyticsOnlyConsent: CookieFirstConsent;
|
|
55
|
+
declare const analyticsOnlyConsent: CookieFirstConsent$1;
|
|
56
56
|
/**
|
|
57
57
|
* Marketing only - user accepted advertising
|
|
58
58
|
*/
|
|
59
|
-
declare const marketingOnlyConsent: CookieFirstConsent;
|
|
59
|
+
declare const marketingOnlyConsent: CookieFirstConsent$1;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Expected walkerOS consent outputs.
|
|
@@ -107,11 +107,11 @@ interface CookieFirstEnv extends Source.BaseEnv {
|
|
|
107
107
|
/**
|
|
108
108
|
* Create a mock CookieFirst API object
|
|
109
109
|
*/
|
|
110
|
-
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent | null) => CookieFirstAPI;
|
|
110
|
+
declare const createMockCookieFirstAPI: (consent?: CookieFirstConsent$1 | null) => CookieFirstAPI;
|
|
111
111
|
/**
|
|
112
112
|
* Create a mock window object with CookieFirst
|
|
113
113
|
*/
|
|
114
|
-
declare const createMockWindow: (consent?: CookieFirstConsent | null) => Partial<Window> & {
|
|
114
|
+
declare const createMockWindow: (consent?: CookieFirstConsent$1 | null) => Partial<Window> & {
|
|
115
115
|
CookieFirst: CookieFirstAPI;
|
|
116
116
|
};
|
|
117
117
|
/**
|
|
@@ -135,7 +135,15 @@ declare namespace step {
|
|
|
135
135
|
export { step_categoryMapOverride as categoryMapOverride, step_cfInitDetection as cfInitDetection, step_fullConsent as fullConsent, step_partialConsent as partialConsent };
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
interface CookieFirstConsent {
|
|
139
|
+
necessary?: boolean;
|
|
140
|
+
functional?: boolean;
|
|
141
|
+
performance?: boolean;
|
|
142
|
+
advertising?: boolean;
|
|
143
|
+
[category: string]: boolean | undefined;
|
|
144
|
+
}
|
|
145
|
+
declare const createTrigger: Trigger.CreateFn<CookieFirstConsent, void>;
|
|
146
|
+
/** Sets window.CookieFirst.consent before source init (legacy). */
|
|
147
|
+
declare const trigger: (input: unknown, env: Record<string, unknown>) => void;
|
|
140
148
|
|
|
141
|
-
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockCookieFirstAPI, createMockElbFn, createMockWindow, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, mockEnv, noConsent, noopLogger, partialConsent$1 as partialConsent, partialConsentMapped,
|
|
149
|
+
export { analyticsOnlyConsent, analyticsOnlyMapped, createMockCookieFirstAPI, createMockElbFn, createMockWindow, createTrigger, fullConsent$1 as fullConsent, fullConsentMapped, marketingOnlyConsent, marketingOnlyMapped, minimalConsent, minimalConsentMapped, mockEnv, noConsent, noopLogger, partialConsent$1 as partialConsent, partialConsentMapped, step, trigger };
|