@walkeros/web-destination-amplitude 4.8.2 → 4.8.3-next-1793115089237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @walkeros/web-destination-amplitude
2
2
 
3
+ ## 4.8.3-next-1793115089237
4
+
5
+ ### Patch Changes
6
+
7
+ - 5313635: The sample events from `getEvent` now use the standard event names:
8
+ `checkout start` replaces `checkout view`, an order carries `tax` and `total`,
9
+ a promotion names its placement `slot`, and product events carry `currency`.
10
+ Order `value` is now the merchandise value: the `order complete` sample goes
11
+ from 555 to 462, and the gross amount charged is `total` (467.22). The
12
+ destination examples read `data.tax`, `data.slot` and the search keys
13
+ `data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
14
+ read `data.total` first, then `data.value`. The CLI ships default event
15
+ contracts for common site types in `examples/contracts/`.
16
+ - 5313635: The package publishes a minimal example: the project API key is all
17
+ Amplitude needs to deliver. The docs page renders the install line, the
18
+ integrated code and the flow from it, and the package test runs the same
19
+ settings, so the setup a reader copies is the one that was tested.
20
+ - Updated dependencies [29d2218]
21
+ - Updated dependencies [34fd225]
22
+ - Updated dependencies [5313635]
23
+ - Updated dependencies [5313635]
24
+ - Updated dependencies [5313635]
25
+ - Updated dependencies [5313635]
26
+ - Updated dependencies [5313635]
27
+ - Updated dependencies [34fd225]
28
+ - Updated dependencies [5313635]
29
+ - Updated dependencies [5313635]
30
+ - @walkeros/web-core@4.8.3-next-1793115089237
31
+ - @walkeros/core@4.8.3-next-1793115089237
32
+
3
33
  ## 4.8.2
4
34
 
5
35
  ### Patch Changes
@@ -286,9 +316,6 @@
286
316
  and `event.context` remain required.
287
317
  - Each source self-registers via TypeScript module augmentation of `SourceMap`
288
318
  in `@walkeros/core`.
289
- - App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
290
- part of this release. Telemetry from v4 CLI/MCP will not validate against
291
- the existing app schema until that follow-up ships.
292
319
  - `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
293
320
  configs using `skip: true` in mapping rules must rename to `silent: true`.
294
321
  Hard cut: no legacy alias, the field is gone.
package/dist/dev.d.mts CHANGED
@@ -253,7 +253,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
253
253
  /**
254
254
  * Consent revoked → amplitude.setOptOut(true). The destination checks
255
255
  * the consent keys declared in config.consent and toggles optOut
256
- * accordingly (strict: all required keys must be granted).
256
+ * accordingly (one granted required key is enough, as at the collector's
257
+ * consent gate).
257
258
  *
258
259
  * Uses the canonical StepExample.command='consent' pattern: the test
259
260
  * runner dispatches via elb('walker consent', in) instead of pushing
@@ -292,10 +293,14 @@ declare namespace step {
292
293
  export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
293
294
  }
294
295
 
296
+ /** The settings Amplitude needs to deliver: the project API key. */
297
+ declare const minimal: Flow.MinimalExample;
298
+
295
299
  declare const index_env: typeof env;
300
+ declare const index_minimal: typeof minimal;
296
301
  declare const index_step: typeof step;
297
302
  declare namespace index {
298
- export { index_env as env, index_step as step };
303
+ export { index_env as env, index_minimal as minimal, index_step as step };
299
304
  }
300
305
 
301
306
  export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -253,7 +253,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
253
253
  /**
254
254
  * Consent revoked → amplitude.setOptOut(true). The destination checks
255
255
  * the consent keys declared in config.consent and toggles optOut
256
- * accordingly (strict: all required keys must be granted).
256
+ * accordingly (one granted required key is enough, as at the collector's
257
+ * consent gate).
257
258
  *
258
259
  * Uses the canonical StepExample.command='consent' pattern: the test
259
260
  * runner dispatches via elb('walker consent', in) instead of pushing
@@ -292,10 +293,14 @@ declare namespace step {
292
293
  export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
293
294
  }
294
295
 
296
+ /** The settings Amplitude needs to deliver: the project API key. */
297
+ declare const minimal: Flow.MinimalExample;
298
+
295
299
  declare const index_env: typeof env;
300
+ declare const index_minimal: typeof minimal;
296
301
  declare const index_step: typeof step;
297
302
  declare namespace index {
298
- export { index_env as env, index_step as step };
303
+ export { index_env as env, index_minimal as minimal, index_step as step };
299
304
  }
300
305
 
301
306
  export { index as examples, index$1 as schemas };
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};a(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,a,s,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))r.call(e,p)||p===s||t(e,p,{get:()=>a[p],enumerable:!(o=n(a,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:u.z.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:u.z.string().describe("Application version; tagged onto every event.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:u.z.unknown().describe("Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:u.z.unknown().describe("Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.").optional(),engagement:u.z.unknown().describe("Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.").optional()}).loose(),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:l.z.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),m=(0,p.zodToSchema)(d),g=(0,p.zodToSchema)(c),y={};a(y,{env:()=>v,step:()=>O});var v={};a(v,{init:()=>_,push:()=>w,simulation:()=>k});var h=()=>{},f=()=>({promise:Promise.resolve()}),b=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},I=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},_={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},w={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},k=["call:amplitude.init","call:amplitude.add","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],O={};a(O,{consentGrantOptIn:()=>x,consentRevokeOptOut:()=>q,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>U,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>G,groupAssignmentWithoutData:()=>M,orderCompleteMultiProduct:()=>T,ruleIncludeReplaces:()=>E,silentRule:()=>W,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>P,userLogoutReset:()=>j,wildcardIgnored:()=>z});var A=require("@walkeros/core"),R={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:(0,A.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},z={public:!1,in:(0,A.createEvent)({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:(0,A.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},E={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:(0,A.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},U={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:(0,A.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},P={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:(0,A.createEvent)({name:"user login",timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},j={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:(0,A.createEvent)({name:"user logout",timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:(0,A.createEvent)({name:"subscription renew",timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},T={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:(0,A.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_value:555,globals_pagegroup:"shop"}]]},G={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:(0,A.createEvent)({name:"company update",timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},q={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},x={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]},W={public:!1,description:"A rule with silent: true and no settings calls nothing.",in:(0,A.getEvent)("page view",{timestamp:1700000120}),mapping:{silent:!0},out:[]},M={public:!1,description:"A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update"},mapping:G.mapping,out:[]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};r(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,r,s,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let p of i(r))a.call(e,p)||p===s||t(e,p,{get:()=>r[p],enumerable:!(o=n(r,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:u.z.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:u.z.string().describe("Application version; tagged onto every event.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:u.z.unknown().describe("Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:u.z.unknown().describe("Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.").optional(),engagement:u.z.unknown().describe("Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.").optional()}).loose(),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:l.z.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),m=(0,p.zodToSchema)(d),g=(0,p.zodToSchema)(c),y={};r(y,{env:()=>v,minimal:()=>K,step:()=>O});var v={};r(v,{init:()=>_,push:()=>w,simulation:()=>k});var h=()=>{},f=()=>({promise:Promise.resolve()}),b=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},I=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},_={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},w={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},k=["call:amplitude.init","call:amplitude.add","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],O={};r(O,{consentGrantOptIn:()=>x,consentRevokeOptOut:()=>q,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>U,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>G,groupAssignmentWithoutData:()=>M,orderCompleteMultiProduct:()=>T,ruleIncludeReplaces:()=>E,silentRule:()=>W,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>P,userLogoutReset:()=>j,wildcardIgnored:()=>z});var A=require("@walkeros/core"),R={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:(0,A.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},z={public:!1,in:(0,A.createEvent)({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:(0,A.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420,data_currency:"EUR"}]]},E={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:(0,A.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},U={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:(0,A.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},P={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:(0,A.createEvent)({name:"user login",timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},j={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:(0,A.createEvent)({name:"user logout",timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:(0,A.createEvent)({name:"subscription renew",timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},T={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:(0,A.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_value:462,data_tax:73.76,data_shipping:5.22,data_total:467.22,globals_pagegroup:"shop"}]]},G={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:(0,A.createEvent)({name:"company update",timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},q={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},x={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]},W={public:!1,description:"A rule with silent: true and no settings calls nothing.",in:(0,A.getEvent)("page view",{timestamp:1700000120}),mapping:{silent:!0},out:[]},M={public:!1,description:"A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update"},mapping:G.mapping,out:[]},K={settings:{apiKey:"a1b2c3d4e5f6789012345678abcdef12"}};//# 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\n .object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" → \"API Keys\" (like a1b2c3d4e5f6789012345678abcdef12).',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe('Amplitude server zone. Default: US.')\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 1000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 30.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 5.')\n .optional(),\n transport: z\n .enum(['fetch', 'xhr', 'beacon'])\n .describe('HTTP transport. Default: fetch.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.',\n )\n .optional(),\n appVersion: z\n .string()\n .describe('Application version; tagged onto every event.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n sessionReplay: z\n .unknown()\n .describe(\n 'Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).',\n )\n .optional(),\n experiment: z\n .unknown()\n .describe(\n 'Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.',\n )\n .optional(),\n engagement: z\n .unknown()\n .describe(\n 'Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.',\n )\n .optional(),\n })\n // Pass-through settings are loose: every other Amplitude BrowserOptions\n // key (serverUrl, defaultTracking, ...) is forwarded to the SDK as given.\n .loose();\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: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). 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, IdentifyInstance, RevenueInstance } from '../types';\n\n/**\n * Example environment configurations for the Amplitude destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.amplitude` undefined — the destination falls back\n * to the real `@amplitude/unified` module namespace.\n */\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\n/**\n * Minimal chainable Identify mock. The real SDK class has the same shape.\n * Tests spy by replacing these methods with jest.fn() in the test runner.\n */\nclass MockIdentify implements IdentifyInstance {\n _ops: Record<string, Record<string, unknown>> = {};\n\n private _record(op: string, prop: string, value?: unknown) {\n if (!this._ops[op]) this._ops[op] = {};\n this._ops[op][prop] = value;\n return this;\n }\n\n set(prop: string, value: unknown) {\n return this._record('set', prop, value);\n }\n setOnce(prop: string, value: unknown) {\n return this._record('setOnce', prop, value);\n }\n add(prop: string, value: unknown) {\n return this._record('add', prop, value);\n }\n append(prop: string, value: unknown) {\n return this._record('append', prop, value);\n }\n prepend(prop: string, value: unknown) {\n return this._record('prepend', prop, value);\n }\n preInsert(prop: string, value: unknown) {\n return this._record('preInsert', prop, value);\n }\n postInsert(prop: string, value: unknown) {\n return this._record('postInsert', prop, value);\n }\n remove(prop: string, value: unknown) {\n return this._record('remove', prop, value);\n }\n unset(prop: string) {\n return this._record('unset', prop);\n }\n clearAll() {\n this._ops['clearAll'] = {};\n return this;\n }\n\n toJSON() {\n return this._ops;\n }\n}\n\n/** Minimal chainable Revenue mock. */\nclass MockRevenue implements RevenueInstance {\n _data: Record<string, unknown> = {};\n\n setProductId(v: string) {\n this._data.productId = v;\n return this;\n }\n setPrice(v: number) {\n this._data.price = v;\n return this;\n }\n setQuantity(v: number) {\n this._data.quantity = v;\n return this;\n }\n setRevenueType(v: string) {\n this._data.revenueType = v;\n return this;\n }\n setCurrency(v: string) {\n this._data.currency = v;\n return this;\n }\n setRevenue(v: number) {\n this._data.revenue = v;\n return this;\n }\n setReceipt(v: string) {\n this._data.receipt = v;\n return this;\n }\n setReceiptSig(v: string) {\n this._data.receiptSig = v;\n return this;\n }\n setEventProperties(v: unknown) {\n this._data.eventProperties = v;\n return this;\n }\n\n toJSON() {\n return this._data;\n }\n}\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.add',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.reset',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setUserId',\n 'call:amplitude.setDeviceId',\n 'call:amplitude.setSessionId',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings and/or an\n * `await` hint for async scenarios. The test runner reads `settings`\n * from the example and merges it into the base destination settings\n * on top of the fixed apiKey. `configInclude` is passed as config-level\n * include when registering the destination.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default track',\n description:\n 'A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.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: AmplitudeStepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data`\n * section into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.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 include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: AmplitudeStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, 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 'amplitude.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 (once the\n * state cache is empty). The destination sets user/device/session IDs\n * and tracks them in runtime state; subsequent pushes with unchanged\n * values do NOT re-fire the setters.\n *\n * This example represents the first push in a fresh session. user.id,\n * user.device, user.session come from the walkerOS session fixture.\n *\n * The walkerOS fixture's user.session is 's3ss10n' (string). The\n * destination deterministically hashes non-numeric session strings via\n * djb2 so the same walkerOS session always maps to the same Amplitude\n * session number (cross-page-load consistency). djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user: 'user.id',\n device: 'user.device',\n session: 'user.session',\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'us3r'],\n ['amplitude.setDeviceId', 'c00k13'],\n ['amplitude.setSessionId', 394324160],\n ['amplitude.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary - this is the\n * \"user login\" pattern: set user_id, enrich user properties. `silent: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n user: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'new-user-123'],\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105000,\n },\n add: {\n login_count: 1,\n },\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires amplitude.reset(), which clears userId\n * and regenerates deviceId. `silent: true` because we're only running the\n * reset side effect, no default track().\n */\nexport const userLogoutReset: AmplitudeStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.',\n in: createEvent({ name: 'user logout', timestamp: 1700000106 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['amplitude.reset']],\n};\n\n/**\n * Single-product revenue - resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The walkerOS default event has no data.currency, so the fallback fires.\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.',\n in: createEvent({\n name: 'subscription renew',\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order - the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order fires one amplitude.revenue call per nested product plus a single track for the order totals.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n // Only iterate nested entries that have a price field (products).\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_value: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.',\n in: createEvent({\n name: 'company update',\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [\n ['amplitude.setOptOut', false],\n ['amplitude.setOptOut', true],\n ],\n};\n\n/**\n * Consent granted → amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n\n/** A silent rule without settings of its own calls nothing. */\nexport const silentRule: AmplitudeStepExample = {\n public: false,\n description: 'A rule with silent: true and no settings calls nothing.',\n in: getEvent('page view', { timestamp: 1700000120 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group rule of groupAssignmentWithProperties on an update\n * without data: no group resolves, so nothing is sent. A declared skip: an\n * unmet mapping, not a failure.\n */\nexport const groupAssignmentWithoutData: AmplitudeStepExample = {\n public: false,\n description:\n 'A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'company update', entity: 'company', action: 'update' },\n mapping: groupAssignmentWithProperties.mapping,\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,aAC3B,OAAO;AAAA,EACN,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EAC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QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,6BAAmD;AAAA,EAC9D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,EAAE,MAAM,kBAAkB,QAAQ,WAAW,QAAQ,SAAS;AAAA,EAClE,SAAS,8BAA8B;AAAA,EACvC,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/minimal.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\n .object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" → \"API Keys\" (like a1b2c3d4e5f6789012345678abcdef12).',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe('Amplitude server zone. Default: US.')\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 1000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 30.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 5.')\n .optional(),\n transport: z\n .enum(['fetch', 'xhr', 'beacon'])\n .describe('HTTP transport. Default: fetch.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.',\n )\n .optional(),\n appVersion: z\n .string()\n .describe('Application version; tagged onto every event.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n sessionReplay: z\n .unknown()\n .describe(\n 'Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).',\n )\n .optional(),\n experiment: z\n .unknown()\n .describe(\n 'Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.',\n )\n .optional(),\n engagement: z\n .unknown()\n .describe(\n 'Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.',\n )\n .optional(),\n })\n // Pass-through settings are loose: every other Amplitude BrowserOptions\n // key (serverUrl, defaultTracking, ...) is forwarded to the SDK as given.\n .loose();\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: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). 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';\nexport { minimal } from './minimal';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\n/**\n * Example environment configurations for the Amplitude destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.amplitude` undefined — the destination falls back\n * to the real `@amplitude/unified` module namespace.\n */\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\n/**\n * Minimal chainable Identify mock. The real SDK class has the same shape.\n * Tests spy by replacing these methods with jest.fn() in the test runner.\n */\nclass MockIdentify implements IdentifyInstance {\n _ops: Record<string, Record<string, unknown>> = {};\n\n private _record(op: string, prop: string, value?: unknown) {\n if (!this._ops[op]) this._ops[op] = {};\n this._ops[op][prop] = value;\n return this;\n }\n\n set(prop: string, value: unknown) {\n return this._record('set', prop, value);\n }\n setOnce(prop: string, value: unknown) {\n return this._record('setOnce', prop, value);\n }\n add(prop: string, value: unknown) {\n return this._record('add', prop, value);\n }\n append(prop: string, value: unknown) {\n return this._record('append', prop, value);\n }\n prepend(prop: string, value: unknown) {\n return this._record('prepend', prop, value);\n }\n preInsert(prop: string, value: unknown) {\n return this._record('preInsert', prop, value);\n }\n postInsert(prop: string, value: unknown) {\n return this._record('postInsert', prop, value);\n }\n remove(prop: string, value: unknown) {\n return this._record('remove', prop, value);\n }\n unset(prop: string) {\n return this._record('unset', prop);\n }\n clearAll() {\n this._ops['clearAll'] = {};\n return this;\n }\n\n toJSON() {\n return this._ops;\n }\n}\n\n/** Minimal chainable Revenue mock. */\nclass MockRevenue implements RevenueInstance {\n _data: Record<string, unknown> = {};\n\n setProductId(v: string) {\n this._data.productId = v;\n return this;\n }\n setPrice(v: number) {\n this._data.price = v;\n return this;\n }\n setQuantity(v: number) {\n this._data.quantity = v;\n return this;\n }\n setRevenueType(v: string) {\n this._data.revenueType = v;\n return this;\n }\n setCurrency(v: string) {\n this._data.currency = v;\n return this;\n }\n setRevenue(v: number) {\n this._data.revenue = v;\n return this;\n }\n setReceipt(v: string) {\n this._data.receipt = v;\n return this;\n }\n setReceiptSig(v: string) {\n this._data.receiptSig = v;\n return this;\n }\n setEventProperties(v: unknown) {\n this._data.eventProperties = v;\n return this;\n }\n\n toJSON() {\n return this._data;\n }\n}\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.add',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.reset',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setUserId',\n 'call:amplitude.setDeviceId',\n 'call:amplitude.setSessionId',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings and/or an\n * `await` hint for async scenarios. The test runner reads `settings`\n * from the example and merges it into the base destination settings\n * on top of the fixed apiKey. `configInclude` is passed as config-level\n * include when registering the destination.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default track',\n description:\n 'A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.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: AmplitudeStepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data`\n * section into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.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 data_currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Per-rule include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: AmplitudeStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, 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 'amplitude.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 (once the\n * state cache is empty). The destination sets user/device/session IDs\n * and tracks them in runtime state; subsequent pushes with unchanged\n * values do NOT re-fire the setters.\n *\n * This example represents the first push in a fresh session. user.id,\n * user.device, user.session come from the walkerOS session fixture.\n *\n * The walkerOS fixture's user.session is 's3ss10n' (string). The\n * destination deterministically hashes non-numeric session strings via\n * djb2 so the same walkerOS session always maps to the same Amplitude\n * session number (cross-page-load consistency). djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user: 'user.id',\n device: 'user.device',\n session: 'user.session',\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'us3r'],\n ['amplitude.setDeviceId', 'c00k13'],\n ['amplitude.setSessionId', 394324160],\n ['amplitude.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary - this is the\n * \"user login\" pattern: set user_id, enrich user properties. `silent: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n user: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'new-user-123'],\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105000,\n },\n add: {\n login_count: 1,\n },\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires amplitude.reset(), which clears userId\n * and regenerates deviceId. `silent: true` because we're only running the\n * reset side effect, no default track().\n */\nexport const userLogoutReset: AmplitudeStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.',\n in: createEvent({ name: 'user logout', timestamp: 1700000106 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['amplitude.reset']],\n};\n\n/**\n * Single-product revenue - resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The walkerOS default event has no data.currency, so the fallback fires.\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.',\n in: createEvent({\n name: 'subscription renew',\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order - the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order fires one amplitude.revenue call per nested product plus a single track for the order totals.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n // Only iterate nested entries that have a price field (products).\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_value: 462,\n data_tax: 73.76,\n data_shipping: 5.22,\n data_total: 467.22,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.',\n in: createEvent({\n name: 'company update',\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (one granted required key is enough, as at the collector's\n * consent gate).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [\n ['amplitude.setOptOut', false],\n ['amplitude.setOptOut', true],\n ],\n};\n\n/**\n * Consent granted → amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n\n/** A silent rule without settings of its own calls nothing. */\nexport const silentRule: AmplitudeStepExample = {\n public: false,\n description: 'A rule with silent: true and no settings calls nothing.',\n in: getEvent('page view', { timestamp: 1700000120 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group rule of groupAssignmentWithProperties on an update\n * without data: no group resolves, so nothing is sent. A declared skip: an\n * unmet mapping, not a failure.\n */\nexport const groupAssignmentWithoutData: AmplitudeStepExample = {\n public: false,\n description:\n 'A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'company update', entity: 'company', action: 'update' },\n mapping: groupAssignmentWithProperties.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings Amplitude needs to deliver: the project API key. */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: 'a1b2c3d4e5f6789012345678abcdef12' },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,aACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,qBAAqB,aAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,4DAA4D,EACrE,SAAS;AAAA,EACZ,gBAAgB,aACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,iBAAiB,aACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,0CAA0C,EACnD,SAAS;AAAA,EACZ,WAAW,aACR,KAAK,CAAC,SAAS,OAAO,QAAQ,CAAC,EAC/B,SAAS,iCAAiC,EAC1C,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,aACT,OAAO,EACP,SAAS,+CAA+C,EACxD,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,aACZ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,aACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AA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U;AAAA,UACV,MAAM;AAAA,QACR;AAAA,QACA,SAAS;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,sBAA4C;AAAA,EACvD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK;AAAA,IACH,CAAC,uBAAuB,KAAK;AAAA,IAC7B,CAAC,uBAAuB,IAAI;AAAA,EAC9B;AACF;AAKO,IAAM,oBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;AAGO,IAAM,aAAmC;AAAA,EAC9C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,6BAAmD;AAAA,EAC9D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,EAAE,MAAM,kBAAkB,QAAQ,WAAW,QAAQ,SAAS;AAAA,EAClE,SAAS,8BAA8B;AAAA,EACvC,KAAK,CAAC;AACR;;;AC3cO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,mCAAmC;AACzD;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,n)=>{for(var i in n)e(t,i,{get:n[i],enumerable:!0})},n={};t(n,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>d,settings:()=>p});import{zodToSchema as i}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var a=s.object({apiKey:s.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:s.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:s.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:s.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:s.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:s.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:s.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:s.string().describe("Application version; tagged onto every event.").optional(),identify:s.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:s.unknown().describe("Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:s.unknown().describe("Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.").optional(),engagement:s.unknown().describe("Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.").optional()}).loose();import{z as r}from"@walkeros/core/dev";var o=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:r.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:r.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:r.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:r.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),p=i(a),d=i(o),u={};t(u,{env:()=>l,step:()=>I});var l={};t(l,{init:()=>h,push:()=>v,simulation:()=>f});var c=()=>{},m=()=>({promise:Promise.resolve()}),y=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},g=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},h={amplitude:{init:m,add:m,track:c,identify:c,revenue:c,reset:c,setOptOut:c,setUserId:c,setDeviceId:c,setSessionId:c,setGroup:c,groupIdentify:c,Identify:y,Revenue:g}},v={amplitude:{init:m,add:m,track:c,identify:c,revenue:c,reset:c,setOptOut:c,setUserId:c,setDeviceId:c,setSessionId:c,setGroup:c,groupIdentify:c,Identify:y,Revenue:g}},f=["call:amplitude.init","call:amplitude.add","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};t(I,{consentGrantOptIn:()=>T,consentRevokeOptOut:()=>E,defaultEventForwarding:()=>w,destinationLevelIdentify:()=>R,destinationLevelInclude:()=>O,groupAssignmentWithProperties:()=>P,groupAssignmentWithoutData:()=>x,orderCompleteMultiProduct:()=>G,ruleIncludeReplaces:()=>A,silentRule:()=>j,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>S,userLogoutReset:()=>U,wildcardIgnored:()=>k});import{createEvent as b,getEvent as _}from"@walkeros/core";var w={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:_("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},k={public:!1,in:b({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},O={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:_("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},A={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:_("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},R={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:_("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},S={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:b({name:"user login",timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},U={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:b({name:"user logout",timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:b({name:"subscription renew",timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},G={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:_("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_value:555,globals_pagegroup:"shop"}]]},P={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:b({name:"company update",timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},E={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},T={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]},j={public:!1,description:"A rule with silent: true and no settings calls nothing.",in:_("page view",{timestamp:1700000120}),mapping:{silent:!0},out:[]},x={public:!1,description:"A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update"},mapping:P.mapping,out:[]};export{u as examples,n as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,n)=>{for(var i in n)e(t,i,{get:n[i],enumerable:!0})},n={};t(n,{MappingSchema:()=>o,SettingsSchema:()=>s,mapping:()=>d,settings:()=>p});import{zodToSchema as i}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var s=a.object({apiKey:a.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:a.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:a.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:a.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:a.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:a.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:a.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:a.string().describe("Application version; tagged onto every event.").optional(),identify:a.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:a.unknown().describe("Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:a.unknown().describe("Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.").optional(),engagement:a.unknown().describe("Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.").optional()}).loose();import{z as r}from"@walkeros/core/dev";var o=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:r.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:r.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:r.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:r.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),p=i(s),d=i(o),u={};t(u,{env:()=>l,minimal:()=>W,step:()=>I});var l={};t(l,{init:()=>h,push:()=>v,simulation:()=>f});var c=()=>{},m=()=>({promise:Promise.resolve()}),y=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},g=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},h={amplitude:{init:m,add:m,track:c,identify:c,revenue:c,reset:c,setOptOut:c,setUserId:c,setDeviceId:c,setSessionId:c,setGroup:c,groupIdentify:c,Identify:y,Revenue:g}},v={amplitude:{init:m,add:m,track:c,identify:c,revenue:c,reset:c,setOptOut:c,setUserId:c,setDeviceId:c,setSessionId:c,setGroup:c,groupIdentify:c,Identify:y,Revenue:g}},f=["call:amplitude.init","call:amplitude.add","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],I={};t(I,{consentGrantOptIn:()=>T,consentRevokeOptOut:()=>P,defaultEventForwarding:()=>w,destinationLevelIdentify:()=>R,destinationLevelInclude:()=>O,groupAssignmentWithProperties:()=>G,groupAssignmentWithoutData:()=>x,orderCompleteMultiProduct:()=>E,ruleIncludeReplaces:()=>A,silentRule:()=>j,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>S,userLogoutReset:()=>U,wildcardIgnored:()=>k});import{createEvent as b,getEvent as _}from"@walkeros/core";var w={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:_("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},k={public:!1,in:b({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},O={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:_("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420,data_currency:"EUR"}]]},A={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:_("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},R={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:_("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},S={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:b({name:"user login",timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},U={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:b({name:"user logout",timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:b({name:"subscription renew",timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},E={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:_("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_value:462,data_tax:73.76,data_shipping:5.22,data_total:467.22,globals_pagegroup:"shop"}]]},G={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:b({name:"company update",timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},P={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},T={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]},j={public:!1,description:"A rule with silent: true and no settings calls nothing.",in:_("page view",{timestamp:1700000120}),mapping:{silent:!0},out:[]},x={public:!1,description:"A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update"},mapping:G.mapping,out:[]},W={settings:{apiKey:"a1b2c3d4e5f6789012345678abcdef12"}};export{u as examples,n 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\n .object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" → \"API Keys\" (like a1b2c3d4e5f6789012345678abcdef12).',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe('Amplitude server zone. Default: US.')\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 1000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 30.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 5.')\n .optional(),\n transport: z\n .enum(['fetch', 'xhr', 'beacon'])\n .describe('HTTP transport. Default: fetch.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.',\n )\n .optional(),\n appVersion: z\n .string()\n .describe('Application version; tagged onto every event.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n sessionReplay: z\n .unknown()\n .describe(\n 'Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).',\n )\n .optional(),\n experiment: z\n .unknown()\n .describe(\n 'Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.',\n )\n .optional(),\n engagement: z\n .unknown()\n .describe(\n 'Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.',\n )\n .optional(),\n })\n // Pass-through settings are loose: every other Amplitude BrowserOptions\n // key (serverUrl, defaultTracking, ...) is forwarded to the SDK as given.\n .loose();\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: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). 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, IdentifyInstance, RevenueInstance } from '../types';\n\n/**\n * Example environment configurations for the Amplitude destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.amplitude` undefined — the destination falls back\n * to the real `@amplitude/unified` module namespace.\n */\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\n/**\n * Minimal chainable Identify mock. The real SDK class has the same shape.\n * Tests spy by replacing these methods with jest.fn() in the test runner.\n */\nclass MockIdentify implements IdentifyInstance {\n _ops: Record<string, Record<string, unknown>> = {};\n\n private _record(op: string, prop: string, value?: unknown) {\n if (!this._ops[op]) this._ops[op] = {};\n this._ops[op][prop] = value;\n return this;\n }\n\n set(prop: string, value: unknown) {\n return this._record('set', prop, value);\n }\n setOnce(prop: string, value: unknown) {\n return this._record('setOnce', prop, value);\n }\n add(prop: string, value: unknown) {\n return this._record('add', prop, value);\n }\n append(prop: string, value: unknown) {\n return this._record('append', prop, value);\n }\n prepend(prop: string, value: unknown) {\n return this._record('prepend', prop, value);\n }\n preInsert(prop: string, value: unknown) {\n return this._record('preInsert', prop, value);\n }\n postInsert(prop: string, value: unknown) {\n return this._record('postInsert', prop, value);\n }\n remove(prop: string, value: unknown) {\n return this._record('remove', prop, value);\n }\n unset(prop: string) {\n return this._record('unset', prop);\n }\n clearAll() {\n this._ops['clearAll'] = {};\n return this;\n }\n\n toJSON() {\n return this._ops;\n }\n}\n\n/** Minimal chainable Revenue mock. */\nclass MockRevenue implements RevenueInstance {\n _data: Record<string, unknown> = {};\n\n setProductId(v: string) {\n this._data.productId = v;\n return this;\n }\n setPrice(v: number) {\n this._data.price = v;\n return this;\n }\n setQuantity(v: number) {\n this._data.quantity = v;\n return this;\n }\n setRevenueType(v: string) {\n this._data.revenueType = v;\n return this;\n }\n setCurrency(v: string) {\n this._data.currency = v;\n return this;\n }\n setRevenue(v: number) {\n this._data.revenue = v;\n return this;\n }\n setReceipt(v: string) {\n this._data.receipt = v;\n return this;\n }\n setReceiptSig(v: string) {\n this._data.receiptSig = v;\n return this;\n }\n setEventProperties(v: unknown) {\n this._data.eventProperties = v;\n return this;\n }\n\n toJSON() {\n return this._data;\n }\n}\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.add',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.reset',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setUserId',\n 'call:amplitude.setDeviceId',\n 'call:amplitude.setSessionId',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings and/or an\n * `await` hint for async scenarios. The test runner reads `settings`\n * from the example and merges it into the base destination settings\n * on top of the fixed apiKey. `configInclude` is passed as config-level\n * include when registering the destination.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default track',\n description:\n 'A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.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: AmplitudeStepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data`\n * section into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.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 include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: AmplitudeStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, 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 'amplitude.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 (once the\n * state cache is empty). The destination sets user/device/session IDs\n * and tracks them in runtime state; subsequent pushes with unchanged\n * values do NOT re-fire the setters.\n *\n * This example represents the first push in a fresh session. user.id,\n * user.device, user.session come from the walkerOS session fixture.\n *\n * The walkerOS fixture's user.session is 's3ss10n' (string). The\n * destination deterministically hashes non-numeric session strings via\n * djb2 so the same walkerOS session always maps to the same Amplitude\n * session number (cross-page-load consistency). djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user: 'user.id',\n device: 'user.device',\n session: 'user.session',\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'us3r'],\n ['amplitude.setDeviceId', 'c00k13'],\n ['amplitude.setSessionId', 394324160],\n ['amplitude.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary - this is the\n * \"user login\" pattern: set user_id, enrich user properties. `silent: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n user: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'new-user-123'],\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105000,\n },\n add: {\n login_count: 1,\n },\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires amplitude.reset(), which clears userId\n * and regenerates deviceId. `silent: true` because we're only running the\n * reset side effect, no default track().\n */\nexport const userLogoutReset: AmplitudeStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.',\n in: createEvent({ name: 'user logout', timestamp: 1700000106 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['amplitude.reset']],\n};\n\n/**\n * Single-product revenue - resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The walkerOS default event has no data.currency, so the fallback fires.\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.',\n in: createEvent({\n name: 'subscription renew',\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order - the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order fires one amplitude.revenue call per nested product plus a single track for the order totals.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n // Only iterate nested entries that have a price field (products).\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_value: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.',\n in: createEvent({\n name: 'company update',\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (strict: all required keys must be granted).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [\n ['amplitude.setOptOut', false],\n ['amplitude.setOptOut', true],\n ],\n};\n\n/**\n * Consent granted → amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n\n/** A silent rule without settings of its own calls nothing. */\nexport const silentRule: AmplitudeStepExample = {\n public: false,\n description: 'A rule with silent: true and no settings calls nothing.',\n in: getEvent('page view', { timestamp: 1700000120 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group rule of groupAssignmentWithProperties on an update\n * without data: no group resolves, so nothing is sent. A declared skip: an\n * unmet mapping, not a failure.\n */\nexport const groupAssignmentWithoutData: AmplitudeStepExample = {\n public: false,\n description:\n 'A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'company update', entity: 'company', action: 'update' },\n mapping: groupAssignmentWithProperties.mapping,\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,EACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,qBAAqB,EAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,4DAA4D,EACrE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,0CAA0C,EACnD,SAAS;AAAA,EACZ,WAAW,EACR,KAAK,CAAC,SAAS,OAAO,QAAQ,CAAC,EAC/B,SAAS,iCAAiC,EAC1C,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,EACT,OAAO,EACP,SAAS,+CAA+C,EACxD,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,EACZ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,EACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,EACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EAGA,MAAM;;;ACzET,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR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;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK;AAAA,IACH,CAAC,uBAAuB,KAAK;AAAA,IAC7B,CAAC,uBAAuB,IAAI;AAAA,EAC9B;AACF;AAKO,IAAM,oBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,uBAAuB,KAAK,CAAC;AACtC;AAGO,IAAM,aAAmC;AAAA,EAC9C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,6BAAmD;AAAA,EAC9D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,EAAE,MAAM,kBAAkB,QAAQ,WAAW,QAAQ,SAAS;AAAA,EAClE,SAAS,8BAA8B;AAAA,EACvC,KAAK,CAAC;AACR;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/minimal.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\n .object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Amplitude project API key. Find it in your Amplitude project settings under \"General\" → \"API Keys\" (like a1b2c3d4e5f6789012345678abcdef12).',\n ),\n serverZone: z\n .enum(['US', 'EU'])\n .describe('Amplitude server zone. Default: US.')\n .optional(),\n flushIntervalMillis: z\n .number()\n .int()\n .positive()\n .describe('How often (in ms) to flush the event queue. Default: 1000.')\n .optional(),\n flushQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Max queued events before a flush. Default: 30.')\n .optional(),\n flushMaxRetries: z\n .number()\n .int()\n .nonnegative()\n .describe('Max retries on failed flush. Default: 5.')\n .optional(),\n transport: z\n .enum(['fetch', 'xhr', 'beacon'])\n .describe('HTTP transport. Default: fetch.')\n .optional(),\n useBatch: z\n .boolean()\n .describe(\n 'Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.',\n )\n .optional(),\n appVersion: z\n .string()\n .describe('Application version; tagged onto every event.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n sessionReplay: z\n .unknown()\n .describe(\n 'Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).',\n )\n .optional(),\n experiment: z\n .unknown()\n .describe(\n 'Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.',\n )\n .optional(),\n engagement: z\n .unknown()\n .describe(\n 'Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.',\n )\n .optional(),\n })\n // Pass-through settings are loose: every other Amplitude BrowserOptions\n // key (serverUrl, defaultTracking, ...) is forwarded to the SDK as given.\n .loose();\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: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.',\n )\n .optional(),\n revenue: z\n .unknown()\n .describe(\n 'Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).',\n )\n .optional(),\n groupIdentify: z\n .unknown()\n .describe(\n 'Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). 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';\nexport { minimal } from './minimal';\n","import type { Env, IdentifyInstance, RevenueInstance } from '../types';\n\n/**\n * Example environment configurations for the Amplitude destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves `env.amplitude` undefined — the destination falls back\n * to the real `@amplitude/unified` module namespace.\n */\n\nconst noop = () => {};\nconst noopPromise = () => ({ promise: Promise.resolve() });\n\n/**\n * Minimal chainable Identify mock. The real SDK class has the same shape.\n * Tests spy by replacing these methods with jest.fn() in the test runner.\n */\nclass MockIdentify implements IdentifyInstance {\n _ops: Record<string, Record<string, unknown>> = {};\n\n private _record(op: string, prop: string, value?: unknown) {\n if (!this._ops[op]) this._ops[op] = {};\n this._ops[op][prop] = value;\n return this;\n }\n\n set(prop: string, value: unknown) {\n return this._record('set', prop, value);\n }\n setOnce(prop: string, value: unknown) {\n return this._record('setOnce', prop, value);\n }\n add(prop: string, value: unknown) {\n return this._record('add', prop, value);\n }\n append(prop: string, value: unknown) {\n return this._record('append', prop, value);\n }\n prepend(prop: string, value: unknown) {\n return this._record('prepend', prop, value);\n }\n preInsert(prop: string, value: unknown) {\n return this._record('preInsert', prop, value);\n }\n postInsert(prop: string, value: unknown) {\n return this._record('postInsert', prop, value);\n }\n remove(prop: string, value: unknown) {\n return this._record('remove', prop, value);\n }\n unset(prop: string) {\n return this._record('unset', prop);\n }\n clearAll() {\n this._ops['clearAll'] = {};\n return this;\n }\n\n toJSON() {\n return this._ops;\n }\n}\n\n/** Minimal chainable Revenue mock. */\nclass MockRevenue implements RevenueInstance {\n _data: Record<string, unknown> = {};\n\n setProductId(v: string) {\n this._data.productId = v;\n return this;\n }\n setPrice(v: number) {\n this._data.price = v;\n return this;\n }\n setQuantity(v: number) {\n this._data.quantity = v;\n return this;\n }\n setRevenueType(v: string) {\n this._data.revenueType = v;\n return this;\n }\n setCurrency(v: string) {\n this._data.currency = v;\n return this;\n }\n setRevenue(v: number) {\n this._data.revenue = v;\n return this;\n }\n setReceipt(v: string) {\n this._data.receipt = v;\n return this;\n }\n setReceiptSig(v: string) {\n this._data.receiptSig = v;\n return this;\n }\n setEventProperties(v: unknown) {\n this._data.eventProperties = v;\n return this;\n }\n\n toJSON() {\n return this._data;\n }\n}\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n amplitude: {\n init: noopPromise,\n add: noopPromise,\n track: noop,\n identify: noop,\n revenue: noop,\n reset: noop,\n setOptOut: noop,\n setUserId: noop,\n setDeviceId: noop,\n setSessionId: noop,\n setGroup: noop,\n groupIdentify: noop,\n Identify: MockIdentify,\n Revenue: MockRevenue,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:amplitude.init',\n 'call:amplitude.add',\n 'call:amplitude.track',\n 'call:amplitude.identify',\n 'call:amplitude.revenue',\n 'call:amplitude.reset',\n 'call:amplitude.setOptOut',\n 'call:amplitude.setUserId',\n 'call:amplitude.setDeviceId',\n 'call:amplitude.setSessionId',\n 'call:amplitude.setGroup',\n 'call:amplitude.groupIdentify',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings and/or an\n * `await` hint for async scenarios. The test runner reads `settings`\n * from the example and merges it into the base destination settings\n * on top of the fixed apiKey. `configInclude` is passed as config-level\n * include when registering the destination.\n */\nexport type AmplitudeStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * amplitude.track(event.name, event_properties). With no mapping and\n * no destination-level include, event_properties is `{}`.\n */\nexport const defaultEventForwarding: AmplitudeStepExample = {\n title: 'Default track',\n description:\n 'A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['amplitude.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: AmplitudeStepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data`\n * section into prefixed event_properties on every push.\n */\nexport const destinationLevelInclude: AmplitudeStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'amplitude.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 data_currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Per-rule include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: AmplitudeStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, 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 'amplitude.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 (once the\n * state cache is empty). The destination sets user/device/session IDs\n * and tracks them in runtime state; subsequent pushes with unchanged\n * values do NOT re-fire the setters.\n *\n * This example represents the first push in a fresh session. user.id,\n * user.device, user.session come from the walkerOS session fixture.\n *\n * The walkerOS fixture's user.session is 's3ss10n' (string). The\n * destination deterministically hashes non-numeric session strings via\n * djb2 so the same walkerOS session always maps to the same Amplitude\n * session number (cross-page-load consistency). djb2('s3ss10n') = 394324160.\n */\nexport const destinationLevelIdentify: AmplitudeStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n user: 'user.id',\n device: 'user.device',\n session: 'user.session',\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'us3r'],\n ['amplitude.setDeviceId', 'c00k13'],\n ['amplitude.setSessionId', 394324160],\n ['amplitude.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full operation vocabulary - this is the\n * \"user login\" pattern: set user_id, enrich user properties. `silent: true`\n * suppresses the default amplitude.track() call because we're running\n * identity side effects only.\n */\nexport const userLoginIdentify: AmplitudeStepExample = {\n title: 'User login identify',\n description:\n 'A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n user: 'data.user_id',\n set: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n email: 'data.email',\n },\n },\n setOnce: {\n map: {\n first_login: 'timestamp',\n },\n },\n add: {\n map: {\n login_count: { value: 1 },\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setUserId', 'new-user-123'],\n [\n 'amplitude.identify',\n {\n set: {\n plan: 'premium',\n company: 'Acme',\n email: 'user@acme.com',\n },\n setOnce: {\n first_login: 1700000105000,\n },\n add: {\n login_count: 1,\n },\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires amplitude.reset(), which clears userId\n * and regenerates deviceId. `silent: true` because we're only running the\n * reset side effect, no default track().\n */\nexport const userLogoutReset: AmplitudeStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.',\n in: createEvent({ name: 'user logout', timestamp: 1700000106 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['amplitude.reset']],\n};\n\n/**\n * Single-product revenue - resolves `settings.revenue` to one object and\n * fires one amplitude.revenue() call. Note the `{ key: \"data.currency\",\n * value: \"EUR\" }` fallback syntax: try data.currency, default to \"EUR\".\n *\n * The walkerOS default event has no data.currency, so the fallback fires.\n */\nexport const subscriptionRenewRevenue: AmplitudeStepExample = {\n title: 'Subscription revenue',\n description:\n 'A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.',\n in: createEvent({\n name: 'subscription renew',\n timestamp: 1700000107,\n data: {\n plan_id: 'plan-pro',\n amount: 9.99,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n revenue: {\n map: {\n productId: 'data.plan_id',\n price: 'data.amount',\n revenueType: { value: 'renewal' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'plan-pro',\n price: 9.99,\n revenueType: 'renewal',\n currency: 'EUR',\n },\n ],\n ],\n};\n\n/**\n * Multi-product order - the canonical Amplitude ecommerce pattern.\n * `revenue.loop: [\"nested\", { map: ... }]` iterates event.nested and\n * resolves one revenue item per entry. Each becomes a separate\n * amplitude.revenue() call. The order-level track() fires once with\n * include-based event_properties.\n *\n * The default \"order complete\" fixture has 3 nested entries: two\n * products (ers, cc) and one gift. Products have `data.price`; the\n * gift has only `data.name`. The `condition` on the loop inner value\n * filters to products only (price must be present).\n */\nexport const orderCompleteMultiProduct: AmplitudeStepExample = {\n title: 'Multi-product order',\n description:\n 'An order fires one amplitude.revenue call per nested product plus a single track for the order totals.',\n in: getEvent('order complete', { timestamp: 1700000108 }),\n mapping: {\n include: ['data', 'globals'],\n settings: {\n revenue: {\n loop: [\n 'nested',\n {\n // Only iterate nested entries that have a price field (products).\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n productId: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n revenueType: { value: 'purchase' },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n out: [\n [\n 'amplitude.revenue',\n {\n productId: 'ers',\n price: 420,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.revenue',\n {\n productId: 'cc',\n price: 42,\n quantity: 1,\n revenueType: 'purchase',\n currency: 'EUR',\n },\n ],\n [\n 'amplitude.track',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_value: 462,\n data_tax: 73.76,\n data_shipping: 5.22,\n data_total: 467.22,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Group assignment + group properties. Typically used for B2B products\n * where a user belongs to a company. Both SDK calls fire on the same rule.\n */\nexport const groupAssignmentWithProperties: AmplitudeStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.',\n in: createEvent({\n name: 'company update',\n timestamp: 1700000109,\n data: {\n company: 'Acme',\n industry: 'tech',\n employee_count: 50,\n founded_year: 2020,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n },\n },\n groupIdentify: {\n map: {\n type: { value: 'company' },\n name: 'data.company',\n set: {\n map: {\n industry: 'data.industry',\n size: 'data.employee_count',\n },\n },\n setOnce: {\n map: {\n founded: 'data.founded_year',\n },\n },\n },\n },\n },\n },\n out: [\n ['amplitude.setGroup', 'company', 'Acme'],\n [\n 'amplitude.groupIdentify',\n 'company',\n 'Acme',\n {\n set: {\n industry: 'tech',\n size: 50,\n },\n setOnce: {\n founded: 2020,\n },\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → amplitude.setOptOut(true). The destination checks\n * the consent keys declared in config.consent and toggles optOut\n * accordingly (one granted required key is enough, as at the collector's\n * consent gate).\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: AmplitudeStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [\n ['amplitude.setOptOut', false],\n ['amplitude.setOptOut', true],\n ],\n};\n\n/**\n * Consent granted → amplitude.setOptOut(false).\n */\nexport const consentGrantOptIn: AmplitudeStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['amplitude.setOptOut', false]],\n};\n\n/** A silent rule without settings of its own calls nothing. */\nexport const silentRule: AmplitudeStepExample = {\n public: false,\n description: 'A rule with silent: true and no settings calls nothing.',\n in: getEvent('page view', { timestamp: 1700000120 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent group rule of groupAssignmentWithProperties on an update\n * without data: no group resolves, so nothing is sent. A declared skip: an\n * unmet mapping, not a failure.\n */\nexport const groupAssignmentWithoutData: AmplitudeStepExample = {\n public: false,\n description:\n 'A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'company update', entity: 'company', action: 'update' },\n mapping: groupAssignmentWithProperties.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings Amplitude needs to deliver: the project API key. */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: 'a1b2c3d4e5f6789012345678abcdef12' },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,YAAY,EACT,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,qBAAqB,EAClB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,4DAA4D,EACrE,SAAS;AAAA,EACZ,gBAAgB,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,iBAAiB,EACd,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,SAAS,0CAA0C,EACnD,SAAS;AAAA,EACZ,WAAW,EACR,KAAK,CAAC,SAAS,OAAO,QAAQ,CAAC,EAC/B,SAAS,iCAAiC,EAC1C,SAAS;AAAA,EACZ,UAAU,EACP,Q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R;;;AC3cO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,mCAAmC;AACzD;","names":["z"]}
@@ -207,7 +207,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
207
207
  /**
208
208
  * Consent revoked → amplitude.setOptOut(true). The destination checks
209
209
  * the consent keys declared in config.consent and toggles optOut
210
- * accordingly (strict: all required keys must be granted).
210
+ * accordingly (one granted required key is enough, as at the collector's
211
+ * consent gate).
211
212
  *
212
213
  * Uses the canonical StepExample.command='consent' pattern: the test
213
214
  * runner dispatches via elb('walker consent', in) instead of pushing
@@ -246,4 +247,7 @@ declare namespace step {
246
247
  export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
247
248
  }
248
249
 
249
- export { env, step };
250
+ /** The settings Amplitude needs to deliver: the project API key. */
251
+ declare const minimal: Flow.MinimalExample;
252
+
253
+ export { env, minimal, step };
@@ -207,7 +207,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
207
207
  /**
208
208
  * Consent revoked → amplitude.setOptOut(true). The destination checks
209
209
  * the consent keys declared in config.consent and toggles optOut
210
- * accordingly (strict: all required keys must be granted).
210
+ * accordingly (one granted required key is enough, as at the collector's
211
+ * consent gate).
211
212
  *
212
213
  * Uses the canonical StepExample.command='consent' pattern: the test
213
214
  * runner dispatches via elb('walker consent', in) instead of pushing
@@ -246,4 +247,7 @@ declare namespace step {
246
247
  export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
247
248
  }
248
249
 
249
- export { env, step };
250
+ /** The settings Amplitude needs to deliver: the project API key. */
251
+ declare const minimal: Flow.MinimalExample;
252
+
253
+ export { env, minimal, step };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
+ minimal: () => minimal,
24
25
  step: () => step_exports
25
26
  });
26
27
  module.exports = __toCommonJS(examples_exports);
@@ -219,7 +220,8 @@ var destinationLevelInclude = {
219
220
  data_name: "Everyday Ruck Snack",
220
221
  data_color: "black",
221
222
  data_size: "l",
222
- data_price: 420
223
+ data_price: 420,
224
+ data_currency: "EUR"
223
225
  }
224
226
  ]
225
227
  ]
@@ -426,9 +428,10 @@ var orderCompleteMultiProduct = {
426
428
  {
427
429
  data_id: "0rd3r1d",
428
430
  data_currency: "EUR",
431
+ data_value: 462,
432
+ data_tax: 73.76,
429
433
  data_shipping: 5.22,
430
- data_taxes: 73.76,
431
- data_value: 555,
434
+ data_total: 467.22,
432
435
  globals_pagegroup: "shop"
433
436
  }
434
437
  ]
@@ -527,8 +530,14 @@ var groupAssignmentWithoutData = {
527
530
  mapping: groupAssignmentWithProperties.mapping,
528
531
  out: []
529
532
  };
533
+
534
+ // src/examples/minimal.ts
535
+ var minimal = {
536
+ settings: { apiKey: "a1b2c3d4e5f6789012345678abcdef12" }
537
+ };
530
538
  // Annotate the CommonJS export names for ESM import in node:
531
539
  0 && (module.exports = {
532
540
  env,
541
+ minimal,
533
542
  step
534
543
  });
@@ -198,7 +198,8 @@ var destinationLevelInclude = {
198
198
  data_name: "Everyday Ruck Snack",
199
199
  data_color: "black",
200
200
  data_size: "l",
201
- data_price: 420
201
+ data_price: 420,
202
+ data_currency: "EUR"
202
203
  }
203
204
  ]
204
205
  ]
@@ -405,9 +406,10 @@ var orderCompleteMultiProduct = {
405
406
  {
406
407
  data_id: "0rd3r1d",
407
408
  data_currency: "EUR",
409
+ data_value: 462,
410
+ data_tax: 73.76,
408
411
  data_shipping: 5.22,
409
- data_taxes: 73.76,
410
- data_value: 555,
412
+ data_total: 467.22,
411
413
  globals_pagegroup: "shop"
412
414
  }
413
415
  ]
@@ -506,7 +508,13 @@ var groupAssignmentWithoutData = {
506
508
  mapping: groupAssignmentWithProperties.mapping,
507
509
  out: []
508
510
  };
511
+
512
+ // src/examples/minimal.ts
513
+ var minimal = {
514
+ settings: { apiKey: "a1b2c3d4e5f6789012345678abcdef12" }
515
+ };
509
516
  export {
510
517
  env_exports as env,
518
+ minimal,
511
519
  step_exports as step
512
520
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-amplitude",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -213,6 +213,11 @@
213
213
  "call:amplitude.groupIdentify"
214
214
  ]
215
215
  },
216
+ "minimal": {
217
+ "settings": {
218
+ "apiKey": "a1b2c3d4e5f6789012345678abcdef12"
219
+ }
220
+ },
216
221
  "step": {
217
222
  "consentGrantOptIn": {
218
223
  "title": "Consent granted",
@@ -261,7 +266,8 @@
261
266
  "name": "Everyday Ruck Snack",
262
267
  "color": "black",
263
268
  "size": "l",
264
- "price": 420
269
+ "price": 420,
270
+ "currency": "EUR"
265
271
  },
266
272
  "context": {
267
273
  "shopping": [
@@ -398,7 +404,8 @@
398
404
  "name": "Everyday Ruck Snack",
399
405
  "color": "black",
400
406
  "size": "l",
401
- "price": 420
407
+ "price": 420,
408
+ "currency": "EUR"
402
409
  },
403
410
  "context": {
404
411
  "shopping": [
@@ -446,7 +453,8 @@
446
453
  "data_name": "Everyday Ruck Snack",
447
454
  "data_color": "black",
448
455
  "data_size": "l",
449
- "data_price": 420
456
+ "data_price": 420,
457
+ "data_currency": "EUR"
450
458
  }
451
459
  ]
452
460
  ]
@@ -490,7 +498,7 @@
490
498
  "consent": {
491
499
  "functional": true
492
500
  },
493
- "id": "91bfc72946a8154f",
501
+ "id": "da9cba46c2d0c95d",
494
502
  "trigger": "test",
495
503
  "entity": "company",
496
504
  "action": "update",
@@ -607,9 +615,10 @@
607
615
  "data": {
608
616
  "id": "0rd3r1d",
609
617
  "currency": "EUR",
618
+ "value": 462,
619
+ "tax": 73.76,
610
620
  "shipping": 5.22,
611
- "taxes": 73.76,
612
- "value": 555
621
+ "total": 467.22
613
622
  },
614
623
  "context": {
615
624
  "shopping": [
@@ -752,9 +761,10 @@
752
761
  {
753
762
  "data_id": "0rd3r1d",
754
763
  "data_currency": "EUR",
764
+ "data_value": 462,
765
+ "data_tax": 73.76,
755
766
  "data_shipping": 5.22,
756
- "data_taxes": 73.76,
757
- "data_value": 555,
767
+ "data_total": 467.22,
758
768
  "globals_pagegroup": "shop"
759
769
  }
760
770
  ]
@@ -768,9 +778,10 @@
768
778
  "data": {
769
779
  "id": "0rd3r1d",
770
780
  "currency": "EUR",
781
+ "value": 462,
782
+ "tax": 73.76,
771
783
  "shipping": 5.22,
772
- "taxes": 73.76,
773
- "value": 555
784
+ "total": 467.22
774
785
  },
775
786
  "context": {
776
787
  "shopping": [
@@ -967,7 +978,7 @@
967
978
  "consent": {
968
979
  "functional": true
969
980
  },
970
- "id": "c52144147c06acbd",
981
+ "id": "ccff56b4d4586b60",
971
982
  "trigger": "test",
972
983
  "entity": "subscription",
973
984
  "action": "renew",
@@ -1049,7 +1060,7 @@
1049
1060
  "consent": {
1050
1061
  "functional": true
1051
1062
  },
1052
- "id": "cd7d17de7055f726",
1063
+ "id": "ce0e466544054ee7",
1053
1064
  "trigger": "test",
1054
1065
  "entity": "user",
1055
1066
  "action": "login",
@@ -1157,7 +1168,7 @@
1157
1168
  "consent": {
1158
1169
  "functional": true
1159
1170
  },
1160
- "id": "b8004c987132472e",
1171
+ "id": "0efd58ea5f394958",
1161
1172
  "trigger": "test",
1162
1173
  "entity": "user",
1163
1174
  "action": "logout",
@@ -1224,7 +1235,7 @@
1224
1235
  "consent": {
1225
1236
  "functional": true
1226
1237
  },
1227
- "id": "9e19242bdbd75057",
1238
+ "id": "162f28dcd80d3b25",
1228
1239
  "trigger": "test",
1229
1240
  "entity": "debug",
1230
1241
  "action": "noise",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-amplitude",
3
3
  "description": "Amplitude web destination for walkerOS (analytics, session replay, experiments, guides & surveys)",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -42,11 +42,11 @@
42
42
  "@amplitude/plugin-experiment-browser": "1.0.0-beta.28",
43
43
  "@amplitude/plugin-session-replay-browser": "1.31.0",
44
44
  "@amplitude/unified": "^1.0.16",
45
- "@walkeros/core": "4.8.2",
46
- "@walkeros/web-core": "4.8.2"
45
+ "@walkeros/core": "4.8.3-next-1793115089237",
46
+ "@walkeros/web-core": "4.8.3-next-1793115089237"
47
47
  },
48
48
  "devDependencies": {
49
- "@walkeros/collector": "4.8.2"
49
+ "@walkeros/collector": "4.8.3-next-1793115089237"
50
50
  },
51
51
  "repository": {
52
52
  "url": "git+https://github.com/elbwalker/walkerOS.git",