@walkeros/web-destination-segment 3.4.2 → 4.0.0-next-1777463920154

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.
@@ -125,13 +125,13 @@ type SegmentStepExample = Flow.StepExample & {
125
125
  */
126
126
  declare const init: Flow.StepExample;
127
127
  /**
128
- * Default event forwarding every walkerOS event becomes
128
+ * Default event forwarding - every walkerOS event becomes
129
129
  * analytics.track(event.name, properties). With no mapping and no
130
130
  * destination-level include, properties is `{}`.
131
131
  */
132
132
  declare const defaultEventForwarding: SegmentStepExample;
133
133
  /**
134
- * Wildcard ignore walkerOS's standard way to drop events. The rule
134
+ * Wildcard ignore - walkerOS's standard way to drop events. The rule
135
135
  * matches but does nothing. The destination fires zero SDK calls.
136
136
  */
137
137
  declare const wildcardIgnored: SegmentStepExample;
@@ -154,48 +154,48 @@ declare const ruleIncludeReplaces: SegmentStepExample;
154
154
  */
155
155
  declare const destinationLevelIdentify: SegmentStepExample;
156
156
  /**
157
- * Per-event identify with traits the canonical "user login" pattern.
158
- * skip: true suppresses the default analytics.track() call because we're
157
+ * Per-event identify with traits - the canonical "user login" pattern.
158
+ * silent: true suppresses the default analytics.track() call because we're
159
159
  * running identity side effects only. Matches Segment Spec reserved traits
160
160
  * (email, name, plan, company) so downstream destinations recognize them.
161
161
  */
162
162
  declare const userLoginIdentify: SegmentStepExample;
163
163
  /**
164
- * Profile update omit userId. Segment's SDK uses the currently stored
164
+ * Profile update - omit userId. Segment's SDK uses the currently stored
165
165
  * userId and merges the traits into the existing trait set.
166
166
  */
167
167
  declare const profileUpdateTraitsOnly: SegmentStepExample;
168
168
  /**
169
- * User logout reset: true fires analytics.reset(), which clears userId,
169
+ * User logout - reset: true fires analytics.reset(), which clears userId,
170
170
  * anonymousId, traits, and generates a new anonymous ID.
171
- * skip: true because we're only running the reset side effect.
171
+ * silent: true because we're only running the reset side effect.
172
172
  */
173
173
  declare const userLogoutReset: SegmentStepExample;
174
174
  /**
175
- * Per-event group assignment company update event attaches the user
175
+ * Per-event group assignment - company update event attaches the user
176
176
  * to a company and sets the company's traits in one call.
177
177
  */
178
178
  declare const companyUpdateGroup: SegmentStepExample;
179
179
  /**
180
- * Explicit page() call the canonical Segment pattern for page views.
181
- * skip: true suppresses the default track() call; settings.page fires
180
+ * Explicit page() call - the canonical Segment pattern for page views.
181
+ * silent: true suppresses the default track() call; settings.page fires
182
182
  * analytics.page(category, name, properties) instead.
183
183
  */
184
184
  declare const pageViewAsPage: SegmentStepExample;
185
185
  /**
186
- * Minimal page() call settings.page: true produces an empty
186
+ * Minimal page() call - settings.page: true produces an empty
187
187
  * analytics.page() relying entirely on SDK auto-collection.
188
188
  */
189
189
  declare const pageViewMinimal: SegmentStepExample;
190
190
  /**
191
- * Segment ecommerce spec Order Completed event. One track() call with
191
+ * Segment ecommerce spec - Order Completed event. One track() call with
192
192
  * a products array. Uses mapping.name to produce the Segment Spec name
193
193
  * and mapping.data to build the properties object including the nested
194
194
  * products loop. The loop filters via condition to products with prices.
195
195
  */
196
196
  declare const orderCompletedEcommerce: SegmentStepExample;
197
197
  /**
198
- * Consent context forwarding when the event has consent state,
198
+ * Consent context forwarding - when the event has consent state,
199
199
  * the destination automatically stamps every track/identify/group/page
200
200
  * call with context.consent.categoryPreferences. settings.consent
201
201
  * remaps walkerOS keys to Segment category names.
@@ -125,13 +125,13 @@ type SegmentStepExample = Flow.StepExample & {
125
125
  */
126
126
  declare const init: Flow.StepExample;
127
127
  /**
128
- * Default event forwarding every walkerOS event becomes
128
+ * Default event forwarding - every walkerOS event becomes
129
129
  * analytics.track(event.name, properties). With no mapping and no
130
130
  * destination-level include, properties is `{}`.
131
131
  */
132
132
  declare const defaultEventForwarding: SegmentStepExample;
133
133
  /**
134
- * Wildcard ignore walkerOS's standard way to drop events. The rule
134
+ * Wildcard ignore - walkerOS's standard way to drop events. The rule
135
135
  * matches but does nothing. The destination fires zero SDK calls.
136
136
  */
137
137
  declare const wildcardIgnored: SegmentStepExample;
@@ -154,48 +154,48 @@ declare const ruleIncludeReplaces: SegmentStepExample;
154
154
  */
155
155
  declare const destinationLevelIdentify: SegmentStepExample;
156
156
  /**
157
- * Per-event identify with traits the canonical "user login" pattern.
158
- * skip: true suppresses the default analytics.track() call because we're
157
+ * Per-event identify with traits - the canonical "user login" pattern.
158
+ * silent: true suppresses the default analytics.track() call because we're
159
159
  * running identity side effects only. Matches Segment Spec reserved traits
160
160
  * (email, name, plan, company) so downstream destinations recognize them.
161
161
  */
162
162
  declare const userLoginIdentify: SegmentStepExample;
163
163
  /**
164
- * Profile update omit userId. Segment's SDK uses the currently stored
164
+ * Profile update - omit userId. Segment's SDK uses the currently stored
165
165
  * userId and merges the traits into the existing trait set.
166
166
  */
167
167
  declare const profileUpdateTraitsOnly: SegmentStepExample;
168
168
  /**
169
- * User logout reset: true fires analytics.reset(), which clears userId,
169
+ * User logout - reset: true fires analytics.reset(), which clears userId,
170
170
  * anonymousId, traits, and generates a new anonymous ID.
171
- * skip: true because we're only running the reset side effect.
171
+ * silent: true because we're only running the reset side effect.
172
172
  */
173
173
  declare const userLogoutReset: SegmentStepExample;
174
174
  /**
175
- * Per-event group assignment company update event attaches the user
175
+ * Per-event group assignment - company update event attaches the user
176
176
  * to a company and sets the company's traits in one call.
177
177
  */
178
178
  declare const companyUpdateGroup: SegmentStepExample;
179
179
  /**
180
- * Explicit page() call the canonical Segment pattern for page views.
181
- * skip: true suppresses the default track() call; settings.page fires
180
+ * Explicit page() call - the canonical Segment pattern for page views.
181
+ * silent: true suppresses the default track() call; settings.page fires
182
182
  * analytics.page(category, name, properties) instead.
183
183
  */
184
184
  declare const pageViewAsPage: SegmentStepExample;
185
185
  /**
186
- * Minimal page() call settings.page: true produces an empty
186
+ * Minimal page() call - settings.page: true produces an empty
187
187
  * analytics.page() relying entirely on SDK auto-collection.
188
188
  */
189
189
  declare const pageViewMinimal: SegmentStepExample;
190
190
  /**
191
- * Segment ecommerce spec Order Completed event. One track() call with
191
+ * Segment ecommerce spec - Order Completed event. One track() call with
192
192
  * a products array. Uses mapping.name to produce the Segment Spec name
193
193
  * and mapping.data to build the properties object including the nested
194
194
  * products loop. The loop filters via condition to products with prices.
195
195
  */
196
196
  declare const orderCompletedEcommerce: SegmentStepExample;
197
197
  /**
198
- * Consent context forwarding when the event has consent state,
198
+ * Consent context forwarding - when the event has consent state,
199
199
  * the destination automatically stamps every track/identify/group/page
200
200
  * call with context.consent.categoryPreferences. settings.consent
201
201
  * remaps walkerOS keys to Segment category names.
@@ -90,32 +90,37 @@ __export(step_exports, {
90
90
 
91
91
  // ../../../core/dist/index.mjs
92
92
  var e = Object.defineProperty;
93
- var c = {};
93
+ var a = {};
94
94
  ((t, n) => {
95
95
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
96
- })(c, { Level: () => u });
97
- 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 W = { merge: true, shallow: true, extend: true };
99
- function L(e2, t = {}, n = {}) {
100
- n = { ...W, ...n };
96
+ })(a, { Level: () => c });
97
+ var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
98
+ var X = { merge: true, shallow: true, extend: true };
99
+ function G(e2, t = {}, n = {}) {
100
+ n = { ...X, ...n };
101
101
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
102
102
  const i = e2[o2];
103
103
  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;
104
104
  }, {});
105
105
  return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
106
106
  }
107
- function fe(e2 = {}) {
107
+ function he() {
108
+ let e2 = "";
109
+ for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
110
+ return e2;
111
+ }
112
+ function ve(e2 = {}) {
108
113
  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.4.2", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
114
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ 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" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
110
115
  if (e2.name) {
111
- const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
112
- t2 && n2 && (r.entity = t2, r.action = n2);
116
+ const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
117
+ t2 && o && (n.entity = t2, n.action = o);
113
118
  }
114
- return r;
119
+ return n;
115
120
  }
116
- function le(e2 = "entity action", t = {}) {
121
+ function we(e2 = "entity action", t = {}) {
117
122
  const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
118
- return fe({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
123
+ return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
119
124
  }
120
125
 
121
126
  // src/examples/step.ts
@@ -138,19 +143,19 @@ var init2 = {
138
143
  var defaultEventForwarding = {
139
144
  title: "Default track",
140
145
  description: "A walker event becomes a Segment analytics.track call with the event name and empty properties.",
141
- in: le("product view", { timestamp: 1700000100 }),
146
+ in: we("product view", { timestamp: 1700000100 }),
142
147
  out: [["analytics.track", "product view", {}]]
143
148
  };
144
149
  var wildcardIgnored = {
145
150
  public: false,
146
- in: le("debug noise", { timestamp: 1700000101 }),
151
+ in: we("debug noise", { timestamp: 1700000101 }),
147
152
  mapping: { ignore: true },
148
153
  out: []
149
154
  };
150
155
  var destinationLevelInclude = {
151
156
  title: "Include data",
152
157
  description: "Destination-level include flattens the event data section into prefixed Segment track properties.",
153
- in: le("product view", { timestamp: 1700000102 }),
158
+ in: we("product view", { timestamp: 1700000102 }),
154
159
  configInclude: ["data"],
155
160
  out: [
156
161
  [
@@ -169,7 +174,7 @@ var destinationLevelInclude = {
169
174
  var ruleIncludeReplaces = {
170
175
  title: "Rule include overrides",
171
176
  description: "A per-rule include replaces the destination-level include so this event forwards only globals.",
172
- in: le("order complete", { timestamp: 1700000103 }),
177
+ in: we("order complete", { timestamp: 1700000103 }),
173
178
  configInclude: ["data"],
174
179
  mapping: {
175
180
  include: ["globals"]
@@ -187,7 +192,7 @@ var ruleIncludeReplaces = {
187
192
  var destinationLevelIdentify = {
188
193
  title: "Destination identify",
189
194
  description: "Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",
190
- in: le("page view", { timestamp: 1700000104 }),
195
+ in: we("page view", { timestamp: 1700000104 }),
191
196
  settings: {
192
197
  identify: {
193
198
  map: {
@@ -203,7 +208,7 @@ var destinationLevelIdentify = {
203
208
  var userLoginIdentify = {
204
209
  title: "User login identify",
205
210
  description: "A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",
206
- in: le("user login", {
211
+ in: we("user login", {
207
212
  timestamp: 1700000105,
208
213
  data: {
209
214
  user_id: "new-user-123",
@@ -215,7 +220,7 @@ var userLoginIdentify = {
215
220
  }
216
221
  }),
217
222
  mapping: {
218
- skip: true,
223
+ silent: true,
219
224
  settings: {
220
225
  identify: {
221
226
  map: {
@@ -253,7 +258,7 @@ var userLoginIdentify = {
253
258
  var profileUpdateTraitsOnly = {
254
259
  title: "Profile update",
255
260
  description: "A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",
256
- in: le("profile update", {
261
+ in: we("profile update", {
257
262
  timestamp: 1700000106,
258
263
  data: {
259
264
  name: "Jane Q. Doe",
@@ -262,7 +267,7 @@ var profileUpdateTraitsOnly = {
262
267
  }
263
268
  }),
264
269
  mapping: {
265
- skip: true,
270
+ silent: true,
266
271
  settings: {
267
272
  identify: {
268
273
  map: {
@@ -292,9 +297,9 @@ var profileUpdateTraitsOnly = {
292
297
  var userLogoutReset = {
293
298
  title: "User logout reset",
294
299
  description: "A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",
295
- in: le("user logout", { timestamp: 1700000107 }),
300
+ in: we("user logout", { timestamp: 1700000107 }),
296
301
  mapping: {
297
- skip: true,
302
+ silent: true,
298
303
  settings: {
299
304
  reset: true
300
305
  }
@@ -304,7 +309,7 @@ var userLogoutReset = {
304
309
  var companyUpdateGroup = {
305
310
  title: "Group company",
306
311
  description: "A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",
307
- in: le("company update", {
312
+ in: we("company update", {
308
313
  timestamp: 1700000108,
309
314
  data: {
310
315
  company_id: "comp-456",
@@ -315,7 +320,7 @@ var companyUpdateGroup = {
315
320
  }
316
321
  }),
317
322
  mapping: {
318
- skip: true,
323
+ silent: true,
319
324
  settings: {
320
325
  group: {
321
326
  map: {
@@ -348,7 +353,7 @@ var companyUpdateGroup = {
348
353
  var pageViewAsPage = {
349
354
  title: "Page view",
350
355
  description: "A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",
351
- in: le("page view", {
356
+ in: we("page view", {
352
357
  timestamp: 1700000109,
353
358
  data: {
354
359
  category: "docs",
@@ -357,7 +362,7 @@ var pageViewAsPage = {
357
362
  }
358
363
  }),
359
364
  mapping: {
360
- skip: true,
365
+ silent: true,
361
366
  settings: {
362
367
  page: {
363
368
  map: {
@@ -386,9 +391,9 @@ var pageViewAsPage = {
386
391
  var pageViewMinimal = {
387
392
  title: "Page view minimal",
388
393
  description: "A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",
389
- in: le("page view", { timestamp: 1700000110 }),
394
+ in: we("page view", { timestamp: 1700000110 }),
390
395
  mapping: {
391
- skip: true,
396
+ silent: true,
392
397
  settings: {
393
398
  page: true
394
399
  }
@@ -398,7 +403,7 @@ var pageViewMinimal = {
398
403
  var orderCompletedEcommerce = {
399
404
  title: "Order completed",
400
405
  description: "A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",
401
- in: le("order complete", { timestamp: 1700000111 }),
406
+ in: we("order complete", { timestamp: 1700000111 }),
402
407
  mapping: {
403
408
  name: "Order Completed",
404
409
  data: {
@@ -463,7 +468,7 @@ var orderCompletedEcommerce = {
463
468
  var consentContextForwarded = {
464
469
  title: "Consent context",
465
470
  description: "Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",
466
- in: le("product view", {
471
+ in: we("product view", {
467
472
  timestamp: 1700000112,
468
473
  consent: { analytics: true, marketing: true }
469
474
  }),
@@ -69,32 +69,37 @@ __export(step_exports, {
69
69
 
70
70
  // ../../../core/dist/index.mjs
71
71
  var e = Object.defineProperty;
72
- var c = {};
72
+ var a = {};
73
73
  ((t, n) => {
74
74
  for (var o in n) e(t, o, { get: n[o], enumerable: true });
75
- })(c, { Level: () => u });
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 || {});
77
- var W = { merge: true, shallow: true, extend: true };
78
- function L(e2, t = {}, n = {}) {
79
- n = { ...W, ...n };
75
+ })(a, { Level: () => c });
76
+ var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
77
+ var X = { merge: true, shallow: true, extend: true };
78
+ function G(e2, t = {}, n = {}) {
79
+ n = { ...X, ...n };
80
80
  const o = Object.entries(t).reduce((t2, [o2, r]) => {
81
81
  const i = e2[o2];
82
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;
83
83
  }, {});
84
84
  return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
85
85
  }
86
- function fe(e2 = {}) {
86
+ function he() {
87
+ let e2 = "";
88
+ for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
89
+ return e2;
90
+ }
91
+ function ve(e2 = {}) {
87
92
  var _a;
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.2", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
93
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ 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" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
89
94
  if (e2.name) {
90
- const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
91
- t2 && n2 && (r.entity = t2, r.action = n2);
95
+ const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
96
+ t2 && o && (n.entity = t2, n.action = o);
92
97
  }
93
- return r;
98
+ return n;
94
99
  }
95
- function le(e2 = "entity action", t = {}) {
100
+ function we(e2 = "entity action", t = {}) {
96
101
  const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
97
- return fe({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
102
+ return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
98
103
  }
99
104
 
100
105
  // src/examples/step.ts
@@ -117,19 +122,19 @@ var init2 = {
117
122
  var defaultEventForwarding = {
118
123
  title: "Default track",
119
124
  description: "A walker event becomes a Segment analytics.track call with the event name and empty properties.",
120
- in: le("product view", { timestamp: 1700000100 }),
125
+ in: we("product view", { timestamp: 1700000100 }),
121
126
  out: [["analytics.track", "product view", {}]]
122
127
  };
123
128
  var wildcardIgnored = {
124
129
  public: false,
125
- in: le("debug noise", { timestamp: 1700000101 }),
130
+ in: we("debug noise", { timestamp: 1700000101 }),
126
131
  mapping: { ignore: true },
127
132
  out: []
128
133
  };
129
134
  var destinationLevelInclude = {
130
135
  title: "Include data",
131
136
  description: "Destination-level include flattens the event data section into prefixed Segment track properties.",
132
- in: le("product view", { timestamp: 1700000102 }),
137
+ in: we("product view", { timestamp: 1700000102 }),
133
138
  configInclude: ["data"],
134
139
  out: [
135
140
  [
@@ -148,7 +153,7 @@ var destinationLevelInclude = {
148
153
  var ruleIncludeReplaces = {
149
154
  title: "Rule include overrides",
150
155
  description: "A per-rule include replaces the destination-level include so this event forwards only globals.",
151
- in: le("order complete", { timestamp: 1700000103 }),
156
+ in: we("order complete", { timestamp: 1700000103 }),
152
157
  configInclude: ["data"],
153
158
  mapping: {
154
159
  include: ["globals"]
@@ -166,7 +171,7 @@ var ruleIncludeReplaces = {
166
171
  var destinationLevelIdentify = {
167
172
  title: "Destination identify",
168
173
  description: "Destination-level identify calls analytics.identify with the resolved userId before firing the default track.",
169
- in: le("page view", { timestamp: 1700000104 }),
174
+ in: we("page view", { timestamp: 1700000104 }),
170
175
  settings: {
171
176
  identify: {
172
177
  map: {
@@ -182,7 +187,7 @@ var destinationLevelIdentify = {
182
187
  var userLoginIdentify = {
183
188
  title: "User login identify",
184
189
  description: "A user login fires Segment analytics.identify with userId and reserved traits such as email, name, and plan.",
185
- in: le("user login", {
190
+ in: we("user login", {
186
191
  timestamp: 1700000105,
187
192
  data: {
188
193
  user_id: "new-user-123",
@@ -194,7 +199,7 @@ var userLoginIdentify = {
194
199
  }
195
200
  }),
196
201
  mapping: {
197
- skip: true,
202
+ silent: true,
198
203
  settings: {
199
204
  identify: {
200
205
  map: {
@@ -232,7 +237,7 @@ var userLoginIdentify = {
232
237
  var profileUpdateTraitsOnly = {
233
238
  title: "Profile update",
234
239
  description: "A profile update calls Segment analytics.identify with traits and no userId to merge traits into the current profile.",
235
- in: le("profile update", {
240
+ in: we("profile update", {
236
241
  timestamp: 1700000106,
237
242
  data: {
238
243
  name: "Jane Q. Doe",
@@ -241,7 +246,7 @@ var profileUpdateTraitsOnly = {
241
246
  }
242
247
  }),
243
248
  mapping: {
244
- skip: true,
249
+ silent: true,
245
250
  settings: {
246
251
  identify: {
247
252
  map: {
@@ -271,9 +276,9 @@ var profileUpdateTraitsOnly = {
271
276
  var userLogoutReset = {
272
277
  title: "User logout reset",
273
278
  description: "A user logout calls analytics.reset to clear userId, anonymousId, and traits then generate a new anonymous id.",
274
- in: le("user logout", { timestamp: 1700000107 }),
279
+ in: we("user logout", { timestamp: 1700000107 }),
275
280
  mapping: {
276
- skip: true,
281
+ silent: true,
277
282
  settings: {
278
283
  reset: true
279
284
  }
@@ -283,7 +288,7 @@ var userLogoutReset = {
283
288
  var companyUpdateGroup = {
284
289
  title: "Group company",
285
290
  description: "A company update fires Segment analytics.group with a groupId and traits for account-level tracking.",
286
- in: le("company update", {
291
+ in: we("company update", {
287
292
  timestamp: 1700000108,
288
293
  data: {
289
294
  company_id: "comp-456",
@@ -294,7 +299,7 @@ var companyUpdateGroup = {
294
299
  }
295
300
  }),
296
301
  mapping: {
297
- skip: true,
302
+ silent: true,
298
303
  settings: {
299
304
  group: {
300
305
  map: {
@@ -327,7 +332,7 @@ var companyUpdateGroup = {
327
332
  var pageViewAsPage = {
328
333
  title: "Page view",
329
334
  description: "A page view fires Segment analytics.page with category, name, and properties instead of a generic track.",
330
- in: le("page view", {
335
+ in: we("page view", {
331
336
  timestamp: 1700000109,
332
337
  data: {
333
338
  category: "docs",
@@ -336,7 +341,7 @@ var pageViewAsPage = {
336
341
  }
337
342
  }),
338
343
  mapping: {
339
- skip: true,
344
+ silent: true,
340
345
  settings: {
341
346
  page: {
342
347
  map: {
@@ -365,9 +370,9 @@ var pageViewAsPage = {
365
370
  var pageViewMinimal = {
366
371
  title: "Page view minimal",
367
372
  description: "A mapping with page: true fires an empty analytics.page call relying on Segments auto-collection.",
368
- in: le("page view", { timestamp: 1700000110 }),
373
+ in: we("page view", { timestamp: 1700000110 }),
369
374
  mapping: {
370
- skip: true,
375
+ silent: true,
371
376
  settings: {
372
377
  page: true
373
378
  }
@@ -377,7 +382,7 @@ var pageViewMinimal = {
377
382
  var orderCompletedEcommerce = {
378
383
  title: "Order completed",
379
384
  description: "A completed order is mapped to the Segment Spec Order Completed event with a nested products array.",
380
- in: le("order complete", { timestamp: 1700000111 }),
385
+ in: we("order complete", { timestamp: 1700000111 }),
381
386
  mapping: {
382
387
  name: "Order Completed",
383
388
  data: {
@@ -442,7 +447,7 @@ var orderCompletedEcommerce = {
442
447
  var consentContextForwarded = {
443
448
  title: "Consent context",
444
449
  description: "Walker consent is stamped on every Segment call via context.consent.categoryPreferences for downstream filtering.",
445
- in: le("product view", {
450
+ in: we("product view", {
446
451
  timestamp: 1700000112,
447
452
  consent: { analytics: true, marketing: true }
448
453
  }),