@walkeros/web-destination-amplitude 4.8.1 → 4.8.3-next-1793115089237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -3
- package/README.md +7 -0
- package/dist/dev.d.mts +63 -48
- package/dist/dev.d.ts +63 -48
- 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 +62 -48
- package/dist/examples/index.d.ts +62 -48
- package/dist/examples/index.js +42 -15
- package/dist/examples/index.mjs +42 -16
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +46 -46
- package/dist/index.d.ts +46 -46
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +150 -43
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @walkeros/web-destination-amplitude
|
|
2
2
|
|
|
3
|
+
## 4.8.3-next-1793115089237
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5313635: The sample events from `getEvent` now use the standard event names:
|
|
8
|
+
`checkout start` replaces `checkout view`, an order carries `tax` and `total`,
|
|
9
|
+
a promotion names its placement `slot`, and product events carry `currency`.
|
|
10
|
+
Order `value` is now the merchandise value: the `order complete` sample goes
|
|
11
|
+
from 555 to 462, and the gross amount charged is `total` (467.22). The
|
|
12
|
+
destination examples read `data.tax`, `data.slot` and the search keys
|
|
13
|
+
`data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
|
|
14
|
+
read `data.total` first, then `data.value`. The CLI ships default event
|
|
15
|
+
contracts for common site types in `examples/contracts/`.
|
|
16
|
+
- 5313635: The package publishes a minimal example: the project API key is all
|
|
17
|
+
Amplitude needs to deliver. The docs page renders the install line, the
|
|
18
|
+
integrated code and the flow from it, and the package test runs the same
|
|
19
|
+
settings, so the setup a reader copies is the one that was tested.
|
|
20
|
+
- Updated dependencies [29d2218]
|
|
21
|
+
- Updated dependencies [34fd225]
|
|
22
|
+
- Updated dependencies [5313635]
|
|
23
|
+
- Updated dependencies [5313635]
|
|
24
|
+
- Updated dependencies [5313635]
|
|
25
|
+
- Updated dependencies [5313635]
|
|
26
|
+
- Updated dependencies [5313635]
|
|
27
|
+
- Updated dependencies [34fd225]
|
|
28
|
+
- Updated dependencies [5313635]
|
|
29
|
+
- Updated dependencies [5313635]
|
|
30
|
+
- @walkeros/web-core@4.8.3-next-1793115089237
|
|
31
|
+
- @walkeros/core@4.8.3-next-1793115089237
|
|
32
|
+
|
|
33
|
+
## 4.8.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- b1d65e2: Amplitude loads each plugin package only when that plugin is enabled.
|
|
38
|
+
The package now imports cleanly under Node and tsx, so simulation and tooling
|
|
39
|
+
no longer fail on a browser-only plugin that the flow never uses.
|
|
40
|
+
- 2374f54: Without Session Replay, Experiment or Guides & Surveys settings only
|
|
41
|
+
Amplitude analytics starts; enabling one still starts all three. Options now
|
|
42
|
+
reach the SDK (`autocapture: false` was lost before). A missing `apiKey` is a
|
|
43
|
+
`config` error and a failed init is retried by the next push.
|
|
44
|
+
- 7e5fc27: A silent rule whose identify, group or similar mapping resolves to
|
|
45
|
+
nothing sends nothing, counts as delivered and writes one DEBUG line naming
|
|
46
|
+
the call and mapping key, never the value. An identity or group that is
|
|
47
|
+
already current writes nothing.
|
|
48
|
+
- 7e5fc27: Settings accept SDK options that the schema does not list and pass
|
|
49
|
+
them through to the SDK, so a newer SDK option no longer fails validation.
|
|
50
|
+
Amplitude events from a setup with plugins no longer carry the
|
|
51
|
+
`amplitude-ts-unified` library prefix.
|
|
52
|
+
- 2374f54: A failed vendor call, a missing required setting (`config`) and an
|
|
53
|
+
event that cannot be sent (`missing-input`) are reported as failed pushes,
|
|
54
|
+
with the dead-letter queue and one ERROR line, instead of counting as
|
|
55
|
+
delivered. Rules with `silent: true` send no event. Settings schemas reject
|
|
56
|
+
unknown keys.
|
|
57
|
+
- Updated dependencies [2374f54]
|
|
58
|
+
- Updated dependencies [7e5fc27]
|
|
59
|
+
- Updated dependencies [2374f54]
|
|
60
|
+
- Updated dependencies [964590a]
|
|
61
|
+
- Updated dependencies [4100ede]
|
|
62
|
+
- Updated dependencies [2374f54]
|
|
63
|
+
- Updated dependencies [2374f54]
|
|
64
|
+
- Updated dependencies [15eb7b2]
|
|
65
|
+
- Updated dependencies [33a2779]
|
|
66
|
+
- Updated dependencies [33a2779]
|
|
67
|
+
- Updated dependencies [b1d65e2]
|
|
68
|
+
- Updated dependencies [964590a]
|
|
69
|
+
- Updated dependencies [2374f54]
|
|
70
|
+
- @walkeros/core@4.8.2
|
|
71
|
+
- @walkeros/web-core@4.8.2
|
|
72
|
+
|
|
3
73
|
## 4.8.1
|
|
4
74
|
|
|
5
75
|
### Patch Changes
|
|
@@ -246,9 +316,6 @@
|
|
|
246
316
|
and `event.context` remain required.
|
|
247
317
|
- Each source self-registers via TypeScript module augmentation of `SourceMap`
|
|
248
318
|
in `@walkeros/core`.
|
|
249
|
-
- App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
|
|
250
|
-
part of this release. Telemetry from v4 CLI/MCP will not validate against
|
|
251
|
-
the existing app schema until that follow-up ships.
|
|
252
319
|
- `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
|
|
253
320
|
configs using `skip: true` in mapping rules must rename to `silent: true`.
|
|
254
321
|
Hard cut: no legacy alias, the field is gone.
|
package/README.md
CHANGED
|
@@ -45,6 +45,13 @@ npm install @walkeros/web-destination-amplitude
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## Plugins
|
|
49
|
+
|
|
50
|
+
With only `apiKey` and the analytics options, only Amplitude analytics starts.
|
|
51
|
+
Each plugin starts only from its own setting: `sessionReplay` starts Session
|
|
52
|
+
Replay, `experiment` with a `deploymentKey` starts Experiment, and `engagement`
|
|
53
|
+
starts Guides & Surveys, which loads its SDK from cdn.amplitude.com.
|
|
54
|
+
|
|
48
55
|
## Documentation
|
|
49
56
|
|
|
50
57
|
Full configuration, mapping, and examples live in the docs:
|
package/dist/dev.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
27
27
|
sessionReplay: z.ZodOptional<z.ZodUnknown>;
|
|
28
28
|
experiment: z.ZodOptional<z.ZodUnknown>;
|
|
29
29
|
engagement: z.ZodOptional<z.ZodUnknown>;
|
|
30
|
-
}, z.core.$
|
|
30
|
+
}, z.core.$loose>;
|
|
31
31
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
32
32
|
|
|
33
33
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -52,6 +52,8 @@ declare namespace index$1 {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
type BrowserOptions = Omit<Types.BrowserOptions, 'identify'>;
|
|
55
|
+
type AmplitudeBrowserOptions = Types.BrowserOptions;
|
|
56
|
+
type AmplitudePlugin = Types.Plugin;
|
|
55
57
|
/**
|
|
56
58
|
* Destination-level settings.
|
|
57
59
|
*
|
|
@@ -83,55 +85,53 @@ interface RuntimeState {
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
/**
|
|
86
|
-
* Amplitude SDK surface
|
|
87
|
-
* destination actually uses. Mirrors the real
|
|
88
|
-
*
|
|
88
|
+
* Amplitude SDK surface: the subset of @amplitude/unified the
|
|
89
|
+
* destination actually uses. Mirrors the real client's methods so tests can
|
|
90
|
+
* mock each one via env.amplitude. Generic over the Identify and Revenue
|
|
91
|
+
* instances, so the real SDK gets back the instances it created.
|
|
89
92
|
*/
|
|
90
|
-
interface AmplitudeSDK {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
Identify: new () => IdentifyInstance;
|
|
109
|
-
Revenue: new () => RevenueInstance;
|
|
93
|
+
interface AmplitudeSDK<I extends IdentifyInstance = IdentifyInstance, R extends RevenueInstance = RevenueInstance> {
|
|
94
|
+
/** Analytics. */
|
|
95
|
+
init: (apiKey: string, options?: AmplitudeBrowserOptions) => unknown;
|
|
96
|
+
/** One plugin: Session Replay, Experiment or Guides & Surveys. */
|
|
97
|
+
add: (plugin: AmplitudePlugin) => unknown;
|
|
98
|
+
track: (eventType: string, eventProperties?: Record<string, unknown>) => unknown;
|
|
99
|
+
identify: (identify: I) => unknown;
|
|
100
|
+
revenue: (revenue: R) => unknown;
|
|
101
|
+
reset: () => unknown;
|
|
102
|
+
setOptOut: (optOut: boolean) => unknown;
|
|
103
|
+
setUserId: (userId: string | undefined) => unknown;
|
|
104
|
+
setDeviceId: (deviceId: string) => unknown;
|
|
105
|
+
setSessionId: (sessionId: number) => unknown;
|
|
106
|
+
setGroup: (groupType: string, groupName: string | string[]) => unknown;
|
|
107
|
+
groupIdentify: (groupType: string, groupName: string, identify: I) => unknown;
|
|
108
|
+
Identify: new () => I;
|
|
109
|
+
Revenue: new () => R;
|
|
110
110
|
}
|
|
111
|
-
/** Chainable Identify
|
|
111
|
+
/** Chainable Identify, as the @amplitude/unified Identify class. */
|
|
112
112
|
interface IdentifyInstance {
|
|
113
|
-
set
|
|
114
|
-
setOnce
|
|
115
|
-
add
|
|
116
|
-
append
|
|
117
|
-
prepend
|
|
118
|
-
preInsert
|
|
119
|
-
postInsert
|
|
120
|
-
remove
|
|
121
|
-
unset
|
|
122
|
-
clearAll
|
|
113
|
+
set(property: string, value: unknown): IdentifyInstance;
|
|
114
|
+
setOnce(property: string, value: unknown): IdentifyInstance;
|
|
115
|
+
add(property: string, value: number): IdentifyInstance;
|
|
116
|
+
append(property: string, value: unknown): IdentifyInstance;
|
|
117
|
+
prepend(property: string, value: unknown): IdentifyInstance;
|
|
118
|
+
preInsert(property: string, value: unknown): IdentifyInstance;
|
|
119
|
+
postInsert(property: string, value: unknown): IdentifyInstance;
|
|
120
|
+
remove(property: string, value: unknown): IdentifyInstance;
|
|
121
|
+
unset(property: string): IdentifyInstance;
|
|
122
|
+
clearAll(): IdentifyInstance;
|
|
123
123
|
}
|
|
124
|
-
/** Chainable Revenue
|
|
124
|
+
/** Chainable Revenue, as the @amplitude/unified Revenue class. */
|
|
125
125
|
interface RevenueInstance {
|
|
126
|
-
setProductId
|
|
127
|
-
setPrice
|
|
128
|
-
setQuantity
|
|
129
|
-
setRevenueType
|
|
130
|
-
setCurrency
|
|
131
|
-
setRevenue
|
|
132
|
-
setReceipt
|
|
133
|
-
setReceiptSig
|
|
134
|
-
setEventProperties
|
|
126
|
+
setProductId(id: string): RevenueInstance;
|
|
127
|
+
setPrice(price: number): RevenueInstance;
|
|
128
|
+
setQuantity(quantity: number): RevenueInstance;
|
|
129
|
+
setRevenueType(type: string): RevenueInstance;
|
|
130
|
+
setCurrency(currency: string): RevenueInstance;
|
|
131
|
+
setRevenue(revenue: number): RevenueInstance;
|
|
132
|
+
setReceipt(receipt: string): RevenueInstance;
|
|
133
|
+
setReceiptSig(signature: string): RevenueInstance;
|
|
134
|
+
setEventProperties(properties: Record<string, unknown>): RevenueInstance;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Env — optional SDK override. Production leaves this undefined and the
|
|
@@ -253,7 +253,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
|
|
|
253
253
|
/**
|
|
254
254
|
* Consent revoked → amplitude.setOptOut(true). The destination checks
|
|
255
255
|
* the consent keys declared in config.consent and toggles optOut
|
|
256
|
-
* accordingly (
|
|
256
|
+
* accordingly (one granted required key is enough, as at the collector's
|
|
257
|
+
* consent gate).
|
|
257
258
|
*
|
|
258
259
|
* Uses the canonical StepExample.command='consent' pattern: the test
|
|
259
260
|
* runner dispatches via elb('walker consent', in) instead of pushing
|
|
@@ -264,6 +265,14 @@ declare const consentRevokeOptOut: AmplitudeStepExample;
|
|
|
264
265
|
* Consent granted → amplitude.setOptOut(false).
|
|
265
266
|
*/
|
|
266
267
|
declare const consentGrantOptIn: AmplitudeStepExample;
|
|
268
|
+
/** A silent rule without settings of its own calls nothing. */
|
|
269
|
+
declare const silentRule: AmplitudeStepExample;
|
|
270
|
+
/**
|
|
271
|
+
* The silent group rule of groupAssignmentWithProperties on an update
|
|
272
|
+
* without data: no group resolves, so nothing is sent. A declared skip: an
|
|
273
|
+
* unmet mapping, not a failure.
|
|
274
|
+
*/
|
|
275
|
+
declare const groupAssignmentWithoutData: AmplitudeStepExample;
|
|
267
276
|
|
|
268
277
|
type step_AmplitudeStepExample = AmplitudeStepExample;
|
|
269
278
|
declare const step_consentGrantOptIn: typeof consentGrantOptIn;
|
|
@@ -272,20 +281,26 @@ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
|
272
281
|
declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
|
|
273
282
|
declare const step_destinationLevelInclude: typeof destinationLevelInclude;
|
|
274
283
|
declare const step_groupAssignmentWithProperties: typeof groupAssignmentWithProperties;
|
|
284
|
+
declare const step_groupAssignmentWithoutData: typeof groupAssignmentWithoutData;
|
|
275
285
|
declare const step_orderCompleteMultiProduct: typeof orderCompleteMultiProduct;
|
|
276
286
|
declare const step_ruleIncludeReplaces: typeof ruleIncludeReplaces;
|
|
287
|
+
declare const step_silentRule: typeof silentRule;
|
|
277
288
|
declare const step_subscriptionRenewRevenue: typeof subscriptionRenewRevenue;
|
|
278
289
|
declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
279
290
|
declare const step_userLogoutReset: typeof userLogoutReset;
|
|
280
291
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
281
292
|
declare namespace step {
|
|
282
|
-
export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
293
|
+
export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
283
294
|
}
|
|
284
295
|
|
|
296
|
+
/** The settings Amplitude needs to deliver: the project API key. */
|
|
297
|
+
declare const minimal: Flow.MinimalExample;
|
|
298
|
+
|
|
285
299
|
declare const index_env: typeof env;
|
|
300
|
+
declare const index_minimal: typeof minimal;
|
|
286
301
|
declare const index_step: typeof step;
|
|
287
302
|
declare namespace index {
|
|
288
|
-
export { index_env as env, index_step as step };
|
|
303
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
289
304
|
}
|
|
290
305
|
|
|
291
306
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
27
27
|
sessionReplay: z.ZodOptional<z.ZodUnknown>;
|
|
28
28
|
experiment: z.ZodOptional<z.ZodUnknown>;
|
|
29
29
|
engagement: z.ZodOptional<z.ZodUnknown>;
|
|
30
|
-
}, z.core.$
|
|
30
|
+
}, z.core.$loose>;
|
|
31
31
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
32
32
|
|
|
33
33
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -52,6 +52,8 @@ declare namespace index$1 {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
type BrowserOptions = Omit<Types.BrowserOptions, 'identify'>;
|
|
55
|
+
type AmplitudeBrowserOptions = Types.BrowserOptions;
|
|
56
|
+
type AmplitudePlugin = Types.Plugin;
|
|
55
57
|
/**
|
|
56
58
|
* Destination-level settings.
|
|
57
59
|
*
|
|
@@ -83,55 +85,53 @@ interface RuntimeState {
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
/**
|
|
86
|
-
* Amplitude SDK surface
|
|
87
|
-
* destination actually uses. Mirrors the real
|
|
88
|
-
*
|
|
88
|
+
* Amplitude SDK surface: the subset of @amplitude/unified the
|
|
89
|
+
* destination actually uses. Mirrors the real client's methods so tests can
|
|
90
|
+
* mock each one via env.amplitude. Generic over the Identify and Revenue
|
|
91
|
+
* instances, so the real SDK gets back the instances it created.
|
|
89
92
|
*/
|
|
90
|
-
interface AmplitudeSDK {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
Identify: new () => IdentifyInstance;
|
|
109
|
-
Revenue: new () => RevenueInstance;
|
|
93
|
+
interface AmplitudeSDK<I extends IdentifyInstance = IdentifyInstance, R extends RevenueInstance = RevenueInstance> {
|
|
94
|
+
/** Analytics. */
|
|
95
|
+
init: (apiKey: string, options?: AmplitudeBrowserOptions) => unknown;
|
|
96
|
+
/** One plugin: Session Replay, Experiment or Guides & Surveys. */
|
|
97
|
+
add: (plugin: AmplitudePlugin) => unknown;
|
|
98
|
+
track: (eventType: string, eventProperties?: Record<string, unknown>) => unknown;
|
|
99
|
+
identify: (identify: I) => unknown;
|
|
100
|
+
revenue: (revenue: R) => unknown;
|
|
101
|
+
reset: () => unknown;
|
|
102
|
+
setOptOut: (optOut: boolean) => unknown;
|
|
103
|
+
setUserId: (userId: string | undefined) => unknown;
|
|
104
|
+
setDeviceId: (deviceId: string) => unknown;
|
|
105
|
+
setSessionId: (sessionId: number) => unknown;
|
|
106
|
+
setGroup: (groupType: string, groupName: string | string[]) => unknown;
|
|
107
|
+
groupIdentify: (groupType: string, groupName: string, identify: I) => unknown;
|
|
108
|
+
Identify: new () => I;
|
|
109
|
+
Revenue: new () => R;
|
|
110
110
|
}
|
|
111
|
-
/** Chainable Identify
|
|
111
|
+
/** Chainable Identify, as the @amplitude/unified Identify class. */
|
|
112
112
|
interface IdentifyInstance {
|
|
113
|
-
set
|
|
114
|
-
setOnce
|
|
115
|
-
add
|
|
116
|
-
append
|
|
117
|
-
prepend
|
|
118
|
-
preInsert
|
|
119
|
-
postInsert
|
|
120
|
-
remove
|
|
121
|
-
unset
|
|
122
|
-
clearAll
|
|
113
|
+
set(property: string, value: unknown): IdentifyInstance;
|
|
114
|
+
setOnce(property: string, value: unknown): IdentifyInstance;
|
|
115
|
+
add(property: string, value: number): IdentifyInstance;
|
|
116
|
+
append(property: string, value: unknown): IdentifyInstance;
|
|
117
|
+
prepend(property: string, value: unknown): IdentifyInstance;
|
|
118
|
+
preInsert(property: string, value: unknown): IdentifyInstance;
|
|
119
|
+
postInsert(property: string, value: unknown): IdentifyInstance;
|
|
120
|
+
remove(property: string, value: unknown): IdentifyInstance;
|
|
121
|
+
unset(property: string): IdentifyInstance;
|
|
122
|
+
clearAll(): IdentifyInstance;
|
|
123
123
|
}
|
|
124
|
-
/** Chainable Revenue
|
|
124
|
+
/** Chainable Revenue, as the @amplitude/unified Revenue class. */
|
|
125
125
|
interface RevenueInstance {
|
|
126
|
-
setProductId
|
|
127
|
-
setPrice
|
|
128
|
-
setQuantity
|
|
129
|
-
setRevenueType
|
|
130
|
-
setCurrency
|
|
131
|
-
setRevenue
|
|
132
|
-
setReceipt
|
|
133
|
-
setReceiptSig
|
|
134
|
-
setEventProperties
|
|
126
|
+
setProductId(id: string): RevenueInstance;
|
|
127
|
+
setPrice(price: number): RevenueInstance;
|
|
128
|
+
setQuantity(quantity: number): RevenueInstance;
|
|
129
|
+
setRevenueType(type: string): RevenueInstance;
|
|
130
|
+
setCurrency(currency: string): RevenueInstance;
|
|
131
|
+
setRevenue(revenue: number): RevenueInstance;
|
|
132
|
+
setReceipt(receipt: string): RevenueInstance;
|
|
133
|
+
setReceiptSig(signature: string): RevenueInstance;
|
|
134
|
+
setEventProperties(properties: Record<string, unknown>): RevenueInstance;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Env — optional SDK override. Production leaves this undefined and the
|
|
@@ -253,7 +253,8 @@ declare const groupAssignmentWithProperties: AmplitudeStepExample;
|
|
|
253
253
|
/**
|
|
254
254
|
* Consent revoked → amplitude.setOptOut(true). The destination checks
|
|
255
255
|
* the consent keys declared in config.consent and toggles optOut
|
|
256
|
-
* accordingly (
|
|
256
|
+
* accordingly (one granted required key is enough, as at the collector's
|
|
257
|
+
* consent gate).
|
|
257
258
|
*
|
|
258
259
|
* Uses the canonical StepExample.command='consent' pattern: the test
|
|
259
260
|
* runner dispatches via elb('walker consent', in) instead of pushing
|
|
@@ -264,6 +265,14 @@ declare const consentRevokeOptOut: AmplitudeStepExample;
|
|
|
264
265
|
* Consent granted → amplitude.setOptOut(false).
|
|
265
266
|
*/
|
|
266
267
|
declare const consentGrantOptIn: AmplitudeStepExample;
|
|
268
|
+
/** A silent rule without settings of its own calls nothing. */
|
|
269
|
+
declare const silentRule: AmplitudeStepExample;
|
|
270
|
+
/**
|
|
271
|
+
* The silent group rule of groupAssignmentWithProperties on an update
|
|
272
|
+
* without data: no group resolves, so nothing is sent. A declared skip: an
|
|
273
|
+
* unmet mapping, not a failure.
|
|
274
|
+
*/
|
|
275
|
+
declare const groupAssignmentWithoutData: AmplitudeStepExample;
|
|
267
276
|
|
|
268
277
|
type step_AmplitudeStepExample = AmplitudeStepExample;
|
|
269
278
|
declare const step_consentGrantOptIn: typeof consentGrantOptIn;
|
|
@@ -272,20 +281,26 @@ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
|
272
281
|
declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
|
|
273
282
|
declare const step_destinationLevelInclude: typeof destinationLevelInclude;
|
|
274
283
|
declare const step_groupAssignmentWithProperties: typeof groupAssignmentWithProperties;
|
|
284
|
+
declare const step_groupAssignmentWithoutData: typeof groupAssignmentWithoutData;
|
|
275
285
|
declare const step_orderCompleteMultiProduct: typeof orderCompleteMultiProduct;
|
|
276
286
|
declare const step_ruleIncludeReplaces: typeof ruleIncludeReplaces;
|
|
287
|
+
declare const step_silentRule: typeof silentRule;
|
|
277
288
|
declare const step_subscriptionRenewRevenue: typeof subscriptionRenewRevenue;
|
|
278
289
|
declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
279
290
|
declare const step_userLogoutReset: typeof userLogoutReset;
|
|
280
291
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
281
292
|
declare namespace step {
|
|
282
|
-
export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
293
|
+
export { type step_AmplitudeStepExample as AmplitudeStepExample, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_ruleIncludeReplaces as ruleIncludeReplaces, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
283
294
|
}
|
|
284
295
|
|
|
296
|
+
/** The settings Amplitude needs to deliver: the project API key. */
|
|
297
|
+
declare const minimal: Flow.MinimalExample;
|
|
298
|
+
|
|
285
299
|
declare const index_env: typeof env;
|
|
300
|
+
declare const index_minimal: typeof minimal;
|
|
286
301
|
declare const index_step: typeof step;
|
|
287
302
|
declare namespace index {
|
|
288
|
-
export { index_env as env, index_step as step };
|
|
303
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
289
304
|
}
|
|
290
305
|
|
|
291
306
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},a={};s(a,{examples:()=>y,schemas:()=>o}),module.exports=(e=a,((e,s,a,o)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let d of i(s))r.call(e,d)||d===a||t(e,d,{get:()=>s[d],enumerable:!(o=n(s,d))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};s(o,{MappingSchema:()=>c,SettingsSchema:()=>p,mapping:()=>v,settings:()=>m});var d=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:u.z.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:u.z.string().describe("Application version; tagged onto every event.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:u.z.unknown().describe("Session Replay options, passed to the Session Replay plugin. @amplitude/unified sets up the plugin on every init, whether or not this is set; it records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:u.z.unknown().describe("Feature Experiment options. Passed to the Experiment plugin only when they include `deploymentKey`. @amplitude/unified sets up the plugin on every init; without a deploymentKey it uses the API key.").optional(),engagement:u.z.unknown().describe("Guides & Surveys options object. @amplitude/unified loads the Guides & Surveys SDK from cdn.amplitude.com on every init, whether or not this is set; `true` passes no options.").optional()}),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:l.z.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),m=(0,d.zodToSchema)(p),v=(0,d.zodToSchema)(c),y={};s(y,{env:()=>g,step:()=>O});var g={};s(g,{init:()=>_,push:()=>w,simulation:()=>k});var h=()=>{},f=()=>({promise:Promise.resolve()}),b=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},I=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},_={amplitude:{initAll:()=>Promise.resolve(),track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,flush:f,add:f,Identify:b,Revenue:I}},w={amplitude:{initAll:()=>Promise.resolve(),track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,flush:f,add:f,Identify:b,Revenue:I}},k=["call:amplitude.initAll","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],O={};s(O,{consentGrantOptIn:()=>x,consentRevokeOptOut:()=>q,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>P,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>T,orderCompleteMultiProduct:()=>G,ruleIncludeReplaces:()=>E,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>U,userLogoutReset:()=>j,wildcardIgnored:()=>z});var A=require("@walkeros/core"),R={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:(0,A.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},z={public:!1,in:(0,A.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:(0,A.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},E={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:(0,A.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},P={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:(0,A.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},U={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:(0,A.getEvent)("user login",{timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},j={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:(0,A.getEvent)("user logout",{timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:(0,A.getEvent)("subscription renew",{timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},G={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:(0,A.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},T={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:(0,A.getEvent)("company update",{timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},q={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},x={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]};//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},s={};r(s,{examples:()=>y,schemas:()=>o}),module.exports=(e=s,((e,r,s,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let p of i(r))a.call(e,p)||p===s||t(e,p,{get:()=>r[p],enumerable:!(o=n(r,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>c,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),d=u.z.object({apiKey:u.z.string().min(1).describe('Your Amplitude project API key. Find it in your Amplitude project settings under "General" → "API Keys" (like a1b2c3d4e5f6789012345678abcdef12).'),serverZone:u.z.enum(["US","EU"]).describe("Amplitude server zone. Default: US.").optional(),flushIntervalMillis:u.z.number().int().positive().describe("How often (in ms) to flush the event queue. Default: 1000.").optional(),flushQueueSize:u.z.number().int().positive().describe("Max queued events before a flush. Default: 30.").optional(),flushMaxRetries:u.z.number().int().nonnegative().describe("Max retries on failed flush. Default: 5.").optional(),transport:u.z.enum(["fetch","xhr","beacon"]).describe("HTTP transport. Default: fetch.").optional(),useBatch:u.z.boolean().describe("Use the Amplitude batch endpoint instead of the standard endpoint. Default: false.").optional(),appVersion:u.z.string().describe("Application version; tagged onto every event.").optional(),identify:u.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),sessionReplay:u.z.unknown().describe("Session Replay options. When set, the Session Replay plugin starts; the other plugins start only from their own settings. It records a sampled share of sessions, set by the project sampling settings in Amplitude when present, else by sampleRate (default 0).").optional(),experiment:u.z.unknown().describe("Feature Experiment options. The Experiment plugin starts only when they include `deploymentKey`; the other plugins start only from their own settings.").optional(),engagement:u.z.unknown().describe("Guides & Surveys options object; `true` passes no options. When set, the Guides & Surveys plugin starts and loads its SDK from cdn.amplitude.com; the other plugins start only from their own settings.").optional()}).loose(),l=require("@walkeros/core/dev"),c=l.z.object({identify:l.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: user, device, session, set, setOnce, add, append, prepend, preInsert, postInsert, remove, unset, clearAll.").optional(),revenue:l.z.unknown().describe("Revenue mapping. Resolves to a single object or (via loop) an array of objects, each with: productId, price, quantity, revenueType, currency, revenue, receipt, receiptSig, eventProperties. One amplitude.revenue() call fires per item.").optional(),group:l.z.unknown().describe("Group assignment. Resolves to { type, name } → amplitude.setGroup(type, name).").optional(),groupIdentify:l.z.unknown().describe("Group properties. Resolves to { type, name, set?, setOnce?, ... } → amplitude.groupIdentify(type, name, identify).").optional(),reset:l.z.unknown().describe("Logout trigger. Resolves to a truthy value → amplitude.reset() (clears userId, regenerates deviceId). Typically used with silent: true on a user logout rule.").optional()}),m=(0,p.zodToSchema)(d),g=(0,p.zodToSchema)(c),y={};r(y,{env:()=>v,minimal:()=>K,step:()=>O});var v={};r(v,{init:()=>_,push:()=>w,simulation:()=>k});var h=()=>{},f=()=>({promise:Promise.resolve()}),b=class{constructor(){this._ops={}}_record(e,t,n){return this._ops[e]||(this._ops[e]={}),this._ops[e][t]=n,this}set(e,t){return this._record("set",e,t)}setOnce(e,t){return this._record("setOnce",e,t)}add(e,t){return this._record("add",e,t)}append(e,t){return this._record("append",e,t)}prepend(e,t){return this._record("prepend",e,t)}preInsert(e,t){return this._record("preInsert",e,t)}postInsert(e,t){return this._record("postInsert",e,t)}remove(e,t){return this._record("remove",e,t)}unset(e){return this._record("unset",e)}clearAll(){return this._ops.clearAll={},this}toJSON(){return this._ops}},I=class{constructor(){this._data={}}setProductId(e){return this._data.productId=e,this}setPrice(e){return this._data.price=e,this}setQuantity(e){return this._data.quantity=e,this}setRevenueType(e){return this._data.revenueType=e,this}setCurrency(e){return this._data.currency=e,this}setRevenue(e){return this._data.revenue=e,this}setReceipt(e){return this._data.receipt=e,this}setReceiptSig(e){return this._data.receiptSig=e,this}setEventProperties(e){return this._data.eventProperties=e,this}toJSON(){return this._data}},_={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},w={amplitude:{init:f,add:f,track:h,identify:h,revenue:h,reset:h,setOptOut:h,setUserId:h,setDeviceId:h,setSessionId:h,setGroup:h,groupIdentify:h,Identify:b,Revenue:I}},k=["call:amplitude.init","call:amplitude.add","call:amplitude.track","call:amplitude.identify","call:amplitude.revenue","call:amplitude.reset","call:amplitude.setOptOut","call:amplitude.setUserId","call:amplitude.setDeviceId","call:amplitude.setSessionId","call:amplitude.setGroup","call:amplitude.groupIdentify"],O={};r(O,{consentGrantOptIn:()=>x,consentRevokeOptOut:()=>q,defaultEventForwarding:()=>R,destinationLevelIdentify:()=>U,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>G,groupAssignmentWithoutData:()=>M,orderCompleteMultiProduct:()=>T,ruleIncludeReplaces:()=>E,silentRule:()=>W,subscriptionRenewRevenue:()=>D,userLoginIdentify:()=>P,userLogoutReset:()=>j,wildcardIgnored:()=>z});var A=require("@walkeros/core"),R={title:"Default track",description:"A walker event is forwarded to Amplitude as an amplitude.track call with the event name and empty properties.",in:(0,A.getEvent)("product view",{timestamp:1700000100}),out:[["amplitude.track","product view",{}]]},z={public:!1,in:(0,A.createEvent)({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed event_properties on every track call.",in:(0,A.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["amplitude.track","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420,data_currency:"EUR"}]]},E={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:(0,A.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["amplitude.track","order complete",{globals_pagegroup:"shop"}]]},U={title:"Destination identify",description:"With settings.identify mapping user, device, and session to 'user.id', 'user.device', and 'user.session', the destination sets userId, deviceId, and sessionId before the track call. A non-numeric session string is hashed to a stable number. Setters only re-fire when the resolved values change.",in:(0,A.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{user:"user.id",device:"user.device",session:"user.session"}}},out:[["amplitude.setUserId","us3r"],["amplitude.setDeviceId","c00k13"],["amplitude.setSessionId",394324160],["amplitude.track","page view",{}]]},P={title:"User login identify",description:"A user login sets the Amplitude userId and runs identify with set, setOnce, and add operations.",in:(0,A.createEvent)({name:"user login",timestamp:1700000105e3,data:{user_id:"new-user-123",plan:"premium",company:"Acme",email:"user@acme.com"}}),mapping:{silent:!0,settings:{identify:{map:{user:"data.user_id",set:{map:{plan:"data.plan",company:"data.company",email:"data.email"}},setOnce:{map:{first_login:"timestamp"}},add:{map:{login_count:{value:1}}}}}}},out:[["amplitude.setUserId","new-user-123"],["amplitude.identify",{set:{plan:"premium",company:"Acme",email:"user@acme.com"},setOnce:{first_login:1700000105e3},add:{login_count:1}}]]},j={title:"User logout reset",description:"A user logout calls amplitude.reset to clear the userId and regenerate the deviceId.",in:(0,A.createEvent)({name:"user logout",timestamp:1700000106}),mapping:{silent:!0,settings:{reset:!0}},out:[["amplitude.reset"]]},D={title:"Subscription revenue",description:"A subscription renewal fires a single amplitude.revenue call with productId, price, and currency fallback.",in:(0,A.createEvent)({name:"subscription renew",timestamp:1700000107,data:{plan_id:"plan-pro",amount:9.99}}),mapping:{silent:!0,settings:{revenue:{map:{productId:"data.plan_id",price:"data.amount",revenueType:{value:"renewal"},currency:{key:"data.currency",value:"EUR"}}}}},out:[["amplitude.revenue",{productId:"plan-pro",price:9.99,revenueType:"renewal",currency:"EUR"}]]},T={title:"Multi-product order",description:"An order fires one amplitude.revenue call per nested product plus a single track for the order totals.",in:(0,A.getEvent)("order complete",{timestamp:1700000108}),mapping:{include:["data","globals"],settings:{revenue:{loop:["nested",{condition:e=>{var t;return"number"==typeof(null==(t=null==e?void 0:e.data)?void 0:t.price)},map:{productId:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1},revenueType:{value:"purchase"},currency:{key:"data.currency",value:"EUR"}}}]}}},out:[["amplitude.revenue",{productId:"ers",price:420,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.revenue",{productId:"cc",price:42,quantity:1,revenueType:"purchase",currency:"EUR"}],["amplitude.track","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_value:462,data_tax:73.76,data_shipping:5.22,data_total:467.22,globals_pagegroup:"shop"}]]},G={title:"Group assignment",description:"A company update assigns the user to a group and sets group properties via setGroup and groupIdentify.",in:(0,A.createEvent)({name:"company update",timestamp:1700000109,data:{company:"Acme",industry:"tech",employee_count:50,founded_year:2020}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},name:"data.company"}},groupIdentify:{map:{type:{value:"company"},name:"data.company",set:{map:{industry:"data.industry",size:"data.employee_count"}},setOnce:{map:{founded:"data.founded_year"}}}}}},out:[["amplitude.setGroup","company","Acme"],["amplitude.groupIdentify","company","Acme",{set:{industry:"tech",size:50},setOnce:{founded:2020}}]]},q={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics opts out of Amplitude tracking via setOptOut(true).",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["amplitude.setOptOut",!1],["amplitude.setOptOut",!0]]},x={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics opts into Amplitude tracking via setOptOut(false).",command:"consent",in:{analytics:!0},settings:{},out:[["amplitude.setOptOut",!1]]},W={public:!1,description:"A rule with silent: true and no settings calls nothing.",in:(0,A.getEvent)("page view",{timestamp:1700000120}),mapping:{silent:!0},out:[]},M={public:!1,description:"A silent rule whose group mapping finds no company sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update"},mapping:G.mapping,out:[]},K={settings:{apiKey:"a1b2c3d4e5f6789012345678abcdef12"}};//# sourceMappingURL=dev.js.map
|