@walkeros/web-destination-plausible 0.6.0 → 0.6.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.
- 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 +12 -12
- package/dist/examples/index.mjs +12 -12
- package/package.json +2 -2
package/dist/examples/index.js
CHANGED
|
@@ -83,37 +83,37 @@ __export(events_exports, {
|
|
|
83
83
|
|
|
84
84
|
// ../../../core/dist/index.mjs
|
|
85
85
|
var e = Object.defineProperty;
|
|
86
|
-
var
|
|
86
|
+
var a = {};
|
|
87
87
|
((t, n) => {
|
|
88
88
|
for (var r in n) e(t, r, { get: n[r], enumerable: true });
|
|
89
|
-
})(
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
function
|
|
93
|
-
n = {
|
|
89
|
+
})(a, { 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 $ = { merge: true, shallow: true, extend: true };
|
|
92
|
+
function A(e2, t = {}, n = {}) {
|
|
93
|
+
n = { ...$, ...n };
|
|
94
94
|
const r = Object.entries(t).reduce((t2, [r2, o]) => {
|
|
95
95
|
const i = e2[r2];
|
|
96
96
|
return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
|
|
97
97
|
}, {});
|
|
98
98
|
return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function H(e2 = {}) {
|
|
101
101
|
var _a;
|
|
102
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o =
|
|
102
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o = A({ 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}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.6.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
103
103
|
if (e2.name) {
|
|
104
104
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
105
105
|
t2 && n2 && (o.entity = t2, o.action = n2);
|
|
106
106
|
}
|
|
107
107
|
return o;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function q(e2 = "entity action", t = {}) {
|
|
110
110
|
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 } };
|
|
111
|
-
return
|
|
111
|
+
return H({ ...{ "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 });
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// src/examples/events.ts
|
|
115
115
|
function purchase() {
|
|
116
|
-
const event =
|
|
116
|
+
const event = q("order complete");
|
|
117
117
|
return [
|
|
118
118
|
"purchase",
|
|
119
119
|
{
|
|
@@ -125,7 +125,7 @@ function purchase() {
|
|
|
125
125
|
];
|
|
126
126
|
}
|
|
127
127
|
function customEvent() {
|
|
128
|
-
const event =
|
|
128
|
+
const event = q();
|
|
129
129
|
return [
|
|
130
130
|
"Custom Event",
|
|
131
131
|
{
|
package/dist/examples/index.mjs
CHANGED
|
@@ -61,37 +61,37 @@ __export(events_exports, {
|
|
|
61
61
|
|
|
62
62
|
// ../../../core/dist/index.mjs
|
|
63
63
|
var e = Object.defineProperty;
|
|
64
|
-
var
|
|
64
|
+
var a = {};
|
|
65
65
|
((t, n) => {
|
|
66
66
|
for (var r in n) e(t, r, { get: n[r], enumerable: true });
|
|
67
|
-
})(
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
n = {
|
|
67
|
+
})(a, { 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 $ = { merge: true, shallow: true, extend: true };
|
|
70
|
+
function A(e2, t = {}, n = {}) {
|
|
71
|
+
n = { ...$, ...n };
|
|
72
72
|
const r = Object.entries(t).reduce((t2, [r2, o]) => {
|
|
73
73
|
const i = e2[r2];
|
|
74
74
|
return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
|
|
75
75
|
}, {});
|
|
76
76
|
return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function H(e2 = {}) {
|
|
79
79
|
var _a;
|
|
80
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o =
|
|
80
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o = A({ 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}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.6.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
81
81
|
if (e2.name) {
|
|
82
82
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
83
83
|
t2 && n2 && (o.entity = t2, o.action = n2);
|
|
84
84
|
}
|
|
85
85
|
return o;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function q(e2 = "entity action", t = {}) {
|
|
88
88
|
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 } };
|
|
89
|
-
return
|
|
89
|
+
return H({ ...{ "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 });
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// src/examples/events.ts
|
|
93
93
|
function purchase() {
|
|
94
|
-
const event =
|
|
94
|
+
const event = q("order complete");
|
|
95
95
|
return [
|
|
96
96
|
"purchase",
|
|
97
97
|
{
|
|
@@ -103,7 +103,7 @@ function purchase() {
|
|
|
103
103
|
];
|
|
104
104
|
}
|
|
105
105
|
function customEvent() {
|
|
106
|
-
const event =
|
|
106
|
+
const event = q();
|
|
107
107
|
return [
|
|
108
108
|
"Custom Event",
|
|
109
109
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-plausible",
|
|
3
3
|
"description": "Plausible web destination for walkerOS",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
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.6.
|
|
38
|
+
"@walkeros/web-core": "0.6.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {},
|
|
41
41
|
"repository": {
|