@walkeros/web-destination-plausible 2.0.1 → 2.1.1

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.
@@ -1,4 +1,4 @@
1
- import { WalkerOS, Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { WalkerOS, Flow } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  declare global {
@@ -11,8 +11,6 @@ declare global {
11
11
  type Plausible = (event: string, options?: {
12
12
  props?: WalkerOS.AnyObject;
13
13
  }) => void;
14
- interface Mapping {
15
- }
16
14
  interface Env extends DestinationWeb.Env {
17
15
  window: {
18
16
  plausible: Plausible & {
@@ -20,7 +18,6 @@ interface Env extends DestinationWeb.Env {
20
18
  };
21
19
  };
22
20
  }
23
- type Rule = Mapping$1.Rule<Mapping>;
24
21
 
25
22
  declare const init: Env | undefined;
26
23
  declare const push: Env;
@@ -31,29 +28,13 @@ declare namespace env {
31
28
  export { env_init as init, env_push as push };
32
29
  }
33
30
 
34
- declare function purchase$1(): unknown[];
35
- declare function customEvent$1(): unknown[];
36
-
37
- declare namespace events {
38
- export { customEvent$1 as customEvent, purchase$1 as purchase };
39
- }
40
-
41
- declare const customEvent: Rule;
42
- declare const purchase: Rule;
43
- declare const config: {
44
- entity: {
45
- action: Rule;
46
- };
47
- order: {
48
- complete: Rule;
49
- };
50
- };
31
+ declare const purchase: Flow.StepExample;
32
+ declare const customEvent: Flow.StepExample;
51
33
 
52
- declare const mapping_config: typeof config;
53
- declare const mapping_customEvent: typeof customEvent;
54
- declare const mapping_purchase: typeof purchase;
55
- declare namespace mapping {
56
- export { mapping_config as config, mapping_customEvent as customEvent, mapping_purchase as purchase };
34
+ declare const step_customEvent: typeof customEvent;
35
+ declare const step_purchase: typeof purchase;
36
+ declare namespace step {
37
+ export { step_customEvent as customEvent, step_purchase as purchase };
57
38
  }
58
39
 
59
- export { env, events, mapping };
40
+ export { env, step };
@@ -1,4 +1,4 @@
1
- import { WalkerOS, Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { WalkerOS, Flow } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  declare global {
@@ -11,8 +11,6 @@ declare global {
11
11
  type Plausible = (event: string, options?: {
12
12
  props?: WalkerOS.AnyObject;
13
13
  }) => void;
14
- interface Mapping {
15
- }
16
14
  interface Env extends DestinationWeb.Env {
17
15
  window: {
18
16
  plausible: Plausible & {
@@ -20,7 +18,6 @@ interface Env extends DestinationWeb.Env {
20
18
  };
21
19
  };
22
20
  }
23
- type Rule = Mapping$1.Rule<Mapping>;
24
21
 
25
22
  declare const init: Env | undefined;
26
23
  declare const push: Env;
@@ -31,29 +28,13 @@ declare namespace env {
31
28
  export { env_init as init, env_push as push };
32
29
  }
33
30
 
34
- declare function purchase$1(): unknown[];
35
- declare function customEvent$1(): unknown[];
36
-
37
- declare namespace events {
38
- export { customEvent$1 as customEvent, purchase$1 as purchase };
39
- }
40
-
41
- declare const customEvent: Rule;
42
- declare const purchase: Rule;
43
- declare const config: {
44
- entity: {
45
- action: Rule;
46
- };
47
- order: {
48
- complete: Rule;
49
- };
50
- };
31
+ declare const purchase: Flow.StepExample;
32
+ declare const customEvent: Flow.StepExample;
51
33
 
52
- declare const mapping_config: typeof config;
53
- declare const mapping_customEvent: typeof customEvent;
54
- declare const mapping_purchase: typeof purchase;
55
- declare namespace mapping {
56
- export { mapping_config as config, mapping_customEvent as customEvent, mapping_purchase as purchase };
34
+ declare const step_customEvent: typeof customEvent;
35
+ declare const step_purchase: typeof purchase;
36
+ declare namespace step {
37
+ export { step_customEvent as customEvent, step_purchase as purchase };
57
38
  }
58
39
 
59
- export { env, events, mapping };
40
+ export { env, step };
@@ -21,8 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
- events: () => events_exports,
25
- mapping: () => mapping_exports
24
+ step: () => step_exports
26
25
  });
27
26
  module.exports = __toCommonJS(examples_exports);
28
27
 
@@ -74,103 +73,95 @@ var push = {
74
73
  }
75
74
  };
76
75
 
77
- // src/examples/events.ts
78
- var events_exports = {};
79
- __export(events_exports, {
76
+ // src/examples/step.ts
77
+ var step_exports = {};
78
+ __export(step_exports, {
80
79
  customEvent: () => customEvent,
81
80
  purchase: () => purchase
82
81
  });
83
82
 
84
83
  // ../../../core/dist/index.mjs
85
- var e = Object.defineProperty;
86
- var c = {};
87
- ((t, n) => {
88
- for (var o in n) e(t, o, { get: n[o], enumerable: true });
89
- })(c, { Level: () => u });
90
- var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
91
- var A = { merge: true, shallow: true, extend: true };
92
- function P(e2, t = {}, n = {}) {
93
- n = { ...A, ...n };
94
- const o = Object.entries(t).reduce((t2, [o2, r]) => {
95
- const i = e2[o2];
96
- 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
+ var t = Object.defineProperty;
85
+ var a = {};
86
+ ((e, n) => {
87
+ for (var o in n) t(e, o, { get: n[o], enumerable: true });
88
+ })(a, { Level: () => u });
89
+ var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
90
+ var D = { merge: true, shallow: true, extend: true };
91
+ function H(t2, e = {}, n = {}) {
92
+ n = { ...D, ...n };
93
+ const o = Object.entries(e).reduce((e2, [o2, r]) => {
94
+ const i = t2[o2];
95
+ return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
97
96
  }, {});
98
- return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
97
+ return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
99
98
  }
100
- function Z(e2 = {}) {
99
+ function nt(t2 = {}) {
101
100
  var _a;
102
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = P({ 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: "2.0.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
103
- if (e2.name) {
104
- const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
105
- t2 && n2 && (r.entity = t2, r.action = n2);
101
+ const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ 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: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.1.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
102
+ if (t2.name) {
103
+ const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
104
+ e2 && n2 && (r.entity = e2, r.action = n2);
106
105
  }
107
106
  return r;
108
107
  }
109
- function q(e2 = "entity action", t = {}) {
110
- 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 } };
111
- return Z({ ...{ "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 });
108
+ function ot(t2 = "entity action", e = {}) {
109
+ const n = e.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 } };
110
+ return nt({ ...{ "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" } } }[t2], ...e, name: t2 });
112
111
  }
113
112
 
114
- // src/examples/events.ts
115
- function purchase() {
116
- const event = q("order complete");
117
- return [
113
+ // src/examples/step.ts
114
+ var purchase = {
115
+ in: ot("order complete", { timestamp: 1700000200 }),
116
+ mapping: {
117
+ name: "purchase",
118
+ data: {
119
+ map: {
120
+ revenue: {
121
+ map: {
122
+ currency: { value: "EUR" },
123
+ amount: "data.total"
124
+ }
125
+ }
126
+ }
127
+ }
128
+ },
129
+ out: [
118
130
  "purchase",
119
131
  {
120
132
  revenue: {
121
133
  currency: "EUR",
122
- amount: event.data.total
134
+ amount: 555
123
135
  }
124
136
  }
125
- ];
126
- }
127
- function customEvent() {
128
- const event = q();
129
- return [
130
- "Custom Event",
131
- {
132
- props: event.data,
133
- revenue: event.data.number
134
- }
135
- ];
136
- }
137
-
138
- // src/examples/mapping.ts
139
- var mapping_exports = {};
140
- __export(mapping_exports, {
141
- config: () => config,
142
- customEvent: () => customEvent2,
143
- purchase: () => purchase2
144
- });
145
- var customEvent2 = {
146
- name: "Custom Event",
147
- data: {
148
- map: {
149
- props: "data",
150
- revenue: "data.number"
151
- }
152
- }
137
+ ]
153
138
  };
154
- var purchase2 = {
155
- name: "purchase",
156
- data: {
157
- map: {
158
- revenue: {
159
- map: {
160
- currency: { value: "EUR" },
161
- amount: "data.total"
162
- }
139
+ var customEvent = {
140
+ in: ot("entity action", { timestamp: 1700000201 }),
141
+ mapping: {
142
+ name: "Custom Event",
143
+ data: {
144
+ map: {
145
+ props: "data",
146
+ revenue: "data.number"
163
147
  }
164
148
  }
165
- }
166
- };
167
- var config = {
168
- entity: { action: customEvent2 },
169
- order: { complete: purchase2 }
149
+ },
150
+ out: [
151
+ "Custom Event",
152
+ {
153
+ props: {
154
+ string: "foo",
155
+ number: 1,
156
+ boolean: true,
157
+ array: [0, "text", false]
158
+ },
159
+ revenue: 1
160
+ }
161
+ ]
170
162
  };
171
163
  // Annotate the CommonJS export names for ESM import in node:
172
164
  0 && (module.exports = {
173
165
  env,
174
- events,
175
- mapping
166
+ step
176
167
  });
@@ -52,102 +52,94 @@ var push = {
52
52
  }
53
53
  };
54
54
 
55
- // src/examples/events.ts
56
- var events_exports = {};
57
- __export(events_exports, {
55
+ // src/examples/step.ts
56
+ var step_exports = {};
57
+ __export(step_exports, {
58
58
  customEvent: () => customEvent,
59
59
  purchase: () => purchase
60
60
  });
61
61
 
62
62
  // ../../../core/dist/index.mjs
63
- var e = Object.defineProperty;
64
- var c = {};
65
- ((t, n) => {
66
- for (var o in n) e(t, o, { get: n[o], enumerable: true });
67
- })(c, { Level: () => u });
68
- var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
69
- var A = { merge: true, shallow: true, extend: true };
70
- function P(e2, t = {}, n = {}) {
71
- n = { ...A, ...n };
72
- const o = Object.entries(t).reduce((t2, [o2, r]) => {
73
- const i = e2[o2];
74
- 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;
63
+ var t = Object.defineProperty;
64
+ var a = {};
65
+ ((e, n) => {
66
+ for (var o in n) t(e, o, { get: n[o], enumerable: true });
67
+ })(a, { Level: () => u });
68
+ var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
69
+ var D = { merge: true, shallow: true, extend: true };
70
+ function H(t2, e = {}, n = {}) {
71
+ n = { ...D, ...n };
72
+ const o = Object.entries(e).reduce((e2, [o2, r]) => {
73
+ const i = t2[o2];
74
+ return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
75
75
  }, {});
76
- return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
76
+ return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
77
77
  }
78
- function Z(e2 = {}) {
78
+ function nt(t2 = {}) {
79
79
  var _a;
80
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = P({ 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: "2.0.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
81
- if (e2.name) {
82
- const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
83
- t2 && n2 && (r.entity = t2, r.action = n2);
80
+ const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ 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: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.1.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
81
+ if (t2.name) {
82
+ const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
83
+ e2 && n2 && (r.entity = e2, r.action = n2);
84
84
  }
85
85
  return r;
86
86
  }
87
- function q(e2 = "entity action", t = {}) {
88
- 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 } };
89
- return Z({ ...{ "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 });
87
+ function ot(t2 = "entity action", e = {}) {
88
+ const n = e.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 } };
89
+ return nt({ ...{ "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" } } }[t2], ...e, name: t2 });
90
90
  }
91
91
 
92
- // src/examples/events.ts
93
- function purchase() {
94
- const event = q("order complete");
95
- return [
92
+ // src/examples/step.ts
93
+ var purchase = {
94
+ in: ot("order complete", { timestamp: 1700000200 }),
95
+ mapping: {
96
+ name: "purchase",
97
+ data: {
98
+ map: {
99
+ revenue: {
100
+ map: {
101
+ currency: { value: "EUR" },
102
+ amount: "data.total"
103
+ }
104
+ }
105
+ }
106
+ }
107
+ },
108
+ out: [
96
109
  "purchase",
97
110
  {
98
111
  revenue: {
99
112
  currency: "EUR",
100
- amount: event.data.total
113
+ amount: 555
101
114
  }
102
115
  }
103
- ];
104
- }
105
- function customEvent() {
106
- const event = q();
107
- return [
108
- "Custom Event",
109
- {
110
- props: event.data,
111
- revenue: event.data.number
112
- }
113
- ];
114
- }
115
-
116
- // src/examples/mapping.ts
117
- var mapping_exports = {};
118
- __export(mapping_exports, {
119
- config: () => config,
120
- customEvent: () => customEvent2,
121
- purchase: () => purchase2
122
- });
123
- var customEvent2 = {
124
- name: "Custom Event",
125
- data: {
126
- map: {
127
- props: "data",
128
- revenue: "data.number"
129
- }
130
- }
116
+ ]
131
117
  };
132
- var purchase2 = {
133
- name: "purchase",
134
- data: {
135
- map: {
136
- revenue: {
137
- map: {
138
- currency: { value: "EUR" },
139
- amount: "data.total"
140
- }
118
+ var customEvent = {
119
+ in: ot("entity action", { timestamp: 1700000201 }),
120
+ mapping: {
121
+ name: "Custom Event",
122
+ data: {
123
+ map: {
124
+ props: "data",
125
+ revenue: "data.number"
141
126
  }
142
127
  }
143
- }
144
- };
145
- var config = {
146
- entity: { action: customEvent2 },
147
- order: { complete: purchase2 }
128
+ },
129
+ out: [
130
+ "Custom Event",
131
+ {
132
+ props: {
133
+ string: "foo",
134
+ number: 1,
135
+ boolean: true,
136
+ array: [0, "text", false]
137
+ },
138
+ revenue: 1
139
+ }
140
+ ]
148
141
  };
149
142
  export {
150
143
  env_exports as env,
151
- events_exports as events,
152
- mapping_exports as mapping
144
+ step_exports as step
153
145
  };
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationPlausible:()=>s,default:()=>b,destinationPlausible:()=>p});var r=Object.defineProperty;((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>l});var a,l=((a=l||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function c(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}var s={},p={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=c(t),o=n,i=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:o}=c(t),i=o,r=i.createElement("script");r.src=n,e&&(r.dataset.domain=e);i.head.appendChild(r)}(i.domain,t),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const i=u(n)?n:{},{window:r}=c(o);(0,r.plausible)(`${e.name}`,i)}};var d,b=p;return d=i,((i,r,a,l)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let u of n(r))o.call(i,u)||u===a||e(i,u,{get:()=>r[u],enumerable:!(l=t(r,u))||l.enumerable});return i})(e({},"__esModule",{value:!0}),d)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationPlausible:()=>s,default:()=>b,destinationPlausible:()=>p});var r=Object.defineProperty;((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>l});var a,l=((a=l||{})[a.ERROR=0]="ERROR",a[a.WARN=1]="WARN",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function c(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}var s={},p={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=c(t),o=n,i=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:o}=c(t),i=o,r=i.createElement("script");r.src=n,e&&(r.dataset.domain=e);i.head.appendChild(r)}(i.domain,t),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const i=u(n)?n:{},{window:r}=c(o);(0,r.plausible)(`${e.name}`,i)}};var d,b=p;return d=i,((i,r,a,l)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let u of n(r))o.call(i,u)||u===a||e(i,u,{get:()=>r[u],enumerable:!(l=t(r,u))||l.enumerable});return i})(e({},"__esModule",{value:!0}),d)})();
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _define_property(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _object_spread(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){_define_property(e,n,t[n])})}return e}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Destination=function(){var e=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)},n=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u={};!function(e,n){for(var r in n)t(e,r,{get:n[r],enumerable:!0})}(u,{DestinationPlausible:function(){return p},default:function(){return b},destinationPlausible:function(){return d}});var c=Object.defineProperty;!function(e,n){for(var t in n)c(e,t,{get:n[t],enumerable:!0})}({},{Level:function(){return f}});var a,l,f=((a=f||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a),p={},d={type:"plausible",config:{},init:function(e){var t=e.config,r=e.env,o=n(r).window,i=t.settings||{};return t.loadScript&&function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"https://plausible.io/js/script.manual.js",o=n(t).document,i=o.createElement("script");i.src=r,e&&(i.dataset.domain=e),o.head.appendChild(i)}(i.domain,r),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},t},push:function(t,r){r.config;var o=r.data,i=r.env,u=e(o)?o:{};(0,n(i).window.plausible)("".concat(t.name),u)}},b=d;return l=u,function(e,n,u,c){if(n&&"object"===(void 0===n?"undefined":_type_of(n))||"function"==typeof n){var a=!0,l=!1,f=void 0;try{for(var p,d=function(){var o=p.value;i.call(e,o)||o===u||t(e,o,{get:function(){return n[o]},enumerable:!(c=r(n,o))||c.enumerable})},b=o(n)[Symbol.iterator]();!(a=(p=b.next()).done);a=!0)d()}catch(e){l=!0,f=e}finally{try{a||null==b.return||b.return()}finally{if(l)throw f}}}return e}(t({},"__esModule",{value:!0}),l)}();
1
+ "use strict";function _define_property(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _object_spread(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){_define_property(e,n,t[n])})}return e}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Destination=function(){var e=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)},n=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u={};!function(e,n){for(var r in n)t(e,r,{get:n[r],enumerable:!0})}(u,{DestinationPlausible:function(){return p},default:function(){return b},destinationPlausible:function(){return d}});var c=Object.defineProperty;!function(e,n){for(var t in n)c(e,t,{get:n[t],enumerable:!0})}({},{Level:function(){return f}});var a,l,f=((a=f||{})[a.ERROR=0]="ERROR",a[a.WARN=1]="WARN",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a),p={},d={type:"plausible",config:{},init:function(e){var t=e.config,r=e.env,o=n(r).window,i=t.settings||{};return t.loadScript&&function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"https://plausible.io/js/script.manual.js",o=n(t).document,i=o.createElement("script");i.src=r,e&&(i.dataset.domain=e),o.head.appendChild(i)}(i.domain,r),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},t},push:function(t,r){r.config;var o=r.data,i=r.env,u=e(o)?o:{};(0,n(i).window.plausible)("".concat(t.name),u)}},b=d;return l=u,function(e,n,u,c){if(n&&"object"===(void 0===n?"undefined":_type_of(n))||"function"==typeof n){var a=!0,l=!1,f=void 0;try{for(var p,d=function(){var o=p.value;i.call(e,o)||o===u||t(e,o,{get:function(){return n[o]},enumerable:!(c=r(n,o))||c.enumerable})},b=o(n)[Symbol.iterator]();!(a=(p=b.next()).done);a=!0)d()}catch(e){l=!0,f=e}finally{try{a||null==b.return||b.return()}finally{if(l)throw f}}}return e}(t({},"__esModule",{value:!0}),l)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(a,{DestinationPlausible:()=>p,default:()=>f,destinationPlausible:()=>b}),module.exports=(e=a,((e,a,i,l)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of r(a))o.call(e,s)||s===i||t(e,s,{get:()=>a[s],enumerable:!(l=n(a,s))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i=Object.defineProperty;((e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>s});var l,s=((l=s||{})[l.ERROR=0]="ERROR",l[l.INFO=1]="INFO",l[l.DEBUG=2]="DEBUG",l);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var c=require("@walkeros/web-core"),p={},b={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=(0,c.getEnv)(t),r=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:r}=(0,c.getEnv)(t),o=r,a=o.createElement("script");a.src=n,e&&(a.dataset.domain=e);o.head.appendChild(a)}(o.domain,t),r.plausible=r.plausible||function(){(r.plausible.q=r.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:r}){const o=u(n)?n:{},{window:a}=(0,c.getEnv)(r);(0,a.plausible)(`${e.name}`,o)}};var f=b;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(a,{DestinationPlausible:()=>p,default:()=>f,destinationPlausible:()=>b}),module.exports=(e=a,((e,a,i,l)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of r(a))o.call(e,s)||s===i||t(e,s,{get:()=>a[s],enumerable:!(l=n(a,s))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i=Object.defineProperty;((e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>s});var l,s=((l=s||{})[l.ERROR=0]="ERROR",l[l.WARN=1]="WARN",l[l.INFO=2]="INFO",l[l.DEBUG=3]="DEBUG",l);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var c=require("@walkeros/web-core"),p={},b={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=(0,c.getEnv)(t),r=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:r}=(0,c.getEnv)(t),o=r,a=o.createElement("script");a.src=n,e&&(a.dataset.domain=e);o.head.appendChild(a)}(o.domain,t),r.plausible=r.plausible||function(){(r.plausible.q=r.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:r}){const o=u(n)?n:{},{window:a}=(0,c.getEnv)(r);(0,a.plausible)(`${e.name}`,o)}};var f=b;//# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty;((t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t);function a(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}import{getEnv as i}from"@walkeros/web-core";var o={},r={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=i(t),a=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:a}=i(t),o=a,r=o.createElement("script");r.src=n,e&&(r.dataset.domain=e);o.head.appendChild(r)}(o.domain,t),a.plausible=a.plausible||function(){(a.plausible.q=a.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const r=a(n)?n:{},{window:l}=i(o);(0,l.plausible)(`${e.name}`,r)}};var l=r;export{o as DestinationPlausible,l as default,r as destinationPlausible};//# sourceMappingURL=index.mjs.map
1
+ var e=Object.defineProperty;((t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.WARN=1]="WARN",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t);function a(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}import{getEnv as i}from"@walkeros/web-core";var o={},r={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=i(t),a=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:a}=i(t),o=a,r=o.createElement("script");r.src=n,e&&(r.dataset.domain=e);o.head.appendChild(r)}(o.domain,t),a.plausible=a.plausible||function(){(a.plausible.q=a.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const r=a(n)?n:{},{window:l}=i(o);(0,l.plausible)(`${e.name}`,r)}};var l=r;export{o as DestinationPlausible,l as default,r as destinationPlausible};//# sourceMappingURL=index.mjs.map