@walkeros/web-destination-clarity 4.2.0 → 4.2.1-next-1781538735002

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,13 @@
1
1
  # @walkeros/web-destination-clarity
2
2
 
3
+ ## 4.2.1-next-1781538735002
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [5cbcd23]
8
+ - @walkeros/core@4.2.1-next-1781538735002
9
+ - @walkeros/web-core@4.2.1-next-1781538735002
10
+
3
11
  ## 4.2.0
4
12
 
5
13
  ### Patch Changes
package/dist/dev.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
- import { Mapping as Mapping$1, Flow } from '@walkeros/core';
3
+ import { Mapping as Mapping$1, Flow, WalkerOS } from '@walkeros/core';
4
4
  import { DestinationWeb } from '@walkeros/web-core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
@@ -100,6 +100,8 @@ declare namespace env {
100
100
  type ClarityStepExample = Flow.StepExample & {
101
101
  settings?: Partial<Settings>;
102
102
  configInclude?: string[];
103
+ /** Consent granted before `in` so a gated destination is loaded first. */
104
+ before?: WalkerOS.Consent;
103
105
  };
104
106
  /**
105
107
  * Default event forwarding - every walkerOS event becomes Clarity.event(name).
@@ -174,9 +176,12 @@ declare const pageViewSilent: ClarityStepExample;
174
176
  */
175
177
  declare const consentGrantBoth: ClarityStepExample;
176
178
  /**
177
- * Consent revocation - denied categories call Clarity.consentV2(...) with
178
- * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`
179
- * API at all - consentV2 is the single source of truth for consent state.
179
+ * Consent revocation - after analytics and marketing are granted (Clarity
180
+ * loads), revoking them calls Clarity.consentV2(...) with denied flags. The
181
+ * destination does NOT call the legacy `Clarity.consent(false)` API at all -
182
+ * consentV2 is the single source of truth for consent state. The destination
183
+ * is never loaded under denied consent, so the revoke acts on an
184
+ * already-granted destination.
180
185
  */
181
186
  declare const consentRevoke: ClarityStepExample;
182
187
 
package/dist/dev.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
- import { Mapping as Mapping$1, Flow } from '@walkeros/core';
3
+ import { Mapping as Mapping$1, Flow, WalkerOS } from '@walkeros/core';
4
4
  import { DestinationWeb } from '@walkeros/web-core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
@@ -100,6 +100,8 @@ declare namespace env {
100
100
  type ClarityStepExample = Flow.StepExample & {
101
101
  settings?: Partial<Settings>;
102
102
  configInclude?: string[];
103
+ /** Consent granted before `in` so a gated destination is loaded first. */
104
+ before?: WalkerOS.Consent;
103
105
  };
104
106
  /**
105
107
  * Default event forwarding - every walkerOS event becomes Clarity.event(name).
@@ -174,9 +176,12 @@ declare const pageViewSilent: ClarityStepExample;
174
176
  */
175
177
  declare const consentGrantBoth: ClarityStepExample;
176
178
  /**
177
- * Consent revocation - denied categories call Clarity.consentV2(...) with
178
- * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`
179
- * API at all - consentV2 is the single source of truth for consent state.
179
+ * Consent revocation - after analytics and marketing are granted (Clarity
180
+ * loads), revoking them calls Clarity.consentV2(...) with denied flags. The
181
+ * destination does NOT call the legacy `Clarity.consent(false)` API at all -
182
+ * consentV2 is the single source of truth for consent state. The destination
183
+ * is never loaded under denied consent, so the revoke acts on an
184
+ * already-granted destination.
180
185
  */
181
186
  declare const consentRevoke: ClarityStepExample;
182
187
 
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},s={};r(s,{examples:()=>m,schemas:()=>o}),module.exports=(e=s,((e,r,s,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let d of i(r))n.call(e,d)||d===s||t(e,d,{get:()=>r[d],enumerable:!(o=a(r,d))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>p,SettingsSchema:()=>c,mapping:()=>y,settings:()=>u});var d=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('Your Microsoft Clarity project ID (e.g. "3t0wlogvdz"). Find it in your Clarity dashboard under Settings → Setup.'),consent:l.z.record(l.z.string(),l.z.enum(["analytics_Storage","ad_Storage"])).describe('Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { "analytics": "analytics_Storage", "marketing": "ad_Storage" }. Required to get meaningful consent behavior — Clarity expects its own category names.').optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.").optional()}),g=require("@walkeros/core/dev"),p=g.z.object({identify:g.z.unknown().describe("Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).").optional(),set:g.z.unknown().describe("Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.").optional(),upgrade:g.z.unknown().describe("Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.").optional()}),u=(0,d.zodToSchema)(c),y=(0,d.zodToSchema)(p),m={};r(m,{env:()=>v,step:()=>k});var v={};r(v,{init:()=>f,push:()=>w,simulation:()=>b});var h=()=>{},f={clarity:{init:h,identify:h,setTag:h,event:h,consentV2:h,upgrade:h}},w={clarity:{init:h,identify:h,setTag:h,event:h,consentV2:h,upgrade:h}},b=["call:clarity.init","call:clarity.identify","call:clarity.setTag","call:clarity.event","call:clarity.consentV2","call:clarity.upgrade"],k={};r(k,{arrayTagValue:()=>z,combinedFeatures:()=>V,consentGrantBoth:()=>O,consentRevoke:()=>D,defaultEventForwarding:()=>_,destinationLevelIdentify:()=>I,orderCompleteInclude:()=>P,orderCompleteUpgrade:()=>A,pageViewSilent:()=>j,productViewWithTags:()=>E,userLoginIdentify:()=>T,wildcardIgnored:()=>S});var C=require("@walkeros/core"),_={title:"Default event",description:"A walker event becomes a Clarity.event call with the event name as the Clarity custom event.",in:(0,C.getEvent)("product view",{timestamp:1700000100}),out:[["clarity.event","product view"]]},S={public:!1,in:(0,C.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},T={title:"User login identify",description:"A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.",in:(0,C.getEvent)("user login",{timestamp:1700000102,data:{id:"u-123",name:"Jane Doe"},globals:{pagegroup:"shop",pagetype:"home"}}),mapping:{settings:{identify:{map:{customId:"data.id",customSessionId:"user.session",customPageId:"globals.pagetype",friendlyName:"data.name"}}}},out:[["clarity.identify","u-123","s3ss10n","home","Jane Doe"],["clarity.event","user login"]]},I={title:"Destination identify",description:"Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.",in:(0,C.getEvent)("page view",{timestamp:1700000103}),settings:{identify:{map:{customId:"user.id"}}},out:[["clarity.identify","us3r"],["clarity.event","page view"]]},E={title:"Custom tags",description:"A product view sets Clarity session tags such as product color and id before firing the event.",in:(0,C.getEvent)("product view",{timestamp:1700000104}),mapping:{settings:{set:{map:{product_color:"data.color",product_id:"data.id"}}}},out:[["clarity.setTag","product_color","black"],["clarity.setTag","product_id","ers"],["clarity.event","product view"]]},z={title:"Array tag values",description:"Array values such as product tags are passed through to Clarity.setTag preserving the array shape.",in:(0,C.getEvent)("product view",{timestamp:1700000105,data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420,tags:["sale","featured"]}}),mapping:{settings:{set:{map:{product_tags:"data.tags"}}}},out:[["clarity.setTag","product_tags",["sale","featured"]],["clarity.event","product view"]]},A={title:"Upgrade session",description:"A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.",in:(0,C.getEvent)("order complete",{timestamp:1700000106}),mapping:{name:"Purchase",settings:{upgrade:{value:"purchase"}}},out:[["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},P={title:"Include data as tags",description:"A mapping include flattens the event data section into Clarity.setTag calls before the event fires.",in:(0,C.getEvent)("order complete",{timestamp:1700000107}),mapping:{include:["data"]},out:[["clarity.setTag","data_id","0rd3r1d"],["clarity.setTag","data_currency","EUR"],["clarity.setTag","data_shipping","5.22"],["clarity.setTag","data_taxes","73.76"],["clarity.setTag","data_total","555"],["clarity.event","order complete"]]},V={title:"Combined features",description:"A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.",in:(0,C.getEvent)("order complete",{timestamp:1700000108}),mapping:{name:"Purchase",settings:{identify:{map:{customId:"user.id"}},set:{map:{order_id:"data.id"}},upgrade:{value:"purchase"}}},out:[["clarity.identify","us3r"],["clarity.setTag","order_id","0rd3r1d"],["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},j={title:"Tags without event",description:"A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.",in:(0,C.getEvent)("page view",{timestamp:1700000109}),mapping:{silent:!0,settings:{set:{map:{page_id:"data.id"}}}},out:[["clarity.setTag","page_id","/docs/"]]},O={title:"Consent granted",description:"A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.",command:"consent",in:{analytics:!0,marketing:!0},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}]]},D={title:"Consent revoked",description:"A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",command:"consent",in:{analytics:!1,marketing:!1},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"denied",ad_Storage:"denied"}]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},s={};r(s,{examples:()=>m,schemas:()=>o}),module.exports=(e=s,((e,r,s,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let d of i(r))n.call(e,d)||d===s||t(e,d,{get:()=>r[d],enumerable:!(o=a(r,d))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>p,SettingsSchema:()=>c,mapping:()=>y,settings:()=>u});var d=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('Your Microsoft Clarity project ID (e.g. "3t0wlogvdz"). Find it in your Clarity dashboard under Settings → Setup.'),consent:l.z.record(l.z.string(),l.z.enum(["analytics_Storage","ad_Storage"])).describe('Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { "analytics": "analytics_Storage", "marketing": "ad_Storage" }. Required to get meaningful consent behavior — Clarity expects its own category names.').optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.").optional()}),g=require("@walkeros/core/dev"),p=g.z.object({identify:g.z.unknown().describe("Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).").optional(),set:g.z.unknown().describe("Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.").optional(),upgrade:g.z.unknown().describe("Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.").optional()}),u=(0,d.zodToSchema)(c),y=(0,d.zodToSchema)(p),m={};r(m,{env:()=>v,step:()=>k});var v={};r(v,{init:()=>f,push:()=>w,simulation:()=>b});var h=()=>{},f={clarity:{init:h,identify:h,setTag:h,event:h,consentV2:h,upgrade:h}},w={clarity:{init:h,identify:h,setTag:h,event:h,consentV2:h,upgrade:h}},b=["call:clarity.init","call:clarity.identify","call:clarity.setTag","call:clarity.event","call:clarity.consentV2","call:clarity.upgrade"],k={};r(k,{arrayTagValue:()=>z,combinedFeatures:()=>V,consentGrantBoth:()=>O,consentRevoke:()=>D,defaultEventForwarding:()=>C,destinationLevelIdentify:()=>I,orderCompleteInclude:()=>P,orderCompleteUpgrade:()=>A,pageViewSilent:()=>j,productViewWithTags:()=>E,userLoginIdentify:()=>T,wildcardIgnored:()=>S});var _=require("@walkeros/core"),C={title:"Default event",description:"A walker event becomes a Clarity.event call with the event name as the Clarity custom event.",in:(0,_.getEvent)("product view",{timestamp:1700000100}),out:[["clarity.event","product view"]]},S={public:!1,in:(0,_.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},T={title:"User login identify",description:"A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.",in:(0,_.getEvent)("user login",{timestamp:1700000102,data:{id:"u-123",name:"Jane Doe"},globals:{pagegroup:"shop",pagetype:"home"}}),mapping:{settings:{identify:{map:{customId:"data.id",customSessionId:"user.session",customPageId:"globals.pagetype",friendlyName:"data.name"}}}},out:[["clarity.identify","u-123","s3ss10n","home","Jane Doe"],["clarity.event","user login"]]},I={title:"Destination identify",description:"Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.",in:(0,_.getEvent)("page view",{timestamp:1700000103}),settings:{identify:{map:{customId:"user.id"}}},out:[["clarity.identify","us3r"],["clarity.event","page view"]]},E={title:"Custom tags",description:"A product view sets Clarity session tags such as product color and id before firing the event.",in:(0,_.getEvent)("product view",{timestamp:1700000104}),mapping:{settings:{set:{map:{product_color:"data.color",product_id:"data.id"}}}},out:[["clarity.setTag","product_color","black"],["clarity.setTag","product_id","ers"],["clarity.event","product view"]]},z={title:"Array tag values",description:"Array values such as product tags are passed through to Clarity.setTag preserving the array shape.",in:(0,_.getEvent)("product view",{timestamp:1700000105,data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420,tags:["sale","featured"]}}),mapping:{settings:{set:{map:{product_tags:"data.tags"}}}},out:[["clarity.setTag","product_tags",["sale","featured"]],["clarity.event","product view"]]},A={title:"Upgrade session",description:"A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.",in:(0,_.getEvent)("order complete",{timestamp:1700000106}),mapping:{name:"Purchase",settings:{upgrade:{value:"purchase"}}},out:[["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},P={title:"Include data as tags",description:"A mapping include flattens the event data section into Clarity.setTag calls before the event fires.",in:(0,_.getEvent)("order complete",{timestamp:1700000107}),mapping:{include:["data"]},out:[["clarity.setTag","data_id","0rd3r1d"],["clarity.setTag","data_currency","EUR"],["clarity.setTag","data_shipping","5.22"],["clarity.setTag","data_taxes","73.76"],["clarity.setTag","data_total","555"],["clarity.event","order complete"]]},V={title:"Combined features",description:"A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.",in:(0,_.getEvent)("order complete",{timestamp:1700000108}),mapping:{name:"Purchase",settings:{identify:{map:{customId:"user.id"}},set:{map:{order_id:"data.id"}},upgrade:{value:"purchase"}}},out:[["clarity.identify","us3r"],["clarity.setTag","order_id","0rd3r1d"],["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},j={title:"Tags without event",description:"A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.",in:(0,_.getEvent)("page view",{timestamp:1700000109}),mapping:{silent:!0,settings:{set:{map:{page_id:"data.id"}}}},out:[["clarity.setTag","page_id","/docs/"]]},O={title:"Consent granted",description:"A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.",command:"consent",in:{analytics:!0,marketing:!0},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}]]},D={title:"Consent revoked",description:"A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",command:"consent",before:{analytics:!0,marketing:!0},in:{analytics:!1,marketing:!1},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}],["clarity.consentV2",{analytics_Storage:"denied",ad_Storage:"denied"}]]};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Microsoft Clarity project ID (e.g. \"3t0wlogvdz\"). Find it in your Clarity dashboard under Settings → Setup.',\n ),\n consent: z\n .record(z.string(), z.enum(['analytics_Storage', 'ad_Storage']))\n .describe(\n 'Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { \"analytics\": \"analytics_Storage\", \"marketing\": \"ad_Storage\" }. Required to get meaningful consent behavior — Clarity expects its own category names.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).',\n )\n .optional(),\n set: z\n .unknown()\n .describe(\n 'Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.',\n )\n .optional(),\n upgrade: z\n .unknown()\n .describe(\n 'Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Microsoft Clarity destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.clarity` undefined — the destination falls back\n * to the real `@microsoft/clarity` default export.\n */\n\nconst noop = () => {};\n\n/**\n * Pre-init environment — Clarity SDK methods are no-ops until init wires them.\n */\nexport const init: Env | undefined = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Post-init environment — Clarity SDK methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate\n */\nexport const simulation = [\n 'call:clarity.init',\n 'call:clarity.identify',\n 'call:clarity.setTag',\n 'call:clarity.event',\n 'call:clarity.consentV2',\n 'call:clarity.upgrade',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally override destination-level settings for a test.\n * The test runner reads `settings` from the example and merges it into the\n * base destination settings (on top of the fixed `apiKey`). `configInclude`\n * is passed as config-level include when registering the destination.\n */\nexport type ClarityStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes Clarity.event(name).\n * No mapping rule; the destination's default push behavior fires.\n */\nexport const defaultEventForwarding: ClarityStepExample = {\n title: 'Default event',\n description:\n 'A walker event becomes a Clarity.event call with the event name as the Clarity custom event.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['clarity.event', 'product view']],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy events.\n * The destination forwards by default; users opt OUT via `\"*\": { \"*\": { ignore: true } }`\n * plus explicit allows. This example IS an ignored event - the destination\n * must produce zero calls.\n */\nexport const wildcardIgnored: ClarityStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Identity via settings.identify (per-event, user login).\n * Resolves positional args for Clarity.identify(customId, sessionId, pageId, friendlyName).\n * Trailing undefined args are omitted, so all four args are passed when friendlyName is set.\n * Then fires the default Clarity.event(...) forwarding.\n */\nexport const userLoginIdentify: ClarityStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: { id: 'u-123', name: 'Jane Doe' },\n globals: { pagegroup: 'shop', pagetype: 'home' },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n customId: 'data.id',\n customSessionId: 'user.session',\n customPageId: 'globals.pagetype',\n friendlyName: 'data.name',\n },\n },\n },\n },\n out: [\n ['clarity.identify', 'u-123', 's3ss10n', 'home', 'Jane Doe'],\n ['clarity.event', 'user login'],\n ],\n};\n\n/**\n * Destination-level settings.identify - Clarity officially recommends calling\n * identify() on every page load. walkerOS expresses this via destination-level\n * `settings.identify`, which fires on every push.\n */\nexport const destinationLevelIdentify: ClarityStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.',\n in: getEvent('page view', { timestamp: 1700000103 }),\n settings: {\n identify: {\n map: {\n customId: 'user.id',\n },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.event', 'page view'],\n ],\n};\n\n/**\n * Explicit custom tags via mapping.settings.set.\n * Each resolved key → Clarity.setTag(key, value). Tags fire after identify\n * but before the default event.\n */\nexport const productViewWithTags: ClarityStepExample = {\n title: 'Custom tags',\n description:\n 'A product view sets Clarity session tags such as product color and id before firing the event.',\n in: getEvent('product view', { timestamp: 1700000104 }),\n mapping: {\n settings: {\n set: {\n map: {\n product_color: 'data.color',\n product_id: 'data.id',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_color', 'black'],\n ['clarity.setTag', 'product_id', 'ers'],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Array tag values - Clarity.setTag(key, value) natively accepts string[].\n * walkerOS array values are passed through unchanged (each element is\n * coerced to string, but the array shape is preserved - no flattening,\n * no splitting into multiple calls).\n */\nexport const arrayTagValue: ClarityStepExample = {\n title: 'Array tag values',\n description:\n 'Array values such as product tags are passed through to Clarity.setTag preserving the array shape.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n data: {\n id: 'ers',\n name: 'Everyday Ruck Snack',\n color: 'black',\n size: 'l',\n price: 420,\n tags: ['sale', 'featured'],\n },\n }),\n mapping: {\n settings: {\n set: {\n map: {\n product_tags: 'data.tags',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_tags', ['sale', 'featured']],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Session priority upgrade - mark this session as important so Clarity retains\n * it beyond the sampling cap. upgrade fires before the default event.\n */\nexport const orderCompleteUpgrade: ClarityStepExample = {\n title: 'Upgrade session',\n description:\n 'A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.',\n in: getEvent('order complete', { timestamp: 1700000106 }),\n mapping: {\n name: 'Purchase',\n settings: {\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * settings.include flattens a walkerOS event section into Clarity.setTag calls.\n * Primitives coerce to strings; arrays pass through as string[].\n * The example includes `data` only; keys become `data_<field>`.\n */\nexport const orderCompleteInclude: ClarityStepExample = {\n title: 'Include data as tags',\n description:\n 'A mapping include flattens the event data section into Clarity.setTag calls before the event fires.',\n in: getEvent('order complete', { timestamp: 1700000107 }),\n mapping: {\n include: ['data'],\n },\n out: [\n ['clarity.setTag', 'data_id', '0rd3r1d'],\n ['clarity.setTag', 'data_currency', 'EUR'],\n ['clarity.setTag', 'data_shipping', '5.22'],\n ['clarity.setTag', 'data_taxes', '73.76'],\n ['clarity.setTag', 'data_total', '555'],\n ['clarity.event', 'order complete'],\n ],\n};\n\n/**\n * Combined-feature rule - Clarity's canonical usage pattern: identify the\n * user, set session tags, upgrade session priority, then fire the event.\n * This is the authoritative test for the push execution order\n * (identify → tags → upgrade → event).\n */\nexport const combinedFeatures: ClarityStepExample = {\n title: 'Combined features',\n description:\n 'A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n name: 'Purchase',\n settings: {\n identify: { map: { customId: 'user.id' } },\n set: { map: { order_id: 'data.id' } },\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.setTag', 'order_id', '0rd3r1d'],\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * mapping.silent - the rule runs (set/identify/upgrade all execute) but the\n * default Clarity.event(...) call is suppressed. Useful for page view, where\n * Clarity has its own page tracking and you only want to set tags.\n */\nexport const pageViewSilent: ClarityStepExample = {\n title: 'Tags without event',\n description:\n 'A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.',\n in: getEvent('page view', { timestamp: 1700000109 }),\n mapping: {\n silent: true,\n settings: {\n set: {\n map: {\n page_id: 'data.id',\n },\n },\n },\n },\n out: [['clarity.setTag', 'page_id', '/docs/']],\n};\n\n/**\n * Consent translation via settings.consent.\n * walkerOS consent { analytics: true, marketing: true } with the mapping\n * { analytics: 'analytics_Storage', marketing: 'ad_Storage' } fires:\n * Clarity.consentV2({ analytics_Storage: 'granted', ad_Storage: 'granted' })\n *\n * Uses the canonical StepExample.command='consent' pattern: the test runner\n * dispatches via elb('walker consent', in) instead of pushing an event.\n */\nexport const consentGrantBoth: ClarityStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.',\n command: 'consent',\n in: { analytics: true, marketing: true } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n ],\n};\n\n/**\n * Consent revocation - denied categories call Clarity.consentV2(...) with\n * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`\n * API at all - consentV2 is the single source of truth for consent state.\n */\nexport const consentRevoke: ClarityStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.',\n command: 'consent',\n in: { analytics: false, marketing: false } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'denied', ad_Storage: 'denied' },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,aACN,OAAO,aAAE,OAAO,GAAG,aAAE,KAAK,CAAC,qBAAqB,YAAY,CAAC,CAAC,EAC9D;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACrBD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,UAAU,cACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AA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ACzC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,UAAU,YAAY,SAAS;AAAA,IACtD;AAAA,EACF;AACF;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Microsoft Clarity project ID (e.g. \"3t0wlogvdz\"). Find it in your Clarity dashboard under Settings → Setup.',\n ),\n consent: z\n .record(z.string(), z.enum(['analytics_Storage', 'ad_Storage']))\n .describe(\n 'Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { \"analytics\": \"analytics_Storage\", \"marketing\": \"ad_Storage\" }. Required to get meaningful consent behavior — Clarity expects its own category names.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).',\n )\n .optional(),\n set: z\n .unknown()\n .describe(\n 'Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.',\n )\n .optional(),\n upgrade: z\n .unknown()\n .describe(\n 'Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Microsoft Clarity destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.clarity` undefined — the destination falls back\n * to the real `@microsoft/clarity` default export.\n */\n\nconst noop = () => {};\n\n/**\n * Pre-init environment — Clarity SDK methods are no-ops until init wires them.\n */\nexport const init: Env | undefined = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Post-init environment — Clarity SDK methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate\n */\nexport const simulation = [\n 'call:clarity.init',\n 'call:clarity.identify',\n 'call:clarity.setTag',\n 'call:clarity.event',\n 'call:clarity.consentV2',\n 'call:clarity.upgrade',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally override destination-level settings for a test.\n * The test runner reads `settings` from the example and merges it into the\n * base destination settings (on top of the fixed `apiKey`). `configInclude`\n * is passed as config-level include when registering the destination.\n */\nexport type ClarityStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes Clarity.event(name).\n * No mapping rule; the destination's default push behavior fires.\n */\nexport const defaultEventForwarding: ClarityStepExample = {\n title: 'Default event',\n description:\n 'A walker event becomes a Clarity.event call with the event name as the Clarity custom event.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['clarity.event', 'product view']],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy events.\n * The destination forwards by default; users opt OUT via `\"*\": { \"*\": { ignore: true } }`\n * plus explicit allows. This example IS an ignored event - the destination\n * must produce zero calls.\n */\nexport const wildcardIgnored: ClarityStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Identity via settings.identify (per-event, user login).\n * Resolves positional args for Clarity.identify(customId, sessionId, pageId, friendlyName).\n * Trailing undefined args are omitted, so all four args are passed when friendlyName is set.\n * Then fires the default Clarity.event(...) forwarding.\n */\nexport const userLoginIdentify: ClarityStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: { id: 'u-123', name: 'Jane Doe' },\n globals: { pagegroup: 'shop', pagetype: 'home' },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n customId: 'data.id',\n customSessionId: 'user.session',\n customPageId: 'globals.pagetype',\n friendlyName: 'data.name',\n },\n },\n },\n },\n out: [\n ['clarity.identify', 'u-123', 's3ss10n', 'home', 'Jane Doe'],\n ['clarity.event', 'user login'],\n ],\n};\n\n/**\n * Destination-level settings.identify - Clarity officially recommends calling\n * identify() on every page load. walkerOS expresses this via destination-level\n * `settings.identify`, which fires on every push.\n */\nexport const destinationLevelIdentify: ClarityStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.',\n in: getEvent('page view', { timestamp: 1700000103 }),\n settings: {\n identify: {\n map: {\n customId: 'user.id',\n },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.event', 'page view'],\n ],\n};\n\n/**\n * Explicit custom tags via mapping.settings.set.\n * Each resolved key → Clarity.setTag(key, value). Tags fire after identify\n * but before the default event.\n */\nexport const productViewWithTags: ClarityStepExample = {\n title: 'Custom tags',\n description:\n 'A product view sets Clarity session tags such as product color and id before firing the event.',\n in: getEvent('product view', { timestamp: 1700000104 }),\n mapping: {\n settings: {\n set: {\n map: {\n product_color: 'data.color',\n product_id: 'data.id',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_color', 'black'],\n ['clarity.setTag', 'product_id', 'ers'],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Array tag values - Clarity.setTag(key, value) natively accepts string[].\n * walkerOS array values are passed through unchanged (each element is\n * coerced to string, but the array shape is preserved - no flattening,\n * no splitting into multiple calls).\n */\nexport const arrayTagValue: ClarityStepExample = {\n title: 'Array tag values',\n description:\n 'Array values such as product tags are passed through to Clarity.setTag preserving the array shape.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n data: {\n id: 'ers',\n name: 'Everyday Ruck Snack',\n color: 'black',\n size: 'l',\n price: 420,\n tags: ['sale', 'featured'],\n },\n }),\n mapping: {\n settings: {\n set: {\n map: {\n product_tags: 'data.tags',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_tags', ['sale', 'featured']],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Session priority upgrade - mark this session as important so Clarity retains\n * it beyond the sampling cap. upgrade fires before the default event.\n */\nexport const orderCompleteUpgrade: ClarityStepExample = {\n title: 'Upgrade session',\n description:\n 'A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.',\n in: getEvent('order complete', { timestamp: 1700000106 }),\n mapping: {\n name: 'Purchase',\n settings: {\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * settings.include flattens a walkerOS event section into Clarity.setTag calls.\n * Primitives coerce to strings; arrays pass through as string[].\n * The example includes `data` only; keys become `data_<field>`.\n */\nexport const orderCompleteInclude: ClarityStepExample = {\n title: 'Include data as tags',\n description:\n 'A mapping include flattens the event data section into Clarity.setTag calls before the event fires.',\n in: getEvent('order complete', { timestamp: 1700000107 }),\n mapping: {\n include: ['data'],\n },\n out: [\n ['clarity.setTag', 'data_id', '0rd3r1d'],\n ['clarity.setTag', 'data_currency', 'EUR'],\n ['clarity.setTag', 'data_shipping', '5.22'],\n ['clarity.setTag', 'data_taxes', '73.76'],\n ['clarity.setTag', 'data_total', '555'],\n ['clarity.event', 'order complete'],\n ],\n};\n\n/**\n * Combined-feature rule - Clarity's canonical usage pattern: identify the\n * user, set session tags, upgrade session priority, then fire the event.\n * This is the authoritative test for the push execution order\n * (identify → tags → upgrade → event).\n */\nexport const combinedFeatures: ClarityStepExample = {\n title: 'Combined features',\n description:\n 'A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n name: 'Purchase',\n settings: {\n identify: { map: { customId: 'user.id' } },\n set: { map: { order_id: 'data.id' } },\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.setTag', 'order_id', '0rd3r1d'],\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * mapping.silent - the rule runs (set/identify/upgrade all execute) but the\n * default Clarity.event(...) call is suppressed. Useful for page view, where\n * Clarity has its own page tracking and you only want to set tags.\n */\nexport const pageViewSilent: ClarityStepExample = {\n title: 'Tags without event',\n description:\n 'A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.',\n in: getEvent('page view', { timestamp: 1700000109 }),\n mapping: {\n silent: true,\n settings: {\n set: {\n map: {\n page_id: 'data.id',\n },\n },\n },\n },\n out: [['clarity.setTag', 'page_id', '/docs/']],\n};\n\n/**\n * Consent translation via settings.consent.\n * walkerOS consent { analytics: true, marketing: true } with the mapping\n * { analytics: 'analytics_Storage', marketing: 'ad_Storage' } fires:\n * Clarity.consentV2({ analytics_Storage: 'granted', ad_Storage: 'granted' })\n *\n * Uses the canonical StepExample.command='consent' pattern: the test runner\n * dispatches via elb('walker consent', in) instead of pushing an event.\n */\nexport const consentGrantBoth: ClarityStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.',\n command: 'consent',\n in: { analytics: true, marketing: true } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n ],\n};\n\n/**\n * Consent revocation - after analytics and marketing are granted (Clarity\n * loads), revoking them calls Clarity.consentV2(...) with denied flags. The\n * destination does NOT call the legacy `Clarity.consent(false)` API at all -\n * consentV2 is the single source of truth for consent state. The destination\n * is never loaded under denied consent, so the revoke acts on an\n * already-granted destination.\n */\nexport const consentRevoke: ClarityStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.',\n command: 'consent',\n before: { analytics: true, marketing: true },\n in: { analytics: false, marketing: false } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n [\n 'clarity.consentV2',\n { analytics_Storage: 'denied', ad_Storage: 'denied' },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,aACN,OAAO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AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,WAAW,YAAY,UAAU;AAAA,IACxD;AAAA,EACF;AACF;AAUO,IAAM,gBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,MAAM,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,WAAW,OAAO,WAAW,MAAM;AAAA,EACzC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,WAAW,YAAY,UAAU;AAAA,IACxD;AAAA,IACA;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,UAAU,YAAY,SAAS;AAAA,IACtD;AAAA,EACF;AACF;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>s,mapping:()=>l,settings:()=>d});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var s=n.object({apiKey:n.string().min(1).describe('Your Microsoft Clarity project ID (e.g. "3t0wlogvdz"). Find it in your Clarity dashboard under Settings → Setup.'),consent:n.record(n.string(),n.enum(["analytics_Storage","ad_Storage"])).describe('Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { "analytics": "analytics_Storage", "marketing": "ad_Storage" }. Required to get meaningful consent behavior — Clarity expects its own category names.').optional(),identify:n.unknown().describe("walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.").optional()});import{z as r}from"@walkeros/core/dev";var o=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).").optional(),set:r.unknown().describe("Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.").optional(),upgrade:r.unknown().describe("Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.").optional()}),d=i(s),l=i(o),c={};t(c,{env:()=>p,step:()=>v});var p={};t(p,{init:()=>u,push:()=>m,simulation:()=>y});var g=()=>{},u={clarity:{init:g,identify:g,setTag:g,event:g,consentV2:g,upgrade:g}},m={clarity:{init:g,identify:g,setTag:g,event:g,consentV2:g,upgrade:g}},y=["call:clarity.init","call:clarity.identify","call:clarity.setTag","call:clarity.event","call:clarity.consentV2","call:clarity.upgrade"],v={};t(v,{arrayTagValue:()=>_,combinedFeatures:()=>I,consentGrantBoth:()=>V,consentRevoke:()=>P,defaultEventForwarding:()=>f,destinationLevelIdentify:()=>C,orderCompleteInclude:()=>T,orderCompleteUpgrade:()=>S,pageViewSilent:()=>A,productViewWithTags:()=>b,userLoginIdentify:()=>k,wildcardIgnored:()=>w});import{getEvent as h}from"@walkeros/core";var f={title:"Default event",description:"A walker event becomes a Clarity.event call with the event name as the Clarity custom event.",in:h("product view",{timestamp:1700000100}),out:[["clarity.event","product view"]]},w={public:!1,in:h("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},k={title:"User login identify",description:"A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.",in:h("user login",{timestamp:1700000102,data:{id:"u-123",name:"Jane Doe"},globals:{pagegroup:"shop",pagetype:"home"}}),mapping:{settings:{identify:{map:{customId:"data.id",customSessionId:"user.session",customPageId:"globals.pagetype",friendlyName:"data.name"}}}},out:[["clarity.identify","u-123","s3ss10n","home","Jane Doe"],["clarity.event","user login"]]},C={title:"Destination identify",description:"Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.",in:h("page view",{timestamp:1700000103}),settings:{identify:{map:{customId:"user.id"}}},out:[["clarity.identify","us3r"],["clarity.event","page view"]]},b={title:"Custom tags",description:"A product view sets Clarity session tags such as product color and id before firing the event.",in:h("product view",{timestamp:1700000104}),mapping:{settings:{set:{map:{product_color:"data.color",product_id:"data.id"}}}},out:[["clarity.setTag","product_color","black"],["clarity.setTag","product_id","ers"],["clarity.event","product view"]]},_={title:"Array tag values",description:"Array values such as product tags are passed through to Clarity.setTag preserving the array shape.",in:h("product view",{timestamp:1700000105,data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420,tags:["sale","featured"]}}),mapping:{settings:{set:{map:{product_tags:"data.tags"}}}},out:[["clarity.setTag","product_tags",["sale","featured"]],["clarity.event","product view"]]},S={title:"Upgrade session",description:"A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.",in:h("order complete",{timestamp:1700000106}),mapping:{name:"Purchase",settings:{upgrade:{value:"purchase"}}},out:[["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},T={title:"Include data as tags",description:"A mapping include flattens the event data section into Clarity.setTag calls before the event fires.",in:h("order complete",{timestamp:1700000107}),mapping:{include:["data"]},out:[["clarity.setTag","data_id","0rd3r1d"],["clarity.setTag","data_currency","EUR"],["clarity.setTag","data_shipping","5.22"],["clarity.setTag","data_taxes","73.76"],["clarity.setTag","data_total","555"],["clarity.event","order complete"]]},I={title:"Combined features",description:"A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.",in:h("order complete",{timestamp:1700000108}),mapping:{name:"Purchase",settings:{identify:{map:{customId:"user.id"}},set:{map:{order_id:"data.id"}},upgrade:{value:"purchase"}}},out:[["clarity.identify","us3r"],["clarity.setTag","order_id","0rd3r1d"],["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},A={title:"Tags without event",description:"A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.",in:h("page view",{timestamp:1700000109}),mapping:{silent:!0,settings:{set:{map:{page_id:"data.id"}}}},out:[["clarity.setTag","page_id","/docs/"]]},V={title:"Consent granted",description:"A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.",command:"consent",in:{analytics:!0,marketing:!0},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}]]},P={title:"Consent revoked",description:"A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",command:"consent",in:{analytics:!1,marketing:!1},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"denied",ad_Storage:"denied"}]]};export{c as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>r,mapping:()=>l,settings:()=>d});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var r=n.object({apiKey:n.string().min(1).describe('Your Microsoft Clarity project ID (e.g. "3t0wlogvdz"). Find it in your Clarity dashboard under Settings → Setup.'),consent:n.record(n.string(),n.enum(["analytics_Storage","ad_Storage"])).describe('Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { "analytics": "analytics_Storage", "marketing": "ad_Storage" }. Required to get meaningful consent behavior — Clarity expects its own category names.').optional(),identify:n.unknown().describe("walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.").optional()});import{z as s}from"@walkeros/core/dev";var o=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).").optional(),set:s.unknown().describe("Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.").optional(),upgrade:s.unknown().describe("Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.").optional()}),d=i(r),l=i(o),c={};t(c,{env:()=>p,step:()=>v});var p={};t(p,{init:()=>u,push:()=>m,simulation:()=>y});var g=()=>{},u={clarity:{init:g,identify:g,setTag:g,event:g,consentV2:g,upgrade:g}},m={clarity:{init:g,identify:g,setTag:g,event:g,consentV2:g,upgrade:g}},y=["call:clarity.init","call:clarity.identify","call:clarity.setTag","call:clarity.event","call:clarity.consentV2","call:clarity.upgrade"],v={};t(v,{arrayTagValue:()=>_,combinedFeatures:()=>I,consentGrantBoth:()=>V,consentRevoke:()=>P,defaultEventForwarding:()=>f,destinationLevelIdentify:()=>b,orderCompleteInclude:()=>T,orderCompleteUpgrade:()=>S,pageViewSilent:()=>A,productViewWithTags:()=>C,userLoginIdentify:()=>k,wildcardIgnored:()=>w});import{getEvent as h}from"@walkeros/core";var f={title:"Default event",description:"A walker event becomes a Clarity.event call with the event name as the Clarity custom event.",in:h("product view",{timestamp:1700000100}),out:[["clarity.event","product view"]]},w={public:!1,in:h("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},k={title:"User login identify",description:"A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.",in:h("user login",{timestamp:1700000102,data:{id:"u-123",name:"Jane Doe"},globals:{pagegroup:"shop",pagetype:"home"}}),mapping:{settings:{identify:{map:{customId:"data.id",customSessionId:"user.session",customPageId:"globals.pagetype",friendlyName:"data.name"}}}},out:[["clarity.identify","u-123","s3ss10n","home","Jane Doe"],["clarity.event","user login"]]},b={title:"Destination identify",description:"Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.",in:h("page view",{timestamp:1700000103}),settings:{identify:{map:{customId:"user.id"}}},out:[["clarity.identify","us3r"],["clarity.event","page view"]]},C={title:"Custom tags",description:"A product view sets Clarity session tags such as product color and id before firing the event.",in:h("product view",{timestamp:1700000104}),mapping:{settings:{set:{map:{product_color:"data.color",product_id:"data.id"}}}},out:[["clarity.setTag","product_color","black"],["clarity.setTag","product_id","ers"],["clarity.event","product view"]]},_={title:"Array tag values",description:"Array values such as product tags are passed through to Clarity.setTag preserving the array shape.",in:h("product view",{timestamp:1700000105,data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420,tags:["sale","featured"]}}),mapping:{settings:{set:{map:{product_tags:"data.tags"}}}},out:[["clarity.setTag","product_tags",["sale","featured"]],["clarity.event","product view"]]},S={title:"Upgrade session",description:"A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.",in:h("order complete",{timestamp:1700000106}),mapping:{name:"Purchase",settings:{upgrade:{value:"purchase"}}},out:[["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},T={title:"Include data as tags",description:"A mapping include flattens the event data section into Clarity.setTag calls before the event fires.",in:h("order complete",{timestamp:1700000107}),mapping:{include:["data"]},out:[["clarity.setTag","data_id","0rd3r1d"],["clarity.setTag","data_currency","EUR"],["clarity.setTag","data_shipping","5.22"],["clarity.setTag","data_taxes","73.76"],["clarity.setTag","data_total","555"],["clarity.event","order complete"]]},I={title:"Combined features",description:"A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.",in:h("order complete",{timestamp:1700000108}),mapping:{name:"Purchase",settings:{identify:{map:{customId:"user.id"}},set:{map:{order_id:"data.id"}},upgrade:{value:"purchase"}}},out:[["clarity.identify","us3r"],["clarity.setTag","order_id","0rd3r1d"],["clarity.upgrade","purchase"],["clarity.event","Purchase"]]},A={title:"Tags without event",description:"A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.",in:h("page view",{timestamp:1700000109}),mapping:{silent:!0,settings:{set:{map:{page_id:"data.id"}}}},out:[["clarity.setTag","page_id","/docs/"]]},V={title:"Consent granted",description:"A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.",command:"consent",in:{analytics:!0,marketing:!0},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}]]},P={title:"Consent revoked",description:"A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",command:"consent",before:{analytics:!0,marketing:!0},in:{analytics:!1,marketing:!1},settings:{consent:{analytics:"analytics_Storage",marketing:"ad_Storage"}},out:[["clarity.consentV2",{analytics_Storage:"granted",ad_Storage:"granted"}],["clarity.consentV2",{analytics_Storage:"denied",ad_Storage:"denied"}]]};export{c as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Microsoft Clarity project ID (e.g. \"3t0wlogvdz\"). Find it in your Clarity dashboard under Settings → Setup.',\n ),\n consent: z\n .record(z.string(), z.enum(['analytics_Storage', 'ad_Storage']))\n .describe(\n 'Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { \"analytics\": \"analytics_Storage\", \"marketing\": \"ad_Storage\" }. Required to get meaningful consent behavior — Clarity expects its own category names.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).',\n )\n .optional(),\n set: z\n .unknown()\n .describe(\n 'Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.',\n )\n .optional(),\n upgrade: z\n .unknown()\n .describe(\n 'Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Microsoft Clarity destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.clarity` undefined — the destination falls back\n * to the real `@microsoft/clarity` default export.\n */\n\nconst noop = () => {};\n\n/**\n * Pre-init environment — Clarity SDK methods are no-ops until init wires them.\n */\nexport const init: Env | undefined = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Post-init environment — Clarity SDK methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate\n */\nexport const simulation = [\n 'call:clarity.init',\n 'call:clarity.identify',\n 'call:clarity.setTag',\n 'call:clarity.event',\n 'call:clarity.consentV2',\n 'call:clarity.upgrade',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally override destination-level settings for a test.\n * The test runner reads `settings` from the example and merges it into the\n * base destination settings (on top of the fixed `apiKey`). `configInclude`\n * is passed as config-level include when registering the destination.\n */\nexport type ClarityStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes Clarity.event(name).\n * No mapping rule; the destination's default push behavior fires.\n */\nexport const defaultEventForwarding: ClarityStepExample = {\n title: 'Default event',\n description:\n 'A walker event becomes a Clarity.event call with the event name as the Clarity custom event.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['clarity.event', 'product view']],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy events.\n * The destination forwards by default; users opt OUT via `\"*\": { \"*\": { ignore: true } }`\n * plus explicit allows. This example IS an ignored event - the destination\n * must produce zero calls.\n */\nexport const wildcardIgnored: ClarityStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Identity via settings.identify (per-event, user login).\n * Resolves positional args for Clarity.identify(customId, sessionId, pageId, friendlyName).\n * Trailing undefined args are omitted, so all four args are passed when friendlyName is set.\n * Then fires the default Clarity.event(...) forwarding.\n */\nexport const userLoginIdentify: ClarityStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: { id: 'u-123', name: 'Jane Doe' },\n globals: { pagegroup: 'shop', pagetype: 'home' },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n customId: 'data.id',\n customSessionId: 'user.session',\n customPageId: 'globals.pagetype',\n friendlyName: 'data.name',\n },\n },\n },\n },\n out: [\n ['clarity.identify', 'u-123', 's3ss10n', 'home', 'Jane Doe'],\n ['clarity.event', 'user login'],\n ],\n};\n\n/**\n * Destination-level settings.identify - Clarity officially recommends calling\n * identify() on every page load. walkerOS expresses this via destination-level\n * `settings.identify`, which fires on every push.\n */\nexport const destinationLevelIdentify: ClarityStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.',\n in: getEvent('page view', { timestamp: 1700000103 }),\n settings: {\n identify: {\n map: {\n customId: 'user.id',\n },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.event', 'page view'],\n ],\n};\n\n/**\n * Explicit custom tags via mapping.settings.set.\n * Each resolved key → Clarity.setTag(key, value). Tags fire after identify\n * but before the default event.\n */\nexport const productViewWithTags: ClarityStepExample = {\n title: 'Custom tags',\n description:\n 'A product view sets Clarity session tags such as product color and id before firing the event.',\n in: getEvent('product view', { timestamp: 1700000104 }),\n mapping: {\n settings: {\n set: {\n map: {\n product_color: 'data.color',\n product_id: 'data.id',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_color', 'black'],\n ['clarity.setTag', 'product_id', 'ers'],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Array tag values - Clarity.setTag(key, value) natively accepts string[].\n * walkerOS array values are passed through unchanged (each element is\n * coerced to string, but the array shape is preserved - no flattening,\n * no splitting into multiple calls).\n */\nexport const arrayTagValue: ClarityStepExample = {\n title: 'Array tag values',\n description:\n 'Array values such as product tags are passed through to Clarity.setTag preserving the array shape.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n data: {\n id: 'ers',\n name: 'Everyday Ruck Snack',\n color: 'black',\n size: 'l',\n price: 420,\n tags: ['sale', 'featured'],\n },\n }),\n mapping: {\n settings: {\n set: {\n map: {\n product_tags: 'data.tags',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_tags', ['sale', 'featured']],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Session priority upgrade - mark this session as important so Clarity retains\n * it beyond the sampling cap. upgrade fires before the default event.\n */\nexport const orderCompleteUpgrade: ClarityStepExample = {\n title: 'Upgrade session',\n description:\n 'A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.',\n in: getEvent('order complete', { timestamp: 1700000106 }),\n mapping: {\n name: 'Purchase',\n settings: {\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * settings.include flattens a walkerOS event section into Clarity.setTag calls.\n * Primitives coerce to strings; arrays pass through as string[].\n * The example includes `data` only; keys become `data_<field>`.\n */\nexport const orderCompleteInclude: ClarityStepExample = {\n title: 'Include data as tags',\n description:\n 'A mapping include flattens the event data section into Clarity.setTag calls before the event fires.',\n in: getEvent('order complete', { timestamp: 1700000107 }),\n mapping: {\n include: ['data'],\n },\n out: [\n ['clarity.setTag', 'data_id', '0rd3r1d'],\n ['clarity.setTag', 'data_currency', 'EUR'],\n ['clarity.setTag', 'data_shipping', '5.22'],\n ['clarity.setTag', 'data_taxes', '73.76'],\n ['clarity.setTag', 'data_total', '555'],\n ['clarity.event', 'order complete'],\n ],\n};\n\n/**\n * Combined-feature rule - Clarity's canonical usage pattern: identify the\n * user, set session tags, upgrade session priority, then fire the event.\n * This is the authoritative test for the push execution order\n * (identify → tags → upgrade → event).\n */\nexport const combinedFeatures: ClarityStepExample = {\n title: 'Combined features',\n description:\n 'A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n name: 'Purchase',\n settings: {\n identify: { map: { customId: 'user.id' } },\n set: { map: { order_id: 'data.id' } },\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.setTag', 'order_id', '0rd3r1d'],\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * mapping.silent - the rule runs (set/identify/upgrade all execute) but the\n * default Clarity.event(...) call is suppressed. Useful for page view, where\n * Clarity has its own page tracking and you only want to set tags.\n */\nexport const pageViewSilent: ClarityStepExample = {\n title: 'Tags without event',\n description:\n 'A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.',\n in: getEvent('page view', { timestamp: 1700000109 }),\n mapping: {\n silent: true,\n settings: {\n set: {\n map: {\n page_id: 'data.id',\n },\n },\n },\n },\n out: [['clarity.setTag', 'page_id', '/docs/']],\n};\n\n/**\n * Consent translation via settings.consent.\n * walkerOS consent { analytics: true, marketing: true } with the mapping\n * { analytics: 'analytics_Storage', marketing: 'ad_Storage' } fires:\n * Clarity.consentV2({ analytics_Storage: 'granted', ad_Storage: 'granted' })\n *\n * Uses the canonical StepExample.command='consent' pattern: the test runner\n * dispatches via elb('walker consent', in) instead of pushing an event.\n */\nexport const consentGrantBoth: ClarityStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.',\n command: 'consent',\n in: { analytics: true, marketing: true } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n ],\n};\n\n/**\n * Consent revocation - denied categories call Clarity.consentV2(...) with\n * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`\n * API at all - consentV2 is the single source of truth for consent state.\n */\nexport const consentRevoke: ClarityStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.',\n command: 'consent',\n in: { analytics: false, marketing: false } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'denied', ad_Storage: 'denied' },\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,qBAAqB,YAAY,CAAC,CAAC,EAC9D;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACrBD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EAC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AAW,OAAO,WAAW,MAAM;AAAA,EACzC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,UAAU,YAAY,SAAS;AAAA,IACtD;AAAA,EACF;AACF;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Microsoft Clarity project ID (e.g. \"3t0wlogvdz\"). Find it in your Clarity dashboard under Settings → Setup.',\n ),\n consent: z\n .record(z.string(), z.enum(['analytics_Storage', 'ad_Storage']))\n .describe(\n 'Translation table from walkerOS consent keys to Clarity ConsentV2 categories. Example: { \"analytics\": \"analytics_Storage\", \"marketing\": \"ad_Storage\" }. Required to get meaningful consent behavior — Clarity expects its own category names.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to positional arguments for Clarity.identify(). Keys: customId (required), customSessionId?, customPageId?, friendlyName?.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to { customId, customSessionId?, customPageId?, friendlyName? } → Clarity.identify(...).',\n )\n .optional(),\n set: z\n .unknown()\n .describe(\n 'Explicit custom tag mapping. Resolved object keys become Clarity.setTag(key, value) calls. Array values pass through as string[] unchanged.',\n )\n .optional(),\n upgrade: z\n .unknown()\n .describe(\n 'Session priority reason. Resolves to a string → Clarity.upgrade(reason). Used to flag important sessions for retention beyond sampling.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Microsoft Clarity destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.clarity` undefined — the destination falls back\n * to the real `@microsoft/clarity` default export.\n */\n\nconst noop = () => {};\n\n/**\n * Pre-init environment — Clarity SDK methods are no-ops until init wires them.\n */\nexport const init: Env | undefined = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Post-init environment — Clarity SDK methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n clarity: {\n init: noop,\n identify: noop,\n setTag: noop,\n event: noop,\n consentV2: noop,\n upgrade: noop,\n },\n};\n\n/**\n * Simulation tracking paths for CLI --simulate\n */\nexport const simulation = [\n 'call:clarity.init',\n 'call:clarity.identify',\n 'call:clarity.setTag',\n 'call:clarity.event',\n 'call:clarity.consentV2',\n 'call:clarity.upgrade',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally override destination-level settings for a test.\n * The test runner reads `settings` from the example and merges it into the\n * base destination settings (on top of the fixed `apiKey`). `configInclude`\n * is passed as config-level include when registering the destination.\n */\nexport type ClarityStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes Clarity.event(name).\n * No mapping rule; the destination's default push behavior fires.\n */\nexport const defaultEventForwarding: ClarityStepExample = {\n title: 'Default event',\n description:\n 'A walker event becomes a Clarity.event call with the event name as the Clarity custom event.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['clarity.event', 'product view']],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy events.\n * The destination forwards by default; users opt OUT via `\"*\": { \"*\": { ignore: true } }`\n * plus explicit allows. This example IS an ignored event - the destination\n * must produce zero calls.\n */\nexport const wildcardIgnored: ClarityStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Identity via settings.identify (per-event, user login).\n * Resolves positional args for Clarity.identify(customId, sessionId, pageId, friendlyName).\n * Trailing undefined args are omitted, so all four args are passed when friendlyName is set.\n * Then fires the default Clarity.event(...) forwarding.\n */\nexport const userLoginIdentify: ClarityStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Clarity.identify with custom id, session id, page id, and friendly name then tracks the event.',\n in: getEvent('user login', {\n timestamp: 1700000102,\n data: { id: 'u-123', name: 'Jane Doe' },\n globals: { pagegroup: 'shop', pagetype: 'home' },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n customId: 'data.id',\n customSessionId: 'user.session',\n customPageId: 'globals.pagetype',\n friendlyName: 'data.name',\n },\n },\n },\n },\n out: [\n ['clarity.identify', 'u-123', 's3ss10n', 'home', 'Jane Doe'],\n ['clarity.event', 'user login'],\n ],\n};\n\n/**\n * Destination-level settings.identify - Clarity officially recommends calling\n * identify() on every page load. walkerOS expresses this via destination-level\n * `settings.identify`, which fires on every push.\n */\nexport const destinationLevelIdentify: ClarityStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls Clarity.identify with the user id on every push as Clarity recommends.',\n in: getEvent('page view', { timestamp: 1700000103 }),\n settings: {\n identify: {\n map: {\n customId: 'user.id',\n },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.event', 'page view'],\n ],\n};\n\n/**\n * Explicit custom tags via mapping.settings.set.\n * Each resolved key → Clarity.setTag(key, value). Tags fire after identify\n * but before the default event.\n */\nexport const productViewWithTags: ClarityStepExample = {\n title: 'Custom tags',\n description:\n 'A product view sets Clarity session tags such as product color and id before firing the event.',\n in: getEvent('product view', { timestamp: 1700000104 }),\n mapping: {\n settings: {\n set: {\n map: {\n product_color: 'data.color',\n product_id: 'data.id',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_color', 'black'],\n ['clarity.setTag', 'product_id', 'ers'],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Array tag values - Clarity.setTag(key, value) natively accepts string[].\n * walkerOS array values are passed through unchanged (each element is\n * coerced to string, but the array shape is preserved - no flattening,\n * no splitting into multiple calls).\n */\nexport const arrayTagValue: ClarityStepExample = {\n title: 'Array tag values',\n description:\n 'Array values such as product tags are passed through to Clarity.setTag preserving the array shape.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n data: {\n id: 'ers',\n name: 'Everyday Ruck Snack',\n color: 'black',\n size: 'l',\n price: 420,\n tags: ['sale', 'featured'],\n },\n }),\n mapping: {\n settings: {\n set: {\n map: {\n product_tags: 'data.tags',\n },\n },\n },\n },\n out: [\n ['clarity.setTag', 'product_tags', ['sale', 'featured']],\n ['clarity.event', 'product view'],\n ],\n};\n\n/**\n * Session priority upgrade - mark this session as important so Clarity retains\n * it beyond the sampling cap. upgrade fires before the default event.\n */\nexport const orderCompleteUpgrade: ClarityStepExample = {\n title: 'Upgrade session',\n description:\n 'A completed order upgrades the Clarity session priority so it is retained beyond the sampling cap.',\n in: getEvent('order complete', { timestamp: 1700000106 }),\n mapping: {\n name: 'Purchase',\n settings: {\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * settings.include flattens a walkerOS event section into Clarity.setTag calls.\n * Primitives coerce to strings; arrays pass through as string[].\n * The example includes `data` only; keys become `data_<field>`.\n */\nexport const orderCompleteInclude: ClarityStepExample = {\n title: 'Include data as tags',\n description:\n 'A mapping include flattens the event data section into Clarity.setTag calls before the event fires.',\n in: getEvent('order complete', { timestamp: 1700000107 }),\n mapping: {\n include: ['data'],\n },\n out: [\n ['clarity.setTag', 'data_id', '0rd3r1d'],\n ['clarity.setTag', 'data_currency', 'EUR'],\n ['clarity.setTag', 'data_shipping', '5.22'],\n ['clarity.setTag', 'data_taxes', '73.76'],\n ['clarity.setTag', 'data_total', '555'],\n ['clarity.event', 'order complete'],\n ],\n};\n\n/**\n * Combined-feature rule - Clarity's canonical usage pattern: identify the\n * user, set session tags, upgrade session priority, then fire the event.\n * This is the authoritative test for the push execution order\n * (identify → tags → upgrade → event).\n */\nexport const combinedFeatures: ClarityStepExample = {\n title: 'Combined features',\n description:\n 'A purchase identifies the user, sets an order tag, upgrades the session, and fires the Clarity event in order.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n name: 'Purchase',\n settings: {\n identify: { map: { customId: 'user.id' } },\n set: { map: { order_id: 'data.id' } },\n upgrade: { value: 'purchase' },\n },\n },\n out: [\n ['clarity.identify', 'us3r'],\n ['clarity.setTag', 'order_id', '0rd3r1d'],\n ['clarity.upgrade', 'purchase'],\n ['clarity.event', 'Purchase'],\n ],\n};\n\n/**\n * mapping.silent - the rule runs (set/identify/upgrade all execute) but the\n * default Clarity.event(...) call is suppressed. Useful for page view, where\n * Clarity has its own page tracking and you only want to set tags.\n */\nexport const pageViewSilent: ClarityStepExample = {\n title: 'Tags without event',\n description:\n 'A page view sets Clarity tags while silent suppresses the event, letting Clarity handle page tracking itself.',\n in: getEvent('page view', { timestamp: 1700000109 }),\n mapping: {\n silent: true,\n settings: {\n set: {\n map: {\n page_id: 'data.id',\n },\n },\n },\n },\n out: [['clarity.setTag', 'page_id', '/docs/']],\n};\n\n/**\n * Consent translation via settings.consent.\n * walkerOS consent { analytics: true, marketing: true } with the mapping\n * { analytics: 'analytics_Storage', marketing: 'ad_Storage' } fires:\n * Clarity.consentV2({ analytics_Storage: 'granted', ad_Storage: 'granted' })\n *\n * Uses the canonical StepExample.command='consent' pattern: the test runner\n * dispatches via elb('walker consent', in) instead of pushing an event.\n */\nexport const consentGrantBoth: ClarityStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command translates analytics and marketing grants into a Clarity.consentV2 call.',\n command: 'consent',\n in: { analytics: true, marketing: true } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n ],\n};\n\n/**\n * Consent revocation - after analytics and marketing are granted (Clarity\n * loads), revoking them calls Clarity.consentV2(...) with denied flags. The\n * destination does NOT call the legacy `Clarity.consent(false)` API at all -\n * consentV2 is the single source of truth for consent state. The destination\n * is never loaded under denied consent, so the revoke acts on an\n * already-granted destination.\n */\nexport const consentRevoke: ClarityStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.',\n command: 'consent',\n before: { analytics: true, marketing: true },\n in: { analytics: false, marketing: false } as WalkerOS.Consent,\n settings: {\n consent: {\n analytics: 'analytics_Storage',\n marketing: 'ad_Storage',\n },\n },\n out: [\n [\n 'clarity.consentV2',\n { analytics_Storage: 'granted', ad_Storage: 'granted' },\n ],\n [\n 'clarity.consentV2',\n { analytics_Storage: 'denied', ad_Storage: 'denied' },\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,qBAAqB,YAAY,CAAC,CAAC,EAC9D;AAA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AA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,WAAW,YAAY,UAAU;AAAA,IACxD;AAAA,EACF;AACF;AAUO,IAAM,gBAAoC;AAAA,EAC/C,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,MAAM,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,WAAW,OAAO,WAAW,MAAM;AAAA,EACzC,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,WAAW,YAAY,UAAU;AAAA,IACxD;AAAA,IACA;AAAA,MACE;AAAA,MACA,EAAE,mBAAmB,UAAU,YAAY,SAAS;AAAA,IACtD;AAAA,EACF;AACF;","names":["z"]}
@@ -1,4 +1,4 @@
1
- import { Mapping, Flow } from '@walkeros/core';
1
+ import { Mapping, Flow, WalkerOS } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  /**
@@ -69,6 +69,8 @@ declare namespace env {
69
69
  type ClarityStepExample = Flow.StepExample & {
70
70
  settings?: Partial<Settings>;
71
71
  configInclude?: string[];
72
+ /** Consent granted before `in` so a gated destination is loaded first. */
73
+ before?: WalkerOS.Consent;
72
74
  };
73
75
  /**
74
76
  * Default event forwarding - every walkerOS event becomes Clarity.event(name).
@@ -143,9 +145,12 @@ declare const pageViewSilent: ClarityStepExample;
143
145
  */
144
146
  declare const consentGrantBoth: ClarityStepExample;
145
147
  /**
146
- * Consent revocation - denied categories call Clarity.consentV2(...) with
147
- * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`
148
- * API at all - consentV2 is the single source of truth for consent state.
148
+ * Consent revocation - after analytics and marketing are granted (Clarity
149
+ * loads), revoking them calls Clarity.consentV2(...) with denied flags. The
150
+ * destination does NOT call the legacy `Clarity.consent(false)` API at all -
151
+ * consentV2 is the single source of truth for consent state. The destination
152
+ * is never loaded under denied consent, so the revoke acts on an
153
+ * already-granted destination.
149
154
  */
150
155
  declare const consentRevoke: ClarityStepExample;
151
156
 
@@ -1,4 +1,4 @@
1
- import { Mapping, Flow } from '@walkeros/core';
1
+ import { Mapping, Flow, WalkerOS } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  /**
@@ -69,6 +69,8 @@ declare namespace env {
69
69
  type ClarityStepExample = Flow.StepExample & {
70
70
  settings?: Partial<Settings>;
71
71
  configInclude?: string[];
72
+ /** Consent granted before `in` so a gated destination is loaded first. */
73
+ before?: WalkerOS.Consent;
72
74
  };
73
75
  /**
74
76
  * Default event forwarding - every walkerOS event becomes Clarity.event(name).
@@ -143,9 +145,12 @@ declare const pageViewSilent: ClarityStepExample;
143
145
  */
144
146
  declare const consentGrantBoth: ClarityStepExample;
145
147
  /**
146
- * Consent revocation - denied categories call Clarity.consentV2(...) with
147
- * denied flags. The destination does NOT call the legacy `Clarity.consent(false)`
148
- * API at all - consentV2 is the single source of truth for consent state.
148
+ * Consent revocation - after analytics and marketing are granted (Clarity
149
+ * loads), revoking them calls Clarity.consentV2(...) with denied flags. The
150
+ * destination does NOT call the legacy `Clarity.consent(false)` API at all -
151
+ * consentV2 is the single source of truth for consent state. The destination
152
+ * is never loaded under denied consent, so the revoke acts on an
153
+ * already-granted destination.
149
154
  */
150
155
  declare const consentRevoke: ClarityStepExample;
151
156
 
@@ -269,6 +269,7 @@ var consentRevoke = {
269
269
  title: "Consent revoked",
270
270
  description: "A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",
271
271
  command: "consent",
272
+ before: { analytics: true, marketing: true },
272
273
  in: { analytics: false, marketing: false },
273
274
  settings: {
274
275
  consent: {
@@ -277,6 +278,10 @@ var consentRevoke = {
277
278
  }
278
279
  },
279
280
  out: [
281
+ [
282
+ "clarity.consentV2",
283
+ { analytics_Storage: "granted", ad_Storage: "granted" }
284
+ ],
280
285
  [
281
286
  "clarity.consentV2",
282
287
  { analytics_Storage: "denied", ad_Storage: "denied" }
@@ -248,6 +248,7 @@ var consentRevoke = {
248
248
  title: "Consent revoked",
249
249
  description: "A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",
250
250
  command: "consent",
251
+ before: { analytics: true, marketing: true },
251
252
  in: { analytics: false, marketing: false },
252
253
  settings: {
253
254
  consent: {
@@ -256,6 +257,10 @@ var consentRevoke = {
256
257
  }
257
258
  },
258
259
  out: [
260
+ [
261
+ "clarity.consentV2",
262
+ { analytics_Storage: "granted", ad_Storage: "granted" }
263
+ ],
259
264
  [
260
265
  "clarity.consentV2",
261
266
  { analytics_Storage: "denied", ad_Storage: "denied" }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-clarity",
4
- "version": "4.2.0",
4
+ "version": "4.2.1-next-1781538735002",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -152,7 +152,7 @@
152
152
  "consent": {
153
153
  "functional": true
154
154
  },
155
- "id": "c171fed2ae74426c",
155
+ "id": "7162daecbc74bc5f",
156
156
  "trigger": "load",
157
157
  "entity": "product",
158
158
  "action": "view",
@@ -267,7 +267,7 @@
267
267
  "consent": {
268
268
  "functional": true
269
269
  },
270
- "id": "4796d43ede2f4909",
270
+ "id": "9942077a8a4161c0",
271
271
  "trigger": "load",
272
272
  "entity": "order",
273
273
  "action": "complete",
@@ -344,6 +344,10 @@
344
344
  "title": "Consent revoked",
345
345
  "description": "A walker consent command with analytics and marketing denied calls Clarity.consentV2 with denied flags.",
346
346
  "command": "consent",
347
+ "before": {
348
+ "analytics": true,
349
+ "marketing": true
350
+ },
347
351
  "in": {
348
352
  "analytics": false,
349
353
  "marketing": false
@@ -355,6 +359,13 @@
355
359
  }
356
360
  },
357
361
  "out": [
362
+ [
363
+ "clarity.consentV2",
364
+ {
365
+ "analytics_Storage": "granted",
366
+ "ad_Storage": "granted"
367
+ }
368
+ ],
358
369
  [
359
370
  "clarity.consentV2",
360
371
  {
@@ -397,7 +408,7 @@
397
408
  "consent": {
398
409
  "functional": true
399
410
  },
400
- "id": "d65da7cb2da52a0b",
411
+ "id": "030450c5a4cbf63e",
401
412
  "trigger": "load",
402
413
  "entity": "product",
403
414
  "action": "view",
@@ -456,7 +467,7 @@
456
467
  "consent": {
457
468
  "functional": true
458
469
  },
459
- "id": "0a2a378d74265994",
470
+ "id": "23f0cf884e63af27",
460
471
  "trigger": "load",
461
472
  "entity": "page",
462
473
  "action": "view",
@@ -565,7 +576,7 @@
565
576
  "consent": {
566
577
  "functional": true
567
578
  },
568
- "id": "449b586fea2cea6e",
579
+ "id": "21c9d9c9888b36bc",
569
580
  "trigger": "load",
570
581
  "entity": "order",
571
582
  "action": "complete",
@@ -693,7 +704,7 @@
693
704
  "consent": {
694
705
  "functional": true
695
706
  },
696
- "id": "bc653e952c929cf2",
707
+ "id": "d1db186b4239325d",
697
708
  "trigger": "load",
698
709
  "entity": "order",
699
710
  "action": "complete",
@@ -764,7 +775,7 @@
764
775
  "consent": {
765
776
  "functional": true
766
777
  },
767
- "id": "2027d208ca9ceeef",
778
+ "id": "8fe2f2fe8071e1e5",
768
779
  "trigger": "load",
769
780
  "entity": "page",
770
781
  "action": "view",
@@ -826,7 +837,7 @@
826
837
  "consent": {
827
838
  "functional": true
828
839
  },
829
- "id": "19f359f70b15d19d",
840
+ "id": "c0a91f5c9ef76370",
830
841
  "trigger": "load",
831
842
  "entity": "product",
832
843
  "action": "view",
@@ -902,7 +913,7 @@
902
913
  "consent": {
903
914
  "functional": true
904
915
  },
905
- "id": "d65d0bc025f7b1ca",
916
+ "id": "9b57ff8803578e26",
906
917
  "trigger": "test",
907
918
  "entity": "user",
908
919
  "action": "login",
@@ -981,7 +992,7 @@
981
992
  "consent": {
982
993
  "functional": true
983
994
  },
984
- "id": "fd023ccc486ad003",
995
+ "id": "fe2c00168f3472c7",
985
996
  "trigger": "test",
986
997
  "entity": "debug",
987
998
  "action": "noise",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-clarity",
3
3
  "description": "Microsoft Clarity web destination for walkerOS (session replay, heatmaps, smart events)",
4
- "version": "4.2.0",
4
+ "version": "4.2.1-next-1781538735002",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@microsoft/clarity": "^1.0.2",
42
- "@walkeros/core": "4.2.0",
43
- "@walkeros/web-core": "4.2.0"
42
+ "@walkeros/core": "4.2.1-next-1781538735002",
43
+ "@walkeros/web-core": "4.2.1-next-1781538735002"
44
44
  },
45
45
  "devDependencies": {
46
- "@walkeros/collector": "4.2.0"
46
+ "@walkeros/collector": "4.2.1-next-1781538735002"
47
47
  },
48
48
  "repository": {
49
49
  "url": "git+https://github.com/elbwalker/walkerOS.git",