@walkeros/web-destination-segment 3.3.1 → 3.4.0-next-1776749829492

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.
@@ -56,6 +56,7 @@ __export(step_exports, {
56
56
  defaultEventForwarding: () => defaultEventForwarding,
57
57
  destinationLevelIdentify: () => destinationLevelIdentify,
58
58
  destinationLevelInclude: () => destinationLevelInclude,
59
+ init: () => init2,
59
60
  orderCompletedEcommerce: () => orderCompletedEcommerce,
60
61
  pageViewAsPage: () => pageViewAsPage,
61
62
  pageViewMinimal: () => pageViewMinimal,
@@ -73,9 +74,9 @@ var c = {};
73
74
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
74
75
  })(c, { Level: () => u });
75
76
  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 || {});
76
- var F = { merge: true, shallow: true, extend: true };
77
+ var W = { merge: true, shallow: true, extend: true };
77
78
  function L(e2, t = {}, n = {}) {
78
- n = { ...F, ...n };
79
+ n = { ...W, ...n };
79
80
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
80
81
  const i = e2[o2];
81
82
  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;
@@ -84,7 +85,7 @@ function L(e2, t = {}, n = {}) {
84
85
  }
85
86
  function fe(e2 = {}) {
86
87
  var _a;
87
- 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 });
88
+ 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-next-1776749829492", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
88
89
  if (e2.name) {
89
90
  const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
90
91
  t2 && n2 && (r.entity = t2, r.action = n2);
@@ -97,9 +98,23 @@ function le(e2 = "entity action", t = {}) {
97
98
  }
98
99
 
99
100
  // src/examples/step.ts
101
+ var init2 = {
102
+ in: {
103
+ settings: {
104
+ apiKey: "test-project"
105
+ }
106
+ },
107
+ out: [
108
+ [
109
+ "analytics.load",
110
+ { writeKey: "test-project" },
111
+ { initialPageview: false }
112
+ ]
113
+ ]
114
+ };
100
115
  var defaultEventForwarding = {
101
116
  in: le("product view", { timestamp: 1700000100 }),
102
- out: ["analytics.track", "product view", {}]
117
+ out: [["analytics.track", "product view", {}]]
103
118
  };
104
119
  var wildcardIgnored = {
105
120
  in: le("debug noise", { timestamp: 1700000101 }),
@@ -110,15 +125,17 @@ var destinationLevelInclude = {
110
125
  in: le("product view", { timestamp: 1700000102 }),
111
126
  configInclude: ["data"],
112
127
  out: [
113
- "analytics.track",
114
- "product view",
115
- {
116
- data_id: "ers",
117
- data_name: "Everyday Ruck Snack",
118
- data_color: "black",
119
- data_size: "l",
120
- data_price: 420
121
- }
128
+ [
129
+ "analytics.track",
130
+ "product view",
131
+ {
132
+ data_id: "ers",
133
+ data_name: "Everyday Ruck Snack",
134
+ data_color: "black",
135
+ data_size: "l",
136
+ data_price: 420
137
+ }
138
+ ]
122
139
  ]
123
140
  };
124
141
  var ruleIncludeReplaces = {
@@ -128,11 +145,13 @@ var ruleIncludeReplaces = {
128
145
  include: ["globals"]
129
146
  },
130
147
  out: [
131
- "analytics.track",
132
- "order complete",
133
- {
134
- globals_pagegroup: "shop"
135
- }
148
+ [
149
+ "analytics.track",
150
+ "order complete",
151
+ {
152
+ globals_pagegroup: "shop"
153
+ }
154
+ ]
136
155
  ]
137
156
  };
138
157
  var destinationLevelIdentify = {
@@ -185,14 +204,16 @@ var userLoginIdentify = {
185
204
  }
186
205
  },
187
206
  out: [
188
- "analytics.identify",
189
- "new-user-123",
190
- {
191
- email: "user@acme.com",
192
- name: "Jane Doe",
193
- plan: "premium",
194
- company: { name: "Acme", id: "comp-456" }
195
- }
207
+ [
208
+ "analytics.identify",
209
+ "new-user-123",
210
+ {
211
+ email: "user@acme.com",
212
+ name: "Jane Doe",
213
+ plan: "premium",
214
+ company: { name: "Acme", id: "comp-456" }
215
+ }
216
+ ]
196
217
  ]
197
218
  };
198
219
  var profileUpdateTraitsOnly = {
@@ -221,13 +242,15 @@ var profileUpdateTraitsOnly = {
221
242
  }
222
243
  },
223
244
  out: [
224
- "analytics.identify",
225
- void 0,
226
- {
227
- name: "Jane Q. Doe",
228
- avatar: "https://example.com/avatar.png",
229
- phone: "+1234567890"
230
- }
245
+ [
246
+ "analytics.identify",
247
+ void 0,
248
+ {
249
+ name: "Jane Q. Doe",
250
+ avatar: "https://example.com/avatar.png",
251
+ phone: "+1234567890"
252
+ }
253
+ ]
231
254
  ]
232
255
  };
233
256
  var userLogoutReset = {
@@ -238,7 +261,7 @@ var userLogoutReset = {
238
261
  reset: true
239
262
  }
240
263
  },
241
- out: ["analytics.reset"]
264
+ out: [["analytics.reset"]]
242
265
  };
243
266
  var companyUpdateGroup = {
244
267
  in: le("company update", {
@@ -270,14 +293,16 @@ var companyUpdateGroup = {
270
293
  }
271
294
  },
272
295
  out: [
273
- "analytics.group",
274
- "comp-456",
275
- {
276
- name: "Acme",
277
- industry: "tech",
278
- employees: 50,
279
- plan: "enterprise"
280
- }
296
+ [
297
+ "analytics.group",
298
+ "comp-456",
299
+ {
300
+ name: "Acme",
301
+ industry: "tech",
302
+ employees: 50,
303
+ plan: "enterprise"
304
+ }
305
+ ]
281
306
  ]
282
307
  };
283
308
  var pageViewAsPage = {
@@ -306,12 +331,14 @@ var pageViewAsPage = {
306
331
  }
307
332
  },
308
333
  out: [
309
- "analytics.page",
310
- "docs",
311
- "Getting Started",
312
- {
313
- section: "tutorials"
314
- }
334
+ [
335
+ "analytics.page",
336
+ "docs",
337
+ "Getting Started",
338
+ {
339
+ section: "tutorials"
340
+ }
341
+ ]
315
342
  ]
316
343
  };
317
344
  var pageViewMinimal = {
@@ -322,7 +349,7 @@ var pageViewMinimal = {
322
349
  page: true
323
350
  }
324
351
  },
325
- out: ["analytics.page"]
352
+ out: [["analytics.page"]]
326
353
  };
327
354
  var orderCompletedEcommerce = {
328
355
  in: le("order complete", { timestamp: 1700000111 }),
@@ -358,31 +385,33 @@ var orderCompletedEcommerce = {
358
385
  }
359
386
  },
360
387
  out: [
361
- "analytics.track",
362
- "Order Completed",
363
- {
364
- order_id: "0rd3r1d",
365
- currency: "EUR",
366
- shipping: 5.22,
367
- tax: 73.76,
368
- total: 555,
369
- products: [
370
- {
371
- product_id: "ers",
372
- name: "Everyday Ruck Snack",
373
- price: 420,
374
- quantity: 1,
375
- currency: "EUR"
376
- },
377
- {
378
- product_id: "cc",
379
- name: "Cool Cap",
380
- price: 42,
381
- quantity: 1,
382
- currency: "EUR"
383
- }
384
- ]
385
- }
388
+ [
389
+ "analytics.track",
390
+ "Order Completed",
391
+ {
392
+ order_id: "0rd3r1d",
393
+ currency: "EUR",
394
+ shipping: 5.22,
395
+ tax: 73.76,
396
+ total: 555,
397
+ products: [
398
+ {
399
+ product_id: "ers",
400
+ name: "Everyday Ruck Snack",
401
+ price: 420,
402
+ quantity: 1,
403
+ currency: "EUR"
404
+ },
405
+ {
406
+ product_id: "cc",
407
+ name: "Cool Cap",
408
+ price: 42,
409
+ quantity: 1,
410
+ currency: "EUR"
411
+ }
412
+ ]
413
+ }
414
+ ]
386
415
  ]
387
416
  };
388
417
  var consentContextForwarded = {
@@ -397,28 +426,32 @@ var consentContextForwarded = {
397
426
  }
398
427
  },
399
428
  out: [
400
- "analytics.track",
401
- "product view",
402
- {},
403
- {
404
- context: {
405
- consent: {
406
- categoryPreferences: {
407
- Analytics: true,
408
- Advertising: true
429
+ [
430
+ "analytics.track",
431
+ "product view",
432
+ {},
433
+ {
434
+ context: {
435
+ consent: {
436
+ categoryPreferences: {
437
+ Analytics: true,
438
+ Advertising: true
439
+ }
409
440
  }
410
441
  }
411
442
  }
412
- }
443
+ ]
413
444
  ]
414
445
  };
415
446
  var consentGrantDeferredLoad = {
416
447
  command: "consent",
417
448
  in: { analytics: true },
418
449
  out: [
419
- "analytics.load",
420
- { writeKey: "test-project" },
421
- { initialPageview: false }
450
+ [
451
+ "analytics.load",
452
+ { writeKey: "test-project" },
453
+ { initialPageview: false }
454
+ ]
422
455
  ]
423
456
  };
424
457
  var consentRevokeNoOp = {