@walkeros/web-destination-optimizely 4.1.0-next-1778668930820 → 4.1.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.
- package/CHANGELOG.md +105 -0
- package/README.md +30 -94
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +7 -45
- package/dist/examples/index.mjs +7 -45
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +9 -9
- package/package.json +6 -4
package/dist/examples/index.js
CHANGED
|
@@ -81,55 +81,17 @@ __export(step_exports, {
|
|
|
81
81
|
signupWithAttributes: () => signupWithAttributes,
|
|
82
82
|
wildcardIgnored: () => wildcardIgnored
|
|
83
83
|
});
|
|
84
|
-
|
|
85
|
-
// ../../../core/dist/index.mjs
|
|
86
|
-
var e = Object.defineProperty;
|
|
87
|
-
var s = {};
|
|
88
|
-
((t, n) => {
|
|
89
|
-
for (var r in n) e(t, r, { get: n[r], enumerable: true });
|
|
90
|
-
})(s, { Level: () => c });
|
|
91
|
-
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 || {});
|
|
92
|
-
var B = { merge: true, shallow: true, extend: true };
|
|
93
|
-
function J(e2, t = {}, n = {}) {
|
|
94
|
-
n = { ...B, ...n };
|
|
95
|
-
const r = Object.entries(t).reduce((t2, [r2, o]) => {
|
|
96
|
-
const a = e2[r2];
|
|
97
|
-
return n.merge && Array.isArray(a) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...a]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
|
|
98
|
-
}, {});
|
|
99
|
-
return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
|
|
100
|
-
}
|
|
101
|
-
function ye() {
|
|
102
|
-
let e2 = "";
|
|
103
|
-
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
104
|
-
return e2;
|
|
105
|
-
}
|
|
106
|
-
function he(e2 = {}) {
|
|
107
|
-
var _a;
|
|
108
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = J({ 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 || ye(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
109
|
-
if (e2.name) {
|
|
110
|
-
const [t2, r] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
111
|
-
t2 && r && (n.entity = t2, n.action = r);
|
|
112
|
-
}
|
|
113
|
-
return n;
|
|
114
|
-
}
|
|
115
|
-
function ve(e2 = "entity action", t = {}) {
|
|
116
|
-
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
117
|
-
return he({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, 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", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, 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": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.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 });
|
|
118
|
-
}
|
|
119
|
-
var jt = ["code", "package", "before", "next", "cache", "mapping"];
|
|
120
|
-
var kt = /* @__PURE__ */ new Set([...jt, "config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"]);
|
|
121
|
-
|
|
122
|
-
// src/examples/step.ts
|
|
84
|
+
var import_core = require("@walkeros/core");
|
|
123
85
|
var defaultEventForwarding = {
|
|
124
86
|
title: "Default event",
|
|
125
87
|
description: "A walker event becomes an Optimizely trackEvent call with the event name and empty eventTags.",
|
|
126
|
-
in:
|
|
88
|
+
in: (0, import_core.getEvent)("page view", { timestamp: 1700000100 }),
|
|
127
89
|
out: [["optimizely.trackEvent", "page view", {}]]
|
|
128
90
|
};
|
|
129
91
|
var mappedEventName = {
|
|
130
92
|
title: "Mapped event key",
|
|
131
93
|
description: "A mapping renames the walker event to an Optimizely event key defined in the project.",
|
|
132
|
-
in:
|
|
94
|
+
in: (0, import_core.getEvent)("product view", { timestamp: 1700000101 }),
|
|
133
95
|
mapping: {
|
|
134
96
|
name: "product_viewed"
|
|
135
97
|
},
|
|
@@ -138,7 +100,7 @@ var mappedEventName = {
|
|
|
138
100
|
var orderCompleteRevenue = {
|
|
139
101
|
title: "Purchase revenue",
|
|
140
102
|
description: "An order fires an Optimizely purchase event with revenue in cents, value, and additional event tags.",
|
|
141
|
-
in:
|
|
103
|
+
in: (0, import_core.getEvent)("order complete", {
|
|
142
104
|
timestamp: 1700000102,
|
|
143
105
|
data: {
|
|
144
106
|
revenue_cents: 55500,
|
|
@@ -171,7 +133,7 @@ var orderCompleteRevenue = {
|
|
|
171
133
|
var signupWithAttributes = {
|
|
172
134
|
title: "Signup with attributes",
|
|
173
135
|
description: "A user signup sets per-event Optimizely attributes via setAttribute before firing the trackEvent.",
|
|
174
|
-
in:
|
|
136
|
+
in: (0, import_core.getEvent)("user signup", {
|
|
175
137
|
timestamp: 1700000103,
|
|
176
138
|
data: {
|
|
177
139
|
method: "google",
|
|
@@ -197,14 +159,14 @@ var signupWithAttributes = {
|
|
|
197
159
|
};
|
|
198
160
|
var wildcardIgnored = {
|
|
199
161
|
public: false,
|
|
200
|
-
in:
|
|
162
|
+
in: (0, import_core.getEvent)("debug noise", { timestamp: 1700000104 }),
|
|
201
163
|
mapping: { ignore: true },
|
|
202
164
|
out: []
|
|
203
165
|
};
|
|
204
166
|
var attributesOnlySilent = {
|
|
205
167
|
title: "Attributes only",
|
|
206
168
|
description: "A profile update sets Optimizely user attributes without firing a trackEvent for user enrichment.",
|
|
207
|
-
in:
|
|
169
|
+
in: (0, import_core.getEvent)("profile update", {
|
|
208
170
|
timestamp: 1700000105,
|
|
209
171
|
data: {
|
|
210
172
|
plan: "premium",
|
package/dist/examples/index.mjs
CHANGED
|
@@ -60,55 +60,17 @@ __export(step_exports, {
|
|
|
60
60
|
signupWithAttributes: () => signupWithAttributes,
|
|
61
61
|
wildcardIgnored: () => wildcardIgnored
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
// ../../../core/dist/index.mjs
|
|
65
|
-
var e = Object.defineProperty;
|
|
66
|
-
var s = {};
|
|
67
|
-
((t, n) => {
|
|
68
|
-
for (var r in n) e(t, r, { get: n[r], enumerable: true });
|
|
69
|
-
})(s, { Level: () => c });
|
|
70
|
-
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 || {});
|
|
71
|
-
var B = { merge: true, shallow: true, extend: true };
|
|
72
|
-
function J(e2, t = {}, n = {}) {
|
|
73
|
-
n = { ...B, ...n };
|
|
74
|
-
const r = Object.entries(t).reduce((t2, [r2, o]) => {
|
|
75
|
-
const a = e2[r2];
|
|
76
|
-
return n.merge && Array.isArray(a) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...a]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
|
|
77
|
-
}, {});
|
|
78
|
-
return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
|
|
79
|
-
}
|
|
80
|
-
function ye() {
|
|
81
|
-
let e2 = "";
|
|
82
|
-
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
83
|
-
return e2;
|
|
84
|
-
}
|
|
85
|
-
function he(e2 = {}) {
|
|
86
|
-
var _a;
|
|
87
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = J({ 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 || ye(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
88
|
-
if (e2.name) {
|
|
89
|
-
const [t2, r] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
90
|
-
t2 && r && (n.entity = t2, n.action = r);
|
|
91
|
-
}
|
|
92
|
-
return n;
|
|
93
|
-
}
|
|
94
|
-
function ve(e2 = "entity action", t = {}) {
|
|
95
|
-
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
96
|
-
return he({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, 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", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, 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": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.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 });
|
|
97
|
-
}
|
|
98
|
-
var jt = ["code", "package", "before", "next", "cache", "mapping"];
|
|
99
|
-
var kt = /* @__PURE__ */ new Set([...jt, "config", "env", "validate", "variables", "examples", "disabled", "id", "logger", "mock", "chainMocks"]);
|
|
100
|
-
|
|
101
|
-
// src/examples/step.ts
|
|
63
|
+
import { getEvent } from "@walkeros/core";
|
|
102
64
|
var defaultEventForwarding = {
|
|
103
65
|
title: "Default event",
|
|
104
66
|
description: "A walker event becomes an Optimizely trackEvent call with the event name and empty eventTags.",
|
|
105
|
-
in:
|
|
67
|
+
in: getEvent("page view", { timestamp: 1700000100 }),
|
|
106
68
|
out: [["optimizely.trackEvent", "page view", {}]]
|
|
107
69
|
};
|
|
108
70
|
var mappedEventName = {
|
|
109
71
|
title: "Mapped event key",
|
|
110
72
|
description: "A mapping renames the walker event to an Optimizely event key defined in the project.",
|
|
111
|
-
in:
|
|
73
|
+
in: getEvent("product view", { timestamp: 1700000101 }),
|
|
112
74
|
mapping: {
|
|
113
75
|
name: "product_viewed"
|
|
114
76
|
},
|
|
@@ -117,7 +79,7 @@ var mappedEventName = {
|
|
|
117
79
|
var orderCompleteRevenue = {
|
|
118
80
|
title: "Purchase revenue",
|
|
119
81
|
description: "An order fires an Optimizely purchase event with revenue in cents, value, and additional event tags.",
|
|
120
|
-
in:
|
|
82
|
+
in: getEvent("order complete", {
|
|
121
83
|
timestamp: 1700000102,
|
|
122
84
|
data: {
|
|
123
85
|
revenue_cents: 55500,
|
|
@@ -150,7 +112,7 @@ var orderCompleteRevenue = {
|
|
|
150
112
|
var signupWithAttributes = {
|
|
151
113
|
title: "Signup with attributes",
|
|
152
114
|
description: "A user signup sets per-event Optimizely attributes via setAttribute before firing the trackEvent.",
|
|
153
|
-
in:
|
|
115
|
+
in: getEvent("user signup", {
|
|
154
116
|
timestamp: 1700000103,
|
|
155
117
|
data: {
|
|
156
118
|
method: "google",
|
|
@@ -176,14 +138,14 @@ var signupWithAttributes = {
|
|
|
176
138
|
};
|
|
177
139
|
var wildcardIgnored = {
|
|
178
140
|
public: false,
|
|
179
|
-
in:
|
|
141
|
+
in: getEvent("debug noise", { timestamp: 1700000104 }),
|
|
180
142
|
mapping: { ignore: true },
|
|
181
143
|
out: []
|
|
182
144
|
};
|
|
183
145
|
var attributesOnlySilent = {
|
|
184
146
|
title: "Attributes only",
|
|
185
147
|
description: "A profile update sets Optimizely user attributes without firing a trackEvent for user enrichment.",
|
|
186
|
-
in:
|
|
148
|
+
in: getEvent("profile update", {
|
|
187
149
|
timestamp: 1700000105,
|
|
188
150
|
data: {
|
|
189
151
|
plan: "premium",
|