@walkeros/web-source-cmp-cookiefirst 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @walkeros/web-source-cmp-cookiefirst
2
2
 
3
+ ## 4.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 91e9aeb: The `explicitOnly` setting description now says what the source does:
8
+ it has no effect here, since the source always waits for the user's first
9
+ choice and reports every consent CookieFirst provides after that.
10
+ - Updated dependencies [0635330]
11
+ - Updated dependencies [0635330]
12
+ - Updated dependencies [91e9aeb]
13
+ - @walkeros/collector@4.7.1
14
+ - @walkeros/core@4.7.1
15
+
3
16
  ## 4.7.0
4
17
 
5
18
  ### Patch Changes
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},i={};a(i,{examples:()=>s,schemas:()=>A}),module.exports=(e=i,((e,a,i,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let c of r(a))o.call(e,c)||c===i||t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};a(s,{analyticsOnlyConsent:()=>u,analyticsOnlyMapped:()=>k,createMockCookieFirstAPI:()=>h,createMockElbFn:()=>C,createMockWindow:()=>M,createTrigger:()=>_,fullConsent:()=>c,fullConsentMapped:()=>f,marketingOnlyConsent:()=>d,marketingOnlyMapped:()=>v,minimalConsent:()=>p,minimalConsentMapped:()=>y,mockEnv:()=>O,noConsent:()=>g,noopLogger:()=>b,partialConsent:()=>l,partialConsentMapped:()=>m,step:()=>F,trigger:()=>x});var c={necessary:!0,functional:!0,performance:!0,advertising:!0},l={necessary:!0,functional:!0,performance:!1,advertising:!1},p={necessary:!0,functional:!1,performance:!1,advertising:!1},g=null,u={necessary:!0,functional:!1,performance:!0,advertising:!1},d={necessary:!0,functional:!1,performance:!1,advertising:!0},f={functional:!0,analytics:!0,marketing:!0},m={functional:!0,analytics:!1,marketing:!1},y={functional:!0,analytics:!1,marketing:!1},k={functional:!0,analytics:!0,marketing:!1},v={functional:!0,analytics:!1,marketing:!0},w=()=>{},C=()=>()=>Promise.resolve({ok:!0}),b={error:w,warn:w,info:w,debug:w,throw:e=>{throw"string"==typeof e?new Error(e):e},json:w,scope:()=>b},h=(e=null)=>({consent:e}),M=(e=null)=>({CookieFirst:h(e),addEventListener:w,removeEventListener:w}),O={get push(){return C()},get command(){return C()},get elb(){return C()},get window(){return M()},logger:b},F={};a(F,{categoryMapOverride:()=>E,cfInitDetection:()=>z,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",{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",{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",{functional:!0,statistics:!0,marketing:!1}]]},z={title:"cf_init detection",description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{functional:!0,analytics:!1,marketing:!0}]]},S=require("@walkeros/collector"),_=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await(0,S.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}))}}},x=(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 A={};a(A,{SettingsSchema:()=>q,settings:()=>I});var D=require("@walkeros/core/dev"),L=require("@walkeros/core/dev"),q=L.z.object({categoryMap:L.z.record(L.z.string(),L.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:L.z.boolean().describe("Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true.").optional(),globalName:L.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)(q);//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},a={};i(a,{examples:()=>s,schemas:()=>A}),module.exports=(e=a,((e,i,a,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of r(i))o.call(e,c)||c===a||t(e,c,{get:()=>i[c],enumerable:!(s=n(i,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};i(s,{analyticsOnlyConsent:()=>g,analyticsOnlyMapped:()=>k,createMockCookieFirstAPI:()=>h,createMockElbFn:()=>C,createMockWindow:()=>M,createTrigger:()=>_,fullConsent:()=>c,fullConsentMapped:()=>f,marketingOnlyConsent:()=>d,marketingOnlyMapped:()=>v,minimalConsent:()=>p,minimalConsentMapped:()=>y,mockEnv:()=>O,noConsent:()=>u,noopLogger:()=>b,partialConsent:()=>l,partialConsentMapped:()=>m,step:()=>F,trigger:()=>x});var c={necessary:!0,functional:!0,performance:!0,advertising:!0},l={necessary:!0,functional:!0,performance:!1,advertising:!1},p={necessary:!0,functional:!1,performance:!1,advertising:!1},u=null,g={necessary:!0,functional:!1,performance:!0,advertising:!1},d={necessary:!0,functional:!1,performance:!1,advertising:!0},f={functional:!0,analytics:!0,marketing:!0},m={functional:!0,analytics:!1,marketing:!1},y={functional:!0,analytics:!1,marketing:!1},k={functional:!0,analytics:!0,marketing:!1},v={functional:!0,analytics:!1,marketing:!0},w=()=>{},C=()=>()=>Promise.resolve({ok:!0}),b={error:w,warn:w,info:w,debug:w,throw:e=>{throw"string"==typeof e?new Error(e):e},json:w,scope:()=>b},h=(e=null)=>({consent:e}),M=(e=null)=>({CookieFirst:h(e),addEventListener:w,removeEventListener:w}),O={get push(){return C()},get command(){return C()},get elb(){return C()},get window(){return M()},logger:b},F={};i(F,{categoryMapOverride:()=>E,cfInitDetection:()=>z,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",{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",{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",{functional:!0,statistics:!0,marketing:!1}]]},z={title:"cf_init detection",description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{functional:!0,analytics:!1,marketing:!0}]]},S=require("@walkeros/collector"),_=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await(0,S.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}))}}},x=(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 A={};i(A,{SettingsSchema:()=>q,settings:()=>I});var D=require("@walkeros/core/dev"),L=require("@walkeros/core/dev"),q=L.z.object({categoryMap:L.z.record(L.z.string(),L.z.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:L.z.boolean().describe("Has no effect in this source: it skips CookieFirst.consent while it is null (no choice made yet) and reports every consent CookieFirst provides after that, whether explicitOnly is true or false. Default: true.").optional(),globalName:L.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)(q);//# 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 explicitOnly: z\n .boolean()\n .describe(\n 'Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true.',\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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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 explicitOnly: z\n .boolean()\n .describe(\n 'Has no effect in this source: it skips CookieFirst.consent while it is null (no choice made yet) and reports every consent CookieFirst provides after that, whether explicitOnly is true or false. Default: true.',\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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C3B,OAAO;AAAA,EACN,aAAa,aACV,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EAEZ,cAAc,aACX,QAAQ,EACR;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;;;ADzBI,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:()=>u,createMockCookieFirstAPI:()=>k,createMockElbFn:()=>f,createMockWindow:()=>v,createTrigger:()=>E,fullConsent:()=>r,fullConsentMapped:()=>l,marketingOnlyConsent:()=>c,marketingOnlyMapped:()=>m,minimalConsent:()=>o,minimalConsentMapped:()=>p,mockEnv:()=>w,noConsent:()=>i,noopLogger:()=>y,partialConsent:()=>a,partialConsentMapped:()=>g,step:()=>C,trigger:()=>P});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={functional:!0,analytics:!0,marketing:!0},g={functional:!0,analytics:!1,marketing:!1},p={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!0,marketing:!1},m={functional:!0,analytics:!1,marketing:!0},d=()=>{},f=()=>()=>Promise.resolve({ok:!0}),y={error:d,warn:d,info:d,debug:d,throw:e=>{throw"string"==typeof e?new Error(e):e},json:d,scope:()=>y},k=(e=null)=>({consent:e}),v=(e=null)=>({CookieFirst:k(e),addEventListener:d,removeEventListener:d}),w={get push(){return f()},get command(){return f()},get elb(){return f()},get window(){return v()},logger:y},C={};t(C,{categoryMapOverride:()=>h,cfInitDetection:()=>F,fullConsent:()=>b,partialConsent:()=>M});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",{functional:!0,analytics:!0,marketing:!0}]]},M={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",{functional:!0,analytics:!1,marketing:!1}]]},h={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",{functional:!0,statistics:!0,marketing:!1}]]},F={title:"cf_init detection",description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{functional:!0,analytics:!1,marketing:!0}]]};import{startFlow as O}from"@walkeros/collector";var E=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await O({...e,run:null==(r=e.run)||r});return void(t={collector:n.collector,elb:n.elb})}window.dispatchEvent(new CustomEvent("cf_consent",{detail:n}))}}},P=(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:()=>A,settings:()=>L});import{zodToSchema as S}from"@walkeros/core/dev";import{z as x}from"@walkeros/core/dev";var A=x.object({categoryMap:x.record(x.string(),x.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:x.boolean().describe("Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true.").optional(),globalName:x.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."}),L=S(A);export{n as examples,j as schemas};//# sourceMappingURL=dev.mjs.map
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:()=>u,createMockCookieFirstAPI:()=>k,createMockElbFn:()=>m,createMockWindow:()=>v,createTrigger:()=>E,fullConsent:()=>r,fullConsentMapped:()=>l,marketingOnlyConsent:()=>c,marketingOnlyMapped:()=>d,minimalConsent:()=>i,minimalConsentMapped:()=>g,mockEnv:()=>w,noConsent:()=>a,noopLogger:()=>y,partialConsent:()=>o,partialConsentMapped:()=>p,step:()=>C,trigger:()=>P});var r={necessary:!0,functional:!0,performance:!0,advertising:!0},o={necessary:!0,functional:!0,performance:!1,advertising:!1},i={necessary:!0,functional:!1,performance:!1,advertising:!1},a=null,s={necessary:!0,functional:!1,performance:!0,advertising:!1},c={necessary:!0,functional:!1,performance:!1,advertising:!0},l={functional:!0,analytics:!0,marketing:!0},p={functional:!0,analytics:!1,marketing:!1},g={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!0,marketing:!1},d={functional:!0,analytics:!1,marketing:!0},f=()=>{},m=()=>()=>Promise.resolve({ok:!0}),y={error:f,warn:f,info:f,debug:f,throw:e=>{throw"string"==typeof e?new Error(e):e},json:f,scope:()=>y},k=(e=null)=>({consent:e}),v=(e=null)=>({CookieFirst:k(e),addEventListener:f,removeEventListener:f}),w={get push(){return m()},get command(){return m()},get elb(){return m()},get window(){return v()},logger:y},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",{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",{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",{functional:!0,statistics:!0,marketing:!1}]]},F={title:"cf_init detection",description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:[["elb","walker consent",{functional:!0,analytics:!1,marketing:!0}]]};import{startFlow as O}from"@walkeros/collector";var E=async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await O({...e,run:null==(r=e.run)||r});return void(t={collector:n.collector,elb:n.elb})}window.dispatchEvent(new CustomEvent("cf_consent",{detail:n}))}}},P=(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:()=>A,settings:()=>L});import{zodToSchema as S}from"@walkeros/core/dev";import{z as x}from"@walkeros/core/dev";var A=x.object({categoryMap:x.record(x.string(),x.string()).describe("Map the CMP's consent categories (keys) to walkerOS consent groups (values).").optional(),explicitOnly:x.boolean().describe("Has no effect in this source: it skips CookieFirst.consent while it is null (no choice made yet) and reports every consent CookieFirst provides after that, whether explicitOnly is true or false. Default: true.").optional(),globalName:x.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."}),L=S(A);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 explicitOnly: z\n .boolean()\n .describe(\n 'Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true.',\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,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,oBAA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AA;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,cAAc,EACX,QAAQ,EACR;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;;;ADzBI,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 * (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 explicitOnly: z\n .boolean()\n .describe(\n 'Has no effect in this source: it skips CookieFirst.consent while it is null (no choice made yet) and reports every consent CookieFirst provides after that, whether explicitOnly is true or false. Default: true.',\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,aAAa;AACf;AAKO,IAAM,iB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AM;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,cAAc,EACX,QAAQ,EACR;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;;;ADzBI,IAAM,WAAW,YAAY,cAAc;","names":["fullConsent","partialConsent","trigger"]}
package/dist/index.d.mts CHANGED
@@ -51,9 +51,9 @@ interface Settings {
51
51
  */
52
52
  categoryMap?: Record<string, string>;
53
53
  /**
54
- * Only process explicit consent (user made a choice).
55
- * When true: Ignores consent if CookieFirst.consent is null
56
- * When false: Processes any consent state including defaults
54
+ * Has no effect in this source: it skips CookieFirst.consent while it is
55
+ * null (no choice made yet) and processes every consent object after that,
56
+ * whether this is true or false.
57
57
  *
58
58
  * Default: true
59
59
  */
package/dist/index.d.ts CHANGED
@@ -51,9 +51,9 @@ interface Settings {
51
51
  */
52
52
  categoryMap?: Record<string, string>;
53
53
  /**
54
- * Only process explicit consent (user made a choice).
55
- * When true: Ignores consent if CookieFirst.consent is null
56
- * When false: Processes any consent state including defaults
54
+ * Has no effect in this source: it skips CookieFirst.consent while it is
55
+ * null (no choice made yet) and processes every consent object after that,
56
+ * whether this is true or false.
57
57
  *
58
58
  * Default: true
59
59
  */
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 * - necessary/functional → functional (essential)\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n necessary: 'functional',\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 explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\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 * uses OR logic: if ANY category is true, the group is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // Skip if explicitOnly and no explicit consent given\n if (settings.explicitOnly && !consent) return;\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n // Use OR logic: if ANY source category is true, the target group is true\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: once true, stays true\n state[mapped] = 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:\n * - necessary → functional\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores consent if CookieFirst.consent is null\n * When false: Processes any consent state including defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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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MAAM,aAAa,UAAU;AAGnC,QAAI,2BAAK,SAAS;AAChB,oBAAc,IAAI,OAAO;AAAA,IAC3B;AAGA,mBAAe,MAAM;AAtHzB,UAAAA;AAuHM,YAAME,OAAM,aAAa,UAAU;AACnC,qBAAcF,MAAAE,QAAA,gBAAAA,KAAK,YAAL,OAAAF,MAAgB,IAAI;AAAA,IACpC;AACA,iBAAa,iBAAiB,WAAW,YAAY;AAGrD,sBAAkB,CAAC,MAAa;AAC9B,YAAM,cAAc;AACpB,oBAAc,YAAY,MAAM;AAAA,IAClC;AACA,iBAAa,iBAAiB,cAAc,eAAe;AAAA,EAC7D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA,SAAS,OAAO,aAAa;AAE3B,UAAI,gBAAgB,cAAc;AAChC,qBAAa,oBAAoB,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","_b","cmp"]}
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 * - necessary/functional → functional (essential)\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n necessary: 'functional',\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 explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\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 * uses OR logic: if ANY category is true, the group is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // A null consent means no choice yet and is skipped by the next line\n // either way, so explicitOnly changes nothing here.\n if (settings.explicitOnly && !consent) return;\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n // Use OR logic: if ANY source category is true, the target group is true\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: once true, stays true\n state[mapped] = 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:\n * - necessary → functional\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Has no effect in this source: it skips CookieFirst.consent while it is\n * null (no choice made yet) and processes every consent object after that,\n * whether this is true or false.\n *\n * Default: true\n */\n explicitOnly?: boolean;\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;;;ADmBO,IAAM,uBAA+C;AAAA,EAC1D,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AA4BO,IAAM,oBAAwC,OAAO,YAAY;AApDxE;AAqDE,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,eAAc,4CAAQ,aAAR,mBAAkB,iBAAlB,YAAkC;AAAA,IAChD,aAAY,4CAAQ,aAAR,mBAAkB,eAAlB,YAAgC;AAAA,EAC9C;AAEA,QAAM,aAAmC,EAAE,SAAS;AAGpD,MAAI;AACJ,MAAI;AAMJ,QAAM,OAAO,YAA2B;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MAChE;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["_a","_b","cmp"]}
@@ -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:\n * - necessary → functional\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Only process explicit consent (user made a choice).\n * When true: Ignores consent if CookieFirst.consent is null\n * When false: Processes any consent state including defaults\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 * - necessary/functional → functional (essential)\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n necessary: 'functional',\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 explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\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 * uses OR logic: if ANY category is true, the group is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // Skip if explicitOnly and no explicit consent given\n if (settings.explicitOnly && !consent) return;\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n // Use OR logic: if ANY source category is true, the target group is true\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: once true, stays true\n state[mapped] = 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;;;ACmBO,IAAM,uBAA+C;AAAA,EAC1D,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;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,OAAM,aAAa,UAAU;AACnC,qBAAcF,MAAAE,QAAA,gBAAAA,KAAK,YAAL,OAAAF,MAAgB,IAAI;AAAA,IACpC;AACA,iBAAa,iBAAiB,WAAW,YAAY;AAGrD,sBAAkB,CAAC,MAAa;AAC9B,YAAM,cAAc;AACpB,oBAAc,YAAY,MAAM;AAAA,IAClC;AACA,iBAAa,iBAAiB,cAAc,eAAe;AAAA,EAC7D;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA,SAAS,OAAO,aAAa;AAE3B,UAAI,gBAAgB,cAAc;AAChC,qBAAa,oBAAoB,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","_b","cmp"]}
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:\n * - necessary → functional\n * - functional → functional\n * - performance → analytics\n * - advertising → marketing\n */\n categoryMap?: Record<string, string>;\n\n /**\n * Has no effect in this source: it skips CookieFirst.consent while it is\n * null (no choice made yet) and processes every consent object after that,\n * whether this is true or false.\n *\n * Default: true\n */\n explicitOnly?: boolean;\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 * - necessary/functional → functional (essential)\n * - performance → analytics (measurement)\n * - advertising → marketing (ads)\n */\nexport const DEFAULT_CATEGORY_MAP: Record<string, string> = {\n necessary: 'functional',\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 explicitOnly: config?.settings?.explicitOnly ?? true,\n globalName: config?.settings?.globalName ?? 'CookieFirst',\n };\n\n const fullConfig: Source.Config<Types> = { settings };\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 * uses OR logic: if ANY category is true, the group is true.\n */\n const handleConsent = (consent: CookieFirstConsent | null) => {\n // A null consent means no choice yet and is skipped by the next line\n // either way, so explicitOnly changes nothing here.\n if (settings.explicitOnly && !consent) return;\n if (!consent) return;\n\n // Map CookieFirst categories to walkerOS consent groups\n // Use OR logic: if ANY source category is true, the target group is true\n const state: WalkerOS.Consent = {};\n Object.entries(consent).forEach(([category, value]) => {\n if (typeof value !== 'boolean') return;\n const mapped = settings.categoryMap?.[category] ?? category;\n // OR logic: once true, stays true\n state[mapped] = 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;;;ACmBO,IAAM,uBAA+C;AAAA,EAC1D,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AA4BO,IAAM,oBAAwC,OAAO,YAAY;AApDxE;AAqDE,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,eAAc,4CAAQ,aAAR,mBAAkB,iBAAlB,YAAkC;AAAA,IAChD,aAAY,4CAAQ,aAAR,mBAAkB,eAAlB,YAAgC;AAAA,EAC9C;AAEA,QAAM,aAAmC,EAAE,SAAS;AAGpD,MAAI;AACJ,MAAI;AAMJ,QAAM,OAAO,YAA2B;AA9E1C,QAAAA;AAgFI,QAAI,CAAC,aAAc;AAQnB,UAAM,gBAAgB,CAAC,YAAuC;AAG5D,UAAI,SAAS,gBAAgB,CAAC,QAAS;AACvC,UAAI,CAAC,QAAS;AAId,YAAM,QAA0B,CAAC;AACjC,aAAO,QAAQ,OAAO,EAAE,QAAQ,C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
6
  "platform": [
7
7
  "web"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "explicitOnly": {
30
30
  "type": "boolean",
31
- "description": "Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true."
31
+ "description": "Has no effect in this source: it skips CookieFirst.consent while it is null (no choice made yet) and reports every consent CookieFirst provides after that, whether explicitOnly is true or false. Default: true."
32
32
  },
33
33
  "globalName": {
34
34
  "type": "string",
@@ -59,7 +59,7 @@
59
59
  "$code": "()=>()=>Promise.resolve({ok:!0})"
60
60
  },
61
61
  "createMockWindow": {
62
- "$code": "(e=null)=>({CookieFirst:k(e),addEventListener:d,removeEventListener:d})"
62
+ "$code": "(e=null)=>({CookieFirst:k(e),addEventListener:f,removeEventListener:f})"
63
63
  },
64
64
  "createTrigger": {
65
65
  "$code": "async e=>{let t;return{get flow(){return t},trigger:()=>async n=>{var r;if(window.CookieFirst={consent:n},!t){const n=await O({...e,run:null==(r=e.run)||r});return void(t={collector:n.collector,elb:n.elb})}window.dispatchEvent(new CustomEvent(\"cf_consent\",{detail:n}))}}}"
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.7.0",
4
+ "version": "4.7.1",
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.7.0",
50
- "@walkeros/collector": "4.7.0"
49
+ "@walkeros/core": "4.7.1",
50
+ "@walkeros/collector": "4.7.1"
51
51
  },
52
52
  "devDependencies": {},
53
53
  "repository": {