@walkeros/web-destination-segment 4.7.2 → 4.8.0-next-1791441510508
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 +13 -0
- package/README.md +6 -2
- package/dist/dev.d.mts +20 -15
- package/dist/dev.d.ts +20 -15
- 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.d.mts +20 -15
- package/dist/examples/index.d.ts +20 -15
- package/dist/examples/index.js +15 -6
- package/dist/examples/index.mjs +15 -6
- package/dist/index.d.mts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +78 -24
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @walkeros/web-destination-segment
|
|
2
2
|
|
|
3
|
+
## 4.8.0-next-1791441510508
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5593d7b: The `consent` setting description now says that only mapped keys are
|
|
8
|
+
forwarded and that no consent context is sent without it. The `cdnURL`
|
|
9
|
+
description says the setting is not applied, the `identify` description says
|
|
10
|
+
identify repeats on every push while `anonymousId` is set, and the step
|
|
11
|
+
examples name the config they rely on.
|
|
12
|
+
- Updated dependencies [5593d7b]
|
|
13
|
+
- @walkeros/core@4.8.0-next-1791441510508
|
|
14
|
+
- @walkeros/web-core@4.8.0-next-1791441510508
|
|
15
|
+
|
|
3
16
|
## 4.7.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# @walkeros/web-destination-segment
|
|
8
8
|
|
|
9
|
-
Segment CDP, routing events to
|
|
9
|
+
Segment CDP, routing events to downstream destinations.
|
|
10
10
|
|
|
11
11
|
[Documentation](https://www.walkeros.io/docs/destinations/web/segment) •
|
|
12
12
|
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-segment)
|
|
@@ -32,7 +32,11 @@ npm install @walkeros/web-destination-segment
|
|
|
32
32
|
"destinations": {
|
|
33
33
|
"segment": {
|
|
34
34
|
"package": "@walkeros/web-destination-segment",
|
|
35
|
-
"config": {
|
|
35
|
+
"config": {
|
|
36
|
+
"settings": {
|
|
37
|
+
"apiKey": "YOUR_SEGMENT_WRITE_KEY"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
}
|
package/dist/dev.d.mts
CHANGED
|
@@ -46,12 +46,11 @@ declare namespace index$1 {
|
|
|
46
46
|
* walkerOS's own `group` mapping) so every passthrough option (cookie,
|
|
47
47
|
* storage, integrations, plan, etc.) keeps IntelliSense intact. walkerOS
|
|
48
48
|
* adds:
|
|
49
|
-
* - `apiKey` (required)
|
|
50
|
-
* - `identify
|
|
51
|
-
* - `group
|
|
52
|
-
* - `
|
|
53
|
-
* - `
|
|
54
|
-
* - `_state` — runtime state (not user-facing, mutated by init/push)
|
|
49
|
+
* - `apiKey` (required): maps to `writeKey` in `AnalyticsBrowser.load()`
|
|
50
|
+
* - `identify`: destination-level identity mapping (Segment `identify()`)
|
|
51
|
+
* - `group`: destination-level group mapping (Segment `group()`)
|
|
52
|
+
* - `consent`: walkerOS consent key → Segment category name mapping
|
|
53
|
+
* - `_state`: runtime state (not user-facing, mutated by init/push)
|
|
55
54
|
*/
|
|
56
55
|
interface Settings extends Omit<InitOptions, 'group'> {
|
|
57
56
|
/** Segment write key. Maps to `writeKey` in the load() settings arg. */
|
|
@@ -63,10 +62,10 @@ interface Settings extends Omit<InitOptions, 'group'> {
|
|
|
63
62
|
/**
|
|
64
63
|
* Mapping from walkerOS consent keys → Segment `categoryPreferences` keys.
|
|
65
64
|
* Example: { marketing: "Advertising", analytics: "Analytics" }
|
|
66
|
-
* If omitted,
|
|
65
|
+
* Only mapped keys are forwarded. If omitted, no consent context is sent.
|
|
67
66
|
*/
|
|
68
67
|
consent?: Record<string, string>;
|
|
69
|
-
/** Runtime state
|
|
68
|
+
/** Runtime state: populated by init() and mutated by push(). Not user-facing. */
|
|
70
69
|
_state?: RuntimeState;
|
|
71
70
|
}
|
|
72
71
|
interface RuntimeState {
|
|
@@ -87,7 +86,7 @@ interface RuntimeState {
|
|
|
87
86
|
loaded?: boolean;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Segment SDK surface
|
|
89
|
+
* Segment SDK surface: the subset of @segment/analytics-next the
|
|
91
90
|
* destination actually uses. Mirrors the AnalyticsBrowser instance shape
|
|
92
91
|
* so tests can mock each method individually via env.analytics.
|
|
93
92
|
*/
|
|
@@ -101,7 +100,7 @@ interface SegmentAnalytics {
|
|
|
101
100
|
setAnonymousId: (id: string) => Promise<unknown> | void;
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
104
|
-
* Segment event options
|
|
103
|
+
* Segment event options: the fourth argument to track/identify/group/page
|
|
105
104
|
* that carries context and integration overrides. The destination uses
|
|
106
105
|
* this to stamp consent context on every event.
|
|
107
106
|
*/
|
|
@@ -127,7 +126,7 @@ interface SegmentSDK {
|
|
|
127
126
|
load: (settings: AnalyticsBrowserSettings, options?: InitOptions) => SegmentAnalytics;
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
|
-
* Env
|
|
129
|
+
* Env: optional SDK override. Production leaves this undefined and the
|
|
131
130
|
* destination falls back to the real @segment/analytics-next module.
|
|
132
131
|
* Tests provide a mock via env.analytics = { ... }.
|
|
133
132
|
*/
|
|
@@ -173,12 +172,12 @@ declare const defaultEventForwarding: SegmentStepExample;
|
|
|
173
172
|
*/
|
|
174
173
|
declare const wildcardIgnored: SegmentStepExample;
|
|
175
174
|
/**
|
|
176
|
-
* Destination-level
|
|
177
|
-
* into prefixed properties on every push.
|
|
175
|
+
* Destination-level include (config.include) flattens the walkerOS `data`
|
|
176
|
+
* section into prefixed properties on every push.
|
|
178
177
|
*/
|
|
179
178
|
declare const destinationLevelInclude: SegmentStepExample;
|
|
180
179
|
/**
|
|
181
|
-
* Per-rule
|
|
180
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
182
181
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
183
182
|
* overrides it with `globals` only.
|
|
184
183
|
*/
|
|
@@ -238,6 +237,11 @@ declare const orderCompletedEcommerce: SegmentStepExample;
|
|
|
238
237
|
* remaps walkerOS keys to Segment category names.
|
|
239
238
|
*/
|
|
240
239
|
declare const consentContextForwarded: SegmentStepExample;
|
|
240
|
+
/**
|
|
241
|
+
* No settings.consent: the event's consent state is not forwarded, so the
|
|
242
|
+
* track call carries no options (consent stamping is opt-in).
|
|
243
|
+
*/
|
|
244
|
+
declare const consentContextOmitted: SegmentStepExample;
|
|
241
245
|
/**
|
|
242
246
|
* Consent granted → deferred load fires for the first time. The
|
|
243
247
|
* destination was initialized with consent requirement; on the walker
|
|
@@ -257,6 +261,7 @@ declare const consentRevokeNoOp: SegmentStepExample;
|
|
|
257
261
|
type step_SegmentStepExample = SegmentStepExample;
|
|
258
262
|
declare const step_companyUpdateGroup: typeof companyUpdateGroup;
|
|
259
263
|
declare const step_consentContextForwarded: typeof consentContextForwarded;
|
|
264
|
+
declare const step_consentContextOmitted: typeof consentContextOmitted;
|
|
260
265
|
declare const step_consentGrantDeferredLoad: typeof consentGrantDeferredLoad;
|
|
261
266
|
declare const step_consentRevokeNoOp: typeof consentRevokeNoOp;
|
|
262
267
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
@@ -272,7 +277,7 @@ declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
|
272
277
|
declare const step_userLogoutReset: typeof userLogoutReset;
|
|
273
278
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
274
279
|
declare namespace step {
|
|
275
|
-
export { type step_SegmentStepExample as SegmentStepExample, step_companyUpdateGroup as companyUpdateGroup, step_consentContextForwarded as consentContextForwarded, step_consentGrantDeferredLoad as consentGrantDeferredLoad, step_consentRevokeNoOp as consentRevokeNoOp, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_init as init, step_orderCompletedEcommerce as orderCompletedEcommerce, step_pageViewAsPage as pageViewAsPage, step_pageViewMinimal as pageViewMinimal, step_profileUpdateTraitsOnly as profileUpdateTraitsOnly, step_ruleIncludeReplaces as ruleIncludeReplaces, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
280
|
+
export { type step_SegmentStepExample as SegmentStepExample, step_companyUpdateGroup as companyUpdateGroup, step_consentContextForwarded as consentContextForwarded, step_consentContextOmitted as consentContextOmitted, step_consentGrantDeferredLoad as consentGrantDeferredLoad, step_consentRevokeNoOp as consentRevokeNoOp, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_init as init, step_orderCompletedEcommerce as orderCompletedEcommerce, step_pageViewAsPage as pageViewAsPage, step_pageViewMinimal as pageViewMinimal, step_profileUpdateTraitsOnly as profileUpdateTraitsOnly, step_ruleIncludeReplaces as ruleIncludeReplaces, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
276
281
|
}
|
|
277
282
|
|
|
278
283
|
declare const index_env: typeof env;
|
package/dist/dev.d.ts
CHANGED
|
@@ -46,12 +46,11 @@ declare namespace index$1 {
|
|
|
46
46
|
* walkerOS's own `group` mapping) so every passthrough option (cookie,
|
|
47
47
|
* storage, integrations, plan, etc.) keeps IntelliSense intact. walkerOS
|
|
48
48
|
* adds:
|
|
49
|
-
* - `apiKey` (required)
|
|
50
|
-
* - `identify
|
|
51
|
-
* - `group
|
|
52
|
-
* - `
|
|
53
|
-
* - `
|
|
54
|
-
* - `_state` — runtime state (not user-facing, mutated by init/push)
|
|
49
|
+
* - `apiKey` (required): maps to `writeKey` in `AnalyticsBrowser.load()`
|
|
50
|
+
* - `identify`: destination-level identity mapping (Segment `identify()`)
|
|
51
|
+
* - `group`: destination-level group mapping (Segment `group()`)
|
|
52
|
+
* - `consent`: walkerOS consent key → Segment category name mapping
|
|
53
|
+
* - `_state`: runtime state (not user-facing, mutated by init/push)
|
|
55
54
|
*/
|
|
56
55
|
interface Settings extends Omit<InitOptions, 'group'> {
|
|
57
56
|
/** Segment write key. Maps to `writeKey` in the load() settings arg. */
|
|
@@ -63,10 +62,10 @@ interface Settings extends Omit<InitOptions, 'group'> {
|
|
|
63
62
|
/**
|
|
64
63
|
* Mapping from walkerOS consent keys → Segment `categoryPreferences` keys.
|
|
65
64
|
* Example: { marketing: "Advertising", analytics: "Analytics" }
|
|
66
|
-
* If omitted,
|
|
65
|
+
* Only mapped keys are forwarded. If omitted, no consent context is sent.
|
|
67
66
|
*/
|
|
68
67
|
consent?: Record<string, string>;
|
|
69
|
-
/** Runtime state
|
|
68
|
+
/** Runtime state: populated by init() and mutated by push(). Not user-facing. */
|
|
70
69
|
_state?: RuntimeState;
|
|
71
70
|
}
|
|
72
71
|
interface RuntimeState {
|
|
@@ -87,7 +86,7 @@ interface RuntimeState {
|
|
|
87
86
|
loaded?: boolean;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Segment SDK surface
|
|
89
|
+
* Segment SDK surface: the subset of @segment/analytics-next the
|
|
91
90
|
* destination actually uses. Mirrors the AnalyticsBrowser instance shape
|
|
92
91
|
* so tests can mock each method individually via env.analytics.
|
|
93
92
|
*/
|
|
@@ -101,7 +100,7 @@ interface SegmentAnalytics {
|
|
|
101
100
|
setAnonymousId: (id: string) => Promise<unknown> | void;
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
104
|
-
* Segment event options
|
|
103
|
+
* Segment event options: the fourth argument to track/identify/group/page
|
|
105
104
|
* that carries context and integration overrides. The destination uses
|
|
106
105
|
* this to stamp consent context on every event.
|
|
107
106
|
*/
|
|
@@ -127,7 +126,7 @@ interface SegmentSDK {
|
|
|
127
126
|
load: (settings: AnalyticsBrowserSettings, options?: InitOptions) => SegmentAnalytics;
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
|
-
* Env
|
|
129
|
+
* Env: optional SDK override. Production leaves this undefined and the
|
|
131
130
|
* destination falls back to the real @segment/analytics-next module.
|
|
132
131
|
* Tests provide a mock via env.analytics = { ... }.
|
|
133
132
|
*/
|
|
@@ -173,12 +172,12 @@ declare const defaultEventForwarding: SegmentStepExample;
|
|
|
173
172
|
*/
|
|
174
173
|
declare const wildcardIgnored: SegmentStepExample;
|
|
175
174
|
/**
|
|
176
|
-
* Destination-level
|
|
177
|
-
* into prefixed properties on every push.
|
|
175
|
+
* Destination-level include (config.include) flattens the walkerOS `data`
|
|
176
|
+
* section into prefixed properties on every push.
|
|
178
177
|
*/
|
|
179
178
|
declare const destinationLevelInclude: SegmentStepExample;
|
|
180
179
|
/**
|
|
181
|
-
* Per-rule
|
|
180
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
182
181
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
183
182
|
* overrides it with `globals` only.
|
|
184
183
|
*/
|
|
@@ -238,6 +237,11 @@ declare const orderCompletedEcommerce: SegmentStepExample;
|
|
|
238
237
|
* remaps walkerOS keys to Segment category names.
|
|
239
238
|
*/
|
|
240
239
|
declare const consentContextForwarded: SegmentStepExample;
|
|
240
|
+
/**
|
|
241
|
+
* No settings.consent: the event's consent state is not forwarded, so the
|
|
242
|
+
* track call carries no options (consent stamping is opt-in).
|
|
243
|
+
*/
|
|
244
|
+
declare const consentContextOmitted: SegmentStepExample;
|
|
241
245
|
/**
|
|
242
246
|
* Consent granted → deferred load fires for the first time. The
|
|
243
247
|
* destination was initialized with consent requirement; on the walker
|
|
@@ -257,6 +261,7 @@ declare const consentRevokeNoOp: SegmentStepExample;
|
|
|
257
261
|
type step_SegmentStepExample = SegmentStepExample;
|
|
258
262
|
declare const step_companyUpdateGroup: typeof companyUpdateGroup;
|
|
259
263
|
declare const step_consentContextForwarded: typeof consentContextForwarded;
|
|
264
|
+
declare const step_consentContextOmitted: typeof consentContextOmitted;
|
|
260
265
|
declare const step_consentGrantDeferredLoad: typeof consentGrantDeferredLoad;
|
|
261
266
|
declare const step_consentRevokeNoOp: typeof consentRevokeNoOp;
|
|
262
267
|
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
@@ -272,7 +277,7 @@ declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
|
272
277
|
declare const step_userLogoutReset: typeof userLogoutReset;
|
|
273
278
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
274
279
|
declare namespace step {
|
|
275
|
-
export { type step_SegmentStepExample as SegmentStepExample, step_companyUpdateGroup as companyUpdateGroup, step_consentContextForwarded as consentContextForwarded, step_consentGrantDeferredLoad as consentGrantDeferredLoad, step_consentRevokeNoOp as consentRevokeNoOp, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_init as init, step_orderCompletedEcommerce as orderCompletedEcommerce, step_pageViewAsPage as pageViewAsPage, step_pageViewMinimal as pageViewMinimal, step_profileUpdateTraitsOnly as profileUpdateTraitsOnly, step_ruleIncludeReplaces as ruleIncludeReplaces, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
280
|
+
export { type step_SegmentStepExample as SegmentStepExample, step_companyUpdateGroup as companyUpdateGroup, step_consentContextForwarded as consentContextForwarded, step_consentContextOmitted as consentContextOmitted, step_consentGrantDeferredLoad as consentGrantDeferredLoad, step_consentRevokeNoOp as consentRevokeNoOp, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_init as init, step_orderCompletedEcommerce as orderCompletedEcommerce, step_pageViewAsPage as pageViewAsPage, step_pageViewMinimal as pageViewMinimal, step_profileUpdateTraitsOnly as profileUpdateTraitsOnly, step_ruleIncludeReplaces as ruleIncludeReplaces, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
276
281
|
}
|
|
277
282
|
|
|
278
283
|
declare const index_env: typeof env;
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},r={};o(r,{examples:()=>y,schemas:()=>s}),module.exports=(e=r,((e,o,r,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===r||t(e,l,{get:()=>o[l],enumerable:!(s=a(o,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({apiKey:c.z.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:c.z.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:c.z.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:c.z.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:c.z.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:c.z.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:c.z.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:c.z.record(c.z.string(),c.z.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:c.z.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:c.z.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:c.z.record(c.z.string(),c.z.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()}),p=require("@walkeros/core/dev"),u=p.z.object({identify:p.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:p.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:p.z.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:p.z.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),m=(0,l.zodToSchema)(d),g=(0,l.zodToSchema)(u),y={};o(y,{env:()=>v,step:()=>S});var v={};o(v,{init:()=>h,push:()=>b,simulation:()=>k});var f=()=>{};function w(){return{load:()=>({track:f,identify:f,group:f,page:f,alias:f,reset:f,setAnonymousId:f})}}var h={analytics:w()},b={analytics:w()},k=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],S={};o(S,{companyUpdateGroup:()=>U,consentContextForwarded:()=>q,consentGrantDeferredLoad:()=>L,consentRevokeNoOp:()=>F,defaultEventForwarding:()=>D,destinationLevelIdentify:()=>O,destinationLevelInclude:()=>E,init:()=>A,orderCompletedEcommerce:()=>K,pageViewAsPage:()=>j,pageViewMinimal:()=>C,profileUpdateTraitsOnly:()=>P,ruleIncludeReplaces:()=>_,userLoginIdentify:()=>R,userLogoutReset:()=>x,wildcardIgnored:()=>z});var I=require("@walkeros/core"),A={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},D={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:(0,I.getEvent)("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},z={public:!1,in:(0,I.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},E={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:(0,I.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},_={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:(0,I.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},O={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:(0,I.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},R={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:(0,I.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},P={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:(0,I.getEvent)("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},x={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:(0,I.getEvent)("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},U={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:(0,I.getEvent)("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},j={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:(0,I.getEvent)("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},C={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:(0,I.getEvent)("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},K={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:(0,I.getEvent)("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},q={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:(0,I.getEvent)("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},L={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},F={public:!1,command:"consent",in:{analytics:!1},out:[]};//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},s={};o(s,{examples:()=>y,schemas:()=>r}),module.exports=(e=s,((e,o,s,r)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===s||t(e,l,{get:()=>o[l],enumerable:!(r=a(o,l))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};o(r,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({apiKey:c.z.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:c.z.string().describe("Not applied: the destination passes it in the load() options, where Analytics.js does not read it, so settings are always fetched from https://cdn.segment.com.").optional(),initialPageview:c.z.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false (walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views).").optional(),disableClientPersistence:c.z.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:c.z.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:c.z.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:c.z.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:c.z.record(c.z.string(),c.z.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:c.z.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Resolved on every push: analytics.identify fires on the first push and when userId or traits change, and on every push while anonymousId is set.").optional(),group:c.z.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:c.z.record(c.z.string(),c.z.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. Only mapped keys are forwarded; when omitted, no consent context is sent.').optional()}),p=require("@walkeros/core/dev"),u=p.z.object({identify:p.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:p.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:p.z.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:p.z.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),m=(0,l.zodToSchema)(d),g=(0,l.zodToSchema)(u),y={};o(y,{env:()=>v,step:()=>S});var v={};o(v,{init:()=>w,push:()=>b,simulation:()=>k});var f=()=>{};function h(){return{load:()=>({track:f,identify:f,group:f,page:f,alias:f,reset:f,setAnonymousId:f})}}var w={analytics:h()},b={analytics:h()},k=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],S={};o(S,{companyUpdateGroup:()=>j,consentContextForwarded:()=>q,consentContextOmitted:()=>L,consentGrantDeferredLoad:()=>W,consentRevokeNoOp:()=>F,defaultEventForwarding:()=>E,destinationLevelIdentify:()=>O,destinationLevelInclude:()=>_,init:()=>A,orderCompletedEcommerce:()=>K,pageViewAsPage:()=>U,pageViewMinimal:()=>C,profileUpdateTraitsOnly:()=>P,ruleIncludeReplaces:()=>D,userLoginIdentify:()=>R,userLogoutReset:()=>x,wildcardIgnored:()=>z});var I=require("@walkeros/core"),A={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},E={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:(0,I.getEvent)("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},z={public:!1,in:(0,I.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},_={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed Segment track properties.",in:(0,I.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},D={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,I.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},O={title:"Destination identify",description:"With settings.identify mapping userId to 'user.id', the destination calls analytics.identify before the default track.",in:(0,I.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},R={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:(0,I.getEvent)("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},P={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:(0,I.getEvent)("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},x={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:(0,I.getEvent)("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},j={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:(0,I.getEvent)("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},U={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:(0,I.getEvent)("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},C={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segment's auto-collection.",in:(0,I.getEvent)("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},K={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:(0,I.getEvent)("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},q={title:"Consent context",description:"With settings.consent mapping analytics to Analytics and marketing to Advertising, the event consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:(0,I.getEvent)("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},L={public:!1,in:(0,I.getEvent)("product view",{timestamp:1700000113e3,consent:{analytics:!0,marketing:!1}}),out:[["analytics.track","product view",{}]]},W={title:"Consent deferred load",description:"With consent: { analytics: true } in the destination config, a walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},F={public:!1,command:"consent",in:{analytics:!1},out:[]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.load.track',\n 'call:analytics.load.identify',\n 'call:analytics.load.group',\n 'call:analytics.load.page',\n 'call:analytics.load.alias',\n 'call:analytics.load.reset',\n 'call:analytics.load.setAnonymousId',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed Segment track properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: SegmentStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls analytics.identify with the resolved userId before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n 'A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.',\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,aACd,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,aACvB,QAAQ,EACR;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,UACA;AAAA,YACE,YAAY;AAAA,YACZ,MAAM;AAAA,YACN,OAAO;AAAA,YACP,UAAU;AAAA,YACV,UAAU;AAAA,UACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAQO,IAAM,0BAA8C;AAAA,EACzD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,SAAS,EAAE,WAAW,MAAM,WAAW,KAAK;AAAA,EAC9C,CAAC;AAAA,EACD,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,SAAS;AAAA,UACP,SAAS;AAAA,YACP,qBAAqB;AAAA,cACnB,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAUO,IAAM,2BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,UAAU,eAAe;AAAA,MAC3B,EAAE,iBAAiB,MAAM;AAAA,IAC3B;AAAA,EACF;AACF;AAOO,IAAM,oBAAwC;AAAA,EACnD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["import_dev","import_dev","init"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4).',\n ),\n cdnURL: z\n .string()\n .describe(\n 'Not applied: the destination passes it in the load() options, where Analytics.js does not read it, so settings are always fetched from https://cdn.segment.com.',\n )\n .optional(),\n initialPageview: z\n .boolean()\n .describe(\n 'When true, the SDK fires an automatic initial page() call on load. Default: false (walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views).',\n )\n .optional(),\n disableClientPersistence: z\n .boolean()\n .describe(\n 'When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.',\n )\n .optional(),\n disableAutoISOConversion: z\n .boolean()\n .describe('Disable automatic ISO string → Date conversion. Default: false.')\n .optional(),\n retryQueue: z\n .boolean()\n .describe('Retry failed events. Default: true.')\n .optional(),\n obfuscate: z\n .boolean()\n .describe('Obfuscate event payloads. Default: false.')\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream Segment destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Resolved on every push: analytics.identify fires on the first push and when userId or traits change, and on every push while anonymousId is set.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.',\n )\n .optional(),\n consent: z\n .record(z.string(), z.string())\n .describe(\n 'Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { \"marketing\": \"Advertising\", \"analytics\": \"Analytics\" }. Only mapped keys are forwarded; when omitted, no consent context is sent.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, SegmentAnalytics, SegmentSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Pre-init env — load() returns an instance whose methods are all no-ops.\n * The test runner clones this and replaces instance methods with jest spies\n * to capture calls.\n */\nfunction createMockInstance(): SegmentAnalytics {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n alias: noop,\n reset: noop,\n setAnonymousId: noop,\n };\n}\n\nfunction createMockSDK(): SegmentSDK {\n return {\n load: () => createMockInstance(),\n };\n}\n\nexport const init: Env | undefined = {\n analytics: createMockSDK(),\n};\n\nexport const push: Env = {\n analytics: createMockSDK(),\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:analytics.load',\n 'call:analytics.load.track',\n 'call:analytics.load.identify',\n 'call:analytics.load.group',\n 'call:analytics.load.page',\n 'call:analytics.load.alias',\n 'call:analytics.load.reset',\n 'call:analytics.load.setAnonymousId',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner merges this on top of a base { apiKey: 'test-project' }.\n */\nexport type SegmentStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical apiKey setting, init calls analytics.load() with the\n * Segment writeKey and the walkerOS defaults (initialPageview: false).\n * Reproduce by passing the same settings as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.',\n in: {\n settings: {\n apiKey: 'test-project',\n },\n },\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * analytics.track(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: SegmentStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Segment analytics.track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: SegmentStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data`\n * section into prefixed properties on every push.\n */\nexport const destinationLevelInclude: SegmentStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed Segment track properties.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'analytics.track',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule 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: SegmentStepExample = {\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 'analytics.track',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push. The\n * destination resolves the mapping, calls analytics.identify(userId),\n * and records the value in runtime state. Subsequent pushes with the\n * same userId do NOT re-fire identify().\n */\nexport const destinationLevelIdentify: SegmentStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping userId to 'user.id', the destination calls analytics.identify before the default track.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n userId: 'user.id',\n },\n },\n },\n out: [\n ['analytics.identify', 'us3r', {}],\n ['analytics.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with traits - the canonical \"user login\" pattern.\n * silent: true suppresses the default analytics.track() call because we're\n * running identity side effects only. Matches Segment Spec reserved traits\n * (email, name, plan, company) so downstream destinations recognize them.\n */\nexport const userLoginIdentify: SegmentStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company_name: 'Acme',\n company_id: 'comp-456',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n company: {\n map: {\n name: 'data.company_name',\n id: 'data.company_id',\n },\n },\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n company: { name: 'Acme', id: 'comp-456' },\n },\n ],\n ],\n};\n\n/**\n * Profile update - omit userId. Segment's SDK uses the currently stored\n * userId and merges the traits into the existing trait set.\n */\nexport const profileUpdateTraitsOnly: SegmentStepExample = {\n title: 'Profile update',\n description:\n 'A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Q. Doe',\n avatar_url: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n phone: 'data.phone',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n undefined,\n {\n name: 'Jane Q. Doe',\n avatar: 'https://example.com/avatar.png',\n phone: '+1234567890',\n },\n ],\n ],\n};\n\n/**\n * User logout - reset: true fires analytics.reset(), which clears userId,\n * anonymousId, traits, and generates a new anonymous ID.\n * silent: true because we're only running the reset side effect.\n */\nexport const userLogoutReset: SegmentStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['analytics.reset']],\n};\n\n/**\n * Per-event group assignment - company update event attaches the user\n * to a company and sets the company's traits in one call.\n */\nexport const companyUpdateGroup: SegmentStepExample = {\n title: 'Group company',\n description:\n 'A company update fires Segment analytics.group with a groupId and traits for account-level tracking.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n 'comp-456',\n {\n name: 'Acme',\n industry: 'tech',\n employees: 50,\n plan: 'enterprise',\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call - the canonical Segment pattern for page views.\n * silent: true suppresses the default track() call; settings.page fires\n * analytics.page(category, name, properties) instead.\n */\nexport const pageViewAsPage: SegmentStepExample = {\n title: 'Page view',\n description:\n 'A page view fires Segment analytics.page with category, name, and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000109,\n data: {\n category: 'docs',\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n category: 'data.category',\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n 'docs',\n 'Getting Started',\n {\n section: 'tutorials',\n },\n ],\n ],\n};\n\n/**\n * Minimal page() call - settings.page: true produces an empty\n * analytics.page() relying entirely on SDK auto-collection.\n */\nexport const pageViewMinimal: SegmentStepExample = {\n title: 'Page view minimal',\n description:\n \"A mapping with page: true fires an empty analytics.page call relying on Segment's auto-collection.\",\n in: getEvent('page view', { timestamp: 1700000110 }),\n mapping: {\n silent: true,\n settings: {\n page: true,\n },\n },\n out: [['analytics.page']],\n};\n\n/**\n * Segment ecommerce spec - Order Completed event. One track() call with\n * a products array. Uses mapping.name to produce the Segment Spec name\n * and mapping.data to build the properties object including the nested\n * products loop. The loop filters via condition to products with prices.\n */\nexport const orderCompletedEcommerce: SegmentStepExample = {\n title: 'Order completed',\n description:\n 'A completed order is mapped to the Segment Spec Order Completed event with a nested products array.',\n in: getEvent('order complete', { timestamp: 1700000111 }),\n mapping: {\n name: 'Order Completed',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n shipping: 'data.shipping',\n tax: 'data.taxes',\n total: 'data.total',\n products: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'analytics.track',\n 'Order Completed',\n {\n order_id: '0rd3r1d',\n currency: 'EUR',\n shipping: 5.22,\n tax: 73.76,\n total: 555,\n products: [\n {\n product_id: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n currency: 'EUR',\n },\n {\n product_id: 'cc',\n name: 'Cool Cap',\n price: 42,\n quantity: 1,\n currency: 'EUR',\n },\n ],\n },\n ],\n ],\n};\n\n/**\n * Consent context forwarding - when the event has consent state,\n * the destination automatically stamps every track/identify/group/page\n * call with context.consent.categoryPreferences. settings.consent\n * remaps walkerOS keys to Segment category names.\n */\nexport const consentContextForwarded: SegmentStepExample = {\n title: 'Consent context',\n description:\n 'With settings.consent mapping analytics to Analytics and marketing to Advertising, the event consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.',\n in: getEvent('product view', {\n timestamp: 1700000112,\n consent: { analytics: true, marketing: true },\n }),\n settings: {\n consent: {\n analytics: 'Analytics',\n marketing: 'Advertising',\n },\n },\n out: [\n [\n 'analytics.track',\n 'product view',\n {},\n {\n context: {\n consent: {\n categoryPreferences: {\n Analytics: true,\n Advertising: true,\n },\n },\n },\n },\n ],\n ],\n};\n\n/**\n * No settings.consent: the event's consent state is not forwarded, so the\n * track call carries no options (consent stamping is opt-in).\n */\nexport const consentContextOmitted: SegmentStepExample = {\n public: false,\n in: getEvent('product view', {\n timestamp: 1700000113000,\n consent: { analytics: true, marketing: false },\n }),\n out: [['analytics.track', 'product view', {}]],\n};\n\n/**\n * Consent granted → deferred load fires for the first time. The\n * destination was initialized with consent requirement; on the walker\n * consent command it calls analytics.load(writeKey, initOptions).\n *\n * Uses the canonical StepExample.command='consent' pattern. The full\n * call shape includes both the settings arg and the initOptions arg.\n */\nexport const consentGrantDeferredLoad: SegmentStepExample = {\n title: 'Consent deferred load',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n out: [\n [\n 'analytics.load',\n { writeKey: 'test-project' },\n { initialPageview: false },\n ],\n ],\n};\n\n/**\n * Consent revoked → no SDK call. The walkerOS consent gate handles\n * blocking subsequent events. The destination's on('consent') handler\n * is a no-op on revocation (Segment has no opt-out method).\n */\nexport const consentRevokeNoOp: SegmentStepExample = {\n public: false,\n command: 'consent',\n in: { analytics: false } as WalkerOS.Consent,\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,aACd,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,aACvB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,0BAA0B,aACvB,QAAQ,EACR,SAAS,sEAAiE,EAC1E,SAAS;AAAA,EACZ,YAAY,aACT,QAAQ,EACR,SAAS,qCAAqC,EAC9C,SAAS;AAAA,EACZ,WAAW,aACR,QAAQ,EACR,SAAS,2CAA2C,EACpD,SAAS;AAAA,EACZ,cAAc,aACX,OAAO,aAAE,OAAO,GAAG,aAAE,QAAQ,CAAC,EAC9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AAM,WAAW,KAAK;AAAA,EAC9C,CAAC;AAAA,EACD,UAAU;AAAA,IACR,SAAS;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC;AAAA,MACD;AAAA,QACE,SAAS;AAAA,UACP,SAAS;AAAA,YACP,qBAAqB;AAAA,cACnB,WAAW;AAAA,cACX,aAAa;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAMO,IAAM,wBAA4C;AAAA,EACvD,QAAQ;AAAA,EACR,QAAI,sBAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,SAAS,EAAE,WAAW,MAAM,WAAW,MAAM;AAAA,EAC/C,CAAC;AAAA,EACD,KAAK,CAAC,CAAC,mBAAmB,gBAAgB,CAAC,CAAC,CAAC;AAC/C;AAUO,IAAM,2BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,UAAU,eAAe;AAAA,MAC3B,EAAE,iBAAiB,MAAM;AAAA,IAC3B;AAAA,EACF;AACF;AAOO,IAAM,oBAAwC;AAAA,EACnD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["import_dev","import_dev","init"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>c,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var o=i.object({apiKey:i.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:i.string().describe("Override the CDN URL used for settings fetch. Default: https://cdn.segment.com. Useful for self-hosted Segment proxies.").optional(),initialPageview:i.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false — walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views.").optional(),disableClientPersistence:i.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:i.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:i.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:i.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:i.record(i.string(),i.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:i.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Fires on the first push and re-fires when the resolved value changes.").optional(),group:i.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:i.record(i.string(),i.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. When omitted, walkerOS keys are forwarded 1:1 to Segment.').optional()});import{z as r}from"@walkeros/core/dev";var s=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:r.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:r.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:r.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),l=n(o),c=n(s),d={};t(d,{env:()=>p,step:()=>f});var p={};t(p,{init:()=>g,push:()=>y,simulation:()=>v});var m=()=>{};function u(){return{load:()=>({track:m,identify:m,group:m,page:m,alias:m,reset:m,setAnonymousId:m})}}var g={analytics:u()},y={analytics:u()},v=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],f={};t(f,{companyUpdateGroup:()=>x,consentContextForwarded:()=>C,consentGrantDeferredLoad:()=>E,consentRevokeNoOp:()=>j,defaultEventForwarding:()=>k,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>S,init:()=>h,orderCompletedEcommerce:()=>O,pageViewAsPage:()=>P,pageViewMinimal:()=>U,profileUpdateTraitsOnly:()=>_,ruleIncludeReplaces:()=>I,userLoginIdentify:()=>D,userLogoutReset:()=>R,wildcardIgnored:()=>b});import{getEvent as w}from"@walkeros/core";var h={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},k={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:w("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},b={public:!1,in:w("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"Destination-level include flattens the event data section into prefixed Segment track properties.",in:w("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},I={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include so this event forwards only globals.",in:w("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},A={title:"Destination identify",description:"Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",in:w("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},D={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:w("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},_={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:w("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},R={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:w("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},x={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:w("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},P={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:w("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},U={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",in:w("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},O={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:w("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},C={title:"Consent context",description:"Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:w("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},E={title:"Consent deferred load",description:"A walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},j={public:!1,command:"consent",in:{analytics:!1},out:[]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{MappingSchema:()=>r,SettingsSchema:()=>o,mapping:()=>c,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var o=i.object({apiKey:i.string().min(1).describe("Your Segment source write key. Find it in your Segment workspace under Connections, Sources, Settings, API Keys. Maps to `writeKey` in the Analytics.js `load()` call (like a1B2c3D4e5F6a1B2c3D4e5F6a1B2c3D4)."),cdnURL:i.string().describe("Not applied: the destination passes it in the load() options, where Analytics.js does not read it, so settings are always fetched from https://cdn.segment.com.").optional(),initialPageview:i.boolean().describe("When true, the SDK fires an automatic initial page() call on load. Default: false (walkerOS sources handle page tracking, so this is disabled to avoid duplicate page views).").optional(),disableClientPersistence:i.boolean().describe("When true, prevents any cookie or localStorage writes. Useful for privacy-conscious setups. Default: false.").optional(),disableAutoISOConversion:i.boolean().describe("Disable automatic ISO string → Date conversion. Default: false.").optional(),retryQueue:i.boolean().describe("Retry failed events. Default: true.").optional(),obfuscate:i.boolean().describe("Obfuscate event payloads. Default: false.").optional(),integrations:i.record(i.string(),i.unknown()).describe('Enable/disable downstream Segment destinations. Example: { "All": true, "Mixpanel": false }.').optional(),identify:i.unknown().describe("Destination-level identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Resolved on every push: analytics.identify fires on the first push and when userId or traits change, and on every push while anonymousId is set.").optional(),group:i.unknown().describe("Destination-level group mapping. Resolves to an object with: groupId, traits. Fires on the first push and re-fires on change.").optional(),consent:i.record(i.string(),i.string()).describe('Mapping from walkerOS consent keys → Segment `categoryPreferences` keys. Example: { "marketing": "Advertising", "analytics": "Analytics" }. Only mapped keys are forwarded; when omitted, no consent context is sent.').optional()});import{z as s}from"@walkeros/core/dev";var r=s.object({identify:s.unknown().describe("Per-event identity mapping. Resolves to an object with any of: userId, traits, anonymousId. Use with rule-level `silent: true` on login/identify events.").optional(),group:s.unknown().describe("Per-event group assignment. Resolves to { groupId, traits }. Use with rule-level `silent: true` on company/team events.").optional(),page:s.unknown().describe("Per-event page call configuration. Resolves to { category?, name?, properties? } for analytics.page(), or `true` for an empty analytics.page() that relies on SDK auto-collection. Use with rule-level `silent: true` on page view events.").optional(),reset:s.unknown().describe("Logout trigger. Resolves to a truthy value → analytics.reset() (clears userId, anonymousId, traits). Typically used with silent: true on a user logout rule.").optional()}),l=n(o),c=n(r),d={};t(d,{env:()=>p,step:()=>f});var p={};t(p,{init:()=>y,push:()=>g,simulation:()=>v});var m=()=>{};function u(){return{load:()=>({track:m,identify:m,group:m,page:m,alias:m,reset:m,setAnonymousId:m})}}var y={analytics:u()},g={analytics:u()},v=["call:analytics.load","call:analytics.load.track","call:analytics.load.identify","call:analytics.load.group","call:analytics.load.page","call:analytics.load.alias","call:analytics.load.reset","call:analytics.load.setAnonymousId"],f={};t(f,{companyUpdateGroup:()=>x,consentContextForwarded:()=>C,consentContextOmitted:()=>E,consentGrantDeferredLoad:()=>j,consentRevokeNoOp:()=>K,defaultEventForwarding:()=>k,destinationLevelIdentify:()=>A,destinationLevelInclude:()=>I,init:()=>w,orderCompletedEcommerce:()=>U,pageViewAsPage:()=>P,pageViewMinimal:()=>O,profileUpdateTraitsOnly:()=>D,ruleIncludeReplaces:()=>S,userLoginIdentify:()=>_,userLogoutReset:()=>R,wildcardIgnored:()=>b});import{getEvent as h}from"@walkeros/core";var w={title:"Initialization",description:"Destination bootstrap calls analytics.load with the Segment writeKey and walker default options.",in:{settings:{apiKey:"test-project"}},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},k={title:"Default track",description:"A walker event becomes a Segment analytics.track call with the event name and empty properties.",in:h("product view",{timestamp:1700000100}),out:[["analytics.track","product view",{}]]},b={public:!1,in:h("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},I={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed Segment track properties.",in:h("product view",{timestamp:1700000102}),configInclude:["data"],out:[["analytics.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},S={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:h("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["analytics.track","order complete",{globals_pagegroup:"shop"}]]},A={title:"Destination identify",description:"With settings.identify mapping userId to 'user.id', the destination calls analytics.identify before the default track.",in:h("page view",{timestamp:1700000104}),settings:{identify:{map:{userId:"user.id"}}},out:[["analytics.identify","us3r",{}],["analytics.track","page view",{}]]},_={title:"User login identify",description:"A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",in:h("user login",{timestamp:1700000105,data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium",company_name:"Acme",company_id:"comp-456"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan",company:{map:{name:"data.company_name",id:"data.company_id"}}}}}}}},out:[["analytics.identify","new-user-123",{email:"user@acme.com",name:"Jane Doe",plan:"premium",company:{name:"Acme",id:"comp-456"}}]]},D={title:"Profile update",description:"A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",in:h("profile update",{timestamp:1700000106,data:{name:"Jane Q. Doe",avatar_url:"https://example.com/avatar.png",phone:"+1234567890"}}),mapping:{silent:!0,settings:{identify:{map:{traits:{map:{name:"data.name",avatar:"data.avatar_url",phone:"data.phone"}}}}}},out:[["analytics.identify",void 0,{name:"Jane Q. Doe",avatar:"https://example.com/avatar.png",phone:"+1234567890"}]]},R={title:"User logout reset",description:"A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",in:h("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["analytics.reset"]]},x={title:"Group company",description:"A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",in:h("company update",{timestamp:1700000108,data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50,plan:"enterprise"}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees",plan:"data.plan"}}}}}},out:[["analytics.group","comp-456",{name:"Acme",industry:"tech",employees:50,plan:"enterprise"}]]},P={title:"Page view",description:"A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",in:h("page view",{timestamp:1700000109,data:{category:"docs",title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{category:"data.category",name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page","docs","Getting Started",{section:"tutorials"}]]},O={title:"Page view minimal",description:"A mapping with page: true fires an empty analytics.page call relying on Segment's auto-collection.",in:h("page view",{timestamp:1700000110}),mapping:{silent:!0,settings:{page:!0}},out:[["analytics.page"]]},U={title:"Order completed",description:"A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",in:h("order complete",{timestamp:1700000111}),mapping:{name:"Order Completed",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},shipping:"data.shipping",tax:"data.taxes",total:"data.total",products:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{product_id:"data.id",name:"data.name",price:"data.price",quantity:{key:"data.quantity",value:1},currency:{key:"data.currency",value:"EUR"}}}]}}}},out:[["analytics.track","Order Completed",{order_id:"0rd3r1d",currency:"EUR",shipping:5.22,tax:73.76,total:555,products:[{product_id:"ers",name:"Everyday Ruck Snack",price:420,quantity:1,currency:"EUR"},{product_id:"cc",name:"Cool Cap",price:42,quantity:1,currency:"EUR"}]}]]},C={title:"Consent context",description:"With settings.consent mapping analytics to Analytics and marketing to Advertising, the event consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",in:h("product view",{timestamp:1700000112,consent:{analytics:!0,marketing:!0}}),settings:{consent:{analytics:"Analytics",marketing:"Advertising"}},out:[["analytics.track","product view",{},{context:{consent:{categoryPreferences:{Analytics:!0,Advertising:!0}}}}]]},E={public:!1,in:h("product view",{timestamp:1700000113e3,consent:{analytics:!0,marketing:!1}}),out:[["analytics.track","product view",{}]]},j={title:"Consent deferred load",description:"With consent: { analytics: true } in the destination config, a walker consent grant triggers the deferred Segment analytics.load with the configured writeKey.",command:"consent",in:{analytics:!0},out:[["analytics.load",{writeKey:"test-project"},{initialPageview:!1}]]},K={public:!1,command:"consent",in:{analytics:!1},out:[]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|