@walkeros/web-destination-api 1.1.4 → 1.1.6-next-1771252576264
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 +8 -8
- package/dist/examples/index.mjs +8 -8
- package/dist/walkerOS.json +91 -0
- package/package.json +14 -6
package/dist/examples/index.js
CHANGED
|
@@ -58,13 +58,13 @@ __export(events_exports, {
|
|
|
58
58
|
|
|
59
59
|
// ../../../core/dist/index.mjs
|
|
60
60
|
var e = Object.defineProperty;
|
|
61
|
-
var
|
|
61
|
+
var c = {};
|
|
62
62
|
((t, n) => {
|
|
63
63
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
64
|
-
})(
|
|
64
|
+
})(c, { Level: () => u });
|
|
65
65
|
var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
|
|
66
66
|
var A = { merge: true, shallow: true, extend: true };
|
|
67
|
-
function
|
|
67
|
+
function P(e2, t = {}, n = {}) {
|
|
68
68
|
n = { ...A, ...n };
|
|
69
69
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
70
70
|
const i = e2[o2];
|
|
@@ -72,23 +72,23 @@ function $(e2, t = {}, n = {}) {
|
|
|
72
72
|
}, {});
|
|
73
73
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Z(e2 = {}) {
|
|
76
76
|
var _a;
|
|
77
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r =
|
|
77
|
+
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: "1.3.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
78
78
|
if (e2.name) {
|
|
79
79
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
80
80
|
t2 && n2 && (r.entity = t2, r.action = n2);
|
|
81
81
|
}
|
|
82
82
|
return r;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function q(e2 = "entity action", t = {}) {
|
|
85
85
|
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 } };
|
|
86
|
-
return
|
|
86
|
+
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
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/examples/events.ts
|
|
90
90
|
function entity_action() {
|
|
91
|
-
const event =
|
|
91
|
+
const event = q("entity action");
|
|
92
92
|
return JSON.stringify(event.data);
|
|
93
93
|
}
|
|
94
94
|
|
package/dist/examples/index.mjs
CHANGED
|
@@ -36,13 +36,13 @@ __export(events_exports, {
|
|
|
36
36
|
|
|
37
37
|
// ../../../core/dist/index.mjs
|
|
38
38
|
var e = Object.defineProperty;
|
|
39
|
-
var
|
|
39
|
+
var c = {};
|
|
40
40
|
((t, n) => {
|
|
41
41
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
42
|
-
})(
|
|
42
|
+
})(c, { Level: () => u });
|
|
43
43
|
var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
|
|
44
44
|
var A = { merge: true, shallow: true, extend: true };
|
|
45
|
-
function
|
|
45
|
+
function P(e2, t = {}, n = {}) {
|
|
46
46
|
n = { ...A, ...n };
|
|
47
47
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
48
48
|
const i = e2[o2];
|
|
@@ -50,23 +50,23 @@ function $(e2, t = {}, n = {}) {
|
|
|
50
50
|
}, {});
|
|
51
51
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Z(e2 = {}) {
|
|
54
54
|
var _a;
|
|
55
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r =
|
|
55
|
+
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: "1.3.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
56
56
|
if (e2.name) {
|
|
57
57
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
58
58
|
t2 && n2 && (r.entity = t2, r.action = n2);
|
|
59
59
|
}
|
|
60
60
|
return r;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function q(e2 = "entity action", t = {}) {
|
|
63
63
|
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 } };
|
|
64
|
-
return
|
|
64
|
+
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 });
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// src/examples/events.ts
|
|
68
68
|
function entity_action() {
|
|
69
|
-
const event =
|
|
69
|
+
const event = q("entity action");
|
|
70
70
|
return JSON.stringify(event.data);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$meta": {
|
|
3
|
+
"package": "@walkeros/web-destination-api",
|
|
4
|
+
"version": "1.1.5",
|
|
5
|
+
"type": "destination",
|
|
6
|
+
"platform": "web"
|
|
7
|
+
},
|
|
8
|
+
"schemas": {
|
|
9
|
+
"mapping": {
|
|
10
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
},
|
|
15
|
+
"settings": {
|
|
16
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {
|
|
19
|
+
"url": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "uri",
|
|
22
|
+
"description": "The HTTP endpoint URL to send events to (like https://api.example.com/events)"
|
|
23
|
+
},
|
|
24
|
+
"headers": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"propertyNames": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"additionalProperties": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"description": "Additional HTTP headers to include with requests (like { 'Authorization': 'Bearer token', 'Content-Type': 'application/json' })"
|
|
33
|
+
},
|
|
34
|
+
"method": {
|
|
35
|
+
"default": "POST",
|
|
36
|
+
"description": "HTTP method for the request",
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"transform": {
|
|
40
|
+
"description": "Function to transform event data before sending (like (data, config, mapping) => JSON.stringify(data))"
|
|
41
|
+
},
|
|
42
|
+
"transport": {
|
|
43
|
+
"default": "fetch",
|
|
44
|
+
"description": "Transport method for sending requests",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"enum": [
|
|
47
|
+
"fetch",
|
|
48
|
+
"xhr",
|
|
49
|
+
"beacon"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"url",
|
|
55
|
+
"method",
|
|
56
|
+
"transport"
|
|
57
|
+
],
|
|
58
|
+
"additionalProperties": false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"examples": {
|
|
62
|
+
"env": {
|
|
63
|
+
"init": {},
|
|
64
|
+
"push": {
|
|
65
|
+
"sendWeb": {
|
|
66
|
+
"$code": "()=>{}"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"simulation": [
|
|
70
|
+
"call:sendWeb"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"events": {
|
|
74
|
+
"entity_action": {
|
|
75
|
+
"$code": "function Rg(){const e=function(e=\"entity action\",n={}){const t=n.timestamp||(new Date).setHours(0,13,37,0),i={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}};return Lg({...{\"cart view\":{data:{currency:\"EUR\",value:2*i.data.price},context:{shopping:[\"cart\",0]},globals:{pagegroup:\"shop\"},nested:[{entity:\"product\",data:{...i.data,quantity:2},context:{shopping:[\"cart\",0]},nested:[]}],trigger:\"load\"},\"checkout view\":{data:{step:\"payment\",currency:\"EUR\",value:i.data.price+r.data.price},context:{shopping:[\"checkout\",0]},globals:{pagegroup:\"shop\"},nested:[{entity:\"product\",...i,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\",...i,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\":{...i,context:{shopping:[\"intent\",0]},globals:{pagegroup:\"shop\"},nested:[],trigger:\"click\"},\"product view\":{...i,context:{shopping:[\"detail\",0]},globals:{pagegroup:\"shop\"},nested:[],trigger:\"load\"},\"product visible\":{data:{...i.data,position:3,promo:!0},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:t,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,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:!0,custom:\"value\"}}}[e],...n,name:e})}(\"entity action\");return JSON.stringify(e.data)}"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"mapping": {
|
|
79
|
+
"config": {
|
|
80
|
+
"entity": {
|
|
81
|
+
"action": {
|
|
82
|
+
"data": "data"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"entity_action": {
|
|
87
|
+
"data": "data"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-api",
|
|
3
3
|
"description": "Web API destination for walkerOS",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.6-next-1771252576264",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -30,14 +30,17 @@
|
|
|
30
30
|
"build": "tsup --silent",
|
|
31
31
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
32
32
|
"dev": "jest --watchAll --colors",
|
|
33
|
-
"
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
34
35
|
"test": "jest",
|
|
35
36
|
"update": "npx npm-check-updates -u && npm update"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@walkeros/web-core": "1.0.
|
|
39
|
+
"@walkeros/web-core": "1.0.6-next-1771252576264"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@walkeros/collector": "1.3.0-next-1771252576264"
|
|
39
43
|
},
|
|
40
|
-
"devDependencies": {},
|
|
41
44
|
"repository": {
|
|
42
45
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|
|
43
46
|
"directory": "packages/web/destinations/api"
|
|
@@ -47,12 +50,17 @@
|
|
|
47
50
|
"bugs": {
|
|
48
51
|
"url": "https://github.com/elbwalker/walkerOS/issues"
|
|
49
52
|
},
|
|
53
|
+
"walkerOS": {
|
|
54
|
+
"type": "destination",
|
|
55
|
+
"platform": "web"
|
|
56
|
+
},
|
|
50
57
|
"keywords": [
|
|
51
|
-
"walker",
|
|
52
58
|
"walkerOS",
|
|
59
|
+
"walkerOS-destination",
|
|
53
60
|
"destination",
|
|
54
61
|
"web",
|
|
55
|
-
"api"
|
|
62
|
+
"api",
|
|
63
|
+
"analytics"
|
|
56
64
|
],
|
|
57
65
|
"funding": [
|
|
58
66
|
{
|