@walkeros/web-source-cmp-cookiefirst 4.8.1 → 4.8.3-next-1793115089237
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/CHANGELOG.md +58 -3
- package/dist/dev.d.mts +2 -5
- package/dist/dev.d.ts +2 -5
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +2 -5
- package/dist/examples/index.d.ts +2 -5
- package/dist/examples/index.js +16 -7
- package/dist/examples/index.mjs +16 -7
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +19 -10
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @walkeros/web-source-cmp-cookiefirst
|
|
2
2
|
|
|
3
|
+
## 4.8.3-next-1793115089237
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 29d2218: Strictly necessary cookies no longer grant `functional`.
|
|
8
|
+
CookieFirst's `necessary` category and CookiePro's `C0001` are now reported as
|
|
9
|
+
`necessary`, so `functional` follows the visitor's choice for functional
|
|
10
|
+
cookies. Steps that require `functional`, such as the session source with
|
|
11
|
+
`consent: 'functional'`, now wait for that choice. When several categories map
|
|
12
|
+
to the same group, the group is now granted only if all of them are, as in the
|
|
13
|
+
Usercentrics source. CookiePro maps `C0005` (Social Media) to its own `social`
|
|
14
|
+
group instead of `marketing`, so a step for social media cookies requires
|
|
15
|
+
`social`. CookieFirst and Usercentrics match `categoryMap` keys
|
|
16
|
+
case-insensitively, like the other CMP sources.
|
|
17
|
+
- 5313635: The CookieFirst step example for a stored choice now describes what
|
|
18
|
+
it shows: CookieFirst already holds the visitor's choice when the source
|
|
19
|
+
starts, and the source emits it from its read at init.
|
|
20
|
+
- Updated dependencies [5313635]
|
|
21
|
+
- Updated dependencies [5313635]
|
|
22
|
+
- Updated dependencies [34fd225]
|
|
23
|
+
- Updated dependencies [34fd225]
|
|
24
|
+
- Updated dependencies [5313635]
|
|
25
|
+
- Updated dependencies [5313635]
|
|
26
|
+
- Updated dependencies [5313635]
|
|
27
|
+
- Updated dependencies [5313635]
|
|
28
|
+
- Updated dependencies [5313635]
|
|
29
|
+
- Updated dependencies [34fd225]
|
|
30
|
+
- Updated dependencies [5313635]
|
|
31
|
+
- @walkeros/collector@4.8.3-next-1793115089237
|
|
32
|
+
- @walkeros/core@4.8.3-next-1793115089237
|
|
33
|
+
|
|
34
|
+
## 4.8.2
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [2374f54]
|
|
39
|
+
- Updated dependencies [2374f54]
|
|
40
|
+
- Updated dependencies [7e5fc27]
|
|
41
|
+
- Updated dependencies [2374f54]
|
|
42
|
+
- Updated dependencies [2374f54]
|
|
43
|
+
- Updated dependencies [2374f54]
|
|
44
|
+
- Updated dependencies [2374f54]
|
|
45
|
+
- Updated dependencies [7e5fc27]
|
|
46
|
+
- Updated dependencies [2374f54]
|
|
47
|
+
- Updated dependencies [964590a]
|
|
48
|
+
- Updated dependencies [2374f54]
|
|
49
|
+
- Updated dependencies [7e5fc27]
|
|
50
|
+
- Updated dependencies [2374f54]
|
|
51
|
+
- Updated dependencies [964590a]
|
|
52
|
+
- Updated dependencies [4100ede]
|
|
53
|
+
- Updated dependencies [2374f54]
|
|
54
|
+
- Updated dependencies [2374f54]
|
|
55
|
+
- Updated dependencies [15eb7b2]
|
|
56
|
+
- Updated dependencies [33a2779]
|
|
57
|
+
- Updated dependencies [33a2779]
|
|
58
|
+
- @walkeros/collector@4.8.2
|
|
59
|
+
- @walkeros/core@4.8.2
|
|
60
|
+
|
|
3
61
|
## 4.8.1
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
|
@@ -266,9 +324,6 @@
|
|
|
266
324
|
and `event.context` remain required.
|
|
267
325
|
- Each source self-registers via TypeScript module augmentation of `SourceMap`
|
|
268
326
|
in `@walkeros/core`.
|
|
269
|
-
- App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
|
|
270
|
-
part of this release. Telemetry from v4 CLI/MCP will not validate against
|
|
271
|
-
the existing app schema until that follow-up ships.
|
|
272
327
|
- `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
|
|
273
328
|
configs using `skip: true` in mapping rules must rename to `silent: true`.
|
|
274
329
|
Hard cut: no legacy alias, the field is gone.
|
package/dist/dev.d.mts
CHANGED
|
@@ -76,7 +76,8 @@ declare const marketingOnlyConsent: CookieFirstConsent;
|
|
|
76
76
|
*/
|
|
77
77
|
/**
|
|
78
78
|
* Full consent mapped to walkerOS groups
|
|
79
|
-
* (
|
|
79
|
+
* (functional → functional, performance → analytics, advertising → marketing;
|
|
80
|
+
* necessary has no entry and keeps its own name)
|
|
80
81
|
*/
|
|
81
82
|
declare const fullConsentMapped: WalkerOS.Consent;
|
|
82
83
|
/**
|
|
@@ -89,14 +90,10 @@ declare const partialConsentMapped: WalkerOS.Consent;
|
|
|
89
90
|
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
90
91
|
/**
|
|
91
92
|
* Analytics only consent mapped to walkerOS groups
|
|
92
|
-
* Note: functional is true because necessary=true maps to functional
|
|
93
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
94
93
|
*/
|
|
95
94
|
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
96
95
|
/**
|
|
97
96
|
* Marketing only consent mapped to walkerOS groups
|
|
98
|
-
* Note: functional is true because necessary=true maps to functional
|
|
99
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
100
97
|
*/
|
|
101
98
|
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
102
99
|
|
package/dist/dev.d.ts
CHANGED
|
@@ -76,7 +76,8 @@ declare const marketingOnlyConsent: CookieFirstConsent;
|
|
|
76
76
|
*/
|
|
77
77
|
/**
|
|
78
78
|
* Full consent mapped to walkerOS groups
|
|
79
|
-
* (
|
|
79
|
+
* (functional → functional, performance → analytics, advertising → marketing;
|
|
80
|
+
* necessary has no entry and keeps its own name)
|
|
80
81
|
*/
|
|
81
82
|
declare const fullConsentMapped: WalkerOS.Consent;
|
|
82
83
|
/**
|
|
@@ -89,14 +90,10 @@ declare const partialConsentMapped: WalkerOS.Consent;
|
|
|
89
90
|
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
90
91
|
/**
|
|
91
92
|
* Analytics only consent mapped to walkerOS groups
|
|
92
|
-
* Note: functional is true because necessary=true maps to functional
|
|
93
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
94
93
|
*/
|
|
95
94
|
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
96
95
|
/**
|
|
97
96
|
* Marketing only consent mapped to walkerOS groups
|
|
98
|
-
* Note: functional is true because necessary=true maps to functional
|
|
99
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
100
97
|
*/
|
|
101
98
|
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
102
99
|
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},i={};o(i,{examples:()=>s,schemas:()=>q}),module.exports=(e=i,((e,o,i,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of r(o))a.call(e,c)||c===i||t(e,c,{get:()=>o[c],enumerable:!(s=n(o,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{analyticsOnlyConsent:()=>u,analyticsOnlyMapped:()=>k,createMockCookieFirstAPI:()=>h,createMockElbFn:()=>C,createMockWindow:()=>M,createTrigger:()=>A,fullConsent:()=>c,fullConsentMapped:()=>d,marketingOnlyConsent:()=>y,marketingOnlyMapped:()=>v,minimalConsent:()=>g,minimalConsentMapped:()=>f,mockEnv:()=>F,noConsent:()=>p,noopLogger:()=>b,partialConsent:()=>l,partialConsentMapped:()=>m,step:()=>O,trigger:()=>L});var c={necessary:!0,functional:!0,performance:!0,advertising:!0},l={necessary:!0,functional:!0,performance:!1,advertising:!1},g={necessary:!0,functional:!1,performance:!1,advertising:!1},p=null,u={necessary:!0,functional:!1,performance:!0,advertising:!1},y={necessary:!0,functional:!1,performance:!1,advertising:!0},d={necessary:!0,functional:!0,analytics:!0,marketing:!0},m={necessary:!0,functional:!0,analytics:!1,marketing:!1},f={necessary:!0,functional:!1,analytics:!1,marketing:!1},k={necessary:!0,functional:!1,analytics:!0,marketing:!1},v={necessary:!0,functional:!1,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},h=(e=null)=>({consent:e}),M=(e=null)=>({CookieFirst:h(e),addEventListener:w,removeEventListener:w}),F={get push(){return C()},get command(){return C()},get elb(){return C()},get window(){return M()},logger:b},O={};o(O,{categoryMapOverride:()=>E,cfInitDetection:()=>S,fullConsent:()=>j,partialConsent:()=>P});var j={title:"Full consent",description:"CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.",trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:[["elb","walker consent",{necessary:!0,functional:!0,analytics:!0,marketing:!0}]]},P={title:"Partial consent",description:"A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.",trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:[["elb","walker consent",{necessary:!0,functional:!0,analytics:!1,marketing:!1}]]},E={title:"Category map override",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:[["elb","walker consent",{necessary:!0,functional:!1,statistics:!0,marketing:!1}]]},S={title:"Stored choice at start",description:"CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{necessary:!0,functional:!1,analytics:!1,marketing:!0}]]},z=require("@walkeros/collector"),A=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await(0,z.startFlow)({...e,run:null==(r=e.run)||r});return void(t={collector:n.collector,elb:n.elb})}window.dispatchEvent(new CustomEvent("cf_consent",{detail:n}))}}},L=(e,t)=>{const n=t.window;var r;"object"==typeof(r=e)&&null!==r&&!Array.isArray(r)&&Object.values(r).every(e=>void 0===e||"boolean"==typeof e)&&function(e){return"object"==typeof e&&null!==e&&"addEventListener"in e}(n)&&(n.CookieFirst={consent:e})};var q={};o(q,{SettingsSchema:()=>x,settings:()=>I});var D=require("@walkeros/core/dev"),_=require("@walkeros/core/dev"),x=_.z.object({categoryMap:_.z.record(_.z.string(),_.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),globalName:_.z.string().describe("Custom name for the CookieFirst global on window. Default: 'CookieFirst'.").optional()}).meta({id:"CookieFirstSettings",title:"Settings",description:"Settings for the CookieFirst CMP source."}),I=(0,D.zodToSchema)(x);//# 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/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\nexport * as schemas from './schemas';\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 title: 'Full consent',\n description:\n 'CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: true,\n marketing: true,\n },\n ],\n ],\n};\n\nexport const partialConsent: Flow.StepExample = {\n title: 'Partial consent',\n description:\n 'A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: false,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\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 [\n 'elb',\n 'walker consent',\n {\n functional: true,\n statistics: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n title: 'cf_init detection',\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 [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: false,\n marketing: true,\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { CookieFirstConsent } from '../types';\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 // The banner keeps window.CookieFirst current.\n window.CookieFirst = { consent: content };\n\n // First call, the page load: the source reads the global at init and\n // emits once. No cf_init follows: in a browser it fires when the global\n // appears, so a page where the global is already set has seen it before\n // the source started. One page load emits one consent.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n return;\n }\n\n // Later calls are a decision on the loaded page: CookieFirst announces\n // it with cf_consent, carrying the new consent.\n window.dispatchEvent(\n new CustomEvent<CookieFirstConsent>('cf_consent', { detail: content }),\n );\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 const win = env.window;\n if (!isConsent(input) || !isWindow(win)) return;\n win.CookieFirst = { consent: input };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nfunction isConsent(value: unknown): value is CookieFirstConsent {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(\n (state) => state === undefined || typeof state === 'boolean',\n )\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * CookieFirst source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n globalName: z\n .string()\n .describe(\n \"Custom name for the CookieFirst global on window. Default: 'CookieFirst'.\",\n )\n .optional(),\n })\n .meta({\n id: 'CookieFirstSettings',\n title: 'Settings',\n description: 'Settings for the CookieFirst CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;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;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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ACP,aAAa;AACf,CAAC;;;ADlBI,IAAM,eAAW,yBAAY,cAAc;","names":["fullConsent","partialConsent","trigger","import_dev"]}
|
|
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","../src/schemas/index.ts","../src/schemas/settings.ts"],"sourcesContent":["/**\n * Development exports for testing and tooling.\n */\nexport * as examples from './examples';\nexport * as schemas from './schemas';\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 * (functional → functional, performance → analytics, advertising → marketing;\n * necessary has no entry and keeps its own name)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n necessary: true,\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 necessary: true,\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 necessary: true,\n functional: false,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n necessary: true,\n functional: false,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n necessary: true,\n functional: false,\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 title: 'Full consent',\n description:\n 'CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: true,\n analytics: true,\n marketing: true,\n },\n ],\n ],\n};\n\nexport const partialConsent: Flow.StepExample = {\n title: 'Partial consent',\n description:\n 'A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: true,\n analytics: false,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\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 [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: false,\n statistics: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n title: 'Stored choice at start',\n description:\n \"CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.\",\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: false,\n analytics: false,\n marketing: true,\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { CookieFirstConsent } from '../types';\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 // The banner keeps window.CookieFirst current.\n window.CookieFirst = { consent: content };\n\n // First call, the page load: the source reads the global at init and\n // emits once. No cf_init follows: in a browser it fires when the global\n // appears, so a page where the global is already set has seen it before\n // the source started. One page load emits one consent.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n return;\n }\n\n // Later calls are a decision on the loaded page: CookieFirst announces\n // it with cf_consent, carrying the new consent.\n window.dispatchEvent(\n new CustomEvent<CookieFirstConsent>('cf_consent', { detail: content }),\n );\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 const win = env.window;\n if (!isConsent(input) || !isWindow(win)) return;\n win.CookieFirst = { consent: input };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nfunction isConsent(value: unknown): value is CookieFirstConsent {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(\n (state) => state === undefined || typeof state === 'boolean',\n )\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * CookieFirst source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n globalName: z\n .string()\n .describe(\n \"Custom name for the CookieFirst global on window. Default: 'CookieFirst'.\",\n )\n .optional(),\n })\n .meta({\n id: 'CookieFirstSettings',\n title: 'Settings',\n description: 'Settings for the CookieFirst CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;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;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;;;AChDO,IAAM,oBAAsC;AAAA,EACjD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,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A,IACnB,CAAC,UAAU,UAAU,UAAa,OAAO,UAAU;AAAA,EACrD;AAEJ;;;AC7DA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,cAA4B;;;ACA5B,iBAAkB;AAKX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,aAAa,aACV,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,aACT,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADlBI,IAAM,eAAW,yBAAY,cAAc;","names":["fullConsent","partialConsent","trigger","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},n={};t(n,{analyticsOnlyConsent:()=>s,analyticsOnlyMapped:()=>m,createMockCookieFirstAPI:()=>k,createMockElbFn:()=>
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},n={};t(n,{analyticsOnlyConsent:()=>s,analyticsOnlyMapped:()=>m,createMockCookieFirstAPI:()=>k,createMockElbFn:()=>y,createMockWindow:()=>v,createTrigger:()=>O,fullConsent:()=>r,fullConsentMapped:()=>l,marketingOnlyConsent:()=>c,marketingOnlyMapped:()=>u,minimalConsent:()=>o,minimalConsentMapped:()=>p,mockEnv:()=>w,noConsent:()=>i,noopLogger:()=>f,partialConsent:()=>a,partialConsentMapped:()=>g,step:()=>C,trigger:()=>S});var r={necessary:!0,functional:!0,performance:!0,advertising:!0},a={necessary:!0,functional:!0,performance:!1,advertising:!1},o={necessary:!0,functional:!1,performance:!1,advertising:!1},i=null,s={necessary:!0,functional:!1,performance:!0,advertising:!1},c={necessary:!0,functional:!1,performance:!1,advertising:!0},l={necessary:!0,functional:!0,analytics:!0,marketing:!0},g={necessary:!0,functional:!0,analytics:!1,marketing:!1},p={necessary:!0,functional:!1,analytics:!1,marketing:!1},m={necessary:!0,functional:!1,analytics:!0,marketing:!1},u={necessary:!0,functional:!1,analytics:!1,marketing:!0},d=()=>{},y=()=>()=>Promise.resolve({ok:!0}),f={error:d,warn:d,info:d,debug:d,throw:e=>{throw"string"==typeof e?new Error(e):e},json:d,scope:()=>f},k=(e=null)=>({consent:e}),v=(e=null)=>({CookieFirst:k(e),addEventListener:d,removeEventListener:d}),w={get push(){return y()},get command(){return y()},get elb(){return y()},get window(){return v()},logger:f},C={};t(C,{categoryMapOverride:()=>M,cfInitDetection:()=>F,fullConsent:()=>b,partialConsent:()=>h});var b={title:"Full consent",description:"CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.",trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:[["elb","walker consent",{necessary:!0,functional:!0,analytics:!0,marketing:!0}]]},h={title:"Partial consent",description:"A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.",trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:[["elb","walker consent",{necessary:!0,functional:!0,analytics:!1,marketing:!1}]]},M={title:"Category map override",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:[["elb","walker consent",{necessary:!0,functional:!1,statistics:!0,marketing:!1}]]},F={title:"Stored choice at start",description:"CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{necessary:!0,functional:!1,analytics:!1,marketing:!0}]]};import{startFlow as E}from"@walkeros/collector";var O=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await E({...e,run:null==(r=e.run)||r});return void(t={collector:n.collector,elb:n.elb})}window.dispatchEvent(new CustomEvent("cf_consent",{detail:n}))}}},S=(e,t)=>{const n=t.window;var r;"object"==typeof(r=e)&&null!==r&&!Array.isArray(r)&&Object.values(r).every(e=>void 0===e||"boolean"==typeof e)&&function(e){return"object"==typeof e&&null!==e&&"addEventListener"in e}(n)&&(n.CookieFirst={consent:e})};var j={};t(j,{SettingsSchema:()=>L,settings:()=>x});import{zodToSchema as P}from"@walkeros/core/dev";import{z as A}from"@walkeros/core/dev";var L=A.object({categoryMap:A.record(A.string(),A.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),globalName:A.string().describe("Custom name for the CookieFirst global on window. Default: 'CookieFirst'.").optional()}).meta({id:"CookieFirstSettings",title:"Settings",description:"Settings for the CookieFirst CMP source."}),x=P(L);export{n as examples,j as schemas};//# 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/trigger.ts","../src/schemas/index.ts","../src/schemas/settings.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 title: 'Full consent',\n description:\n 'CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: true,\n marketing: true,\n },\n ],\n ],\n};\n\nexport const partialConsent: Flow.StepExample = {\n title: 'Partial consent',\n description:\n 'A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: false,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\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 [\n 'elb',\n 'walker consent',\n {\n functional: true,\n statistics: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n title: 'cf_init detection',\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 [\n 'elb',\n 'walker consent',\n {\n functional: true,\n analytics: false,\n marketing: true,\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { CookieFirstConsent } from '../types';\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 // The banner keeps window.CookieFirst current.\n window.CookieFirst = { consent: content };\n\n // First call, the page load: the source reads the global at init and\n // emits once. No cf_init follows: in a browser it fires when the global\n // appears, so a page where the global is already set has seen it before\n // the source started. One page load emits one consent.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n return;\n }\n\n // Later calls are a decision on the loaded page: CookieFirst announces\n // it with cf_consent, carrying the new consent.\n window.dispatchEvent(\n new CustomEvent<CookieFirstConsent>('cf_consent', { detail: content }),\n );\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 const win = env.window;\n if (!isConsent(input) || !isWindow(win)) return;\n win.CookieFirst = { consent: input };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nfunction isConsent(value: unknown): value is CookieFirstConsent {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(\n (state) => state === undefined || typeof state === 'boolean',\n )\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * CookieFirst source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n globalName: z\n .string()\n .describe(\n \"Custom name for the CookieFirst global on window. Default: 'CookieFirst'.\",\n )\n .optional(),\n })\n .meta({\n id: 'CookieFirstSettings',\n title: 'Settings',\n description: 'Settings for the CookieFirst CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\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,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AAI,cAAc,EAAE,SAAS,MAAM;AACrC;AAEA,SAAS,SAAS,OAAiC;AACjD,SACE,OAAO,UAAU,YAAY,UAAU,QAAQ,sBAAsB;AAEzE;AAEA,SAAS,UAAU,OAA6C;AAC9D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,OAAO,OAAO,KAAK,EAAE;AAAA,IACnB,CAAC,UAAU,UAAU,UAAa,OAAO,UAAU;AAAA,EACrD;AAEJ;;;AC7DA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAKX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,aAAa,EACV,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,EACT,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADlBI,IAAM,WAAW,YAAY,cAAc;","names":["fullConsent","partialConsent","trigger"]}
|
|
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","../src/schemas/index.ts","../src/schemas/settings.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 * (functional → functional, performance → analytics, advertising → marketing;\n * necessary has no entry and keeps its own name)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n necessary: true,\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 necessary: true,\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 necessary: true,\n functional: false,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n necessary: true,\n functional: false,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n necessary: true,\n functional: false,\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 title: 'Full consent',\n description:\n 'CookieFirst reports all categories granted and the source forwards a walker consent command with all groups true.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: true,\n analytics: true,\n marketing: true,\n },\n ],\n ],\n};\n\nexport const partialConsent: Flow.StepExample = {\n title: 'Partial consent',\n description:\n 'A partial CookieFirst grant maps analytics and marketing to false in the emitted walker consent command.',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: true,\n analytics: false,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n title: 'Category map override',\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 [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: false,\n statistics: true,\n marketing: false,\n },\n ],\n ],\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n title: 'Stored choice at start',\n description:\n \"CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.\",\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: [\n [\n 'elb',\n 'walker consent',\n {\n necessary: true,\n functional: false,\n analytics: false,\n marketing: true,\n },\n ],\n ],\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\nimport type { CookieFirstConsent } from '../types';\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 // The banner keeps window.CookieFirst current.\n window.CookieFirst = { consent: content };\n\n // First call, the page load: the source reads the global at init and\n // emits once. No cf_init follows: in a browser it fires when the global\n // appears, so a page where the global is already set has seen it before\n // the source started. One page load emits one consent.\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n return;\n }\n\n // Later calls are a decision on the loaded page: CookieFirst announces\n // it with cf_consent, carrying the new consent.\n window.dispatchEvent(\n new CustomEvent<CookieFirstConsent>('cf_consent', { detail: content }),\n );\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 const win = env.window;\n if (!isConsent(input) || !isWindow(win)) return;\n win.CookieFirst = { consent: input };\n};\n\nfunction isWindow(value: unknown): value is Window {\n return (\n typeof value === 'object' && value !== null && 'addEventListener' in value\n );\n}\n\nfunction isConsent(value: unknown): value is CookieFirstConsent {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(\n (state) => state === undefined || typeof state === 'boolean',\n )\n );\n}\n\nexport { createTrigger, trigger };\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\n// Export Zod schemas and types\nexport { SettingsSchema, type Settings } from './settings';\n\n// JSON Schema exports (for website PropertyTable and documentation tools)\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * CookieFirst source settings schema\n */\nexport const SettingsSchema = z\n .object({\n categoryMap: z\n .record(z.string(), z.string())\n .describe(\n \"Map the CMP's consent categories (keys) to walkerOS consent groups (values).\",\n )\n .optional(),\n\n globalName: z\n .string()\n .describe(\n \"Custom name for the CookieFirst global on window. Default: 'CookieFirst'.\",\n )\n .optional(),\n })\n .meta({\n id: 'CookieFirstSettings',\n title: 'Settings',\n description: 'Settings for the CookieFirst CMP source.',\n });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\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,EAC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AgC,cAAc,EAAE,QAAQ,QAAQ,CAAC;AAAA,IACvE;AAAA,EACF;AAEF,SAAO;AAAA,IACL,IAAI,OAAO;AACT,aAAO;AAAA,IACT;AAAA,IACA,SAAAA;AAAA,EACF;AACF;AAGA,IAAM,UAAU,CAAC,OAAgB,QAAuC;AACtE,QAAM,MAAM,IAAI;AAChB,MAAI,CAAC,UAAU,KAAK,KAAK,CAAC,SAAS,GAAG,EAAG;AACzC,MAAI,cAAc,EAAE,SAAS,MAAM;AACrC;AAEA,SAAS,SAAS,OAAiC;AACjD,SACE,OAAO,UAAU,YAAY,UAAU,QAAQ,sBAAsB;AAEzE;AAEA,SAAS,UAAU,OAA6C;AAC9D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,KACpB,OAAO,OAAO,KAAK,EAAE;AAAA,IACnB,CAAC,UAAU,UAAU,UAAa,OAAO,UAAU;AAAA,EACrD;AAEJ;;;AC7DA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAKX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,aAAa,EACV,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,YAAY,EACT,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,aAAa;AACf,CAAC;;;ADlBI,IAAM,WAAW,YAAY,cAAc;","names":["fullConsent","partialConsent","trigger"]}
|
|
@@ -74,7 +74,8 @@ declare const marketingOnlyConsent: CookieFirstConsent;
|
|
|
74
74
|
*/
|
|
75
75
|
/**
|
|
76
76
|
* Full consent mapped to walkerOS groups
|
|
77
|
-
* (
|
|
77
|
+
* (functional → functional, performance → analytics, advertising → marketing;
|
|
78
|
+
* necessary has no entry and keeps its own name)
|
|
78
79
|
*/
|
|
79
80
|
declare const fullConsentMapped: WalkerOS.Consent;
|
|
80
81
|
/**
|
|
@@ -87,14 +88,10 @@ declare const partialConsentMapped: WalkerOS.Consent;
|
|
|
87
88
|
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
88
89
|
/**
|
|
89
90
|
* Analytics only consent mapped to walkerOS groups
|
|
90
|
-
* Note: functional is true because necessary=true maps to functional
|
|
91
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
92
91
|
*/
|
|
93
92
|
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
94
93
|
/**
|
|
95
94
|
* Marketing only consent mapped to walkerOS groups
|
|
96
|
-
* Note: functional is true because necessary=true maps to functional
|
|
97
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
98
95
|
*/
|
|
99
96
|
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
100
97
|
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -74,7 +74,8 @@ declare const marketingOnlyConsent: CookieFirstConsent;
|
|
|
74
74
|
*/
|
|
75
75
|
/**
|
|
76
76
|
* Full consent mapped to walkerOS groups
|
|
77
|
-
* (
|
|
77
|
+
* (functional → functional, performance → analytics, advertising → marketing;
|
|
78
|
+
* necessary has no entry and keeps its own name)
|
|
78
79
|
*/
|
|
79
80
|
declare const fullConsentMapped: WalkerOS.Consent;
|
|
80
81
|
/**
|
|
@@ -87,14 +88,10 @@ declare const partialConsentMapped: WalkerOS.Consent;
|
|
|
87
88
|
declare const minimalConsentMapped: WalkerOS.Consent;
|
|
88
89
|
/**
|
|
89
90
|
* Analytics only consent mapped to walkerOS groups
|
|
90
|
-
* Note: functional is true because necessary=true maps to functional
|
|
91
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
92
91
|
*/
|
|
93
92
|
declare const analyticsOnlyMapped: WalkerOS.Consent;
|
|
94
93
|
/**
|
|
95
94
|
* Marketing only consent mapped to walkerOS groups
|
|
96
|
-
* Note: functional is true because necessary=true maps to functional
|
|
97
|
-
* (OR logic: if ANY source category is true, target group is true)
|
|
98
95
|
*/
|
|
99
96
|
declare const marketingOnlyMapped: WalkerOS.Consent;
|
|
100
97
|
|
package/dist/examples/index.js
CHANGED
|
@@ -77,27 +77,32 @@ var marketingOnlyConsent = {
|
|
|
77
77
|
|
|
78
78
|
// src/examples/outputs.ts
|
|
79
79
|
var fullConsentMapped = {
|
|
80
|
+
necessary: true,
|
|
80
81
|
functional: true,
|
|
81
82
|
analytics: true,
|
|
82
83
|
marketing: true
|
|
83
84
|
};
|
|
84
85
|
var partialConsentMapped = {
|
|
86
|
+
necessary: true,
|
|
85
87
|
functional: true,
|
|
86
88
|
analytics: false,
|
|
87
89
|
marketing: false
|
|
88
90
|
};
|
|
89
91
|
var minimalConsentMapped = {
|
|
90
|
-
|
|
92
|
+
necessary: true,
|
|
93
|
+
functional: false,
|
|
91
94
|
analytics: false,
|
|
92
95
|
marketing: false
|
|
93
96
|
};
|
|
94
97
|
var analyticsOnlyMapped = {
|
|
95
|
-
|
|
98
|
+
necessary: true,
|
|
99
|
+
functional: false,
|
|
96
100
|
analytics: true,
|
|
97
101
|
marketing: false
|
|
98
102
|
};
|
|
99
103
|
var marketingOnlyMapped = {
|
|
100
|
-
|
|
104
|
+
necessary: true,
|
|
105
|
+
functional: false,
|
|
101
106
|
analytics: false,
|
|
102
107
|
marketing: true
|
|
103
108
|
};
|
|
@@ -169,6 +174,7 @@ var fullConsent2 = {
|
|
|
169
174
|
"elb",
|
|
170
175
|
"walker consent",
|
|
171
176
|
{
|
|
177
|
+
necessary: true,
|
|
172
178
|
functional: true,
|
|
173
179
|
analytics: true,
|
|
174
180
|
marketing: true
|
|
@@ -191,6 +197,7 @@ var partialConsent2 = {
|
|
|
191
197
|
"elb",
|
|
192
198
|
"walker consent",
|
|
193
199
|
{
|
|
200
|
+
necessary: true,
|
|
194
201
|
functional: true,
|
|
195
202
|
analytics: false,
|
|
196
203
|
marketing: false
|
|
@@ -220,7 +227,8 @@ var categoryMapOverride = {
|
|
|
220
227
|
"elb",
|
|
221
228
|
"walker consent",
|
|
222
229
|
{
|
|
223
|
-
|
|
230
|
+
necessary: true,
|
|
231
|
+
functional: false,
|
|
224
232
|
statistics: true,
|
|
225
233
|
marketing: false
|
|
226
234
|
}
|
|
@@ -228,8 +236,8 @@ var categoryMapOverride = {
|
|
|
228
236
|
]
|
|
229
237
|
};
|
|
230
238
|
var cfInitDetection = {
|
|
231
|
-
title: "
|
|
232
|
-
description: "
|
|
239
|
+
title: "Stored choice at start",
|
|
240
|
+
description: "CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.",
|
|
233
241
|
trigger: { type: "consent" },
|
|
234
242
|
in: {
|
|
235
243
|
necessary: true,
|
|
@@ -242,7 +250,8 @@ var cfInitDetection = {
|
|
|
242
250
|
"elb",
|
|
243
251
|
"walker consent",
|
|
244
252
|
{
|
|
245
|
-
|
|
253
|
+
necessary: true,
|
|
254
|
+
functional: false,
|
|
246
255
|
analytics: false,
|
|
247
256
|
marketing: true
|
|
248
257
|
}
|
package/dist/examples/index.mjs
CHANGED
|
@@ -39,27 +39,32 @@ var marketingOnlyConsent = {
|
|
|
39
39
|
|
|
40
40
|
// src/examples/outputs.ts
|
|
41
41
|
var fullConsentMapped = {
|
|
42
|
+
necessary: true,
|
|
42
43
|
functional: true,
|
|
43
44
|
analytics: true,
|
|
44
45
|
marketing: true
|
|
45
46
|
};
|
|
46
47
|
var partialConsentMapped = {
|
|
48
|
+
necessary: true,
|
|
47
49
|
functional: true,
|
|
48
50
|
analytics: false,
|
|
49
51
|
marketing: false
|
|
50
52
|
};
|
|
51
53
|
var minimalConsentMapped = {
|
|
52
|
-
|
|
54
|
+
necessary: true,
|
|
55
|
+
functional: false,
|
|
53
56
|
analytics: false,
|
|
54
57
|
marketing: false
|
|
55
58
|
};
|
|
56
59
|
var analyticsOnlyMapped = {
|
|
57
|
-
|
|
60
|
+
necessary: true,
|
|
61
|
+
functional: false,
|
|
58
62
|
analytics: true,
|
|
59
63
|
marketing: false
|
|
60
64
|
};
|
|
61
65
|
var marketingOnlyMapped = {
|
|
62
|
-
|
|
66
|
+
necessary: true,
|
|
67
|
+
functional: false,
|
|
63
68
|
analytics: false,
|
|
64
69
|
marketing: true
|
|
65
70
|
};
|
|
@@ -131,6 +136,7 @@ var fullConsent2 = {
|
|
|
131
136
|
"elb",
|
|
132
137
|
"walker consent",
|
|
133
138
|
{
|
|
139
|
+
necessary: true,
|
|
134
140
|
functional: true,
|
|
135
141
|
analytics: true,
|
|
136
142
|
marketing: true
|
|
@@ -153,6 +159,7 @@ var partialConsent2 = {
|
|
|
153
159
|
"elb",
|
|
154
160
|
"walker consent",
|
|
155
161
|
{
|
|
162
|
+
necessary: true,
|
|
156
163
|
functional: true,
|
|
157
164
|
analytics: false,
|
|
158
165
|
marketing: false
|
|
@@ -182,7 +189,8 @@ var categoryMapOverride = {
|
|
|
182
189
|
"elb",
|
|
183
190
|
"walker consent",
|
|
184
191
|
{
|
|
185
|
-
|
|
192
|
+
necessary: true,
|
|
193
|
+
functional: false,
|
|
186
194
|
statistics: true,
|
|
187
195
|
marketing: false
|
|
188
196
|
}
|
|
@@ -190,8 +198,8 @@ var categoryMapOverride = {
|
|
|
190
198
|
]
|
|
191
199
|
};
|
|
192
200
|
var cfInitDetection = {
|
|
193
|
-
title: "
|
|
194
|
-
description: "
|
|
201
|
+
title: "Stored choice at start",
|
|
202
|
+
description: "CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.",
|
|
195
203
|
trigger: { type: "consent" },
|
|
196
204
|
in: {
|
|
197
205
|
necessary: true,
|
|
@@ -204,7 +212,8 @@ var cfInitDetection = {
|
|
|
204
212
|
"elb",
|
|
205
213
|
"walker consent",
|
|
206
214
|
{
|
|
207
|
-
|
|
215
|
+
necessary: true,
|
|
216
|
+
functional: false,
|
|
208
217
|
analytics: false,
|
|
209
218
|
marketing: true
|
|
210
219
|
}
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var SourceCookieFirst=(()=>{var e=Object.defineProperty,
|
|
1
|
+
"use strict";var SourceCookieFirst=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(r,{DEFAULT_CATEGORY_MAP:()=>a,SourceCookieFirst:()=>l,default:()=>c,sourceCookieFirst:()=>s});var i,l={},a={functional:"functional",performance:"analytics",advertising:"marketing"},s=async e=>{var t,n,o,r,i;const{config:l,env:s}=e,{elb:c}=s,u=null!=(t=s.window)?t:void 0!==globalThis.window?globalThis.window:void 0,v={categoryMap:{...a,...null==(n=null==l?void 0:l.settings)?void 0:n.categoryMap},globalName:null!=(r=null==(o=null==l?void 0:l.settings)?void 0:o.globalName)?r:"CookieFirst"},f={settings:v},d={};let g,b;Object.entries(null!=(i=v.categoryMap)?i:{}).forEach(([e,t])=>{d[e.toLowerCase()]=t});return{type:"cookiefirst",config:f,push:c,init:async()=>{var e;if(!u)return;const t=e=>{if(!e)return;const t={};Object.entries(e).forEach(([e,n])=>{var o;if("boolean"!=typeof n)return;const r=null!=(o=d[e.toLowerCase()])?o:e;t[r]=(void 0===t[r]||t[r])&&n}),Object.keys(t).length>0&&c("walker consent",t)},n=null!=(e=v.globalName)?e:"CookieFirst",o=u[n];(null==o?void 0:o.consent)&&t(o.consent),g=()=>{var e;const o=u[n];t(null!=(e=null==o?void 0:o.consent)?e:null)},u.addEventListener("cf_init",g),b=e=>{t(e.detail)},u.addEventListener("cf_consent",b)},destroy:async e=>{u&&g&&u.removeEventListener("cf_init",g),u&&b&&u.removeEventListener("cf_consent",b)}}},c=s;return i=r,((r,i,l,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of n(i))o.call(r,s)||s===l||e(r,s,{get:()=>i[s],enumerable:!(a=t(i,s))||a.enumerable});return r})(e({},"__esModule",{value:!0}),i)})();
|
package/dist/index.d.mts
CHANGED
|
@@ -43,8 +43,7 @@ interface Settings {
|
|
|
43
43
|
* Keys: CookieFirst category names
|
|
44
44
|
* Values: walkerOS consent group names
|
|
45
45
|
*
|
|
46
|
-
* Default maps to standard walkerOS groups:
|
|
47
|
-
* - necessary → functional
|
|
46
|
+
* Default maps to standard walkerOS groups (`necessary` keeps its own name):
|
|
48
47
|
* - functional → functional
|
|
49
48
|
* - performance → analytics
|
|
50
49
|
* - advertising → marketing
|
|
@@ -103,9 +102,12 @@ declare namespace index {
|
|
|
103
102
|
* Default category mapping from CookieFirst to walkerOS consent groups.
|
|
104
103
|
*
|
|
105
104
|
* Maps CookieFirst's standard categories to walkerOS convention:
|
|
106
|
-
* -
|
|
105
|
+
* - functional → functional
|
|
107
106
|
* - performance → analytics (measurement)
|
|
108
107
|
* - advertising → marketing (ads)
|
|
108
|
+
*
|
|
109
|
+
* `necessary` has no entry and keeps its own name: strictly necessary
|
|
110
|
+
* cookies need no consent, so they grant no consent group.
|
|
109
111
|
*/
|
|
110
112
|
declare const DEFAULT_CATEGORY_MAP: Record<string, string>;
|
|
111
113
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -43,8 +43,7 @@ interface Settings {
|
|
|
43
43
|
* Keys: CookieFirst category names
|
|
44
44
|
* Values: walkerOS consent group names
|
|
45
45
|
*
|
|
46
|
-
* Default maps to standard walkerOS groups:
|
|
47
|
-
* - necessary → functional
|
|
46
|
+
* Default maps to standard walkerOS groups (`necessary` keeps its own name):
|
|
48
47
|
* - functional → functional
|
|
49
48
|
* - performance → analytics
|
|
50
49
|
* - advertising → marketing
|
|
@@ -103,9 +102,12 @@ declare namespace index {
|
|
|
103
102
|
* Default category mapping from CookieFirst to walkerOS consent groups.
|
|
104
103
|
*
|
|
105
104
|
* Maps CookieFirst's standard categories to walkerOS convention:
|
|
106
|
-
* -
|
|
105
|
+
* - functional → functional
|
|
107
106
|
* - performance → analytics (measurement)
|
|
108
107
|
* - advertising → marketing (ads)
|
|
108
|
+
*
|
|
109
|
+
* `necessary` has no entry and keeps its own name: strictly necessary
|
|
110
|
+
* cookies need no consent, so they grant no consent group.
|
|
109
111
|
*/
|
|
110
112
|
declare const DEFAULT_CATEGORY_MAP: Record<string, string>;
|
|
111
113
|
/**
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,r,n,o,i
|
|
1
|
+
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}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(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}var SourceCookieFirst=function(){var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o={};!function(t,r){for(var n in r)e(t,n,{get:r[n],enumerable:!0})}(o,{DEFAULT_CATEGORY_MAP:function(){return u},SourceCookieFirst:function(){return i},default:function(){return c},sourceCookieFirst:function(){return l}});var a,i={},u={functional:"functional",performance:"analytics",advertising:"marketing"},l=function(e){return _async_to_generator(function(){var t,r,n,o,a,i,l,c,f,s,y,_,p,v,b;return _ts_generator(this,function(d){return i=e.config,l=e.env,c=l.elb,f=null!==(t=l.window)&&void 0!==t?t:void 0!==globalThis.window?globalThis.window:void 0,s={categoryMap:_object_spread({},u,null==i||null===(o=i.settings)||void 0===o?void 0:o.categoryMap),globalName:null!==(r=null==i||null===(a=i.settings)||void 0===a?void 0:a.globalName)&&void 0!==r?r:"CookieFirst"},y={settings:s},_={},Object.entries(null!==(n=s.categoryMap)&&void 0!==n?n:{}).forEach(function(e){var t=_sliced_to_array(e,2),r=t[0],n=t[1];_[r.toLowerCase()]=n}),b=function(){return _async_to_generator(function(){var e,t,r,n;return _ts_generator(this,function(o){return f?(t=function(e){if(e){var t={};Object.entries(e).forEach(function(e){var r,n=_sliced_to_array(e,2),o=n[0],a=n[1];if("boolean"==typeof a){var i=null!==(r=_[o.toLowerCase()])&&void 0!==r?r:o;t[i]=(void 0===t[i]||t[i])&&a}}),Object.keys(t).length>0&&c("walker consent",t)}},r=null!==(e=s.globalName)&&void 0!==e?e:"CookieFirst",(null==(n=f[r])?void 0:n.consent)&&t(n.consent),p=function(){var e,n=f[r];t(null!==(e=null==n?void 0:n.consent)&&void 0!==e?e:null)},f.addEventListener("cf_init",p),v=function(e){t(e.detail)},f.addEventListener("cf_consent",v),[2]):[2]})})()},[2,{type:"cookiefirst",config:y,push:c,init:b,destroy:function(e){return _async_to_generator(function(){return _ts_generator(this,function(e){return f&&p&&f.removeEventListener("cf_init",p),f&&v&&f.removeEventListener("cf_consent",v),[2]})})()}}]})})()},c=l;return a=o,function(o,a,i,u){if(a&&"object"===(void 0===a?"undefined":_type_of(a))||"function"==typeof a){var l=!0,c=!1,f=void 0;try{for(var s,y=function(){var r=s.value;n.call(o,r)||r===i||e(o,r,{get:function(){return a[r]},enumerable:!(u=t(a,r))||u.enumerable})},_=r(a)[Symbol.iterator]();!(l=(s=_.next()).done);l=!0)y()}catch(e){c=!0,f=e}finally{try{l||null==_.return||_.return()}finally{if(c)throw f}}}return o}(e({},"__esModule",{value:!0}),a)}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(i,{DEFAULT_CATEGORY_MAP:()=>a,SourceCookieFirst:()=>l,default:()=>c,sourceCookieFirst:()=>s}),module.exports=(e=i,((e,i,l,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of o(i))r.call(e,s)||s===l||t(e,s,{get:()=>i[s],enumerable:!(a=n(i,s))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var l={},a={functional:"functional",performance:"analytics",advertising:"marketing"},s=async e=>{var t,n,o,r,i;const{config:l,env:s}=e,{elb:c}=s,u=null!=(t=s.window)?t:void 0!==globalThis.window?globalThis.window:void 0,f={categoryMap:{...a,...null==(n=null==l?void 0:l.settings)?void 0:n.categoryMap},globalName:null!=(r=null==(o=null==l?void 0:l.settings)?void 0:o.globalName)?r:"CookieFirst"},v={settings:f},d={};let g,b;Object.entries(null!=(i=f.categoryMap)?i:{}).forEach(([e,t])=>{d[e.toLowerCase()]=t});return{type:"cookiefirst",config:v,push:c,init:async()=>{var e;if(!u)return;const t=e=>{if(!e)return;const t={};Object.entries(e).forEach(([e,n])=>{var o;if("boolean"!=typeof n)return;const r=null!=(o=d[e.toLowerCase()])?o:e;t[r]=(void 0===t[r]||t[r])&&n}),Object.keys(t).length>0&&c("walker consent",t)},n=null!=(e=f.globalName)?e:"CookieFirst",o=u[n];(null==o?void 0:o.consent)&&t(o.consent),g=()=>{var e;const o=u[n];t(null!=(e=null==o?void 0:o.consent)?e:null)},u.addEventListener("cf_init",g),b=e=>{t(e.detail)},u.addEventListener("cf_consent",b)},destroy:async e=>{u&&g&&u.removeEventListener("cf_init",g),u&&b&&u.removeEventListener("cf_consent",b)}}},c=s;//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type {\n Types,\n Settings,\n CookieFirstConsent,\n CookieFirstAPI,\n} from './types';\n\n// Export types for external usage\nexport * as SourceCookieFirst from './types';\n\n/**\n * Default category mapping from CookieFirst to walkerOS consent groups.\n *\n * Maps CookieFirst's standard categories to walkerOS convention:\n * -
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Source, WalkerOS } from '@walkeros/core';\nimport type {\n Types,\n Settings,\n CookieFirstConsent,\n CookieFirstAPI,\n} from './types';\n\n// Export types for external usage\nexport * as SourceCookieFirst from './types';\n\n/**\n * Default category mapping from CookieFirst to walkerOS consent groups.\n *\n * Maps CookieFirst's standard categories to walkerOS convention:\n * - functional → functional\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n *\n * `necessary` has no entry and keeps its own name: strictly necessary\n * cookies need no consent, so they grant no consent group.\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n functional: 'functional',\n performance: 'analytics',\n advertising: 'marketing',\n};\n\n/**\n * CookieFirst consent management source for walkerOS.\n *\n * This source listens to CookieFirst CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * @example\n * ```typescript\n * import { sourceCookieFirst } from '@walkeros/web-source-cmp-cookiefirst';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookieFirst,\n * config: {\n * settings: {\n * categoryMap: {\n * performance: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookieFirst: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults\n const settings: Settings = {\n categoryMap: { ...DEFAULT_CATEGORY_MAP, ...config?.settings?.categoryMap },\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Normalized (lowercase) lookup for case-insensitive category matching;\n // the config keeps the keys as the user wrote them\n const normalizedMap: Record<string, string> = {};\n Object.entries(settings.categoryMap ?? {}).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n // Track listener references for cleanup\n let initListener: (() => void) | undefined;\n let consentListener: ((e: Event) => void) | undefined;\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and no `elb('walker consent')` emit during\n // construction, which would race source merge order.\n const init = async (): Promise<void> => {\n // Only setup if in browser environment\n if (!actualWindow) return;\n /**\n * Handle consent state from CookieFirst.\n * Maps CookieFirst categories to walkerOS consent groups and calls elb.\n *\n * When multiple CookieFirst categories map to the same walkerOS group,\n * any deny denies: the group is true only if every one of them is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // A null consent means no choice yet\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = normalizedMap[category.toLowerCase()] ?? category;\n // Any deny denies: once false, stays false\n state[mapped] =\n state[mapped] === undefined ? value : state[mapped] && value;\n });\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 const globalName = settings.globalName ?? 'CookieFirst';\n const cmp = actualWindow[globalName] as CookieFirstAPI | undefined;\n\n // Process existing consent if CMP already loaded\n if (cmp?.consent) {\n handleConsent(cmp.consent);\n }\n\n // Listen for CMP initialization\n initListener = () => {\n const cmp = actualWindow[globalName] as CookieFirstAPI | undefined;\n handleConsent(cmp?.consent ?? null);\n };\n actualWindow.addEventListener('cf_init', initListener);\n\n // Listen for consent changes\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<CookieFirstConsent>;\n handleConsent(customEvent.detail);\n };\n actualWindow.addEventListener('cf_consent', consentListener);\n };\n\n return {\n type: 'cookiefirst',\n config: fullConfig,\n push: elb,\n init,\n destroy: async (_context) => {\n // Remove event listeners on cleanup\n if (actualWindow && initListener) {\n actualWindow.removeEventListener('cf_init', initListener);\n }\n if (actualWindow && consentListener) {\n actualWindow.removeEventListener('cf_consent', consentListener);\n }\n },\n };\n};\n\nexport default sourceCookieFirst;\n","import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n cookiefirst: { type: 'cookiefirst'; platform?: 'web' };\n }\n}\n\n/**\n * CookieFirst consent object structure\n */\nexport interface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\n/**\n * CookieFirst global API interface\n */\nexport interface CookieFirstAPI {\n consent: CookieFirstConsent | null;\n}\n\ndeclare global {\n interface Window {\n CookieFirst?: CookieFirstAPI;\n [key: string]: CookieFirstAPI | unknown;\n }\n\n interface WindowEventMap {\n cf_init: Event;\n cf_consent: CustomEvent<CookieFirstConsent>;\n }\n}\n\n/**\n * Settings for CookieFirst source\n */\nexport interface Settings {\n /**\n * Map CookieFirst categories to walkerOS consent groups.\n * Keys: CookieFirst category names\n * Values: walkerOS consent group names\n *\n * Default maps to standard walkerOS groups (`necessary` keeps its own name):\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Custom name for window.CookieFirst object.\n * Some implementations use a different global name.\n *\n * Default: 'CookieFirst'\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 CookieFirst source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookieFirst 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ADsBO,IAAM,uBAA+C;AAAA,EAC1D,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AA4BO,IAAM,oBAAwC,OAAO,YAAY;AAtDxE;AAuDE,QAAM,EAAE,QAAQ,IAAI,IAAI;AACxB,QAAM,EAAE,IAAI,IAAI;AAGhB,QAAM,gBACJ,SAAI,WAAJ,YACC,OAAO,WAAW,WAAW,cAAc,WAAW,SAAS;AAGlE,QAAM,WAAqB;AAAA,IACzB,aAAa,EAAE,GAAG,sBAAsB,IAAG,sCAAQ,aAAR,mBAAkB,YAAY;AAAA,IACzE,aAAY,4CAAQ,aAAR,mBAAkB,eAAlB,YAAgC;AAAA,EAC9C;AAEA,QAAM,aAAmC,EAAE,SAAS;AAIpD,QAAM,gBAAwC,CAAC;AAC/C,SAAO,SAAQ,cAAS,gBAAT,YAAwB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC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AAoB,WAAW,YAAY;AAAA,MAC1D;AACA,UAAI,gBAAgB,iBAAiB;AACnC,qBAAa,oBAAoB,cAAc,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","cmp"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n={},e={
|
|
1
|
+
var n={},e={functional:"functional",performance:"analytics",advertising:"marketing"},t=async n=>{var t,o,i,l,a;const{config:s,env:r}=n,{elb:c}=r,u=null!=(t=r.window)?t:void 0!==globalThis.window?globalThis.window:void 0,v={categoryMap:{...e,...null==(o=null==s?void 0:s.settings)?void 0:o.categoryMap},globalName:null!=(l=null==(i=null==s?void 0:s.settings)?void 0:i.globalName)?l:"CookieFirst"},d={settings:v},f={};let g,y;Object.entries(null!=(a=v.categoryMap)?a:{}).forEach(([n,e])=>{f[n.toLowerCase()]=e});return{type:"cookiefirst",config:d,push:c,init:async()=>{var n;if(!u)return;const e=n=>{if(!n)return;const e={};Object.entries(n).forEach(([n,t])=>{var o;if("boolean"!=typeof t)return;const i=null!=(o=f[n.toLowerCase()])?o:n;e[i]=(void 0===e[i]||e[i])&&t}),Object.keys(e).length>0&&c("walker consent",e)},t=null!=(n=v.globalName)?n:"CookieFirst",o=u[t];(null==o?void 0:o.consent)&&e(o.consent),g=()=>{var n;const o=u[t];e(null!=(n=null==o?void 0:o.consent)?n:null)},u.addEventListener("cf_init",g),y=n=>{e(n.detail)},u.addEventListener("cf_consent",y)},destroy:async n=>{u&&g&&u.removeEventListener("cf_init",g),u&&y&&u.removeEventListener("cf_consent",y)}}},o=t;export{e as DEFAULT_CATEGORY_MAP,n as SourceCookieFirst,o as default,t as sourceCookieFirst};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n cookiefirst: { type: 'cookiefirst'; platform?: 'web' };\n }\n}\n\n/**\n * CookieFirst consent object structure\n */\nexport interface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\n/**\n * CookieFirst global API interface\n */\nexport interface CookieFirstAPI {\n consent: CookieFirstConsent | null;\n}\n\ndeclare global {\n interface Window {\n CookieFirst?: CookieFirstAPI;\n [key: string]: CookieFirstAPI | unknown;\n }\n\n interface WindowEventMap {\n cf_init: Event;\n cf_consent: CustomEvent<CookieFirstConsent>;\n }\n}\n\n/**\n * Settings for CookieFirst source\n */\nexport interface Settings {\n /**\n * Map CookieFirst categories to walkerOS consent groups.\n * Keys: CookieFirst category names\n * Values: walkerOS consent group names\n *\n * Default maps to standard walkerOS groups
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\n\ndeclare module '@walkeros/core' {\n interface SourceMap {\n cookiefirst: { type: 'cookiefirst'; platform?: 'web' };\n }\n}\n\n/**\n * CookieFirst consent object structure\n */\nexport interface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\n/**\n * CookieFirst global API interface\n */\nexport interface CookieFirstAPI {\n consent: CookieFirstConsent | null;\n}\n\ndeclare global {\n interface Window {\n CookieFirst?: CookieFirstAPI;\n [key: string]: CookieFirstAPI | unknown;\n }\n\n interface WindowEventMap {\n cf_init: Event;\n cf_consent: CustomEvent<CookieFirstConsent>;\n }\n}\n\n/**\n * Settings for CookieFirst source\n */\nexport interface Settings {\n /**\n * Map CookieFirst categories to walkerOS consent groups.\n * Keys: CookieFirst category names\n * Values: walkerOS consent group names\n *\n * Default maps to standard walkerOS groups (`necessary` keeps its own name):\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Custom name for window.CookieFirst object.\n * Some implementations use a different global name.\n *\n * Default: 'CookieFirst'\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 CookieFirst source\n */\nexport interface Env extends Source.BaseEnv {\n window?: Window & typeof globalThis;\n}\n\n/**\n * Types bundle for CookieFirst source\n */\nexport type Types = Source.Types<Settings, Mapping, Push, Env, InitSettings>;\n\n/**\n * Config type alias\n */\nexport type Config = Source.Config<Types>;\n","import type { Source, WalkerOS } from '@walkeros/core';\nimport type {\n Types,\n Settings,\n CookieFirstConsent,\n CookieFirstAPI,\n} from './types';\n\n// Export types for external usage\nexport * as SourceCookieFirst from './types';\n\n/**\n * Default category mapping from CookieFirst to walkerOS consent groups.\n *\n * Maps CookieFirst's standard categories to walkerOS convention:\n * - functional → functional\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n *\n * `necessary` has no entry and keeps its own name: strictly necessary\n * cookies need no consent, so they grant no consent group.\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n functional: 'functional',\n performance: 'analytics',\n advertising: 'marketing',\n};\n\n/**\n * CookieFirst consent management source for walkerOS.\n *\n * This source listens to CookieFirst CMP events and translates\n * consent states to walkerOS consent commands.\n *\n * @example\n * ```typescript\n * import { sourceCookieFirst } from '@walkeros/web-source-cmp-cookiefirst';\n *\n * await startFlow({\n * sources: {\n * consent: {\n * code: sourceCookieFirst,\n * config: {\n * settings: {\n * categoryMap: {\n * performance: 'statistics', // Custom mapping\n * },\n * },\n * },\n * },\n * },\n * });\n * ```\n */\nexport const sourceCookieFirst: Source.Init<Types> = async (context) => {\n const { config, env } = context;\n const { elb } = env;\n\n // Resolve window with fallback to globalThis\n const actualWindow =\n env.window ??\n (typeof globalThis.window !== 'undefined' ? globalThis.window : undefined);\n\n // Merge user settings with defaults\n const settings: Settings = {\n categoryMap: { ...DEFAULT_CATEGORY_MAP, ...config?.settings?.categoryMap },\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\n\n // Normalized (lowercase) lookup for case-insensitive category matching;\n // the config keeps the keys as the user wrote them\n const normalizedMap: Record<string, string> = {};\n Object.entries(settings.categoryMap ?? {}).forEach(([key, value]) => {\n normalizedMap[key.toLowerCase()] = value;\n });\n\n // Track listener references for cleanup\n let initListener: (() => void) | undefined;\n let consentListener: ((e: Event) => void) | undefined;\n\n // Attach the CMP listeners and perform the static consent read. Deferred to\n // init() (Pass 2 of initSources) so the factory (Pass 1) stays side-effect\n // free: no listener registration and no `elb('walker consent')` emit during\n // construction, which would race source merge order.\n const init = async (): Promise<void> => {\n // Only setup if in browser environment\n if (!actualWindow) return;\n /**\n * Handle consent state from CookieFirst.\n * Maps CookieFirst categories to walkerOS consent groups and calls elb.\n *\n * When multiple CookieFirst categories map to the same walkerOS group,\n * any deny denies: the group is true only if every one of them is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // A null consent means no choice yet\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = normalizedMap[category.toLowerCase()] ?? category;\n // Any deny denies: once false, stays false\n state[mapped] =\n state[mapped] === undefined ? value : state[mapped] && value;\n });\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 const globalName = settings.globalName ?? 'CookieFirst';\n const cmp = actualWindow[globalName] as CookieFirstAPI | undefined;\n\n // Process existing consent if CMP already loaded\n if (cmp?.consent) {\n handleConsent(cmp.consent);\n }\n\n // Listen for CMP initialization\n initListener = () => {\n const cmp = actualWindow[globalName] as CookieFirstAPI | undefined;\n handleConsent(cmp?.consent ?? null);\n };\n actualWindow.addEventListener('cf_init', initListener);\n\n // Listen for consent changes\n consentListener = (e: Event) => {\n const customEvent = e as CustomEvent<CookieFirstConsent>;\n handleConsent(customEvent.detail);\n };\n actualWindow.addEventListener('cf_consent', consentListener);\n };\n\n return {\n type: 'cookiefirst',\n config: fullConfig,\n push: elb,\n init,\n destroy: async (_context) => {\n // Remove event listeners on cleanup\n if (actualWindow && initListener) {\n actualWindow.removeEventListener('cf_init', initListener);\n }\n if (actualWindow && consentListener) {\n actualWindow.removeEventListener('cf_consent', consentListener);\n }\n },\n };\n};\n\nexport default sourceCookieFirst;\n"],"mappings":";AAAA;;;ACsBO,IAAM,uBAA+C;AAAA,EAC1D,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AA4BO,IAAM,oBAAwC,OAAO,YAAY;AAtDxE;AAuDE,QAAM,EAAE,QAAQ,IAAI,IAAI;AACxB,QAAM,EAAE,IAAI,IAAI;AAGhB,QAAM,gBACJ,SAAI,WAAJ,YACC,OAAO,WAAW,WAAW,cAAc,WAAW,SAAS;AAGlE,QAAM,WAAqB;AAAA,IACzB,aAAa,EAAE,GAAG,sBAAsB,IAAG,sCAAQ,aAAR,mBAAkB,YAAY;AAAA,IACzE,aAAY,4CAAQ,aAAR,mBAAkB,eAAlB,YAAgC;AAAA,EAC9C;AAEA,QAAM,aAAmC,EAAE,SAAS;AAIpD,QAAM,gBAAwC,CAAC;AAC/C,SAAO,SAAQ,cAAS,gBAAT,YAAwB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnE,kBAAc,IAAI,YAAY,CAAC,IAAI;AAAA,EACrC,CAAC;AAGD,MAAI;AACJ,MAAI;AAMJ,QAAM,OAAO,YAA2B;AAtF1C,QAAAA;AAwFI,QAAI,CAAC,aAAc;AAQnB,UAAM,gBAAgB,CAAC,YAAuC;AAE5D,UAAI,CAAC,QAAS;AAGd,YAAM,QAA0B,CAAC;AACjC,aAAO,QAAQ,OA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eros/web-source-cmp-cookiefirst",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.3-next-1793115089237",
|
|
5
5
|
"type": "source",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"advertising": false
|
|
45
45
|
},
|
|
46
46
|
"analyticsOnlyMapped": {
|
|
47
|
-
"
|
|
47
|
+
"necessary": true,
|
|
48
|
+
"functional": false,
|
|
48
49
|
"analytics": true,
|
|
49
50
|
"marketing": false
|
|
50
51
|
},
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"advertising": true
|
|
68
69
|
},
|
|
69
70
|
"fullConsentMapped": {
|
|
71
|
+
"necessary": true,
|
|
70
72
|
"functional": true,
|
|
71
73
|
"analytics": true,
|
|
72
74
|
"marketing": true
|
|
@@ -78,7 +80,8 @@
|
|
|
78
80
|
"advertising": true
|
|
79
81
|
},
|
|
80
82
|
"marketingOnlyMapped": {
|
|
81
|
-
"
|
|
83
|
+
"necessary": true,
|
|
84
|
+
"functional": false,
|
|
82
85
|
"analytics": false,
|
|
83
86
|
"marketing": true
|
|
84
87
|
},
|
|
@@ -89,7 +92,8 @@
|
|
|
89
92
|
"advertising": false
|
|
90
93
|
},
|
|
91
94
|
"minimalConsentMapped": {
|
|
92
|
-
"
|
|
95
|
+
"necessary": true,
|
|
96
|
+
"functional": false,
|
|
93
97
|
"analytics": false,
|
|
94
98
|
"marketing": false
|
|
95
99
|
},
|
|
@@ -134,7 +138,7 @@
|
|
|
134
138
|
"$code": "()=>{}"
|
|
135
139
|
},
|
|
136
140
|
"scope": {
|
|
137
|
-
"$code": "()=>
|
|
141
|
+
"$code": "()=>f"
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
},
|
|
@@ -159,7 +163,7 @@
|
|
|
159
163
|
"$code": "()=>{}"
|
|
160
164
|
},
|
|
161
165
|
"scope": {
|
|
162
|
-
"$code": "()=>
|
|
166
|
+
"$code": "()=>f"
|
|
163
167
|
}
|
|
164
168
|
},
|
|
165
169
|
"partialConsent": {
|
|
@@ -169,6 +173,7 @@
|
|
|
169
173
|
"advertising": false
|
|
170
174
|
},
|
|
171
175
|
"partialConsentMapped": {
|
|
176
|
+
"necessary": true,
|
|
172
177
|
"functional": true,
|
|
173
178
|
"analytics": false,
|
|
174
179
|
"marketing": false
|
|
@@ -198,7 +203,8 @@
|
|
|
198
203
|
"elb",
|
|
199
204
|
"walker consent",
|
|
200
205
|
{
|
|
201
|
-
"
|
|
206
|
+
"necessary": true,
|
|
207
|
+
"functional": false,
|
|
202
208
|
"statistics": true,
|
|
203
209
|
"marketing": false
|
|
204
210
|
}
|
|
@@ -206,8 +212,8 @@
|
|
|
206
212
|
]
|
|
207
213
|
},
|
|
208
214
|
"cfInitDetection": {
|
|
209
|
-
"title": "
|
|
210
|
-
"description": "
|
|
215
|
+
"title": "Stored choice at start",
|
|
216
|
+
"description": "CookieFirst already holds the visitor's choice when the source starts, so the read at init emits it.",
|
|
211
217
|
"trigger": {
|
|
212
218
|
"type": "consent"
|
|
213
219
|
},
|
|
@@ -222,7 +228,8 @@
|
|
|
222
228
|
"elb",
|
|
223
229
|
"walker consent",
|
|
224
230
|
{
|
|
225
|
-
"
|
|
231
|
+
"necessary": true,
|
|
232
|
+
"functional": false,
|
|
226
233
|
"analytics": false,
|
|
227
234
|
"marketing": true
|
|
228
235
|
}
|
|
@@ -246,6 +253,7 @@
|
|
|
246
253
|
"elb",
|
|
247
254
|
"walker consent",
|
|
248
255
|
{
|
|
256
|
+
"necessary": true,
|
|
249
257
|
"functional": true,
|
|
250
258
|
"analytics": true,
|
|
251
259
|
"marketing": true
|
|
@@ -270,6 +278,7 @@
|
|
|
270
278
|
"elb",
|
|
271
279
|
"walker consent",
|
|
272
280
|
{
|
|
281
|
+
"necessary": true,
|
|
273
282
|
"functional": true,
|
|
274
283
|
"analytics": false,
|
|
275
284
|
"marketing": false
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-source-cmp-cookiefirst",
|
|
3
3
|
"description": "CookieFirst consent management source for walkerOS",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.3-next-1793115089237",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"walkerOS": {
|
|
7
7
|
"type": "source",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"update": "npx npm-check-updates -u && npm update"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@walkeros/core": "4.8.
|
|
50
|
-
"@walkeros/collector": "4.8.
|
|
49
|
+
"@walkeros/core": "4.8.3-next-1793115089237",
|
|
50
|
+
"@walkeros/collector": "4.8.3-next-1793115089237"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {},
|
|
53
53
|
"repository": {
|