@walkeros/server-destination-amplitude 4.8.1 → 4.8.2

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.
@@ -9,15 +9,22 @@ import { DestinationServer } from '@walkeros/server-core';
9
9
  * Key difference from web: no setUserId/setDeviceId/setSessionId.
10
10
  * Identity is per-event via EventOptions on every SDK call.
11
11
  */
12
+ /**
13
+ * What an SDK call answers: a promise of its result, which resolves after
14
+ * the event was sent (with its HTTP `code`) instead of rejecting.
15
+ */
16
+ interface AmplitudeReturn {
17
+ promise: Promise<unknown>;
18
+ }
12
19
  interface AmplitudeSDK {
13
20
  init: (apiKey: string, options?: Record<string, unknown>) => {
14
21
  promise: Promise<void>;
15
22
  };
16
- track: (eventType: string, eventProperties?: Record<string, unknown>, eventOptions?: EventOptions) => void;
17
- identify: (identify: IdentifyInstance, eventOptions?: EventOptions) => void;
18
- revenue: (revenue: RevenueInstance, eventOptions?: EventOptions) => void;
19
- setGroup: (groupType: string, groupName: string | string[], eventOptions?: EventOptions) => void;
20
- groupIdentify: (groupType: string, groupName: string, identify: IdentifyInstance, eventOptions?: EventOptions) => void;
23
+ track: (eventType: string, eventProperties?: Record<string, unknown>, eventOptions?: EventOptions) => AmplitudeReturn;
24
+ identify: (identify: IdentifyInstance, eventOptions?: EventOptions) => AmplitudeReturn;
25
+ revenue: (revenue: RevenueInstance, eventOptions?: EventOptions) => AmplitudeReturn;
26
+ setGroup: (groupType: string, groupName: string | string[], eventOptions?: EventOptions) => AmplitudeReturn;
27
+ groupIdentify: (groupType: string, groupName: string, identify: IdentifyInstance, eventOptions?: EventOptions) => AmplitudeReturn;
21
28
  setOptOut: (optOut: boolean) => void;
22
29
  flush: () => {
23
30
  promise: Promise<void>;
@@ -221,6 +228,14 @@ declare const consentRevokeOptOut: AmplitudeStepExample;
221
228
  * Consent granted -> amplitude.setOptOut(false).
222
229
  */
223
230
  declare const consentGrantOptIn: AmplitudeStepExample;
231
+ /** A silent rule without identify, group or revenue mappings calls nothing. */
232
+ declare const silentRule: AmplitudeStepExample;
233
+ /**
234
+ * The silent group rule of groupAssignmentWithProperties on an event without
235
+ * data: no group name resolves and the rule suppresses the track, so nothing
236
+ * is sent.
237
+ */
238
+ declare const groupAssignmentWithoutData: AmplitudeStepExample;
224
239
 
225
240
  type step_AmplitudeStepExample = AmplitudeStepExample;
226
241
  declare const step_consentGrantOptIn: typeof consentGrantOptIn;
@@ -230,12 +245,14 @@ declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
230
245
  declare const step_destinationLevelInclude: typeof destinationLevelInclude;
231
246
  declare const step_eventOptionsTimeInsertId: typeof eventOptionsTimeInsertId;
232
247
  declare const step_groupAssignmentWithProperties: typeof groupAssignmentWithProperties;
248
+ declare const step_groupAssignmentWithoutData: typeof groupAssignmentWithoutData;
233
249
  declare const step_orderCompleteMultiProduct: typeof orderCompleteMultiProduct;
250
+ declare const step_silentRule: typeof silentRule;
234
251
  declare const step_subscriptionRenewRevenue: typeof subscriptionRenewRevenue;
235
252
  declare const step_userLoginIdentify: typeof userLoginIdentify;
236
253
  declare const step_wildcardIgnored: typeof wildcardIgnored;
237
254
  declare namespace step {
238
- 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_eventOptionsTimeInsertId as eventOptionsTimeInsertId, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
255
+ 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_eventOptionsTimeInsertId as eventOptionsTimeInsertId, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
239
256
  }
240
257
 
241
258
  export { env, step };
@@ -9,15 +9,22 @@ import { DestinationServer } from '@walkeros/server-core';
9
9
  * Key difference from web: no setUserId/setDeviceId/setSessionId.
10
10
  * Identity is per-event via EventOptions on every SDK call.
11
11
  */
12
+ /**
13
+ * What an SDK call answers: a promise of its result, which resolves after
14
+ * the event was sent (with its HTTP `code`) instead of rejecting.
15
+ */
16
+ interface AmplitudeReturn {
17
+ promise: Promise<unknown>;
18
+ }
12
19
  interface AmplitudeSDK {
13
20
  init: (apiKey: string, options?: Record<string, unknown>) => {
14
21
  promise: Promise<void>;
15
22
  };
16
- track: (eventType: string, eventProperties?: Record<string, unknown>, eventOptions?: EventOptions) => void;
17
- identify: (identify: IdentifyInstance, eventOptions?: EventOptions) => void;
18
- revenue: (revenue: RevenueInstance, eventOptions?: EventOptions) => void;
19
- setGroup: (groupType: string, groupName: string | string[], eventOptions?: EventOptions) => void;
20
- groupIdentify: (groupType: string, groupName: string, identify: IdentifyInstance, eventOptions?: EventOptions) => void;
23
+ track: (eventType: string, eventProperties?: Record<string, unknown>, eventOptions?: EventOptions) => AmplitudeReturn;
24
+ identify: (identify: IdentifyInstance, eventOptions?: EventOptions) => AmplitudeReturn;
25
+ revenue: (revenue: RevenueInstance, eventOptions?: EventOptions) => AmplitudeReturn;
26
+ setGroup: (groupType: string, groupName: string | string[], eventOptions?: EventOptions) => AmplitudeReturn;
27
+ groupIdentify: (groupType: string, groupName: string, identify: IdentifyInstance, eventOptions?: EventOptions) => AmplitudeReturn;
21
28
  setOptOut: (optOut: boolean) => void;
22
29
  flush: () => {
23
30
  promise: Promise<void>;
@@ -221,6 +228,14 @@ declare const consentRevokeOptOut: AmplitudeStepExample;
221
228
  * Consent granted -> amplitude.setOptOut(false).
222
229
  */
223
230
  declare const consentGrantOptIn: AmplitudeStepExample;
231
+ /** A silent rule without identify, group or revenue mappings calls nothing. */
232
+ declare const silentRule: AmplitudeStepExample;
233
+ /**
234
+ * The silent group rule of groupAssignmentWithProperties on an event without
235
+ * data: no group name resolves and the rule suppresses the track, so nothing
236
+ * is sent.
237
+ */
238
+ declare const groupAssignmentWithoutData: AmplitudeStepExample;
224
239
 
225
240
  type step_AmplitudeStepExample = AmplitudeStepExample;
226
241
  declare const step_consentGrantOptIn: typeof consentGrantOptIn;
@@ -230,12 +245,14 @@ declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
230
245
  declare const step_destinationLevelInclude: typeof destinationLevelInclude;
231
246
  declare const step_eventOptionsTimeInsertId: typeof eventOptionsTimeInsertId;
232
247
  declare const step_groupAssignmentWithProperties: typeof groupAssignmentWithProperties;
248
+ declare const step_groupAssignmentWithoutData: typeof groupAssignmentWithoutData;
233
249
  declare const step_orderCompleteMultiProduct: typeof orderCompleteMultiProduct;
250
+ declare const step_silentRule: typeof silentRule;
234
251
  declare const step_subscriptionRenewRevenue: typeof subscriptionRenewRevenue;
235
252
  declare const step_userLoginIdentify: typeof userLoginIdentify;
236
253
  declare const step_wildcardIgnored: typeof wildcardIgnored;
237
254
  declare namespace step {
238
- 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_eventOptionsTimeInsertId as eventOptionsTimeInsertId, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
255
+ 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_eventOptionsTimeInsertId as eventOptionsTimeInsertId, step_groupAssignmentWithProperties as groupAssignmentWithProperties, step_groupAssignmentWithoutData as groupAssignmentWithoutData, step_orderCompleteMultiProduct as orderCompleteMultiProduct, step_silentRule as silentRule, step_subscriptionRenewRevenue as subscriptionRenewRevenue, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
239
256
  }
240
257
 
241
258
  export { env, step };
@@ -99,12 +99,12 @@ var MockRevenue = class {
99
99
  var init = {
100
100
  amplitude: {
101
101
  init: noopPromise,
102
- track: noop,
103
- identify: noop,
104
- revenue: noop,
102
+ track: noopPromise,
103
+ identify: noopPromise,
104
+ revenue: noopPromise,
105
105
  setOptOut: noop,
106
- setGroup: noop,
107
- groupIdentify: noop,
106
+ setGroup: noopPromise,
107
+ groupIdentify: noopPromise,
108
108
  flush: noopPromise,
109
109
  Identify: MockIdentify,
110
110
  Revenue: MockRevenue
@@ -113,12 +113,12 @@ var init = {
113
113
  var push = {
114
114
  amplitude: {
115
115
  init: noopPromise,
116
- track: noop,
117
- identify: noop,
118
- revenue: noop,
116
+ track: noopPromise,
117
+ identify: noopPromise,
118
+ revenue: noopPromise,
119
119
  setOptOut: noop,
120
- setGroup: noop,
121
- groupIdentify: noop,
120
+ setGroup: noopPromise,
121
+ groupIdentify: noopPromise,
122
122
  flush: noopPromise,
123
123
  Identify: MockIdentify,
124
124
  Revenue: MockRevenue
@@ -143,7 +143,9 @@ __export(step_exports, {
143
143
  destinationLevelInclude: () => destinationLevelInclude,
144
144
  eventOptionsTimeInsertId: () => eventOptionsTimeInsertId,
145
145
  groupAssignmentWithProperties: () => groupAssignmentWithProperties,
146
+ groupAssignmentWithoutData: () => groupAssignmentWithoutData,
146
147
  orderCompleteMultiProduct: () => orderCompleteMultiProduct,
148
+ silentRule: () => silentRule,
147
149
  subscriptionRenewRevenue: () => subscriptionRenewRevenue,
148
150
  userLoginIdentify: () => userLoginIdentify,
149
151
  wildcardIgnored: () => wildcardIgnored
@@ -152,19 +154,19 @@ var import_core = require("@walkeros/core");
152
154
  var defaultEventForwarding = {
153
155
  title: "Default event",
154
156
  description: "A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",
155
- in: (0, import_core.getEvent)("product view", { timestamp: 1700000100 }),
156
- out: [["amplitude.track", "product view", {}]]
157
+ in: (0, import_core.getEvent)("product view", { id: "ev1700000100", timestamp: 1700000100 }),
158
+ out: [["amplitude.track", "product view", {}, { insert_id: "ev1700000100" }]]
157
159
  };
158
160
  var wildcardIgnored = {
159
161
  public: false,
160
- in: (0, import_core.getEvent)("debug noise", { timestamp: 1700000101 }),
162
+ in: (0, import_core.createEvent)({ name: "debug noise", timestamp: 1700000101 }),
161
163
  mapping: { ignore: true },
162
164
  out: []
163
165
  };
164
166
  var destinationLevelInclude = {
165
167
  title: "Include data section",
166
168
  description: "Destination-level include flattens the event data section into prefixed event_properties on every track call.",
167
- in: (0, import_core.getEvent)("product view", { timestamp: 1700000102 }),
169
+ in: (0, import_core.getEvent)("product view", { id: "ev1700000102", timestamp: 1700000102 }),
168
170
  configInclude: ["data"],
169
171
  out: [
170
172
  [
@@ -176,14 +178,15 @@ var destinationLevelInclude = {
176
178
  data_color: "black",
177
179
  data_size: "l",
178
180
  data_price: 420
179
- }
181
+ },
182
+ { insert_id: "ev1700000102" }
180
183
  ]
181
184
  ]
182
185
  };
183
186
  var destinationLevelIdentify = {
184
187
  title: "Identify per event",
185
188
  description: "Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",
186
- in: (0, import_core.getEvent)("page view", { timestamp: 1700000104 }),
189
+ in: (0, import_core.getEvent)("page view", { id: "ev1700000104", timestamp: 1700000104 }),
187
190
  settings: {
188
191
  identify: {
189
192
  map: {
@@ -199,6 +202,7 @@ var destinationLevelIdentify = {
199
202
  "page view",
200
203
  {},
201
204
  {
205
+ insert_id: "ev1700000104",
202
206
  user_id: "us3r",
203
207
  device_id: "c00k13",
204
208
  session_id: 394324160
@@ -209,7 +213,9 @@ var destinationLevelIdentify = {
209
213
  var userLoginIdentify = {
210
214
  title: "User login identify",
211
215
  description: "A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",
212
- in: (0, import_core.getEvent)("user login", {
216
+ in: (0, import_core.createEvent)({
217
+ name: "user login",
218
+ id: "ev1700000105",
213
219
  timestamp: 1700000105,
214
220
  data: {
215
221
  user_id: "new-user-123",
@@ -262,6 +268,7 @@ var userLoginIdentify = {
262
268
  }
263
269
  },
264
270
  {
271
+ insert_id: "ev1700000105-identify",
265
272
  user_id: "new-user-123"
266
273
  }
267
274
  ]
@@ -270,7 +277,9 @@ var userLoginIdentify = {
270
277
  var subscriptionRenewRevenue = {
271
278
  title: "Subscription revenue",
272
279
  description: "A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",
273
- in: (0, import_core.getEvent)("subscription renew", {
280
+ in: (0, import_core.createEvent)({
281
+ name: "subscription renew",
282
+ id: "ev1700000107",
274
283
  timestamp: 1700000107,
275
284
  data: {
276
285
  plan_id: "plan-pro",
@@ -298,14 +307,15 @@ var subscriptionRenewRevenue = {
298
307
  price: 9.99,
299
308
  revenueType: "renewal",
300
309
  currency: "EUR"
301
- }
310
+ },
311
+ { insert_id: "ev1700000107-revenue-0" }
302
312
  ]
303
313
  ]
304
314
  };
305
315
  var orderCompleteMultiProduct = {
306
316
  title: "Multi-product order",
307
317
  description: "An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",
308
- in: (0, import_core.getEvent)("order complete", { timestamp: 1700000108 }),
318
+ in: (0, import_core.getEvent)("order complete", { id: "ev1700000108", timestamp: 1700000108 }),
309
319
  mapping: {
310
320
  include: ["data", "globals"],
311
321
  settings: {
@@ -338,7 +348,8 @@ var orderCompleteMultiProduct = {
338
348
  quantity: 1,
339
349
  revenueType: "purchase",
340
350
  currency: "EUR"
341
- }
351
+ },
352
+ { insert_id: "ev1700000108-revenue-0" }
342
353
  ],
343
354
  [
344
355
  "amplitude.revenue",
@@ -348,7 +359,8 @@ var orderCompleteMultiProduct = {
348
359
  quantity: 1,
349
360
  revenueType: "purchase",
350
361
  currency: "EUR"
351
- }
362
+ },
363
+ { insert_id: "ev1700000108-revenue-1" }
352
364
  ],
353
365
  [
354
366
  "amplitude.track",
@@ -358,16 +370,19 @@ var orderCompleteMultiProduct = {
358
370
  data_currency: "EUR",
359
371
  data_shipping: 5.22,
360
372
  data_taxes: 73.76,
361
- data_total: 555,
373
+ data_value: 555,
362
374
  globals_pagegroup: "shop"
363
- }
375
+ },
376
+ { insert_id: "ev1700000108" }
364
377
  ]
365
378
  ]
366
379
  };
367
380
  var groupAssignmentWithProperties = {
368
381
  title: "Group assignment",
369
382
  description: "A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",
370
- in: (0, import_core.getEvent)("company update", {
383
+ in: (0, import_core.createEvent)({
384
+ name: "company update",
385
+ id: "ev1700000109",
371
386
  timestamp: 1700000109,
372
387
  data: {
373
388
  company: "Acme",
@@ -405,7 +420,12 @@ var groupAssignmentWithProperties = {
405
420
  }
406
421
  },
407
422
  out: [
408
- ["amplitude.setGroup", "company", "Acme"],
423
+ [
424
+ "amplitude.setGroup",
425
+ "company",
426
+ "Acme",
427
+ { insert_id: "ev1700000109-group" }
428
+ ],
409
429
  [
410
430
  "amplitude.groupIdentify",
411
431
  "company",
@@ -418,7 +438,8 @@ var groupAssignmentWithProperties = {
418
438
  setOnce: {
419
439
  founded: 2020
420
440
  }
421
- }
441
+ },
442
+ { insert_id: "ev1700000109-groupIdentify" }
422
443
  ]
423
444
  ]
424
445
  };
@@ -449,12 +470,14 @@ var eventOptionsTimeInsertId = {
449
470
  ]
450
471
  ]
451
472
  };
473
+ var analyticsDenied = { analytics: false };
474
+ var analyticsGranted = { analytics: true };
452
475
  var consentRevokeOptOut = {
453
476
  title: "Consent revoked",
454
477
  description: "After analytics consent is granted (Amplitude loads), revoking it opts out of tracking via setOptOut(true).",
455
478
  command: "consent",
456
479
  before: { analytics: true },
457
- in: { analytics: false },
480
+ in: analyticsDenied,
458
481
  settings: {},
459
482
  out: [
460
483
  ["amplitude.setOptOut", false],
@@ -465,10 +488,29 @@ var consentGrantOptIn = {
465
488
  title: "Consent granted",
466
489
  description: "A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",
467
490
  command: "consent",
468
- in: { analytics: true },
491
+ in: analyticsGranted,
469
492
  settings: {},
470
493
  out: [["amplitude.setOptOut", false]]
471
494
  };
495
+ var silentRule = {
496
+ public: false,
497
+ description: "A rule with silent: true and no identify, group or revenue mapping sends nothing to Amplitude.",
498
+ in: (0, import_core.getEvent)("page view", { timestamp: 1700000110 }),
499
+ mapping: { silent: true },
500
+ out: []
501
+ };
502
+ var groupAssignmentWithoutData = {
503
+ public: false,
504
+ description: "A silent group rule whose name finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",
505
+ in: {
506
+ name: "company update",
507
+ entity: "company",
508
+ action: "update",
509
+ timestamp: 1700000111
510
+ },
511
+ mapping: groupAssignmentWithProperties.mapping,
512
+ out: []
513
+ };
472
514
  // Annotate the CommonJS export names for ESM import in node:
473
515
  0 && (module.exports = {
474
516
  env,
@@ -78,12 +78,12 @@ var MockRevenue = class {
78
78
  var init = {
79
79
  amplitude: {
80
80
  init: noopPromise,
81
- track: noop,
82
- identify: noop,
83
- revenue: noop,
81
+ track: noopPromise,
82
+ identify: noopPromise,
83
+ revenue: noopPromise,
84
84
  setOptOut: noop,
85
- setGroup: noop,
86
- groupIdentify: noop,
85
+ setGroup: noopPromise,
86
+ groupIdentify: noopPromise,
87
87
  flush: noopPromise,
88
88
  Identify: MockIdentify,
89
89
  Revenue: MockRevenue
@@ -92,12 +92,12 @@ var init = {
92
92
  var push = {
93
93
  amplitude: {
94
94
  init: noopPromise,
95
- track: noop,
96
- identify: noop,
97
- revenue: noop,
95
+ track: noopPromise,
96
+ identify: noopPromise,
97
+ revenue: noopPromise,
98
98
  setOptOut: noop,
99
- setGroup: noop,
100
- groupIdentify: noop,
99
+ setGroup: noopPromise,
100
+ groupIdentify: noopPromise,
101
101
  flush: noopPromise,
102
102
  Identify: MockIdentify,
103
103
  Revenue: MockRevenue
@@ -122,28 +122,30 @@ __export(step_exports, {
122
122
  destinationLevelInclude: () => destinationLevelInclude,
123
123
  eventOptionsTimeInsertId: () => eventOptionsTimeInsertId,
124
124
  groupAssignmentWithProperties: () => groupAssignmentWithProperties,
125
+ groupAssignmentWithoutData: () => groupAssignmentWithoutData,
125
126
  orderCompleteMultiProduct: () => orderCompleteMultiProduct,
127
+ silentRule: () => silentRule,
126
128
  subscriptionRenewRevenue: () => subscriptionRenewRevenue,
127
129
  userLoginIdentify: () => userLoginIdentify,
128
130
  wildcardIgnored: () => wildcardIgnored
129
131
  });
130
- import { getEvent } from "@walkeros/core";
132
+ import { createEvent, getEvent } from "@walkeros/core";
131
133
  var defaultEventForwarding = {
132
134
  title: "Default event",
133
135
  description: "A walkerOS event forwarded as an Amplitude track call with the event name and empty properties.",
134
- in: getEvent("product view", { timestamp: 1700000100 }),
135
- out: [["amplitude.track", "product view", {}]]
136
+ in: getEvent("product view", { id: "ev1700000100", timestamp: 1700000100 }),
137
+ out: [["amplitude.track", "product view", {}, { insert_id: "ev1700000100" }]]
136
138
  };
137
139
  var wildcardIgnored = {
138
140
  public: false,
139
- in: getEvent("debug noise", { timestamp: 1700000101 }),
141
+ in: createEvent({ name: "debug noise", timestamp: 1700000101 }),
140
142
  mapping: { ignore: true },
141
143
  out: []
142
144
  };
143
145
  var destinationLevelInclude = {
144
146
  title: "Include data section",
145
147
  description: "Destination-level include flattens the event data section into prefixed event_properties on every track call.",
146
- in: getEvent("product view", { timestamp: 1700000102 }),
148
+ in: getEvent("product view", { id: "ev1700000102", timestamp: 1700000102 }),
147
149
  configInclude: ["data"],
148
150
  out: [
149
151
  [
@@ -155,14 +157,15 @@ var destinationLevelInclude = {
155
157
  data_color: "black",
156
158
  data_size: "l",
157
159
  data_price: 420
158
- }
160
+ },
161
+ { insert_id: "ev1700000102" }
159
162
  ]
160
163
  ]
161
164
  };
162
165
  var destinationLevelIdentify = {
163
166
  title: "Identify per event",
164
167
  description: "Destination-level identify resolves user_id, device_id, and session_id into the Amplitude EventOptions on every call.",
165
- in: getEvent("page view", { timestamp: 1700000104 }),
168
+ in: getEvent("page view", { id: "ev1700000104", timestamp: 1700000104 }),
166
169
  settings: {
167
170
  identify: {
168
171
  map: {
@@ -178,6 +181,7 @@ var destinationLevelIdentify = {
178
181
  "page view",
179
182
  {},
180
183
  {
184
+ insert_id: "ev1700000104",
181
185
  user_id: "us3r",
182
186
  device_id: "c00k13",
183
187
  session_id: 394324160
@@ -188,7 +192,9 @@ var destinationLevelIdentify = {
188
192
  var userLoginIdentify = {
189
193
  title: "User login identify",
190
194
  description: "A user login maps to amplitude.identify with set, setOnce, and add operations while the default track call is skipped.",
191
- in: getEvent("user login", {
195
+ in: createEvent({
196
+ name: "user login",
197
+ id: "ev1700000105",
192
198
  timestamp: 1700000105,
193
199
  data: {
194
200
  user_id: "new-user-123",
@@ -241,6 +247,7 @@ var userLoginIdentify = {
241
247
  }
242
248
  },
243
249
  {
250
+ insert_id: "ev1700000105-identify",
244
251
  user_id: "new-user-123"
245
252
  }
246
253
  ]
@@ -249,7 +256,9 @@ var userLoginIdentify = {
249
256
  var subscriptionRenewRevenue = {
250
257
  title: "Subscription revenue",
251
258
  description: "A subscription renewal fires a single amplitude.revenue call with productId, price, and a currency fallback.",
252
- in: getEvent("subscription renew", {
259
+ in: createEvent({
260
+ name: "subscription renew",
261
+ id: "ev1700000107",
253
262
  timestamp: 1700000107,
254
263
  data: {
255
264
  plan_id: "plan-pro",
@@ -277,14 +286,15 @@ var subscriptionRenewRevenue = {
277
286
  price: 9.99,
278
287
  revenueType: "renewal",
279
288
  currency: "EUR"
280
- }
289
+ },
290
+ { insert_id: "ev1700000107-revenue-0" }
281
291
  ]
282
292
  ]
283
293
  };
284
294
  var orderCompleteMultiProduct = {
285
295
  title: "Multi-product order",
286
296
  description: "An order with multiple nested products fires one amplitude.revenue per product plus a single track for the order.",
287
- in: getEvent("order complete", { timestamp: 1700000108 }),
297
+ in: getEvent("order complete", { id: "ev1700000108", timestamp: 1700000108 }),
288
298
  mapping: {
289
299
  include: ["data", "globals"],
290
300
  settings: {
@@ -317,7 +327,8 @@ var orderCompleteMultiProduct = {
317
327
  quantity: 1,
318
328
  revenueType: "purchase",
319
329
  currency: "EUR"
320
- }
330
+ },
331
+ { insert_id: "ev1700000108-revenue-0" }
321
332
  ],
322
333
  [
323
334
  "amplitude.revenue",
@@ -327,7 +338,8 @@ var orderCompleteMultiProduct = {
327
338
  quantity: 1,
328
339
  revenueType: "purchase",
329
340
  currency: "EUR"
330
- }
341
+ },
342
+ { insert_id: "ev1700000108-revenue-1" }
331
343
  ],
332
344
  [
333
345
  "amplitude.track",
@@ -337,16 +349,19 @@ var orderCompleteMultiProduct = {
337
349
  data_currency: "EUR",
338
350
  data_shipping: 5.22,
339
351
  data_taxes: 73.76,
340
- data_total: 555,
352
+ data_value: 555,
341
353
  globals_pagegroup: "shop"
342
- }
354
+ },
355
+ { insert_id: "ev1700000108" }
343
356
  ]
344
357
  ]
345
358
  };
346
359
  var groupAssignmentWithProperties = {
347
360
  title: "Group assignment",
348
361
  description: "A company update assigns the user to a group and sets group properties via setGroup plus groupIdentify.",
349
- in: getEvent("company update", {
362
+ in: createEvent({
363
+ name: "company update",
364
+ id: "ev1700000109",
350
365
  timestamp: 1700000109,
351
366
  data: {
352
367
  company: "Acme",
@@ -384,7 +399,12 @@ var groupAssignmentWithProperties = {
384
399
  }
385
400
  },
386
401
  out: [
387
- ["amplitude.setGroup", "company", "Acme"],
402
+ [
403
+ "amplitude.setGroup",
404
+ "company",
405
+ "Acme",
406
+ { insert_id: "ev1700000109-group" }
407
+ ],
388
408
  [
389
409
  "amplitude.groupIdentify",
390
410
  "company",
@@ -397,7 +417,8 @@ var groupAssignmentWithProperties = {
397
417
  setOnce: {
398
418
  founded: 2020
399
419
  }
400
- }
420
+ },
421
+ { insert_id: "ev1700000109-groupIdentify" }
401
422
  ]
402
423
  ]
403
424
  };
@@ -428,12 +449,14 @@ var eventOptionsTimeInsertId = {
428
449
  ]
429
450
  ]
430
451
  };
452
+ var analyticsDenied = { analytics: false };
453
+ var analyticsGranted = { analytics: true };
431
454
  var consentRevokeOptOut = {
432
455
  title: "Consent revoked",
433
456
  description: "After analytics consent is granted (Amplitude loads), revoking it opts out of tracking via setOptOut(true).",
434
457
  command: "consent",
435
458
  before: { analytics: true },
436
- in: { analytics: false },
459
+ in: analyticsDenied,
437
460
  settings: {},
438
461
  out: [
439
462
  ["amplitude.setOptOut", false],
@@ -444,10 +467,29 @@ var consentGrantOptIn = {
444
467
  title: "Consent granted",
445
468
  description: "A walker consent command with analytics granted opts back into Amplitude tracking via setOptOut(false).",
446
469
  command: "consent",
447
- in: { analytics: true },
470
+ in: analyticsGranted,
448
471
  settings: {},
449
472
  out: [["amplitude.setOptOut", false]]
450
473
  };
474
+ var silentRule = {
475
+ public: false,
476
+ description: "A rule with silent: true and no identify, group or revenue mapping sends nothing to Amplitude.",
477
+ in: getEvent("page view", { timestamp: 1700000110 }),
478
+ mapping: { silent: true },
479
+ out: []
480
+ };
481
+ var groupAssignmentWithoutData = {
482
+ public: false,
483
+ description: "A silent group rule whose name finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",
484
+ in: {
485
+ name: "company update",
486
+ entity: "company",
487
+ action: "update",
488
+ timestamp: 1700000111
489
+ },
490
+ mapping: groupAssignmentWithProperties.mapping,
491
+ out: []
492
+ };
451
493
  export {
452
494
  env_exports as env,
453
495
  step_exports as step