@walkeros/web-destination-meta 0.8.0 → 1.0.1-next-1769158278557
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/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 +23 -23
- package/dist/examples/index.mjs +23 -23
- package/package.json +2 -2
package/dist/examples/index.js
CHANGED
|
@@ -99,41 +99,41 @@ __export(events_exports, {
|
|
|
99
99
|
var e = Object.defineProperty;
|
|
100
100
|
var a = {};
|
|
101
101
|
((t, n) => {
|
|
102
|
-
for (var
|
|
102
|
+
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
103
103
|
})(a, { Level: () => u });
|
|
104
104
|
var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
|
|
105
|
-
var
|
|
106
|
-
function
|
|
107
|
-
n = {
|
|
108
|
-
const
|
|
109
|
-
const i = e2[
|
|
110
|
-
return n.merge && Array.isArray(i) && Array.isArray(
|
|
105
|
+
var A = { merge: true, shallow: true, extend: true };
|
|
106
|
+
function $(e2, t = {}, n = {}) {
|
|
107
|
+
n = { ...A, ...n };
|
|
108
|
+
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
109
|
+
const i = e2[o2];
|
|
110
|
+
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;
|
|
111
111
|
}, {});
|
|
112
|
-
return n.shallow ? { ...e2, ...
|
|
112
|
+
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function P(e2) {
|
|
115
115
|
return Array.isArray(e2);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
return "object" == typeof e2 && null !== e2 && !
|
|
117
|
+
function z(e2) {
|
|
118
|
+
return "object" == typeof e2 && null !== e2 && !P(e2) && "[object Object]" === Object.prototype.toString.call(e2);
|
|
119
119
|
}
|
|
120
120
|
function H(e2 = {}) {
|
|
121
121
|
var _a;
|
|
122
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up",
|
|
122
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = $({ 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: "1.0.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
123
123
|
if (e2.name) {
|
|
124
124
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
125
|
-
t2 && n2 && (
|
|
125
|
+
t2 && n2 && (r.entity = t2, r.action = n2);
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0),
|
|
131
|
-
return H({ ...{ "cart view": { data: { currency: "EUR", value: 2 *
|
|
129
|
+
function Z(e2 = "entity action", t = {}) {
|
|
130
|
+
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 } };
|
|
131
|
+
return H({ ...{ "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 });
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// src/examples/events.ts
|
|
135
135
|
function Purchase() {
|
|
136
|
-
const event =
|
|
136
|
+
const event = Z("order complete");
|
|
137
137
|
return [
|
|
138
138
|
"track",
|
|
139
139
|
"Purchase",
|
|
@@ -148,7 +148,7 @@ function Purchase() {
|
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
150
|
function AddToCart() {
|
|
151
|
-
const event =
|
|
151
|
+
const event = Z("product add");
|
|
152
152
|
return [
|
|
153
153
|
"track",
|
|
154
154
|
"AddToCart",
|
|
@@ -162,7 +162,7 @@ function AddToCart() {
|
|
|
162
162
|
];
|
|
163
163
|
}
|
|
164
164
|
function InitiateCheckout() {
|
|
165
|
-
const event =
|
|
165
|
+
const event = Z("cart view");
|
|
166
166
|
return [
|
|
167
167
|
"track",
|
|
168
168
|
"InitiateCheckout",
|
|
@@ -179,7 +179,7 @@ function InitiateCheckout() {
|
|
|
179
179
|
];
|
|
180
180
|
}
|
|
181
181
|
function ViewContent() {
|
|
182
|
-
const event =
|
|
182
|
+
const event = Z("product view");
|
|
183
183
|
return [
|
|
184
184
|
"track",
|
|
185
185
|
"ViewContent",
|
|
@@ -212,7 +212,7 @@ var Purchase2 = {
|
|
|
212
212
|
loop: [
|
|
213
213
|
"nested",
|
|
214
214
|
{
|
|
215
|
-
condition: (entity) =>
|
|
215
|
+
condition: (entity) => z(entity) && entity.entity === "product",
|
|
216
216
|
map: {
|
|
217
217
|
id: "data.id",
|
|
218
218
|
quantity: { key: "data.quantity", value: 1 }
|
|
@@ -259,7 +259,7 @@ var InitiateCheckout2 = {
|
|
|
259
259
|
loop: [
|
|
260
260
|
"nested",
|
|
261
261
|
{
|
|
262
|
-
condition: (entity) =>
|
|
262
|
+
condition: (entity) => z(entity) && entity.entity === "product",
|
|
263
263
|
map: {
|
|
264
264
|
id: "data.id",
|
|
265
265
|
quantity: { key: "data.quantity", value: 1 }
|
package/dist/examples/index.mjs
CHANGED
|
@@ -77,41 +77,41 @@ __export(events_exports, {
|
|
|
77
77
|
var e = Object.defineProperty;
|
|
78
78
|
var a = {};
|
|
79
79
|
((t, n) => {
|
|
80
|
-
for (var
|
|
80
|
+
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
81
81
|
})(a, { Level: () => u });
|
|
82
82
|
var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
|
|
83
|
-
var
|
|
84
|
-
function
|
|
85
|
-
n = {
|
|
86
|
-
const
|
|
87
|
-
const i = e2[
|
|
88
|
-
return n.merge && Array.isArray(i) && Array.isArray(
|
|
83
|
+
var A = { merge: true, shallow: true, extend: true };
|
|
84
|
+
function $(e2, t = {}, n = {}) {
|
|
85
|
+
n = { ...A, ...n };
|
|
86
|
+
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
87
|
+
const i = e2[o2];
|
|
88
|
+
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;
|
|
89
89
|
}, {});
|
|
90
|
-
return n.shallow ? { ...e2, ...
|
|
90
|
+
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function P(e2) {
|
|
93
93
|
return Array.isArray(e2);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return "object" == typeof e2 && null !== e2 && !
|
|
95
|
+
function z(e2) {
|
|
96
|
+
return "object" == typeof e2 && null !== e2 && !P(e2) && "[object Object]" === Object.prototype.toString.call(e2);
|
|
97
97
|
}
|
|
98
98
|
function H(e2 = {}) {
|
|
99
99
|
var _a;
|
|
100
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up",
|
|
100
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = $({ 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: "1.0.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
101
101
|
if (e2.name) {
|
|
102
102
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
103
|
-
t2 && n2 && (
|
|
103
|
+
t2 && n2 && (r.entity = t2, r.action = n2);
|
|
104
104
|
}
|
|
105
|
-
return
|
|
105
|
+
return r;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0),
|
|
109
|
-
return H({ ...{ "cart view": { data: { currency: "EUR", value: 2 *
|
|
107
|
+
function Z(e2 = "entity action", t = {}) {
|
|
108
|
+
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 } };
|
|
109
|
+
return H({ ...{ "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 });
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// src/examples/events.ts
|
|
113
113
|
function Purchase() {
|
|
114
|
-
const event =
|
|
114
|
+
const event = Z("order complete");
|
|
115
115
|
return [
|
|
116
116
|
"track",
|
|
117
117
|
"Purchase",
|
|
@@ -126,7 +126,7 @@ function Purchase() {
|
|
|
126
126
|
];
|
|
127
127
|
}
|
|
128
128
|
function AddToCart() {
|
|
129
|
-
const event =
|
|
129
|
+
const event = Z("product add");
|
|
130
130
|
return [
|
|
131
131
|
"track",
|
|
132
132
|
"AddToCart",
|
|
@@ -140,7 +140,7 @@ function AddToCart() {
|
|
|
140
140
|
];
|
|
141
141
|
}
|
|
142
142
|
function InitiateCheckout() {
|
|
143
|
-
const event =
|
|
143
|
+
const event = Z("cart view");
|
|
144
144
|
return [
|
|
145
145
|
"track",
|
|
146
146
|
"InitiateCheckout",
|
|
@@ -157,7 +157,7 @@ function InitiateCheckout() {
|
|
|
157
157
|
];
|
|
158
158
|
}
|
|
159
159
|
function ViewContent() {
|
|
160
|
-
const event =
|
|
160
|
+
const event = Z("product view");
|
|
161
161
|
return [
|
|
162
162
|
"track",
|
|
163
163
|
"ViewContent",
|
|
@@ -190,7 +190,7 @@ var Purchase2 = {
|
|
|
190
190
|
loop: [
|
|
191
191
|
"nested",
|
|
192
192
|
{
|
|
193
|
-
condition: (entity) =>
|
|
193
|
+
condition: (entity) => z(entity) && entity.entity === "product",
|
|
194
194
|
map: {
|
|
195
195
|
id: "data.id",
|
|
196
196
|
quantity: { key: "data.quantity", value: 1 }
|
|
@@ -237,7 +237,7 @@ var InitiateCheckout2 = {
|
|
|
237
237
|
loop: [
|
|
238
238
|
"nested",
|
|
239
239
|
{
|
|
240
|
-
condition: (entity) =>
|
|
240
|
+
condition: (entity) => z(entity) && entity.entity === "product",
|
|
241
241
|
map: {
|
|
242
242
|
id: "data.id",
|
|
243
243
|
quantity: { key: "data.quantity", value: 1 }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-meta",
|
|
3
3
|
"description": "Meta pixel web destination for walkerOS",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1-next-1769158278557",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"update": "npx npm-check-updates -u && npm update"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@walkeros/web-core": "0.
|
|
38
|
+
"@walkeros/web-core": "1.0.1-next-1769158278557"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/facebook-pixel": "^0.0.31"
|