@walkeros/web-destination-api 2.0.1 → 2.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/dist/dev.d.mts +14 -26
- package/dist/dev.d.ts +14 -26
- 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.d.mts +8 -21
- package/dist/examples/index.d.ts +8 -21
- package/dist/examples/index.js +53 -45
- package/dist/examples/index.mjs +52 -43
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/walkerOS.json +139 -14
- package/package.json +3 -3
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
1
|
import { DestinationWeb, sendWeb } from '@walkeros/web-core';
|
|
2
|
+
import { Flow } from '@walkeros/core';
|
|
3
3
|
|
|
4
|
-
interface Mapping {
|
|
5
|
-
}
|
|
6
4
|
interface Env extends DestinationWeb.Env {
|
|
7
5
|
sendWeb?: typeof sendWeb;
|
|
8
6
|
}
|
|
9
|
-
type Rule = Mapping$1.Rule<Mapping>;
|
|
10
7
|
|
|
11
8
|
declare const init: Env | undefined;
|
|
12
9
|
declare const push: Env;
|
|
@@ -23,23 +20,13 @@ declare namespace env {
|
|
|
23
20
|
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
declare namespace events {
|
|
29
|
-
export { entity_action$1 as entity_action };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare const entity_action: Rule;
|
|
33
|
-
declare const config: {
|
|
34
|
-
entity: {
|
|
35
|
-
action: Rule;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
23
|
+
declare const entityAction: Flow.StepExample;
|
|
24
|
+
declare const pageView: Flow.StepExample;
|
|
38
25
|
|
|
39
|
-
declare const
|
|
40
|
-
declare const
|
|
41
|
-
declare namespace
|
|
42
|
-
export {
|
|
26
|
+
declare const step_entityAction: typeof entityAction;
|
|
27
|
+
declare const step_pageView: typeof pageView;
|
|
28
|
+
declare namespace step {
|
|
29
|
+
export { step_entityAction as entityAction, step_pageView as pageView };
|
|
43
30
|
}
|
|
44
31
|
|
|
45
|
-
export { env,
|
|
32
|
+
export { env, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
1
|
import { DestinationWeb, sendWeb } from '@walkeros/web-core';
|
|
2
|
+
import { Flow } from '@walkeros/core';
|
|
3
3
|
|
|
4
|
-
interface Mapping {
|
|
5
|
-
}
|
|
6
4
|
interface Env extends DestinationWeb.Env {
|
|
7
5
|
sendWeb?: typeof sendWeb;
|
|
8
6
|
}
|
|
9
|
-
type Rule = Mapping$1.Rule<Mapping>;
|
|
10
7
|
|
|
11
8
|
declare const init: Env | undefined;
|
|
12
9
|
declare const push: Env;
|
|
@@ -23,23 +20,13 @@ declare namespace env {
|
|
|
23
20
|
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
declare namespace events {
|
|
29
|
-
export { entity_action$1 as entity_action };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare const entity_action: Rule;
|
|
33
|
-
declare const config: {
|
|
34
|
-
entity: {
|
|
35
|
-
action: Rule;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
23
|
+
declare const entityAction: Flow.StepExample;
|
|
24
|
+
declare const pageView: Flow.StepExample;
|
|
38
25
|
|
|
39
|
-
declare const
|
|
40
|
-
declare const
|
|
41
|
-
declare namespace
|
|
42
|
-
export {
|
|
26
|
+
declare const step_entityAction: typeof entityAction;
|
|
27
|
+
declare const step_pageView: typeof pageView;
|
|
28
|
+
declare namespace step {
|
|
29
|
+
export { step_entityAction as entityAction, step_pageView as pageView };
|
|
43
30
|
}
|
|
44
31
|
|
|
45
|
-
export { env,
|
|
32
|
+
export { env, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -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
|
-
|
|
25
|
-
mapping: () => mapping_exports
|
|
24
|
+
step: () => step_exports
|
|
26
25
|
});
|
|
27
26
|
module.exports = __toCommonJS(examples_exports);
|
|
28
27
|
|
|
@@ -50,63 +49,72 @@ var simulation = [
|
|
|
50
49
|
// Track sendWeb function calls
|
|
51
50
|
];
|
|
52
51
|
|
|
53
|
-
// src/examples/
|
|
54
|
-
var
|
|
55
|
-
__export(
|
|
56
|
-
|
|
52
|
+
// src/examples/step.ts
|
|
53
|
+
var step_exports = {};
|
|
54
|
+
__export(step_exports, {
|
|
55
|
+
entityAction: () => entityAction,
|
|
56
|
+
pageView: () => pageView
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// ../../../core/dist/index.mjs
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
((
|
|
63
|
-
for (var o in n) e
|
|
64
|
-
})(
|
|
65
|
-
var u = ((
|
|
66
|
-
var
|
|
67
|
-
function
|
|
68
|
-
n = { ...
|
|
69
|
-
const o = Object.entries(
|
|
70
|
-
const i =
|
|
71
|
-
return n.merge && Array.isArray(i) && Array.isArray(r) ?
|
|
60
|
+
var t = Object.defineProperty;
|
|
61
|
+
var a = {};
|
|
62
|
+
((e, n) => {
|
|
63
|
+
for (var o in n) t(e, o, { get: n[o], enumerable: true });
|
|
64
|
+
})(a, { Level: () => u });
|
|
65
|
+
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 || {});
|
|
66
|
+
var D = { merge: true, shallow: true, extend: true };
|
|
67
|
+
function H(t2, e = {}, n = {}) {
|
|
68
|
+
n = { ...D, ...n };
|
|
69
|
+
const o = Object.entries(e).reduce((e2, [o2, r]) => {
|
|
70
|
+
const i = t2[o2];
|
|
71
|
+
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;
|
|
72
72
|
}, {});
|
|
73
|
-
return n.shallow ? { ...
|
|
73
|
+
return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function nt(t2 = {}) {
|
|
76
76
|
var _a;
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const [
|
|
80
|
-
|
|
77
|
+
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.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
|
|
78
|
+
if (t2.name) {
|
|
79
|
+
const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
|
|
80
|
+
e2 && n2 && (r.entity = e2, r.action = n2);
|
|
81
81
|
}
|
|
82
82
|
return r;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
const n =
|
|
86
|
-
return
|
|
84
|
+
function ot(t2 = "entity action", e = {}) {
|
|
85
|
+
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 } };
|
|
86
|
+
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 });
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
// src/examples/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
var entity_action2 = {
|
|
102
|
-
data: "data"
|
|
89
|
+
// src/examples/step.ts
|
|
90
|
+
var entityAction = {
|
|
91
|
+
in: ot("entity action", { timestamp: 1700000500 }),
|
|
92
|
+
mapping: {
|
|
93
|
+
data: "data"
|
|
94
|
+
},
|
|
95
|
+
out: JSON.stringify({
|
|
96
|
+
string: "foo",
|
|
97
|
+
number: 1,
|
|
98
|
+
boolean: true,
|
|
99
|
+
array: [0, "text", false]
|
|
100
|
+
})
|
|
103
101
|
};
|
|
104
|
-
var
|
|
105
|
-
|
|
102
|
+
var pageView = {
|
|
103
|
+
in: ot("page view", { timestamp: 1700000501 }),
|
|
104
|
+
mapping: {
|
|
105
|
+
data: "data"
|
|
106
|
+
},
|
|
107
|
+
out: JSON.stringify({
|
|
108
|
+
domain: "www.example.com",
|
|
109
|
+
title: "walkerOS documentation",
|
|
110
|
+
referrer: "https://www.walkeros.io/",
|
|
111
|
+
search: "?foo=bar",
|
|
112
|
+
hash: "#hash",
|
|
113
|
+
id: "/docs/"
|
|
114
|
+
})
|
|
106
115
|
};
|
|
107
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
117
|
0 && (module.exports = {
|
|
109
118
|
env,
|
|
110
|
-
|
|
111
|
-
mapping
|
|
119
|
+
step
|
|
112
120
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -28,62 +28,71 @@ var simulation = [
|
|
|
28
28
|
// Track sendWeb function calls
|
|
29
29
|
];
|
|
30
30
|
|
|
31
|
-
// src/examples/
|
|
32
|
-
var
|
|
33
|
-
__export(
|
|
34
|
-
|
|
31
|
+
// src/examples/step.ts
|
|
32
|
+
var step_exports = {};
|
|
33
|
+
__export(step_exports, {
|
|
34
|
+
entityAction: () => entityAction,
|
|
35
|
+
pageView: () => pageView
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
// ../../../core/dist/index.mjs
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
((
|
|
41
|
-
for (var o in n) e
|
|
42
|
-
})(
|
|
43
|
-
var u = ((
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
n = { ...
|
|
47
|
-
const o = Object.entries(
|
|
48
|
-
const i =
|
|
49
|
-
return n.merge && Array.isArray(i) && Array.isArray(r) ?
|
|
39
|
+
var t = Object.defineProperty;
|
|
40
|
+
var a = {};
|
|
41
|
+
((e, n) => {
|
|
42
|
+
for (var o in n) t(e, o, { get: n[o], enumerable: true });
|
|
43
|
+
})(a, { Level: () => u });
|
|
44
|
+
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 || {});
|
|
45
|
+
var D = { merge: true, shallow: true, extend: true };
|
|
46
|
+
function H(t2, e = {}, n = {}) {
|
|
47
|
+
n = { ...D, ...n };
|
|
48
|
+
const o = Object.entries(e).reduce((e2, [o2, r]) => {
|
|
49
|
+
const i = t2[o2];
|
|
50
|
+
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;
|
|
50
51
|
}, {});
|
|
51
|
-
return n.shallow ? { ...
|
|
52
|
+
return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function nt(t2 = {}) {
|
|
54
55
|
var _a;
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const [
|
|
58
|
-
|
|
56
|
+
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.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
|
|
57
|
+
if (t2.name) {
|
|
58
|
+
const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
|
|
59
|
+
e2 && n2 && (r.entity = e2, r.action = n2);
|
|
59
60
|
}
|
|
60
61
|
return r;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
const n =
|
|
64
|
-
return
|
|
63
|
+
function ot(t2 = "entity action", e = {}) {
|
|
64
|
+
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 } };
|
|
65
|
+
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 });
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
// src/examples/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
var entity_action2 = {
|
|
80
|
-
data: "data"
|
|
68
|
+
// src/examples/step.ts
|
|
69
|
+
var entityAction = {
|
|
70
|
+
in: ot("entity action", { timestamp: 1700000500 }),
|
|
71
|
+
mapping: {
|
|
72
|
+
data: "data"
|
|
73
|
+
},
|
|
74
|
+
out: JSON.stringify({
|
|
75
|
+
string: "foo",
|
|
76
|
+
number: 1,
|
|
77
|
+
boolean: true,
|
|
78
|
+
array: [0, "text", false]
|
|
79
|
+
})
|
|
81
80
|
};
|
|
82
|
-
var
|
|
83
|
-
|
|
81
|
+
var pageView = {
|
|
82
|
+
in: ot("page view", { timestamp: 1700000501 }),
|
|
83
|
+
mapping: {
|
|
84
|
+
data: "data"
|
|
85
|
+
},
|
|
86
|
+
out: JSON.stringify({
|
|
87
|
+
domain: "www.example.com",
|
|
88
|
+
title: "walkerOS documentation",
|
|
89
|
+
referrer: "https://www.walkeros.io/",
|
|
90
|
+
search: "?foo=bar",
|
|
91
|
+
hash: "#hash",
|
|
92
|
+
id: "/docs/"
|
|
93
|
+
})
|
|
84
94
|
};
|
|
85
95
|
export {
|
|
86
96
|
env_exports as env,
|
|
87
|
-
|
|
88
|
-
mapping_exports as mapping
|
|
97
|
+
step_exports as step
|
|
89
98
|
};
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Walkerjs=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o={};((t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})})(o,{DestinationAPI:()=>g,default:()=>v,destinationAPI:()=>y});var s=Object.defineProperty;((e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})})({},{Level:()=>i});var a,i=((a=i||{})[a.ERROR=0]="ERROR",a[a.
|
|
1
|
+
"use strict";var Walkerjs=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o={};((t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})})(o,{DestinationAPI:()=>g,default:()=>v,destinationAPI:()=>y});var s=Object.defineProperty;((e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})})({},{Level:()=>i});var a,i=((a=i||{})[a.ERROR=0]="ERROR",a[a.WARN=1]="WARN",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a),c={merge:!0,shallow:!0,extend:!0};function u(e,t,r){return function(...n){try{return e(...n)}catch(e){if(!t)return;return t(e)}finally{null==r||r()}}}function f(e){return void 0===e||function(e,t){return typeof e==typeof t}(e,"")?e:JSON.stringify(e)}function d(e={}){return function(e,t={},r={}){r={...c,...r};const n=Object.entries(t).reduce((t,[n,o])=>{const s=e[n];return r.merge&&Array.isArray(s)&&Array.isArray(o)?t[n]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(r.extend||n in e)&&(t[n]=o),t},{});return r.shallow?{...e,...n}:(Object.assign(e,n),e)}({"Content-Type":"application/json; charset=utf-8"},e)}function l(e,t,r={transport:"fetch"}){switch(r.transport||"fetch"){case"beacon":return function(e,t){const r=f(t),n=navigator.sendBeacon(e,r);return{ok:n,error:n?void 0:"Failed to send beacon"}}(e,t);case"xhr":return function(e,t,r={}){const n=d(r.headers),o=r.method||"POST",s=f(t);return u(()=>{const t=new XMLHttpRequest;t.open(o,e,!1);for(const e in n)t.setRequestHeader(e,n[e]);t.send(s);const r=t.status>=200&&t.status<300;return{ok:r,data:u(JSON.parse,()=>t.response)(t.response),error:r?void 0:`${t.status} ${t.statusText}`}},e=>({ok:!1,error:e.message}))()}(e,t,r);default:return async function(e,t,r={}){const n=d(r.headers),o=f(t);return function(e,t,r){return async function(...n){try{return await e(...n)}catch(e){if(!t)return;return await t(e)}finally{await(null==r?void 0:r())}}}(async()=>{const t=await fetch(e,{method:r.method||"POST",headers:n,keepalive:!0,credentials:r.credentials||"same-origin",mode:r.noCors?"no-cors":"cors",body:o}),s=r.noCors?"":await t.text();return{ok:t.ok,data:s,error:t.ok?void 0:t.statusText}},e=>({ok:!1,error:e.message}))()}(e,t,r)}}var g={};function p(e,t,r){const{url:n,headers:o,method:s,transport:a="fetch"}=t;r(n,e,{headers:o,method:s,transport:a})}var h,y={type:"api",config:{},init({config:e,logger:t}){const{url:r}=e.settings||{};r||t.throw("Config settings url missing")},push(e,{config:t,rule:r,data:n,env:o,logger:s}){const{settings:a}=t,{url:i,transform:c}=a||{},u=function(e){return void 0!==e}(n)?n:e;p(c?c(u,t,r):JSON.stringify(u),a,o.sendWeb||l)},pushBatch(e,{config:t,rule:r,env:n}){const o=t.settings,{transform:s}=o,a=e.data.length?e.data:e.events,i=s?a.map(e=>s(e,t,r)):a;p(JSON.stringify(i),o,n.sendWeb||l)}},v=y;return h=o,((o,s,a,i)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of r(s))n.call(o,c)||c===a||e(o,c,{get:()=>s[c],enumerable:!(i=t(s,c))||i.enumerable});return o})(e({},"__esModule",{value:!0}),h)})();
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _array_with_holes(r){if(Array.isArray(r))return r}function _array_without_holes(r){if(Array.isArray(r))return _array_like_to_array(r)}function asyncGeneratorStep(r,e,t,n,o,a,i){try{var u=r[a](i),c=u.value}catch(r){return void t(r)}u.done?e(c):Promise.resolve(c).then(n,o)}function _async_to_generator(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function i(r){asyncGeneratorStep(a,n,o,i,u,"next",r)}function u(r){asyncGeneratorStep(a,n,o,i,u,"throw",r)}i(void 0)})}}function _define_property(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _iterable_to_array(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _iterable_to_array_limit(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,a=[],i=!0,u=!1;try{for(t=t.call(r);!(i=(n=t.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(r){u=!0,o=r}finally{try{i||null==t.return||t.return()}finally{if(u)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.forEach(function(e){_define_property(r,e,t[e])})}return r}function _sliced_to_array(r,e){return _array_with_holes(r)||_iterable_to_array_limit(r,e)||_unsupported_iterable_to_array(r,e)||_non_iterable_rest()}function _to_consumable_array(r){return _array_without_holes(r)||_iterable_to_array(r)||_unsupported_iterable_to_array(r)||_non_iterable_spread()}function _type_of(r){return r&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r}function _unsupported_iterable_to_array(r,e){if(r){if("string"==typeof r)return _array_like_to_array(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_array_like_to_array(r,e):void 0}}function _ts_generator(r,e){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r],n=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Walkerjs=function(){var r=function(r,e,t){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];try{return r.apply(void 0,_to_consumable_array(o))}catch(r){if(!e)return;return e(r)}finally{null==t||t()}}},e=function(r,e,t){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,r.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),e?[4,e(n)]:[2];case 4:return[4,null==t?void 0:t()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},t=function(r){return void 0===r||function(r,e){return(void 0===r?"undefined":_type_of(r))==(void 0===e?"undefined":_type_of(e))}(r,"")?r:JSON.stringify(r)},n=function(){return function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=_object_spread({},h,t);var n=Object.entries(e).reduce(function(e,n){var o=_sliced_to_array(n,2),a=o[0],i=o[1],u=r[a];return t.merge&&Array.isArray(u)&&Array.isArray(i)?e[a]=i.reduce(function(r,e){return r.includes(e)?r:_to_consumable_array(r).concat([e])},_to_consumable_array(u)):(t.extend||a in r)&&(e[a]=i),e},{});return t.shallow?_object_spread({},r,n):(Object.assign(r,n),r)}({"Content-Type":"application/json; charset=utf-8"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})},o=function(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{transport:"fetch"};switch(t.transport||"fetch"){case"beacon":return i(r,e);case"xhr":return u(r,e,t);default:return a(r,e,t)}},a=function(r,o){return _async_to_generator(function(r,o){var a,i,u,c=arguments;return _ts_generator(this,function(s){return i=n((a=c.length>2&&void 0!==c[2]?c[2]:{}).headers),u=t(o),[2,e(function(){return _async_to_generator(function(){var e,t,n;return _ts_generator(this,function(o){switch(o.label){case 0:return[4,fetch(r,{method:a.method||"POST",headers:i,keepalive:!0,credentials:a.credentials||"same-origin",mode:a.noCors?"no-cors":"cors",body:u})];case 1:return e=o.sent(),a.noCors?(n="",[3,4]):[3,2];case 2:return[4,e.text()];case 3:n=o.sent(),o.label=4;case 4:return t=n,[2,{ok:e.ok,data:t,error:e.ok?void 0:e.statusText}]}})})()},function(r){return{ok:!1,error:r.message}})()]})}).apply(this,arguments)},i=function(r,e){var n=t(e),o=navigator.sendBeacon(r,n);return{ok:o,error:o?void 0:"Failed to send beacon"}},u=function(e,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n(a.headers),u=a.method||"POST",c=t(o);return r(function(){var t=new XMLHttpRequest;for(var n in t.open(u,e,!1),i)t.setRequestHeader(n,i[n]);t.send(c);var o=t.status>=200&&t.status<300;return{ok:o,data:r(JSON.parse,function(){return t.response})(t.response),error:o?void 0:"".concat(t.status," ").concat(t.statusText)}},function(r){return{ok:!1,error:r.message}})()},c=function(r,e,t){var n=e.url,o=e.headers,a=e.method,i=e.transport;t(n,r,{headers:o,method:a,transport:void 0===i?"fetch":i})},s=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,_=Object.prototype.hasOwnProperty,y={};!function(r,e){for(var t in e)s(r,t,{get:e[t],enumerable:!0})}(y,{DestinationAPI:function(){return g},default:function(){return w},destinationAPI:function(){return m}});var d=Object.defineProperty;!function(r,e){for(var t in e)d(r,t,{get:e[t],enumerable:!0})}({},{Level:function(){return v}});var p,b,v=((p=v||{})[p.ERROR=0]="ERROR",p[p.
|
|
1
|
+
"use strict";function _array_like_to_array(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _array_with_holes(r){if(Array.isArray(r))return r}function _array_without_holes(r){if(Array.isArray(r))return _array_like_to_array(r)}function asyncGeneratorStep(r,e,t,n,o,a,i){try{var u=r[a](i),c=u.value}catch(r){return void t(r)}u.done?e(c):Promise.resolve(c).then(n,o)}function _async_to_generator(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function i(r){asyncGeneratorStep(a,n,o,i,u,"next",r)}function u(r){asyncGeneratorStep(a,n,o,i,u,"throw",r)}i(void 0)})}}function _define_property(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _iterable_to_array(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _iterable_to_array_limit(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,a=[],i=!0,u=!1;try{for(t=t.call(r);!(i=(n=t.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(r){u=!0,o=r}finally{try{i||null==t.return||t.return()}finally{if(u)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.forEach(function(e){_define_property(r,e,t[e])})}return r}function _sliced_to_array(r,e){return _array_with_holes(r)||_iterable_to_array_limit(r,e)||_unsupported_iterable_to_array(r,e)||_non_iterable_rest()}function _to_consumable_array(r){return _array_without_holes(r)||_iterable_to_array(r)||_unsupported_iterable_to_array(r)||_non_iterable_spread()}function _type_of(r){return r&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r}function _unsupported_iterable_to_array(r,e){if(r){if("string"==typeof r)return _array_like_to_array(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_array_like_to_array(r,e):void 0}}function _ts_generator(r,e){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=e.call(r,a)}catch(r){u=[6,r],n=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Walkerjs=function(){var r=function(r,e,t){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];try{return r.apply(void 0,_to_consumable_array(o))}catch(r){if(!e)return;return e(r)}finally{null==t||t()}}},e=function(r,e,t){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,r.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),e?[4,e(n)]:[2];case 4:return[4,null==t?void 0:t()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},t=function(r){return void 0===r||function(r,e){return(void 0===r?"undefined":_type_of(r))==(void 0===e?"undefined":_type_of(e))}(r,"")?r:JSON.stringify(r)},n=function(){return function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=_object_spread({},h,t);var n=Object.entries(e).reduce(function(e,n){var o=_sliced_to_array(n,2),a=o[0],i=o[1],u=r[a];return t.merge&&Array.isArray(u)&&Array.isArray(i)?e[a]=i.reduce(function(r,e){return r.includes(e)?r:_to_consumable_array(r).concat([e])},_to_consumable_array(u)):(t.extend||a in r)&&(e[a]=i),e},{});return t.shallow?_object_spread({},r,n):(Object.assign(r,n),r)}({"Content-Type":"application/json; charset=utf-8"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})},o=function(r,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{transport:"fetch"};switch(t.transport||"fetch"){case"beacon":return i(r,e);case"xhr":return u(r,e,t);default:return a(r,e,t)}},a=function(r,o){return _async_to_generator(function(r,o){var a,i,u,c=arguments;return _ts_generator(this,function(s){return i=n((a=c.length>2&&void 0!==c[2]?c[2]:{}).headers),u=t(o),[2,e(function(){return _async_to_generator(function(){var e,t,n;return _ts_generator(this,function(o){switch(o.label){case 0:return[4,fetch(r,{method:a.method||"POST",headers:i,keepalive:!0,credentials:a.credentials||"same-origin",mode:a.noCors?"no-cors":"cors",body:u})];case 1:return e=o.sent(),a.noCors?(n="",[3,4]):[3,2];case 2:return[4,e.text()];case 3:n=o.sent(),o.label=4;case 4:return t=n,[2,{ok:e.ok,data:t,error:e.ok?void 0:e.statusText}]}})})()},function(r){return{ok:!1,error:r.message}})()]})}).apply(this,arguments)},i=function(r,e){var n=t(e),o=navigator.sendBeacon(r,n);return{ok:o,error:o?void 0:"Failed to send beacon"}},u=function(e,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n(a.headers),u=a.method||"POST",c=t(o);return r(function(){var t=new XMLHttpRequest;for(var n in t.open(u,e,!1),i)t.setRequestHeader(n,i[n]);t.send(c);var o=t.status>=200&&t.status<300;return{ok:o,data:r(JSON.parse,function(){return t.response})(t.response),error:o?void 0:"".concat(t.status," ").concat(t.statusText)}},function(r){return{ok:!1,error:r.message}})()},c=function(r,e,t){var n=e.url,o=e.headers,a=e.method,i=e.transport;t(n,r,{headers:o,method:a,transport:void 0===i?"fetch":i})},s=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,_=Object.prototype.hasOwnProperty,y={};!function(r,e){for(var t in e)s(r,t,{get:e[t],enumerable:!0})}(y,{DestinationAPI:function(){return g},default:function(){return w},destinationAPI:function(){return m}});var d=Object.defineProperty;!function(r,e){for(var t in e)d(r,t,{get:e[t],enumerable:!0})}({},{Level:function(){return v}});var p,b,v=((p=v||{})[p.ERROR=0]="ERROR",p[p.WARN=1]="WARN",p[p.INFO=2]="INFO",p[p.DEBUG=3]="DEBUG",p),h={merge:!0,shallow:!0,extend:!0},g={},m={type:"api",config:{},init:function(r){var e=r.config,t=r.logger;(e.settings||{}).url||t.throw("Config settings url missing")},push:function(r,e){var t=e.config,n=e.rule,a=e.data,i=e.env,u=(e.logger,t.settings),s=u||{},l=(s.url,s.transform),f=function(r){return void 0!==r}(a)?a:r,_=l?l(f,t,n):JSON.stringify(f);c(_,u,i.sendWeb||o)},pushBatch:function(r,e){var t=e.config,n=e.rule,a=e.env,i=t.settings,u=i.transform,s=r.data.length?r.data:r.events,l=u?s.map(function(r){return u(r,t,n)}):s;c(JSON.stringify(l),i,a.sendWeb||o)}},w=m;return b=y,function(r,e,t,n){if(e&&"object"===(void 0===e?"undefined":_type_of(e))||"function"==typeof e){var o=!0,a=!1,i=void 0;try{for(var u,c=function(){var o=u.value;_.call(r,o)||o===t||s(r,o,{get:function(){return e[o]},enumerable:!(n=l(e,o))||n.enumerable})},y=f(e)[Symbol.iterator]();!(o=(u=y.next()).done);o=!0)c()}catch(r){a=!0,i=r}finally{try{o||null==y.return||y.return()}finally{if(a)throw i}}}return r}(s({},"__esModule",{value:!0}),b)}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={};((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})(s,{DestinationAPI:()=>u,default:()=>d,destinationAPI:()=>l}),module.exports=(e=s,((e,s,a,i)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of n(s))o.call(e,c)||c===a||t(e,c,{get:()=>s[c],enumerable:!(i=r(s,c))||i.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=Object.defineProperty;((e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})})({},{Level:()=>c});var i,c=((i=c||{})[i.ERROR=0]="ERROR",i[i.
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s={};((e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})})(s,{DestinationAPI:()=>u,default:()=>d,destinationAPI:()=>l}),module.exports=(e=s,((e,s,a,i)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of n(s))o.call(e,c)||c===a||t(e,c,{get:()=>s[c],enumerable:!(i=r(s,c))||i.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=Object.defineProperty;((e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})})({},{Level:()=>c});var i,c=((i=c||{})[i.ERROR=0]="ERROR",i[i.WARN=1]="WARN",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i);var f=require("@walkeros/web-core"),u={};function g(e,t,r){const{url:n,headers:o,method:s,transport:a="fetch"}=t;r(n,e,{headers:o,method:s,transport:a})}var l={type:"api",config:{},init({config:e,logger:t}){const{url:r}=e.settings||{};r||t.throw("Config settings url missing")},push(e,{config:t,rule:r,data:n,env:o,logger:s}){const{settings:a}=t,{url:i,transform:c}=a||{},u=function(e){return void 0!==e}(n)?n:e;g(c?c(u,t,r):JSON.stringify(u),a,o.sendWeb||f.sendWeb)},pushBatch(e,{config:t,rule:r,env:n}){const o=t.settings,{transform:s}=o,a=e.data.length?e.data:e.events,i=s?a.map(e=>s(e,t,r)):a;g(JSON.stringify(i),o,n.sendWeb||f.sendWeb)}},d=l;//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty;((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Level:()=>n});var e,n=((e=n||{})[e.ERROR=0]="ERROR",e[e.
|
|
1
|
+
var t=Object.defineProperty;((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})({},{Level:()=>n});var e,n=((e=n||{})[e.ERROR=0]="ERROR",e[e.WARN=1]="WARN",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e),r={merge:!0,shallow:!0,extend:!0};function o(t,e,n){return function(...r){try{return t(...r)}catch(t){if(!e)return;return e(t)}finally{null==n||n()}}}function s(t){return void 0===t||function(t,e){return typeof t==typeof e}(t,"")?t:JSON.stringify(t)}function a(t={}){return function(t,e={},n={}){n={...r,...n};const o=Object.entries(e).reduce((e,[r,o])=>{const s=t[r];return n.merge&&Array.isArray(s)&&Array.isArray(o)?e[r]=o.reduce((t,e)=>t.includes(e)?t:[...t,e],[...s]):(n.extend||r in t)&&(e[r]=o),e},{});return n.shallow?{...t,...o}:(Object.assign(t,o),t)}({"Content-Type":"application/json; charset=utf-8"},t)}function i(t,e,n={transport:"fetch"}){switch(n.transport||"fetch"){case"beacon":return function(t,e){const n=s(e),r=navigator.sendBeacon(t,n);return{ok:r,error:r?void 0:"Failed to send beacon"}}(t,e);case"xhr":return function(t,e,n={}){const r=a(n.headers),i=n.method||"POST",c=s(e);return o(()=>{const e=new XMLHttpRequest;e.open(i,t,!1);for(const t in r)e.setRequestHeader(t,r[t]);e.send(c);const n=e.status>=200&&e.status<300;return{ok:n,data:o(JSON.parse,()=>e.response)(e.response),error:n?void 0:`${e.status} ${e.statusText}`}},t=>({ok:!1,error:t.message}))()}(t,e,n);default:return async function(t,e,n={}){const r=a(n.headers),o=s(e);return function(t,e,n){return async function(...r){try{return await t(...r)}catch(t){if(!e)return;return await e(t)}finally{await(null==n?void 0:n())}}}(async()=>{const e=await fetch(t,{method:n.method||"POST",headers:r,keepalive:!0,credentials:n.credentials||"same-origin",mode:n.noCors?"no-cors":"cors",body:o}),s=n.noCors?"":await e.text();return{ok:e.ok,data:s,error:e.ok?void 0:e.statusText}},t=>({ok:!1,error:t.message}))()}(t,e,n)}}var c={};function u(t,e,n){const{url:r,headers:o,method:s,transport:a="fetch"}=e;n(r,t,{headers:o,method:s,transport:a})}var d={type:"api",config:{},init({config:t,logger:e}){const{url:n}=t.settings||{};n||e.throw("Config settings url missing")},push(t,{config:e,rule:n,data:r,env:o,logger:s}){const{settings:a}=e,{url:c,transform:d}=a||{},f=function(t){return void 0!==t}(r)?r:t;u(d?d(f,e,n):JSON.stringify(f),a,o.sendWeb||i)},pushBatch(t,{config:e,rule:n,env:r}){const o=e.settings,{transform:s}=o,a=t.data.length?t.data:t.events,c=s?a.map(t=>s(t,e,n)):a;u(JSON.stringify(c),o,r.sendWeb||i)}},f=d;export{c as DestinationAPI,f as default,d as destinationAPI};//# sourceMappingURL=index.mjs.map
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-api",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": "web"
|
|
7
7
|
},
|
|
@@ -70,21 +70,146 @@
|
|
|
70
70
|
"call:sendWeb"
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
"step": {
|
|
74
|
+
"entityAction": {
|
|
75
|
+
"in": {
|
|
76
|
+
"name": "entity action",
|
|
77
|
+
"data": {
|
|
78
|
+
"string": "foo",
|
|
79
|
+
"number": 1,
|
|
80
|
+
"boolean": true,
|
|
81
|
+
"array": [
|
|
82
|
+
0,
|
|
83
|
+
"text",
|
|
84
|
+
false
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"context": {
|
|
88
|
+
"dev": [
|
|
89
|
+
"test",
|
|
90
|
+
1
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"globals": {
|
|
94
|
+
"lang": "elb"
|
|
95
|
+
},
|
|
96
|
+
"custom": {
|
|
97
|
+
"completely": "random"
|
|
98
|
+
},
|
|
99
|
+
"user": {
|
|
100
|
+
"id": "us3r",
|
|
101
|
+
"device": "c00k13",
|
|
102
|
+
"session": "s3ss10n"
|
|
103
|
+
},
|
|
104
|
+
"nested": [
|
|
105
|
+
{
|
|
106
|
+
"entity": "child",
|
|
107
|
+
"data": {
|
|
108
|
+
"is": "subordinated"
|
|
109
|
+
},
|
|
110
|
+
"nested": [],
|
|
111
|
+
"context": {
|
|
112
|
+
"element": [
|
|
113
|
+
"child",
|
|
114
|
+
0
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"consent": {
|
|
120
|
+
"functional": true
|
|
121
|
+
},
|
|
122
|
+
"id": "1700000500-gr0up-1",
|
|
123
|
+
"trigger": "test",
|
|
124
|
+
"entity": "entity",
|
|
125
|
+
"action": "action",
|
|
126
|
+
"timestamp": 1700000500,
|
|
127
|
+
"timing": 3.14,
|
|
128
|
+
"group": "gr0up",
|
|
129
|
+
"count": 1,
|
|
130
|
+
"version": {
|
|
131
|
+
"source": "2.0.1",
|
|
132
|
+
"tagging": 1
|
|
133
|
+
},
|
|
134
|
+
"source": {
|
|
135
|
+
"type": "web",
|
|
136
|
+
"id": "https://localhost:80",
|
|
137
|
+
"previous_id": "http://remotehost:9001"
|
|
83
138
|
}
|
|
84
|
-
}
|
|
139
|
+
},
|
|
140
|
+
"mapping": {
|
|
141
|
+
"data": "data"
|
|
142
|
+
},
|
|
143
|
+
"out": "{\"string\":\"foo\",\"number\":1,\"boolean\":true,\"array\":[0,\"text\",false]}"
|
|
85
144
|
},
|
|
86
|
-
"
|
|
87
|
-
"
|
|
145
|
+
"pageView": {
|
|
146
|
+
"in": {
|
|
147
|
+
"name": "page view",
|
|
148
|
+
"data": {
|
|
149
|
+
"domain": "www.example.com",
|
|
150
|
+
"title": "walkerOS documentation",
|
|
151
|
+
"referrer": "https://www.walkeros.io/",
|
|
152
|
+
"search": "?foo=bar",
|
|
153
|
+
"hash": "#hash",
|
|
154
|
+
"id": "/docs/"
|
|
155
|
+
},
|
|
156
|
+
"context": {
|
|
157
|
+
"dev": [
|
|
158
|
+
"test",
|
|
159
|
+
1
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"globals": {
|
|
163
|
+
"pagegroup": "docs"
|
|
164
|
+
},
|
|
165
|
+
"custom": {
|
|
166
|
+
"completely": "random"
|
|
167
|
+
},
|
|
168
|
+
"user": {
|
|
169
|
+
"id": "us3r",
|
|
170
|
+
"device": "c00k13",
|
|
171
|
+
"session": "s3ss10n"
|
|
172
|
+
},
|
|
173
|
+
"nested": [
|
|
174
|
+
{
|
|
175
|
+
"entity": "child",
|
|
176
|
+
"data": {
|
|
177
|
+
"is": "subordinated"
|
|
178
|
+
},
|
|
179
|
+
"nested": [],
|
|
180
|
+
"context": {
|
|
181
|
+
"element": [
|
|
182
|
+
"child",
|
|
183
|
+
0
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"consent": {
|
|
189
|
+
"functional": true
|
|
190
|
+
},
|
|
191
|
+
"id": "1700000501-gr0up-1",
|
|
192
|
+
"trigger": "load",
|
|
193
|
+
"entity": "page",
|
|
194
|
+
"action": "view",
|
|
195
|
+
"timestamp": 1700000501,
|
|
196
|
+
"timing": 3.14,
|
|
197
|
+
"group": "gr0up",
|
|
198
|
+
"count": 1,
|
|
199
|
+
"version": {
|
|
200
|
+
"source": "2.0.1",
|
|
201
|
+
"tagging": 1
|
|
202
|
+
},
|
|
203
|
+
"source": {
|
|
204
|
+
"type": "web",
|
|
205
|
+
"id": "https://localhost:80",
|
|
206
|
+
"previous_id": "http://remotehost:9001"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"mapping": {
|
|
210
|
+
"data": "data"
|
|
211
|
+
},
|
|
212
|
+
"out": "{\"domain\":\"www.example.com\",\"title\":\"walkerOS documentation\",\"referrer\":\"https://www.walkeros.io/\",\"search\":\"?foo=bar\",\"hash\":\"#hash\",\"id\":\"/docs/\"}"
|
|
88
213
|
}
|
|
89
214
|
}
|
|
90
215
|
}
|