@walkeros/web-source-cmp-cookiefirst 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +40 -19
- package/dist/dev.d.ts +40 -19
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +44 -20
- package/dist/examples/index.mjs +44 -20
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +83 -30
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.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// Export examples\nexport * from './examples';\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 // Only setup if in browser environment\n if (actualWindow) {\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 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\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 { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAAM,uBAAyC;AAAA,EACpD,YAAY;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AAU,UAAW;AAChC,cAAM,UAASA,OAAAD,MAAA,SAAS,gBAAT,gBAAAA,IAAuB,cAAvB,OAAAC,MAAoC;AAEnD,cAAM,MAAM,IAAI,MAAM,MAAM,KAAK;AAAA,MACnC,CAAC;AAGD,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAEA,UAAM,cAAa,cAAS,eAAT,YAAuB;AAC1C,UAAM,MAAM,aAAa,UAAU;AAGnC,QAAI,2BAAK,SAAS;AAChB,oBAAc,IAAI,OAAO;AAAA,IAC3B;AAGA,mBAAe,MAAM;AApHzB,UAAAD;AAqHM,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,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":["fullConsent","partialConsent","trigger","_a","_b","cmp"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.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// Export examples\nexport * from './examples';\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 // Only setup if in browser environment\n if (actualWindow) {\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 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\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 { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\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 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 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 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';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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Aa,UAAU;AAGnC,QAAI,2BAAK,SAAS;AAChB,oBAAc,IAAI,OAAO;AAAA,IAC3B;AAGA,mBAAe,MAAM;AApHzB,UAAAD;AAqHM,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,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":["fullConsent","partialConsent","trigger","_a","_b","cmp"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty,e={},t={necessary:!0,functional:!0,performance:!0,advertising:!0},i={necessary:!0,functional:!0,performance:!1,advertising:!1},r={necessary:!0,functional:!1,performance:!1,advertising:!1},o=null,a={necessary:!0,functional:!1,performance:!0,advertising:!1},s={necessary:!0,functional:!1,performance:!1,advertising:!0},c={functional:!0,analytics:!0,marketing:!0},l={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!1,marketing:!1},f={functional:!0,analytics:!0,marketing:!1},g={functional:!0,analytics:!1,marketing:!0},d=()=>{},p=()=>()=>Promise.resolve({ok:!0}),v={error:d,warn:d,info:d,debug:d,throw:n=>{throw"string"==typeof n?new Error(n):n},json:d,scope:()=>v},y=(n=null)=>({consent:n}),m=(n=null)=>({CookieFirst:y(n),addEventListener:d,removeEventListener:d}),w={get push(){return p()},get command(){return p()},get elb(){return p()},get window(){return m()},logger:v},k={};((e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})})(k,{categoryMapOverride:()=>E,cfInitDetection:()=>h,fullConsent:()=>b,partialConsent:()=>C});var b={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:{functional:!0,analytics:!0,marketing:!0}},C={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:{functional:!0,analytics:!1,marketing:!1}},E={description:"Custom categoryMap remaps performance to statistics instead of analytics",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!0,advertising:!1},mapping:{settings:{categoryMap:{performance:"statistics"}}},out:{functional:!0,statistics:!0,marketing:!1}},h={description:"CMP detected via cf_init CustomEvent (primary detection path)",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!1,advertising:!0},out:{functional:!0,analytics:!1,marketing:!0}};import{startFlow as M}from"@walkeros/collector";var O=async n=>{let e;return{get flow(){return e},trigger:()=>async t=>{var i;if(window.CookieFirst={consent:t},!e){const t=await M({...n,run:null==(i=n.run)||i});e={collector:t.collector,elb:t.elb}}window.dispatchEvent(new Event("cf_init"))}}},F=(n,e)=>{n&&"object"==typeof n&&(e.window.CookieFirst={consent:n})},L={necessary:"functional",functional:"functional",performance:"analytics",advertising:"marketing"},_=async n=>{var e,t,i,r,o,a,s;const{config:c,env:l}=n,{elb:u}=l,f=null!=(e=l.window)?e:void 0!==globalThis.window?globalThis.window:void 0,g={categoryMap:{...L,...null==(t=null==c?void 0:c.settings)?void 0:t.categoryMap},explicitOnly:null==(r=null==(i=null==c?void 0:c.settings)?void 0:i.explicitOnly)||r,globalName:null!=(a=null==(o=null==c?void 0:c.settings)?void 0:o.globalName)?a:"CookieFirst"},d={settings:g};let p,v;if(f){const n=n=>{if(g.explicitOnly&&!n)return;if(!n)return;const e={};Object.entries(n).forEach(([n,t])=>{var i,r;if("boolean"!=typeof t)return;const o=null!=(r=null==(i=g.categoryMap)?void 0:i[n])?r:n;e[o]=e[o]||t}),Object.keys(e).length>0&&u("walker consent",e)},e=null!=(s=g.globalName)?s:"CookieFirst",t=f[e];(null==t?void 0:t.consent)&&n(t.consent),p=()=>{var t;const i=f[e];n(null!=(t=null==i?void 0:i.consent)?t:null)},f.addEventListener("cf_init",p),v=e=>{n(e.detail)},f.addEventListener("cf_consent",v)}return{type:"cookiefirst",config:d,push:u,destroy:async n=>{f&&p&&f.removeEventListener("cf_init",p),f&&v&&f.removeEventListener("cf_consent",v)}}},j=_;export{L as DEFAULT_CATEGORY_MAP,e as SourceCookieFirst,a as analyticsOnlyConsent,f as analyticsOnlyMapped,y as createMockCookieFirstAPI,p as createMockElbFn,m as createMockWindow,O as createTrigger,j as default,t as fullConsent,c as fullConsentMapped,s as marketingOnlyConsent,g as marketingOnlyMapped,r as minimalConsent,u as minimalConsentMapped,w as mockEnv,o as noConsent,v as noopLogger,i as partialConsent,l as partialConsentMapped,_ as sourceCookieFirst,k as step,F as trigger};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var n=Object.defineProperty,e={},t={necessary:!0,functional:!0,performance:!0,advertising:!0},i={necessary:!0,functional:!0,performance:!1,advertising:!1},r={necessary:!0,functional:!1,performance:!1,advertising:!1},o=null,a={necessary:!0,functional:!1,performance:!0,advertising:!1},s={necessary:!0,functional:!1,performance:!1,advertising:!0},c={functional:!0,analytics:!0,marketing:!0},l={functional:!0,analytics:!1,marketing:!1},u={functional:!0,analytics:!1,marketing:!1},f={functional:!0,analytics:!0,marketing:!1},g={functional:!0,analytics:!1,marketing:!0},d=()=>{},p=()=>()=>Promise.resolve({ok:!0}),v={error:d,warn:d,info:d,debug:d,throw:n=>{throw"string"==typeof n?new Error(n):n},json:d,scope:()=>v},y=(n=null)=>({consent:n}),m=(n=null)=>({CookieFirst:y(n),addEventListener:d,removeEventListener:d}),w={get push(){return p()},get command(){return p()},get elb(){return p()},get window(){return m()},logger:v},k={};((e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})})(k,{categoryMapOverride:()=>E,cfInitDetection:()=>h,fullConsent:()=>b,partialConsent:()=>C});var b={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!0,advertising:!0},out:[["elb","walker consent",{functional:!0,analytics:!0,marketing:!0}]]},C={trigger:{type:"consent"},in:{necessary:!0,functional:!0,performance:!1,advertising:!1},out:[["elb","walker consent",{functional:!0,analytics:!1,marketing:!1}]]},E={description:"Custom categoryMap remaps performance to statistics instead of analytics",trigger:{type:"consent"},in:{necessary:!0,functional:!1,performance:!0,advertising:!1},mapping:{settings:{categoryMap:{performance:"statistics"}}},out:[["elb","walker consent",{functional:!0,statistics:!0,marketing:!1}]]},h={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 M}from"@walkeros/collector";var O=async n=>{let e;return{get flow(){return e},trigger:()=>async t=>{var i;if(window.CookieFirst={consent:t},!e){const t=await M({...n,run:null==(i=n.run)||i});e={collector:t.collector,elb:t.elb}}window.dispatchEvent(new Event("cf_init"))}}},F=(n,e)=>{n&&"object"==typeof n&&(e.window.CookieFirst={consent:n})},L={necessary:"functional",functional:"functional",performance:"analytics",advertising:"marketing"},_=async n=>{var e,t,i,r,o,a,s;const{config:c,env:l}=n,{elb:u}=l,f=null!=(e=l.window)?e:void 0!==globalThis.window?globalThis.window:void 0,g={categoryMap:{...L,...null==(t=null==c?void 0:c.settings)?void 0:t.categoryMap},explicitOnly:null==(r=null==(i=null==c?void 0:c.settings)?void 0:i.explicitOnly)||r,globalName:null!=(a=null==(o=null==c?void 0:c.settings)?void 0:o.globalName)?a:"CookieFirst"},d={settings:g};let p,v;if(f){const n=n=>{if(g.explicitOnly&&!n)return;if(!n)return;const e={};Object.entries(n).forEach(([n,t])=>{var i,r;if("boolean"!=typeof t)return;const o=null!=(r=null==(i=g.categoryMap)?void 0:i[n])?r:n;e[o]=e[o]||t}),Object.keys(e).length>0&&u("walker consent",e)},e=null!=(s=g.globalName)?s:"CookieFirst",t=f[e];(null==t?void 0:t.consent)&&n(t.consent),p=()=>{var t;const i=f[e];n(null!=(t=null==i?void 0:i.consent)?t:null)},f.addEventListener("cf_init",p),v=e=>{n(e.detail)},f.addEventListener("cf_consent",v)}return{type:"cookiefirst",config:d,push:u,destroy:async n=>{f&&p&&f.removeEventListener("cf_init",p),f&&v&&f.removeEventListener("cf_consent",v)}}},j=_;export{L as DEFAULT_CATEGORY_MAP,e as SourceCookieFirst,a as analyticsOnlyConsent,f as analyticsOnlyMapped,y as createMockCookieFirstAPI,p as createMockElbFn,m as createMockWindow,O as createTrigger,j as default,t as fullConsent,c as fullConsentMapped,s as marketingOnlyConsent,g as marketingOnlyMapped,r as minimalConsent,u as minimalConsentMapped,w as mockEnv,o as noConsent,v as noopLogger,i as partialConsent,l as partialConsentMapped,_ as sourceCookieFirst,k as step,F as trigger};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\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 { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: true,\n marketing: true,\n },\n};\n\nexport const partialConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: false,\n },\n};\n\nexport const categoryMapOverride: Flow.StepExample = {\n description:\n 'Custom categoryMap remaps performance to statistics instead of analytics',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n },\n mapping: {\n settings: {\n categoryMap: {\n performance: 'statistics',\n },\n },\n },\n out: {\n functional: true,\n statistics: true,\n marketing: false,\n },\n};\n\nexport const cfInitDetection: Flow.StepExample = {\n description: 'CMP detected via cf_init CustomEvent (primary detection path)',\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n },\n out: {\n functional: true,\n analytics: false,\n marketing: true,\n },\n};\n","import type { Trigger, Collector } from '@walkeros/core';\nimport { startFlow } from '@walkeros/collector';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n","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// Export examples\nexport * from './examples';\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 // Only setup if in browser environment\n if (actualWindow) {\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 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;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,iBAAqC;AAAA,EAChD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAMO,IAAM,YAAuC;AAK7C,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,IAAM,uBAA2C;AAAA,EACtD,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;;;ACjDO,IAAM,oBAAsC;AAAA,EACjD,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,WAAW;AACb;AAKO,IAA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AAC,KAAAC;AA+FQ,YAAI,OAAO,UAAU,UAAW;AAChC,cAAM,UAASA,OAAAD,MAAA,SAAS,gBAAT,gBAAAA,IAAuB,cAAvB,OAAAC,MAAoC;AAEnD,cAAM,MAAM,IAAI,MAAM,MAAM,KAAK;AAAA,MACnC,CAAC;AAGD,UAAI,OAAO,KAAK,KAAK,EAAE,SAAS,GAAG;AACjC,YAAI,kBAAkB,KAAK;AAAA,MAC7B;AAAA,IACF;AAEA,UAAM,cAAa,cAAS,eAAT,YAAuB;AAC1C,UAAM,MAAM,aAAa,UAAU;AAGnC,QAAI,2BAAK,SAAS;AAChB,oBAAc,IAAI,OAAO;AAAA,IAC3B;AAGA,mBAAe,MAAM;AApHzB,UAAAD;AAqHM,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,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":["fullConsent","partialConsent","trigger","_a","_b","cmp"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/examples/inputs.ts","../src/examples/outputs.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/trigger.ts","../src/index.ts"],"sourcesContent":["import type { Source, Elb } from '@walkeros/core';\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 { CookieFirstConsent } from '../types';\n\n/**\n * Example CookieFirst consent inputs.\n *\n * These represent real consent states from CookieFirst CMP.\n */\n\n/**\n * Full consent - user accepted all categories\n */\nexport const fullConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n};\n\n/**\n * Partial consent - user accepted only necessary and functional\n */\nexport const partialConsent: CookieFirstConsent = {\n necessary: true,\n functional: true,\n performance: false,\n advertising: false,\n};\n\n/**\n * Minimal consent - user accepted only necessary (required)\n */\nexport const minimalConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: false,\n};\n\n/**\n * No consent - user hasn't made a choice yet\n * CookieFirst returns null when no explicit choice has been made\n */\nexport const noConsent: CookieFirstConsent | null = null;\n\n/**\n * Analytics only - user accepted performance tracking\n */\nexport const analyticsOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: true,\n advertising: false,\n};\n\n/**\n * Marketing only - user accepted advertising\n */\nexport const marketingOnlyConsent: CookieFirstConsent = {\n necessary: true,\n functional: false,\n performance: false,\n advertising: true,\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/**\n * Expected walkerOS consent outputs.\n *\n * These represent the consent state after mapping CookieFirst categories\n * to walkerOS consent groups using the default category map.\n */\n\n/**\n * Full consent mapped to walkerOS groups\n * (necessary + functional → functional, performance → analytics, advertising → marketing)\n */\nexport const fullConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: true,\n};\n\n/**\n * Partial consent mapped to walkerOS groups\n */\nexport const partialConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Minimal consent mapped to walkerOS groups\n */\nexport const minimalConsentMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: false,\n};\n\n/**\n * Analytics only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const analyticsOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: true,\n marketing: false,\n};\n\n/**\n * Marketing only consent mapped to walkerOS groups\n * Note: functional is true because necessary=true maps to functional\n * (OR logic: if ANY source category is true, target group is true)\n */\nexport const marketingOnlyMapped: WalkerOS.Consent = {\n functional: true,\n analytics: false,\n marketing: true,\n};\n","import type { Source, Elb, Logger } from '@walkeros/core';\nimport type { CookieFirstAPI, CookieFirstConsent } from '../types';\n\n/**\n * Example environment configurations for CookieFirst source testing.\n *\n * These provide mock structures for testing consent handling\n * without requiring a real browser environment.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\n/**\n * Create a properly typed elb/push function mock that returns a promise with PushResult\n */\nexport const createMockElbFn = (): Elb.Fn => {\n const fn = (() =>\n Promise.resolve({\n ok: true,\n })) as Elb.Fn;\n return fn;\n};\n\n/**\n * Simple no-op logger for demo purposes\n */\nexport const noopLogger: Logger.Instance = {\n error: noop,\n warn: noop,\n info: noop,\n debug: noop,\n throw: (message: string | Error) => {\n throw typeof message === 'string' ? new Error(message) : message;\n },\n json: noop,\n scope: () => noopLogger,\n};\n\n/**\n * Environment interface for CookieFirst source\n */\ninterface CookieFirstEnv extends Source.BaseEnv {\n window?: typeof window;\n}\n\n/**\n * Create a mock CookieFirst API object\n */\nexport const createMockCookieFirstAPI = (\n consent: CookieFirstConsent | null = null,\n): CookieFirstAPI => ({\n consent,\n});\n\n/**\n * Create a mock window object with CookieFirst\n */\nexport const createMockWindow = (\n consent: CookieFirstConsent | null = null,\n): Partial<Window> & { CookieFirst: CookieFirstAPI } => ({\n CookieFirst: createMockCookieFirstAPI(consent),\n addEventListener: noop,\n removeEventListener: noop,\n});\n\n/**\n * Standard mock environment for testing CookieFirst source\n *\n * Use this for testing consent handling without requiring\n * a real browser environment.\n */\nexport const mockEnv: CookieFirstEnv = {\n get push() {\n return createMockElbFn();\n },\n get command() {\n return createMockElbFn();\n },\n get elb() {\n return createMockElbFn();\n },\n get window() {\n return createMockWindow() as unknown as typeof window;\n },\n logger: noopLogger,\n};\n","import type { Flow } from '@walkeros/core';\n\nexport const fullConsent: Flow.StepExample = {\n trigger: { type: 'consent' },\n in: {\n necessary: true,\n functional: true,\n performance: true,\n advertising: true,\n },\n out: [\n [\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 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 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 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';\n\ninterface CookieFirstConsent {\n necessary?: boolean;\n functional?: boolean;\n performance?: boolean;\n advertising?: boolean;\n [category: string]: boolean | undefined;\n}\n\nconst createTrigger: Trigger.CreateFn<CookieFirstConsent, void> = async (\n config: Collector.InitConfig,\n) => {\n let flow: Trigger.FlowHandle | undefined;\n\n const trigger: Trigger.Fn<CookieFirstConsent, void> =\n () => async (content: CookieFirstConsent) => {\n // Pre-init: set CookieFirst global (source reads this during init)\n (window as unknown as Record<string, unknown>).CookieFirst = {\n consent: content,\n };\n\n // Lazy startFlow — source reads global + registers event listeners\n if (!flow) {\n const result = await startFlow({ ...config, run: config.run ?? true });\n flow = { collector: result.collector, elb: result.elb };\n }\n\n // Post-init: dispatch cf_init to trigger consent processing\n window.dispatchEvent(new Event('cf_init'));\n };\n\n return {\n get flow() {\n return flow;\n },\n trigger,\n };\n};\n\n/** Sets window.CookieFirst.consent before source init (legacy). */\nconst trigger = (input: unknown, env: Record<string, unknown>): void => {\n if (!input || typeof input !== 'object') return;\n (env.window as Record<string, unknown>).CookieFirst = { consent: input };\n};\n\nexport { createTrigger, trigger };\n","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// Export examples\nexport * from './examples';\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 // Only setup if in browser environment\n if (actualWindow) {\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 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;;;ACWO,IAAM,cAAkC;AAAA,EAC7C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AACf;AAKO,I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nC,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,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":["fullConsent","partialConsent","trigger","_a","_b","cmp"]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-source-cmp-cookiefirst",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"type": "source",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -10,7 +10,36 @@
|
|
|
10
10
|
"docs": "https://www.walkeros.io/docs/sources/web/cmps/cookiefirst",
|
|
11
11
|
"source": "https://github.com/elbwalker/walkerOS/tree/main/packages/web/sources/cmps/cookiefirst/src"
|
|
12
12
|
},
|
|
13
|
-
"schemas": {
|
|
13
|
+
"schemas": {
|
|
14
|
+
"settings": {
|
|
15
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"categoryMap": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"propertyNames": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"description": "Map the CMP's consent categories (keys) to walkerOS consent groups (values)."
|
|
27
|
+
},
|
|
28
|
+
"explicitOnly": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Only process consent after the user made an explicit choice. Ignores default/implicit states. Default: true."
|
|
31
|
+
},
|
|
32
|
+
"globalName": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Custom name for the CookieFirst global on window. Default: 'CookieFirst'."
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"id": "CookieFirstSettings",
|
|
39
|
+
"title": "Settings",
|
|
40
|
+
"description": "Settings for the CookieFirst CMP source."
|
|
41
|
+
}
|
|
42
|
+
},
|
|
14
43
|
"examples": {
|
|
15
44
|
"analyticsOnlyConsent": {
|
|
16
45
|
"necessary": true,
|
|
@@ -24,16 +53,16 @@
|
|
|
24
53
|
"marketing": false
|
|
25
54
|
},
|
|
26
55
|
"createMockCookieFirstAPI": {
|
|
27
|
-
"$code": "(
|
|
56
|
+
"$code": "(e=null)=>({consent:e})"
|
|
28
57
|
},
|
|
29
58
|
"createMockElbFn": {
|
|
30
59
|
"$code": "()=>()=>Promise.resolve({ok:!0})"
|
|
31
60
|
},
|
|
32
61
|
"createMockWindow": {
|
|
33
|
-
"$code": "(
|
|
62
|
+
"$code": "(e=null)=>({CookieFirst:k(e),addEventListener:u,removeEventListener:u})"
|
|
34
63
|
},
|
|
35
64
|
"createTrigger": {
|
|
36
|
-
"$code": "async
|
|
65
|
+
"$code": "async e=>{let n;return{get flow(){return n},trigger:()=>async t=>{var r;if(window.CookieFirst={consent:t},!n){const t=await O({...e,run:null==(r=e.run)||r});n={collector:t.collector,elb:t.elb}}window.dispatchEvent(new Event(\"cf_init\"))}}}"
|
|
37
66
|
},
|
|
38
67
|
"fullConsent": {
|
|
39
68
|
"necessary": true,
|
|
@@ -103,13 +132,13 @@
|
|
|
103
132
|
"$code": "()=>{}"
|
|
104
133
|
},
|
|
105
134
|
"throw": {
|
|
106
|
-
"$code": "
|
|
135
|
+
"$code": "e=>{throw\"string\"==typeof e?new Error(e):e}"
|
|
107
136
|
},
|
|
108
137
|
"json": {
|
|
109
138
|
"$code": "()=>{}"
|
|
110
139
|
},
|
|
111
140
|
"scope": {
|
|
112
|
-
"$code": "()=>
|
|
141
|
+
"$code": "()=>y"
|
|
113
142
|
}
|
|
114
143
|
}
|
|
115
144
|
},
|
|
@@ -128,13 +157,13 @@
|
|
|
128
157
|
"$code": "()=>{}"
|
|
129
158
|
},
|
|
130
159
|
"throw": {
|
|
131
|
-
"$code": "
|
|
160
|
+
"$code": "e=>{throw\"string\"==typeof e?new Error(e):e}"
|
|
132
161
|
},
|
|
133
162
|
"json": {
|
|
134
163
|
"$code": "()=>{}"
|
|
135
164
|
},
|
|
136
165
|
"scope": {
|
|
137
|
-
"$code": "()=>
|
|
166
|
+
"$code": "()=>y"
|
|
138
167
|
}
|
|
139
168
|
},
|
|
140
169
|
"partialConsent": {
|
|
@@ -167,11 +196,17 @@
|
|
|
167
196
|
}
|
|
168
197
|
}
|
|
169
198
|
},
|
|
170
|
-
"out":
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
199
|
+
"out": [
|
|
200
|
+
[
|
|
201
|
+
"elb",
|
|
202
|
+
"walker consent",
|
|
203
|
+
{
|
|
204
|
+
"functional": true,
|
|
205
|
+
"statistics": true,
|
|
206
|
+
"marketing": false
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
]
|
|
175
210
|
},
|
|
176
211
|
"cfInitDetection": {
|
|
177
212
|
"description": "CMP detected via cf_init CustomEvent (primary detection path)",
|
|
@@ -184,11 +219,17 @@
|
|
|
184
219
|
"performance": false,
|
|
185
220
|
"advertising": true
|
|
186
221
|
},
|
|
187
|
-
"out":
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
222
|
+
"out": [
|
|
223
|
+
[
|
|
224
|
+
"elb",
|
|
225
|
+
"walker consent",
|
|
226
|
+
{
|
|
227
|
+
"functional": true,
|
|
228
|
+
"analytics": false,
|
|
229
|
+
"marketing": true
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
]
|
|
192
233
|
},
|
|
193
234
|
"fullConsent": {
|
|
194
235
|
"trigger": {
|
|
@@ -200,11 +241,17 @@
|
|
|
200
241
|
"performance": true,
|
|
201
242
|
"advertising": true
|
|
202
243
|
},
|
|
203
|
-
"out":
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
244
|
+
"out": [
|
|
245
|
+
[
|
|
246
|
+
"elb",
|
|
247
|
+
"walker consent",
|
|
248
|
+
{
|
|
249
|
+
"functional": true,
|
|
250
|
+
"analytics": true,
|
|
251
|
+
"marketing": true
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
]
|
|
208
255
|
},
|
|
209
256
|
"partialConsent": {
|
|
210
257
|
"trigger": {
|
|
@@ -216,15 +263,21 @@
|
|
|
216
263
|
"performance": false,
|
|
217
264
|
"advertising": false
|
|
218
265
|
},
|
|
219
|
-
"out":
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
266
|
+
"out": [
|
|
267
|
+
[
|
|
268
|
+
"elb",
|
|
269
|
+
"walker consent",
|
|
270
|
+
{
|
|
271
|
+
"functional": true,
|
|
272
|
+
"analytics": false,
|
|
273
|
+
"marketing": false
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
]
|
|
224
277
|
}
|
|
225
278
|
},
|
|
226
279
|
"trigger": {
|
|
227
|
-
"$code": "(n
|
|
280
|
+
"$code": "(e,n)=>{e&&\"object\"==typeof e&&(n.window.CookieFirst={consent:e})}"
|
|
228
281
|
}
|
|
229
282
|
}
|
|
230
283
|
}
|
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": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"walkerOS": {
|
|
7
7
|
"type": "source",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"update": "npx npm-check-updates -u && npm update"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@walkeros/core": "3.
|
|
49
|
-
"@walkeros/collector": "3.
|
|
48
|
+
"@walkeros/core": "3.4.0",
|
|
49
|
+
"@walkeros/collector": "3.4.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {},
|
|
52
52
|
"repository": {
|