@walkeros/web-destination-snowplow 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,17 +20,23 @@ interface Env extends DestinationWeb.Env {
20
20
  };
21
21
  }
22
22
 
23
- declare const init: Env | undefined;
23
+ declare const init$1: Env | undefined;
24
24
  declare const push: Env;
25
25
  declare const simulation: string[];
26
26
 
27
- declare const env_init: typeof init;
28
27
  declare const env_push: typeof push;
29
28
  declare const env_simulation: typeof simulation;
30
29
  declare namespace env {
31
- export { env_init as init, env_push as push, env_simulation as simulation };
30
+ export { init$1 as init, env_push as push, env_simulation as simulation };
32
31
  }
33
32
 
33
+ /**
34
+ * Destination bootstrap.
35
+ * Given the canonical settings, init sets up the Snowplow queue and creates
36
+ * a tracker pointed at the collector URL. Reproduce by passing the same
37
+ * settings to `startFlow` as the destination config.
38
+ */
39
+ declare const init: Flow.StepExample;
34
40
  declare const productView: Flow.StepExample;
35
41
  declare const addToCart: Flow.StepExample;
36
42
  declare const transaction: Flow.StepExample;
@@ -43,13 +49,14 @@ declare const contextLoop: Flow.StepExample;
43
49
  declare const step_addToCart: typeof addToCart;
44
50
  declare const step_checkoutStep: typeof checkoutStep;
45
51
  declare const step_contextLoop: typeof contextLoop;
52
+ declare const step_init: typeof init;
46
53
  declare const step_pageView: typeof pageView;
47
54
  declare const step_productView: typeof productView;
48
55
  declare const step_promoView: typeof promoView;
49
56
  declare const step_structuredEvent: typeof structuredEvent;
50
57
  declare const step_transaction: typeof transaction;
51
58
  declare namespace step {
52
- export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
59
+ export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
53
60
  }
54
61
 
55
62
  export { env, step };
@@ -20,17 +20,23 @@ interface Env extends DestinationWeb.Env {
20
20
  };
21
21
  }
22
22
 
23
- declare const init: Env | undefined;
23
+ declare const init$1: Env | undefined;
24
24
  declare const push: Env;
25
25
  declare const simulation: string[];
26
26
 
27
- declare const env_init: typeof init;
28
27
  declare const env_push: typeof push;
29
28
  declare const env_simulation: typeof simulation;
30
29
  declare namespace env {
31
- export { env_init as init, env_push as push, env_simulation as simulation };
30
+ export { init$1 as init, env_push as push, env_simulation as simulation };
32
31
  }
33
32
 
33
+ /**
34
+ * Destination bootstrap.
35
+ * Given the canonical settings, init sets up the Snowplow queue and creates
36
+ * a tracker pointed at the collector URL. Reproduce by passing the same
37
+ * settings to `startFlow` as the destination config.
38
+ */
39
+ declare const init: Flow.StepExample;
34
40
  declare const productView: Flow.StepExample;
35
41
  declare const addToCart: Flow.StepExample;
36
42
  declare const transaction: Flow.StepExample;
@@ -43,13 +49,14 @@ declare const contextLoop: Flow.StepExample;
43
49
  declare const step_addToCart: typeof addToCart;
44
50
  declare const step_checkoutStep: typeof checkoutStep;
45
51
  declare const step_contextLoop: typeof contextLoop;
52
+ declare const step_init: typeof init;
46
53
  declare const step_pageView: typeof pageView;
47
54
  declare const step_productView: typeof productView;
48
55
  declare const step_promoView: typeof promoView;
49
56
  declare const step_structuredEvent: typeof structuredEvent;
50
57
  declare const step_transaction: typeof transaction;
51
58
  declare namespace step {
52
- export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
59
+ export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
53
60
  }
54
61
 
55
62
  export { env, step };
@@ -81,6 +81,7 @@ __export(step_exports, {
81
81
  addToCart: () => addToCart,
82
82
  checkoutStep: () => checkoutStep,
83
83
  contextLoop: () => contextLoop,
84
+ init: () => init2,
84
85
  pageView: () => pageView,
85
86
  productView: () => productView,
86
87
  promoView: () => promoView,
@@ -95,9 +96,9 @@ var c = {};
95
96
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
96
97
  })(c, { Level: () => u });
97
98
  var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(u || {});
98
- var F = { merge: true, shallow: true, extend: true };
99
+ var W = { merge: true, shallow: true, extend: true };
99
100
  function L(e2, t = {}, n = {}) {
100
- n = { ...F, ...n };
101
+ n = { ...W, ...n };
101
102
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
102
103
  const i = e2[o2];
103
104
  return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
@@ -106,7 +107,7 @@ function L(e2, t = {}, n = {}) {
106
107
  }
107
108
  function fe(e2 = {}) {
108
109
  var _a;
109
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.3.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
110
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.4.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
110
111
  if (e2.name) {
111
112
  const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
112
113
  t2 && n2 && (r.entity = t2, r.action = n2);
@@ -145,6 +146,32 @@ var ACTIONS = {
145
146
  };
146
147
 
147
148
  // src/examples/step.ts
149
+ var init2 = {
150
+ in: {
151
+ loadScript: true,
152
+ settings: {
153
+ collectorUrl: "https://collector.example.com",
154
+ appId: "my-app",
155
+ pageViewEvent: "page view"
156
+ }
157
+ },
158
+ out: [
159
+ [
160
+ "snowplow.newTracker",
161
+ "sp",
162
+ "https://collector.example.com",
163
+ {
164
+ appId: "my-app",
165
+ platform: "web",
166
+ discoverRootDomain: void 0,
167
+ cookieSameSite: void 0,
168
+ appVersion: void 0,
169
+ contexts: void 0,
170
+ anonymousTracking: void 0
171
+ }
172
+ ]
173
+ ]
174
+ };
148
175
  var productView = {
149
176
  in: le("product view", { timestamp: 1700000400 }),
150
177
  mapping: {
@@ -167,26 +194,28 @@ var productView = {
167
194
  }
168
195
  },
169
196
  out: [
170
- "trackSelfDescribingEvent",
171
- {
172
- event: {
173
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
174
- data: {
175
- type: "product_view"
176
- }
177
- },
178
- context: [
179
- {
180
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
197
+ [
198
+ "snowplow.trackSelfDescribingEvent",
199
+ {
200
+ event: {
201
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
181
202
  data: {
182
- id: "ers",
183
- name: "Everyday Ruck Snack",
184
- price: 420,
185
- currency: "USD"
203
+ type: "product_view"
186
204
  }
187
- }
188
- ]
189
- }
205
+ },
206
+ context: [
207
+ {
208
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
209
+ data: {
210
+ id: "ers",
211
+ name: "Everyday Ruck Snack",
212
+ price: 420,
213
+ currency: "USD"
214
+ }
215
+ }
216
+ ]
217
+ }
218
+ ]
190
219
  ]
191
220
  };
192
221
  var addToCart = {
@@ -237,44 +266,46 @@ var addToCart = {
237
266
  }
238
267
  },
239
268
  out: [
240
- "trackSelfDescribingEvent",
241
- {
242
- event: {
243
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
244
- data: {
245
- type: "add_to_cart"
246
- }
247
- },
248
- context: [
249
- {
250
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
269
+ [
270
+ "snowplow.trackSelfDescribingEvent",
271
+ {
272
+ event: {
273
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
251
274
  data: {
252
- id: "ers",
253
- name: "Everyday Ruck Snack",
254
- price: 420,
255
- currency: "USD",
256
- quantity: 1
275
+ type: "add_to_cart"
257
276
  }
258
277
  },
259
- {
260
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",
261
- data: {
262
- currency: "USD"
263
- }
264
- },
265
- {
266
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",
267
- data: {}
268
- },
269
- {
270
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",
271
- data: {
272
- id: "us3r",
273
- is_guest: true
278
+ context: [
279
+ {
280
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
281
+ data: {
282
+ id: "ers",
283
+ name: "Everyday Ruck Snack",
284
+ price: 420,
285
+ currency: "USD",
286
+ quantity: 1
287
+ }
288
+ },
289
+ {
290
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",
291
+ data: {
292
+ currency: "USD"
293
+ }
294
+ },
295
+ {
296
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",
297
+ data: {}
298
+ },
299
+ {
300
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",
301
+ data: {
302
+ id: "us3r",
303
+ is_guest: true
304
+ }
274
305
  }
275
- }
276
- ]
277
- }
306
+ ]
307
+ }
308
+ ]
278
309
  ]
279
310
  };
280
311
  var transaction = {
@@ -298,28 +329,30 @@ var transaction = {
298
329
  }
299
330
  },
300
331
  out: [
301
- "trackSelfDescribingEvent",
302
- {
303
- event: {
304
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
305
- data: {
306
- type: "transaction"
307
- }
308
- },
309
- context: [
310
- {
311
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",
332
+ [
333
+ "snowplow.trackSelfDescribingEvent",
334
+ {
335
+ event: {
336
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
312
337
  data: {
313
- transaction_id: "0rd3r1d",
314
- revenue: 555,
315
- currency: "EUR",
316
- payment_method: "credit_card",
317
- tax: 73.76,
318
- shipping: 5.22
338
+ type: "transaction"
319
339
  }
320
- }
321
- ]
322
- }
340
+ },
341
+ context: [
342
+ {
343
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",
344
+ data: {
345
+ transaction_id: "0rd3r1d",
346
+ revenue: 555,
347
+ currency: "EUR",
348
+ payment_method: "credit_card",
349
+ tax: 73.76,
350
+ shipping: 5.22
351
+ }
352
+ }
353
+ ]
354
+ }
355
+ ]
323
356
  ]
324
357
  };
325
358
  var promoView = {
@@ -343,30 +376,32 @@ var promoView = {
343
376
  }
344
377
  },
345
378
  out: [
346
- "trackSelfDescribingEvent",
347
- {
348
- event: {
349
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
350
- data: {
351
- type: "promo_view"
352
- }
353
- },
354
- context: [
355
- {
356
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",
379
+ [
380
+ "snowplow.trackSelfDescribingEvent",
381
+ {
382
+ event: {
383
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
357
384
  data: {
358
- name: "Setting up tracking easily",
359
- position: "hero"
385
+ type: "promo_view"
360
386
  }
361
- }
362
- ]
363
- }
387
+ },
388
+ context: [
389
+ {
390
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",
391
+ data: {
392
+ name: "Setting up tracking easily",
393
+ position: "hero"
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ ]
364
399
  ]
365
400
  };
366
401
  var pageView = {
367
402
  in: le("page view", { timestamp: 1700000404 }),
368
403
  mapping: void 0,
369
- out: ["trackPageView"]
404
+ out: [["snowplow.trackPageView"]]
370
405
  };
371
406
  var checkoutStep = {
372
407
  in: le("checkout view", { timestamp: 1700000405 }),
@@ -385,23 +420,25 @@ var checkoutStep = {
385
420
  }
386
421
  },
387
422
  out: [
388
- "trackSelfDescribingEvent",
389
- {
390
- event: {
391
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
392
- data: {
393
- type: "checkout_step"
394
- }
395
- },
396
- context: [
397
- {
398
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",
423
+ [
424
+ "snowplow.trackSelfDescribingEvent",
425
+ {
426
+ event: {
427
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
399
428
  data: {
400
- step: "payment"
429
+ type: "checkout_step"
401
430
  }
402
- }
403
- ]
404
- }
431
+ },
432
+ context: [
433
+ {
434
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",
435
+ data: {
436
+ step: "payment"
437
+ }
438
+ }
439
+ ]
440
+ }
441
+ ]
405
442
  ]
406
443
  };
407
444
  var structuredEvent = {
@@ -418,14 +455,16 @@ var structuredEvent = {
418
455
  }
419
456
  },
420
457
  out: [
421
- "trackStructEvent",
422
- {
423
- category: "ecommerce",
424
- action: "impression",
425
- label: "Everyday Ruck Snack",
426
- property: "black",
427
- value: 420
428
- }
458
+ [
459
+ "snowplow.trackStructEvent",
460
+ {
461
+ category: "ecommerce",
462
+ action: "impression",
463
+ label: "Everyday Ruck Snack",
464
+ property: "black",
465
+ value: 420
466
+ }
467
+ ]
429
468
  ]
430
469
  };
431
470
  var contextLoop = {
@@ -461,47 +500,49 @@ var contextLoop = {
461
500
  }
462
501
  },
463
502
  out: [
464
- "trackSelfDescribingEvent",
465
- {
466
- event: {
467
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
468
- data: {
469
- type: "transaction"
470
- }
471
- },
472
- context: [
473
- {
474
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",
475
- data: {
476
- transaction_id: "0rd3r1d",
477
- revenue: 555,
478
- currency: "EUR"
479
- }
480
- },
481
- {
482
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
503
+ [
504
+ "snowplow.trackSelfDescribingEvent",
505
+ {
506
+ event: {
507
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",
483
508
  data: {
484
- id: "ers",
485
- name: "Everyday Ruck Snack",
486
- price: 420
509
+ type: "transaction"
487
510
  }
488
511
  },
489
- {
490
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
491
- data: {
492
- id: "cc",
493
- name: "Cool Cap",
494
- price: 42
495
- }
496
- },
497
- {
498
- schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
499
- data: {
500
- name: "Surprise"
512
+ context: [
513
+ {
514
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",
515
+ data: {
516
+ transaction_id: "0rd3r1d",
517
+ revenue: 555,
518
+ currency: "EUR"
519
+ }
520
+ },
521
+ {
522
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
523
+ data: {
524
+ id: "ers",
525
+ name: "Everyday Ruck Snack",
526
+ price: 420
527
+ }
528
+ },
529
+ {
530
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
531
+ data: {
532
+ id: "cc",
533
+ name: "Cool Cap",
534
+ price: 42
535
+ }
536
+ },
537
+ {
538
+ schema: "iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",
539
+ data: {
540
+ name: "Surprise"
541
+ }
501
542
  }
502
- }
503
- ]
504
- }
543
+ ]
544
+ }
545
+ ]
505
546
  ]
506
547
  };
507
548
  // Annotate the CommonJS export names for ESM import in node: