@walkeros/web-destination-segment 4.7.0-next-1790245733116 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,24 +1,35 @@
1
1
  # @walkeros/web-destination-segment
2
2
 
3
- ## 4.7.0-next-1790245733116
3
+ ## 4.7.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [57788bc]
7
+ - 74821ed: Simulate records every vendor call through one recorder, `observeEnv`
8
+ from `@walkeros/core`, and runs offline: BigQuery, Data Manager and the
9
+ Sheets, GCS and S3 stores reach the network through `env`. Client and `Env`
10
+ types of BigQuery, Firehose, PostHog, SQS and Pub/Sub are structural.
11
+ `@walkeros/cli` exports `resolveExportName` and `selectDevExamples` and drops
12
+ `findExample` and `compareOutput`.
13
+ - Updated dependencies [74821ed]
8
14
  - Updated dependencies [06b498a]
9
- - Updated dependencies [f5a1cfd]
10
- - Updated dependencies [ef02916]
15
+ - Updated dependencies [74821ed]
16
+ - Updated dependencies [64b06de]
17
+ - Updated dependencies [4b4937f]
18
+ - Updated dependencies [74821ed]
19
+ - Updated dependencies [74821ed]
20
+ - Updated dependencies [74821ed]
11
21
  - Updated dependencies [06b498a]
12
- - Updated dependencies [ef02916]
13
- - Updated dependencies [2aebc53]
14
- - Updated dependencies [f5a1cfd]
15
- - Updated dependencies [f5a1cfd]
16
- - Updated dependencies [2aebc53]
17
- - Updated dependencies [8f8aea6]
18
- - Updated dependencies [2aebc53]
19
- - Updated dependencies [2aebc53]
20
- - @walkeros/core@4.7.0-next-1790245733116
21
- - @walkeros/web-core@4.7.0-next-1790245733116
22
+ - Updated dependencies [74821ed]
23
+ - Updated dependencies [74821ed]
24
+ - Updated dependencies [74821ed]
25
+ - Updated dependencies [74821ed]
26
+ - Updated dependencies [74821ed]
27
+ - Updated dependencies [e860006]
28
+ - Updated dependencies [74821ed]
29
+ - Updated dependencies [74821ed]
30
+ - Updated dependencies [4f89234]
31
+ - @walkeros/core@4.7.0
32
+ - @walkeros/web-core@4.7.0
22
33
 
23
34
  ## 4.6.1
24
35
 
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},r={};o(r,{examples:()=>y,schemas:()=>s}),module.exports=(e=r,((e,o,r,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===r||t(e,l,{get:()=>o[l],enumerable:!(s=a(o,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({apiKey:c.z.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:c.z.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:c.z.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:c.z.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:c.z.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:c.z.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:c.z.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:c.z.record(c.z.string(),c.z.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:c.z.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:c.z.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:c.z.record(c.z.string(),c.z.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()}),p=require("@walkeros/core/dev"),u=p.z.object({identify:p.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:p.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:p.z.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:p.z.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),m=(0,l.zodToSchema)(d),g=(0,l.zodToSchema)(u),y={};o(y,{env:()=>v,step:()=>S});var v={};o(v,{init:()=>h,push:()=>b,simulation:()=>k});var f=()=>{};function w(){return{load:()=>({track:f,identify:f,group:f,page:f,alias:f,reset:f,setAnonymousId:f})}}var h={analytics:w()},b={analytics:w()},k=["call:analytics.load","call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.alias","call:analytics.reset","call:analytics.setAnonymousId"],S={};o(S,{companyUpdateGroup:()=>U,consentContextForwarded:()=>q,consentGrantDeferredLoad:()=>L,consentRevokeNoOp:()=>F,defaultEventForwarding:()=>D,destinationLevelIdentify:()=>O,destinationLevelInclude:()=>E,init:()=>A,orderCompletedEcommerce:()=>K,pageViewAsPage:()=>j,pageViewMinimal:()=>C,profileUpdateTraitsOnly:()=>P,ruleIncludeReplaces:()=>_,userLoginIdentify:()=>R,userLogoutReset:()=>x,wildcardIgnored:()=>z});var I=require("@walkeros/core"),A={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},D={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:(0,I.getEvent)("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},z={public:!1,in:(0,I.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},E={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:(0,I.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},_={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:(0,I.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},O={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:(0,I.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},R={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:(0,I.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},P={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:(0,I.getEvent)("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},x={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:(0,I.getEvent)("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},U={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:(0,I.getEvent)("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},j={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:(0,I.getEvent)("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},C={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:(0,I.getEvent)("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},K={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:(0,I.getEvent)("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},q={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:(0,I.getEvent)("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},L={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},F={public:!1,command:"consent",in:{analytics:!1},out:[]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},r={};o(r,{examples:()=>y,schemas:()=>s}),module.exports=(e=r,((e,o,r,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===r||t(e,l,{get:()=>o[l],enumerable:!(s=a(o,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({apiKey:c.z.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:c.z.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:c.z.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:c.z.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:c.z.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:c.z.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:c.z.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:c.z.record(c.z.string(),c.z.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:c.z.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:c.z.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:c.z.record(c.z.string(),c.z.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()}),p=require("@walkeros/core/dev"),u=p.z.object({identify:p.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:p.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:p.z.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:p.z.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),m=(0,l.zodToSchema)(d),g=(0,l.zodToSchema)(u),y={};o(y,{env:()=>v,step:()=>S});var v={};o(v,{init:()=>h,push:()=>b,simulation:()=>k});var f=()=>{};function w(){return{load:()=>({track:f,identify:f,group:f,page:f,alias:f,reset:f,setAnonymousId:f})}}var h={analytics:w()},b={analytics:w()},k=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],S={};o(S,{companyUpdateGroup:()=>U,consentContextForwarded:()=>q,consentGrantDeferredLoad:()=>L,consentRevokeNoOp:()=>F,defaultEventForwarding:()=>D,destinationLevelIdentify:()=>O,destinationLevelInclude:()=>E,init:()=>A,orderCompletedEcommerce:()=>K,pageViewAsPage:()=>j,pageViewMinimal:()=>C,profileUpdateTraitsOnly:()=>P,ruleIncludeReplaces:()=>_,userLoginIdentify:()=>R,userLogoutReset:()=>x,wildcardIgnored:()=>z});var I=require("@walkeros/core"),A={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},D={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:(0,I.getEvent)("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},z={public:!1,in:(0,I.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},E={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:(0,I.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},_={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:(0,I.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},O={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:(0,I.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},R={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:(0,I.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},P={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:(0,I.getEvent)("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},x={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:(0,I.getEvent)("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},U={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:(0,I.getEvent)("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},j={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:(0,I.getEvent)("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},C={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:(0,I.getEvent)("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},K={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:(0,I.getEvent)("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},q={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:(0,I.getEvent)("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},L={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},F={public:!1,command:"consent",in:{analytics:!1},out:[]};//# 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 Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.',\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 an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\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, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.track',\n 'call:analytics.identify',\n 'call:analytics.group',\n 'call:analytics.page',\n 'call:analytics.alias',\n 'call:analytics.reset',\n 'call:analytics.setAnonymousId',\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 carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed Segment track properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: SegmentStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls analytics.identify with the resolved userId before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n 'A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\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,QAAQ,aACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,aACd,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,aACvB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,aACvB,QAAQ,EACR,SAAS,sEAAiE,EAC1E,SAAS;AAAA,EACZ,YAAY,aACT,QAAQ,EACR,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,WAAW,aACR,QAAQ,EACR,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,cAAc,aACX,OAAO,aAAE,OAAO,GAAG,aAAE,QAAQ,CAAC,EAC9B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ,E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;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,SAAS;AAAA,UACP,SAAS;AAAA,YACP,qBAAqB;AAAA,cACnB,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAUO,IAAM,2BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,UAAU,eAAe;AAAA,MAC3B,EAAE,iBAAiB,MAAM;AAAA,IAC3B;AAAA,EACF;AACF;AAOO,IAAM,oBAAwC;AAAA,EACnD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["import_dev","import_dev","init"]}
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 Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.',\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 an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\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, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.load.track',\n 'call:analytics.load.identify',\n 'call:analytics.load.group',\n 'call:analytics.load.page',\n 'call:analytics.load.alias',\n 'call:analytics.load.reset',\n 'call:analytics.load.setAnonymousId',\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 carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed Segment track properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: SegmentStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls analytics.identify with the resolved userId before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n 'A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\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,I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HANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>c,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var o=i.object({apiKey:i.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:i.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:i.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:i.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:i.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:i.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:i.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:i.record(i.string(),i.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:i.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:i.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:i.record(i.string(),i.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()});import{z as r}from"@walkeros/core/dev";var s=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:r.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:r.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:r.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),l=n(o),c=n(s),d={};t(d,{env:()=>p,step:()=>f});var p={};t(p,{init:()=>g,push:()=>y,simulation:()=>v});var m=()=>{};function u(){return{load:()=>({track:m,identify:m,group:m,page:m,alias:m,reset:m,setAnonymousId:m})}}var g={analytics:u()},y={analytics:u()},v=["call:analytics.load","call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.alias","call:analytics.reset","call:analytics.setAnonymousId"],f={};t(f,{companyUpdateGroup:()=>x,consentContextForwarded:()=>C,consentGrantDeferredLoad:()=>E,consentRevokeNoOp:()=>j,defaultEventForwarding:()=>k,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>S,init:()=>h,orderCompletedEcommerce:()=>O,pageViewAsPage:()=>P,pageViewMinimal:()=>U,profileUpdateTraitsOnly:()=>_,ruleIncludeReplaces:()=>I,userLoginIdentify:()=>D,userLogoutReset:()=>R,wildcardIgnored:()=>b});import{getEvent as w}from"@walkeros/core";var h={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},k={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:w("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},b={public:!1,in:w("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:w("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},I={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:w("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},A={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:w("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},D={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:w("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},_={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:w("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},R={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:w("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},x={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:w("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},P={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:w("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},U={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:w("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},O={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:w("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},C={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:w("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},E={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},j={public:!1,command:"consent",in:{analytics:!1},out:[]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>c,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var o=i.object({apiKey:i.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:i.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:i.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:i.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:i.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:i.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:i.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:i.record(i.string(),i.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:i.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:i.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:i.record(i.string(),i.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()});import{z as r}from"@walkeros/core/dev";var s=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:r.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:r.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:r.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),l=n(o),c=n(s),d={};t(d,{env:()=>p,step:()=>f});var p={};t(p,{init:()=>g,push:()=>y,simulation:()=>v});var m=()=>{};function u(){return{load:()=>({track:m,identify:m,group:m,page:m,alias:m,reset:m,setAnonymousId:m})}}var g={analytics:u()},y={analytics:u()},v=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],f={};t(f,{companyUpdateGroup:()=>x,consentContextForwarded:()=>C,consentGrantDeferredLoad:()=>E,consentRevokeNoOp:()=>j,defaultEventForwarding:()=>k,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>S,init:()=>h,orderCompletedEcommerce:()=>O,pageViewAsPage:()=>P,pageViewMinimal:()=>U,profileUpdateTraitsOnly:()=>_,ruleIncludeReplaces:()=>I,userLoginIdentify:()=>D,userLogoutReset:()=>R,wildcardIgnored:()=>b});import{getEvent as w}from"@walkeros/core";var h={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},k={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:w("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},b={public:!1,in:w("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:w("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},I={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:w("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},A={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:w("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},D={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:w("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},_={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:w("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},R={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:w("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},x={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:w("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},P={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:w("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},U={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:w("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},O={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:w("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},C={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:w("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},E={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},j={public:!1,command:"consent",in:{analytics:!1},out:[]};export{d 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 Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.',\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 an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\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, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.track',\n 'call:analytics.identify',\n 'call:analytics.group',\n 'call:analytics.page',\n 'call:analytics.alias',\n 'call:analytics.reset',\n 'call:analytics.setAnonymousId',\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 carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed Segment track properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: SegmentStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls analytics.identify with the resolved userId before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n 'A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\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,QAAQ,EACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,EACd,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,EACvB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,EACvB,QAAQ,EACR,SAAS,sEAAiE,EAC1E,SAAS;AAAA,EACZ,YAAY,EACT,QAAQ,EACR,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,WAAW,EACR,QAAQ,EACR,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,cAAc,EACX,OAAO,EAAE,OAA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,IACX,SAAS,EAAE,WAAW,MAAM,WAAW,KAAK;AAAA,EAC9C,CAAC;AAAA,EACD,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,SAAS;AAAA,UACP,SAAS;AAAA,YACP,qBAAqB;AAAA,cACnB,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAUO,IAAM,2BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,UAAU,eAAe;AAAA,MAC3B,EAAE,iBAAiB,MAAM;AAAA,IAC3B;AAAA,EACF;AACF;AAOO,IAAM,oBAAwC;AAAA,EACnD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["z","init"]}
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 Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.',\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 an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\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, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.load.track',\n 'call:analytics.load.identify',\n 'call:analytics.load.group',\n 'call:analytics.load.page',\n 'call:analytics.load.alias',\n 'call:analytics.load.reset',\n 'call:analytics.load.setAnonymousId',\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 carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed Segment track properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: SegmentStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls analytics.identify with the resolved userId before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n 'A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAA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EACvB,KAAK,CAAC;AACR;","names":["z","init"]}
@@ -58,13 +58,13 @@ var push = {
58
58
  };
59
59
  var simulation = [
60
60
  "call:analytics.load",
61
- "call:analytics.track",
62
- "call:analytics.identify",
63
- "call:analytics.group",
64
- "call:analytics.page",
65
- "call:analytics.alias",
66
- "call:analytics.reset",
67
- "call:analytics.setAnonymousId"
61
+ "call:analytics.load.track",
62
+ "call:analytics.load.identify",
63
+ "call:analytics.load.group",
64
+ "call:analytics.load.page",
65
+ "call:analytics.load.alias",
66
+ "call:analytics.load.reset",
67
+ "call:analytics.load.setAnonymousId"
68
68
  ];
69
69
 
70
70
  // src/examples/step.ts
@@ -37,13 +37,13 @@ var push = {
37
37
  };
38
38
  var simulation = [
39
39
  "call:analytics.load",
40
- "call:analytics.track",
41
- "call:analytics.identify",
42
- "call:analytics.group",
43
- "call:analytics.page",
44
- "call:analytics.alias",
45
- "call:analytics.reset",
46
- "call:analytics.setAnonymousId"
40
+ "call:analytics.load.track",
41
+ "call:analytics.load.identify",
42
+ "call:analytics.load.group",
43
+ "call:analytics.load.page",
44
+ "call:analytics.load.alias",
45
+ "call:analytics.load.reset",
46
+ "call:analytics.load.setAnonymousId"
47
47
  ];
48
48
 
49
49
  // src/examples/step.ts