@walkeros/web-destination-amplitude 4.9.0-next-1793116456867 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -3
- package/README.md +4 -0
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +10 -10
- package/dist/examples/index.mjs +10 -10
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/walkerOS.json +16 -16
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @walkeros/web-destination-amplitude
|
|
2
2
|
|
|
3
|
-
## 4.9.0
|
|
3
|
+
## 4.9.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -13,22 +13,33 @@
|
|
|
13
13
|
`data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
|
|
14
14
|
read `data.total` first, then `data.value`. The CLI ships default event
|
|
15
15
|
contracts for common site types in `examples/contracts/`.
|
|
16
|
+
- 1306d8a: Step examples carry event timestamps in milliseconds, as the walkerOS
|
|
17
|
+
event model defines them, instead of seconds that read as a date in
|
|
18
|
+
January 1970. Where an example's output repeats the timestamp, such as
|
|
19
|
+
`event_timestamp` in the gtag include example or the event a transformer
|
|
20
|
+
example returns, the output shows the same value.
|
|
16
21
|
- 5313635: The package publishes a minimal example: the project API key is all
|
|
17
22
|
Amplitude needs to deliver. The docs page renders the install line, the
|
|
18
23
|
integrated code and the flow from it, and the package test runs the same
|
|
19
24
|
settings, so the setup a reader copies is the one that was tested.
|
|
25
|
+
- Updated dependencies [a67546d]
|
|
20
26
|
- Updated dependencies [29d2218]
|
|
27
|
+
- Updated dependencies [1306d8a]
|
|
21
28
|
- Updated dependencies [34fd225]
|
|
22
29
|
- Updated dependencies [5313635]
|
|
30
|
+
- Updated dependencies [1306d8a]
|
|
31
|
+
- Updated dependencies [fa46337]
|
|
23
32
|
- Updated dependencies [5313635]
|
|
24
33
|
- Updated dependencies [5313635]
|
|
25
34
|
- Updated dependencies [5313635]
|
|
26
35
|
- Updated dependencies [5313635]
|
|
27
36
|
- Updated dependencies [34fd225]
|
|
37
|
+
- Updated dependencies [fa46337]
|
|
38
|
+
- Updated dependencies [1306d8a]
|
|
28
39
|
- Updated dependencies [5313635]
|
|
29
40
|
- Updated dependencies [5313635]
|
|
30
|
-
- @walkeros/
|
|
31
|
-
- @walkeros/core@4.9.0
|
|
41
|
+
- @walkeros/core@4.9.0
|
|
42
|
+
- @walkeros/web-core@4.9.0
|
|
32
43
|
|
|
33
44
|
## 4.8.2
|
|
34
45
|
|
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ npm install @walkeros/web-destination-amplitude
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
This quick start sets no consent, so Amplitude receives every event without
|
|
49
|
+
consent, and a revocation changes nothing: add `consent: { analytics: true }` to
|
|
50
|
+
`config` before you go live, see the docs.
|
|
51
|
+
|
|
48
52
|
## Plugins
|
|
49
53
|
|
|
50
54
|
With only `apiKey` and the analytics options, only Amplitude analytics starts.
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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:17000001e5}),out:[["amplitude.track","product view",{}]]},z={public:!1,in:(0,A.createEvent)({name:"debug noise",timestamp:1700000101e3}),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:1700000102e3}),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:1700000103e3}),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:1700000104e3}),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:1700000106e3}),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:1700000107e3,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:1700000108e3}),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:1700000109e3,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:170000012e4}),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","../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,I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A,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"]}
|
|
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: 1700000100000 }),\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: 1700000101000 }),\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: 1700000102000 }),\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: 1700000103000 }),\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: 1700000104000 }),\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: 1700000106000 }),\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: 1700000107000,\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: 1700000108000 }),\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: 1700000109000,\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: 1700000120000 }),\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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,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:()=>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
|
|
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:17000001e5}),out:[["amplitude.track","product view",{}]]},k={public:!1,in:b({name:"debug noise",timestamp:1700000101e3}),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:1700000102e3}),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:1700000103e3}),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:1700000104e3}),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:1700000106e3}),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:1700000107e3,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:1700000108e3}),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:1700000109e3,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:170000012e4}),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","../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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,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":["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: 1700000100000 }),\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: 1700000101000 }),\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: 1700000102000 }),\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: 1700000103000 }),\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: 1700000104000 }),\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: 1700000106000 }),\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: 1700000107000,\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: 1700000108000 }),\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: 1700000109000,\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: 1700000120000 }),\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,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;A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D,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,IAAI,SAAS,aAAa,EAAE,WAAW,YAAc,CAAC;AAAA,EACtD,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":["z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -197,19 +197,19 @@ var import_core = require("@walkeros/core");
|
|
|
197
197
|
var defaultEventForwarding = {
|
|
198
198
|
title: "Default track",
|
|
199
199
|
description: "A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",
|
|
200
|
-
in: (0, import_core.getEvent)("product view", { timestamp:
|
|
200
|
+
in: (0, import_core.getEvent)("product view", { timestamp: 17000001e5 }),
|
|
201
201
|
out: [["amplitude.track", "product view", {}]]
|
|
202
202
|
};
|
|
203
203
|
var wildcardIgnored = {
|
|
204
204
|
public: false,
|
|
205
|
-
in: (0, import_core.createEvent)({ name: "debug noise", timestamp:
|
|
205
|
+
in: (0, import_core.createEvent)({ name: "debug noise", timestamp: 1700000101e3 }),
|
|
206
206
|
mapping: { ignore: true },
|
|
207
207
|
out: []
|
|
208
208
|
};
|
|
209
209
|
var destinationLevelInclude = {
|
|
210
210
|
title: "Include data",
|
|
211
211
|
description: "With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",
|
|
212
|
-
in: (0, import_core.getEvent)("product view", { timestamp:
|
|
212
|
+
in: (0, import_core.getEvent)("product view", { timestamp: 1700000102e3 }),
|
|
213
213
|
configInclude: ["data"],
|
|
214
214
|
out: [
|
|
215
215
|
[
|
|
@@ -229,7 +229,7 @@ var destinationLevelInclude = {
|
|
|
229
229
|
var ruleIncludeReplaces = {
|
|
230
230
|
title: "Rule include overrides",
|
|
231
231
|
description: "With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",
|
|
232
|
-
in: (0, import_core.getEvent)("order complete", { timestamp:
|
|
232
|
+
in: (0, import_core.getEvent)("order complete", { timestamp: 1700000103e3 }),
|
|
233
233
|
configInclude: ["data"],
|
|
234
234
|
mapping: {
|
|
235
235
|
include: ["globals"]
|
|
@@ -247,7 +247,7 @@ var ruleIncludeReplaces = {
|
|
|
247
247
|
var destinationLevelIdentify = {
|
|
248
248
|
title: "Destination identify",
|
|
249
249
|
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.",
|
|
250
|
-
in: (0, import_core.getEvent)("page view", { timestamp:
|
|
250
|
+
in: (0, import_core.getEvent)("page view", { timestamp: 1700000104e3 }),
|
|
251
251
|
settings: {
|
|
252
252
|
identify: {
|
|
253
253
|
map: {
|
|
@@ -327,7 +327,7 @@ var userLoginIdentify = {
|
|
|
327
327
|
var userLogoutReset = {
|
|
328
328
|
title: "User logout reset",
|
|
329
329
|
description: "A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",
|
|
330
|
-
in: (0, import_core.createEvent)({ name: "user logout", timestamp:
|
|
330
|
+
in: (0, import_core.createEvent)({ name: "user logout", timestamp: 1700000106e3 }),
|
|
331
331
|
mapping: {
|
|
332
332
|
silent: true,
|
|
333
333
|
settings: {
|
|
@@ -341,7 +341,7 @@ var subscriptionRenewRevenue = {
|
|
|
341
341
|
description: "A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",
|
|
342
342
|
in: (0, import_core.createEvent)({
|
|
343
343
|
name: "subscription renew",
|
|
344
|
-
timestamp:
|
|
344
|
+
timestamp: 1700000107e3,
|
|
345
345
|
data: {
|
|
346
346
|
plan_id: "plan-pro",
|
|
347
347
|
amount: 9.99
|
|
@@ -375,7 +375,7 @@ var subscriptionRenewRevenue = {
|
|
|
375
375
|
var orderCompleteMultiProduct = {
|
|
376
376
|
title: "Multi-product order",
|
|
377
377
|
description: "An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",
|
|
378
|
-
in: (0, import_core.getEvent)("order complete", { timestamp:
|
|
378
|
+
in: (0, import_core.getEvent)("order complete", { timestamp: 1700000108e3 }),
|
|
379
379
|
mapping: {
|
|
380
380
|
include: ["data", "globals"],
|
|
381
381
|
settings: {
|
|
@@ -442,7 +442,7 @@ var groupAssignmentWithProperties = {
|
|
|
442
442
|
description: "A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",
|
|
443
443
|
in: (0, import_core.createEvent)({
|
|
444
444
|
name: "company update",
|
|
445
|
-
timestamp:
|
|
445
|
+
timestamp: 1700000109e3,
|
|
446
446
|
data: {
|
|
447
447
|
company: "Acme",
|
|
448
448
|
industry: "tech",
|
|
@@ -519,7 +519,7 @@ var consentGrantOptIn = {
|
|
|
519
519
|
var silentRule = {
|
|
520
520
|
public: false,
|
|
521
521
|
description: "A rule with silent: true and no settings calls nothing.",
|
|
522
|
-
in: (0, import_core.getEvent)("page view", { timestamp:
|
|
522
|
+
in: (0, import_core.getEvent)("page view", { timestamp: 170000012e4 }),
|
|
523
523
|
mapping: { silent: true },
|
|
524
524
|
out: []
|
|
525
525
|
};
|