@walkeros/web-destination-meta 0.1.0 → 0.1.2

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.
@@ -1,5 +1,4 @@
1
1
  import { Mapping as Mapping$1 } from '@walkeros/core';
2
- import { DestinationWeb } from '@walkeros/web-core';
3
2
 
4
3
  declare function Purchase$1(): unknown[];
5
4
  declare function AddToCart$1(): unknown[];
@@ -11,20 +10,11 @@ declare namespace events {
11
10
  }
12
11
 
13
12
  declare global {
14
- namespace WalkerOS {
15
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
- }
17
- }
18
13
  interface Window {
19
14
  _fbq?: facebook.Pixel.Event;
20
15
  fbq?: facebook.Pixel.Event;
21
16
  }
22
17
  }
23
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
- type Config = DestinationWeb.Config<Settings, Mapping>;
25
- interface Settings {
26
- pixelId?: string;
27
- }
28
18
  interface Mapping {
29
19
  track?: StandardEventNames;
30
20
  trackCustom?: string;
@@ -58,9 +48,4 @@ declare namespace mapping {
58
48
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
49
  }
60
50
 
61
- declare const destinationMetaExamples: {
62
- events: typeof events;
63
- mapping: typeof mapping;
64
- };
65
-
66
- export { destinationMetaExamples };
51
+ export { events, mapping };
@@ -1,5 +1,4 @@
1
1
  import { Mapping as Mapping$1 } from '@walkeros/core';
2
- import { DestinationWeb } from '@walkeros/web-core';
3
2
 
4
3
  declare function Purchase$1(): unknown[];
5
4
  declare function AddToCart$1(): unknown[];
@@ -11,20 +10,11 @@ declare namespace events {
11
10
  }
12
11
 
13
12
  declare global {
14
- namespace WalkerOS {
15
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
- }
17
- }
18
13
  interface Window {
19
14
  _fbq?: facebook.Pixel.Event;
20
15
  fbq?: facebook.Pixel.Event;
21
16
  }
22
17
  }
23
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
- type Config = DestinationWeb.Config<Settings, Mapping>;
25
- interface Settings {
26
- pixelId?: string;
27
- }
28
18
  interface Mapping {
29
19
  track?: StandardEventNames;
30
20
  trackCustom?: string;
@@ -58,9 +48,4 @@ declare namespace mapping {
58
48
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
49
  }
60
50
 
61
- declare const destinationMetaExamples: {
62
- events: typeof events;
63
- mapping: typeof mapping;
64
- };
65
-
66
- export { destinationMetaExamples };
51
+ export { events, mapping };
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/examples/index.ts
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
- destinationMetaExamples: () => destinationMetaExamples
23
+ events: () => events_exports,
24
+ mapping: () => mapping_exports
24
25
  });
25
26
  module.exports = __toCommonJS(examples_exports);
26
27
 
@@ -38,7 +39,7 @@ var e;
38
39
  var t;
39
40
  var n = Object.getOwnPropertyNames;
40
41
  var r = (e = { "package.json"(e2, t2) {
41
- t2.exports = { name: "@walkeros/core", description: "Core types and platform-agnostic utilities for walkerOS", version: "0.1.0", main: "./dist/index.js", module: "./dist/index.mjs", types: "./dist/index.d.ts", license: "MIT", files: ["dist/**"], scripts: { build: "tsup --silent", clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist", dev: "jest --watchAll --colors", lint: 'tsc && eslint "**/*.ts*"', test: "jest", update: "npx npm-check-updates -u && npm update" }, dependencies: {}, devDependencies: {}, repository: { url: "git+https://github.com/elbwalker/walkerOS.git", directory: "packages/core" }, author: "elbwalker <hello@elbwalker.com>", homepage: "https://github.com/elbwalker/walkerOS#readme", bugs: { url: "https://github.com/elbwalker/walkerOS/issues" }, keywords: ["walker", "walkerOS", "analytics", "tracking", "data collection", "measurement", "data privacy", "privacy friendly", "web analytics", "product analytics", "core", "types", "utils"], funding: [{ type: "GitHub Sponsors", url: "https://github.com/sponsors/elbwalker" }] };
42
+ t2.exports = { name: "@walkeros/core", description: "Core types and platform-agnostic utilities for walkerOS", version: "0.1.2", main: "./dist/index.js", module: "./dist/index.mjs", types: "./dist/index.d.ts", license: "MIT", files: ["dist/**"], scripts: { build: "tsup --silent", clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist", dev: "jest --watchAll --colors", lint: 'tsc && eslint "**/*.ts*"', test: "jest", update: "npx npm-check-updates -u && npm update" }, dependencies: {}, devDependencies: {}, repository: { url: "git+https://github.com/elbwalker/walkerOS.git", directory: "packages/core" }, author: "elbwalker <hello@elbwalker.com>", homepage: "https://github.com/elbwalker/walkerOS#readme", bugs: { url: "https://github.com/elbwalker/walkerOS/issues" }, keywords: ["walker", "walkerOS", "analytics", "tracking", "data collection", "measurement", "data privacy", "privacy friendly", "web analytics", "product analytics", "core", "types", "utils"], funding: [{ type: "GitHub Sponsors", url: "https://github.com/sponsors/elbwalker" }] };
42
43
  } }, function() {
43
44
  return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
44
45
  });
@@ -57,24 +58,24 @@ function k(e2) {
57
58
  function M(e2) {
58
59
  return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
59
60
  }
60
- var { version: V } = r();
61
- function H(e2 = {}) {
61
+ var { version: R } = r();
62
+ function V(e2 = {}) {
62
63
  var _a;
63
- const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n2 = e2.group || "gr0up", r2 = e2.count || 1, o = v({ 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: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: V, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
64
+ const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n2 = e2.group || "gr0up", r2 = e2.count || 1, o = v({ 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: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: R, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
64
65
  if (e2.name) {
65
66
  const [t3, n3] = (_a = e2.name.split(" ")) != null ? _a : [];
66
67
  t3 && n3 && (o.entity = t3, o.action = n3);
67
68
  }
68
69
  return o;
69
70
  }
70
- function z(e2 = "entity action", t2 = {}) {
71
+ function H(e2 = "entity action", t2 = {}) {
71
72
  const n2 = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r2 = { 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 } };
72
- return H({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r2.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r2.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r2, 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", ...r2, 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.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r2, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r2, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r2.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: n2, 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], ...t2, name: e2 });
73
+ return V({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r2.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r2.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r2, 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", ...r2, 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.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r2, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r2, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r2.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: n2, 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], ...t2, name: e2 });
73
74
  }
74
75
 
75
76
  // src/examples/events.ts
76
77
  function Purchase() {
77
- const event = z("order complete");
78
+ const event = H("order complete");
78
79
  return [
79
80
  "track",
80
81
  "Purchase",
@@ -89,7 +90,7 @@ function Purchase() {
89
90
  ];
90
91
  }
91
92
  function AddToCart() {
92
- const event = z("product add");
93
+ const event = H("product add");
93
94
  return [
94
95
  "track",
95
96
  "AddToCart",
@@ -103,7 +104,7 @@ function AddToCart() {
103
104
  ];
104
105
  }
105
106
  function InitiateCheckout() {
106
- const event = z("cart view");
107
+ const event = H("cart view");
107
108
  return [
108
109
  "track",
109
110
  "InitiateCheckout",
@@ -120,7 +121,7 @@ function InitiateCheckout() {
120
121
  ];
121
122
  }
122
123
  function ViewContent() {
123
- const event = z("product view");
124
+ const event = H("product view");
124
125
  return [
125
126
  "track",
126
127
  "ViewContent",
@@ -241,13 +242,8 @@ var config = {
241
242
  product: { view: ViewContent2, add: AddToCart2 },
242
243
  cart: { view: InitiateCheckout2 }
243
244
  };
244
-
245
- // src/examples/index.ts
246
- var destinationMetaExamples = {
247
- events: events_exports,
248
- mapping: mapping_exports
249
- };
250
245
  // Annotate the CommonJS export names for ESM import in node:
251
246
  0 && (module.exports = {
252
- destinationMetaExamples
247
+ events,
248
+ mapping
253
249
  });
@@ -18,7 +18,7 @@ var e;
18
18
  var t;
19
19
  var n = Object.getOwnPropertyNames;
20
20
  var r = (e = { "package.json"(e2, t2) {
21
- t2.exports = { name: "@walkeros/core", description: "Core types and platform-agnostic utilities for walkerOS", version: "0.1.0", main: "./dist/index.js", module: "./dist/index.mjs", types: "./dist/index.d.ts", license: "MIT", files: ["dist/**"], scripts: { build: "tsup --silent", clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist", dev: "jest --watchAll --colors", lint: 'tsc && eslint "**/*.ts*"', test: "jest", update: "npx npm-check-updates -u && npm update" }, dependencies: {}, devDependencies: {}, repository: { url: "git+https://github.com/elbwalker/walkerOS.git", directory: "packages/core" }, author: "elbwalker <hello@elbwalker.com>", homepage: "https://github.com/elbwalker/walkerOS#readme", bugs: { url: "https://github.com/elbwalker/walkerOS/issues" }, keywords: ["walker", "walkerOS", "analytics", "tracking", "data collection", "measurement", "data privacy", "privacy friendly", "web analytics", "product analytics", "core", "types", "utils"], funding: [{ type: "GitHub Sponsors", url: "https://github.com/sponsors/elbwalker" }] };
21
+ t2.exports = { name: "@walkeros/core", description: "Core types and platform-agnostic utilities for walkerOS", version: "0.1.2", main: "./dist/index.js", module: "./dist/index.mjs", types: "./dist/index.d.ts", license: "MIT", files: ["dist/**"], scripts: { build: "tsup --silent", clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist", dev: "jest --watchAll --colors", lint: 'tsc && eslint "**/*.ts*"', test: "jest", update: "npx npm-check-updates -u && npm update" }, dependencies: {}, devDependencies: {}, repository: { url: "git+https://github.com/elbwalker/walkerOS.git", directory: "packages/core" }, author: "elbwalker <hello@elbwalker.com>", homepage: "https://github.com/elbwalker/walkerOS#readme", bugs: { url: "https://github.com/elbwalker/walkerOS/issues" }, keywords: ["walker", "walkerOS", "analytics", "tracking", "data collection", "measurement", "data privacy", "privacy friendly", "web analytics", "product analytics", "core", "types", "utils"], funding: [{ type: "GitHub Sponsors", url: "https://github.com/sponsors/elbwalker" }] };
22
22
  } }, function() {
23
23
  return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
24
24
  });
@@ -37,24 +37,24 @@ function k(e2) {
37
37
  function M(e2) {
38
38
  return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
39
39
  }
40
- var { version: V } = r();
41
- function H(e2 = {}) {
40
+ var { version: R } = r();
41
+ function V(e2 = {}) {
42
42
  var _a;
43
- const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n2 = e2.group || "gr0up", r2 = e2.count || 1, o = v({ 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: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: V, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
43
+ const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n2 = e2.group || "gr0up", r2 = e2.count || 1, o = v({ 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: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: R, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
44
44
  if (e2.name) {
45
45
  const [t3, n3] = (_a = e2.name.split(" ")) != null ? _a : [];
46
46
  t3 && n3 && (o.entity = t3, o.action = n3);
47
47
  }
48
48
  return o;
49
49
  }
50
- function z(e2 = "entity action", t2 = {}) {
50
+ function H(e2 = "entity action", t2 = {}) {
51
51
  const n2 = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r2 = { 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 } };
52
- return H({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r2.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r2.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r2, 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", ...r2, 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.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r2, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r2, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r2.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: n2, 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], ...t2, name: e2 });
52
+ return V({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r2.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r2.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r2, 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", ...r2, 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.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r2, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r2, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r2.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: n2, 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], ...t2, name: e2 });
53
53
  }
54
54
 
55
55
  // src/examples/events.ts
56
56
  function Purchase() {
57
- const event = z("order complete");
57
+ const event = H("order complete");
58
58
  return [
59
59
  "track",
60
60
  "Purchase",
@@ -69,7 +69,7 @@ function Purchase() {
69
69
  ];
70
70
  }
71
71
  function AddToCart() {
72
- const event = z("product add");
72
+ const event = H("product add");
73
73
  return [
74
74
  "track",
75
75
  "AddToCart",
@@ -83,7 +83,7 @@ function AddToCart() {
83
83
  ];
84
84
  }
85
85
  function InitiateCheckout() {
86
- const event = z("cart view");
86
+ const event = H("cart view");
87
87
  return [
88
88
  "track",
89
89
  "InitiateCheckout",
@@ -100,7 +100,7 @@ function InitiateCheckout() {
100
100
  ];
101
101
  }
102
102
  function ViewContent() {
103
- const event = z("product view");
103
+ const event = H("product view");
104
104
  return [
105
105
  "track",
106
106
  "ViewContent",
@@ -221,12 +221,7 @@ var config = {
221
221
  product: { view: ViewContent2, add: AddToCart2 },
222
222
  cart: { view: InitiateCheckout2 }
223
223
  };
224
-
225
- // src/examples/index.ts
226
- var destinationMetaExamples = {
227
- events: events_exports,
228
- mapping: mapping_exports
229
- };
230
224
  export {
231
- destinationMetaExamples
225
+ events_exports as events,
226
+ mapping_exports as mapping
232
227
  };
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var t,e,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,e)=>{for(var a in e)n(t,a,{get:e[a],enumerable:!0})},s={};i(s,{DestinationMeta:()=>h,default:()=>R,destinationMeta:()=>A,destinationMetaExamples:()=>v});var c=Object.getOwnPropertyNames,d=(t={"package.json"(t,e){e.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.0",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return e||(0,t[c(t)[0]])((e={exports:{}}).exports,e),e.exports}),u={merge:!0,shallow:!0,extend:!0};function p(t){return"object"==typeof t&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)}var{version:l}=d();function g(t={}){var e;const n=t.timestamp||(new Date).setHours(0,13,37,0),a=t.group||"gr0up",o=t.count||1,r=function(t,e={},n={}){n={...u,...n};const a=Object.entries(e).reduce((e,[a,o])=>{const r=t[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?e[a]=o.reduce((t,e)=>t.includes(e)?t:[...t,e],[...r]):(n.extend||a in t)&&(e[a]=o),e},{});return n.shallow?{...t,...a}:(Object.assign(t,a),t)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:l,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},t,{merge:!1});if(t.name){const[n,a]=null!=(e=t.name.split(" "))?e:[];n&&a&&(r.entity=n,r.action=a)}return r}function m(t="entity action",e={}){const n=e.timestamp||(new Date).setHours(0,13,37,0),a={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}};return g({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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"}}}[t],...e,name:t})}function y(t){const e={window:globalThis.window,document:globalThis.document};return t?{...e,...t}:e}var h={},v={};i(v,{destinationMetaExamples:()=>D});var b={};function w(){const t=m("order complete");return["track","Purchase",{value:t.data.total,currency:"EUR",contents:t.nested.filter(t=>"product"===t.entity).map(t=>({id:t.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:t.id}]}function f(){const t=m("product add");return["track","AddToCart",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]}function k(){const t=m("cart view");return["track","InitiateCheckout",{currency:"EUR",value:t.data.value,contents:t.nested.filter(t=>"product"===t.entity).map(t=>({id:t.data.id,quantity:t.data.quantity})),num_items:t.nested.filter(t=>"product"===t.entity).length},{eventID:t.id}]}function x(){const t=m("product view");return["track","ViewContent",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]}i(b,{AddToCart:()=>f,InitiateCheckout:()=>k,Purchase:()=>w,ViewContent:()=>x});var q={};i(q,{AddToCart:()=>j,InitiateCheckout:()=>_,Purchase:()=>C,ViewContent:()=>E,config:()=>S});var O,C={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>p(t)&&"product"===t.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:t=>t.nested.filter(t=>"product"===t.entity).length}}}},j={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},_={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>p(t)&&"product"===t.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:t=>t.nested.filter(t=>"product"===t.entity).length}}}},E={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},S={order:{complete:C},product:{view:E,add:j},cart:{view:_}},D={events:b,mapping:q},A={type:"meta-pixel",config:{},init({config:t,env:e}){const{settings:n={},loadScript:a}=t,{pixelId:o}=n;if(a&&function(t,e="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=y(t),a=n.createElement("script");a.src=e,a.async=!0,n.head.appendChild(a)}(e),!o)return!1;!function(t){const{window:e}=y(t),n=e;if(n.fbq)return;const a=function(...t){a.callMethod?a.callMethod.apply(a,t):a.queue.push(t)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(e);const{window:r}=y(e);return(0,r.fbq)("init",o),t},push(t,{config:e,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=y(o),c=s.fbq;"page view"!==t.name||n.settings||(t.name="PageView");const d=r||i||t.name;c(i?"trackCustom":"track",String(d),p(a)?a:{},{eventID:t.id})}},R=A;return O=s,((t,e,i,s)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let c of o(e))r.call(t,c)||c===i||n(t,c,{get:()=>e[c],enumerable:!(s=a(e,c))||s.enumerable});return t})(n({},"__esModule",{value:!0}),O)})();
1
+ "use strict";var Destination=(()=>{var e,t,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})},s={};i(s,{DestinationMeta:()=>h,default:()=>A,destinationMeta:()=>D,examples:()=>v});var c=Object.getOwnPropertyNames,d=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[c(e)[0]])((t={exports:{}}).exports,t),t.exports}),u={merge:!0,shallow:!0,extend:!0};function p(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:l}=d();function g(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...u,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:l,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function m(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={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}};return g({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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],...t,name:e})}function y(e){const t={window:globalThis.window,document:globalThis.document};return e?{...t,...e}:t}var h={},v={};i(v,{events:()=>b,mapping:()=>q});var b={};function w(){const e=m("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function f(){const e=m("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function k(){const e=m("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function x(){const e=m("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}i(b,{AddToCart:()=>f,InitiateCheckout:()=>k,Purchase:()=>w,ViewContent:()=>x});var q={};i(q,{AddToCart:()=>j,InitiateCheckout:()=>_,Purchase:()=>C,ViewContent:()=>S,config:()=>E});var O,C={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>p(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},j={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},_={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>p(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},S={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},E={order:{complete:C},product:{view:S,add:j},cart:{view:_}},D={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{pixelId:o}=n;if(a&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=y(e),a=n.createElement("script");a.src=t,a.async=!0,n.head.appendChild(a)}(t),!o)return!1;!function(e){const{window:t}=y(e),n=t;if(n.fbq)return;const a=function(...e){a.callMethod?a.callMethod.apply(a,e):a.queue.push(e)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(t);const{window:r}=y(t);return(0,r.fbq)("init",o),e},push(e,{config:t,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=y(o),c=s.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=r||i||e.name;c(i?"trackCustom":"track",String(d),p(a)?a:{},{eventID:e.id})}},A=D;return O=s,((e,t,i,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of o(t))r.call(e,c)||c===i||n(e,c,{get:()=>t[c],enumerable:!(s=a(t,c))||s.enumerable});return e})(n({},"__esModule",{value:!0}),O)})();
package/dist/index.d.mts CHANGED
@@ -2,10 +2,6 @@ import { Mapping as Mapping$1 } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  declare global {
5
- namespace WalkerOS {
6
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
7
- }
8
- }
9
5
  interface Window {
10
6
  _fbq?: facebook.Pixel.Event;
11
7
  fbq?: facebook.Pixel.Event;
@@ -78,16 +74,12 @@ declare namespace mapping {
78
74
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
79
75
  }
80
76
 
81
- declare const destinationMetaExamples: {
82
- events: typeof events;
83
- mapping: typeof mapping;
84
- };
85
-
86
- declare const index_destinationMetaExamples: typeof destinationMetaExamples;
77
+ declare const index_events: typeof events;
78
+ declare const index_mapping: typeof mapping;
87
79
  declare namespace index {
88
- export { index_destinationMetaExamples as destinationMetaExamples };
80
+ export { index_events as events, index_mapping as mapping };
89
81
  }
90
82
 
91
83
  declare const destinationMeta: Destination;
92
84
 
93
- export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
85
+ export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as examples };
package/dist/index.d.ts CHANGED
@@ -2,10 +2,6 @@ import { Mapping as Mapping$1 } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
4
  declare global {
5
- namespace WalkerOS {
6
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
7
- }
8
- }
9
5
  interface Window {
10
6
  _fbq?: facebook.Pixel.Event;
11
7
  fbq?: facebook.Pixel.Event;
@@ -78,16 +74,12 @@ declare namespace mapping {
78
74
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
79
75
  }
80
76
 
81
- declare const destinationMetaExamples: {
82
- events: typeof events;
83
- mapping: typeof mapping;
84
- };
85
-
86
- declare const index_destinationMetaExamples: typeof destinationMetaExamples;
77
+ declare const index_events: typeof events;
78
+ declare const index_mapping: typeof mapping;
87
79
  declare namespace index {
88
- export { index_destinationMetaExamples as destinationMetaExamples };
80
+ export { index_events as events, index_mapping as mapping };
89
81
  }
90
82
 
91
83
  declare const destinationMeta: Destination;
92
84
 
93
- export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
85
+ export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as examples };
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)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(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}var Destination=function(){var e,t,r=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.timestamp||(new Date).setHours(0,13,37,0),r=e.group||"gr0up",n=e.count||1,o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r=_object_spread({},g,r);var n=Object.entries(t).reduce(function(t,n){var o=_sliced_to_array(n,2),a=o[0],i=o[1],c=e[a];return r.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(r.extend||a in e)&&(t[a]=i),t},{});return r.shallow?_object_spread({},e,n):(Object.assign(e,n),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:"".concat(t,"-").concat(r,"-").concat(n),trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:r,count:n,version:{source:v,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){var a,i=_sliced_to_array(null!==(a=e.name.split(" "))&&void 0!==a?a:[],2),c=i[0],u=i[1];c&&u&&(o.entity=c,o.action=u)}return o},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"entity action",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.timestamp||(new Date).setHours(0,13,37,0),o={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},a={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return n(_object_spread_props(_object_spread({},{"cart view":{data:{currency:"EUR",value:2*o.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:_object_spread_props(_object_spread({},o.data),{quantity:2}),context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:o.data.price+a.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[_object_spread_props(_object_spread({entity:"product"},o),{context:{shopping:["checkout",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{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:[_object_spread_props(_object_spread({entity:"product"},o),{context:{shopping:["complete",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":_object_spread_props(_object_spread({},o),{context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"}),"product view":_object_spread_props(_object_spread({},o),{context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"}),"product visible":{data:_object_spread_props(_object_spread({},o.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:r,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],t),{name:e}))},a=function(e){var t={window:globalThis.window,document:globalThis.document};return e?_object_spread({},t,e):t},i=function(){var e=o("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(function(e){return"product"===e.entity}).map(function(e){return{id:e.data.id,quantity:1}}),content_type:"product",num_items:2},{eventID:e.id}]},c=function(){var e=o("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]},u=function(){var e=o("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(function(e){return"product"===e.entity}).map(function(e){return{id:e.data.id,quantity:e.data.quantity}}),num_items:e.nested.filter(function(e){return"product"===e.entity}).length},{eventID:e.id}]},s=function(){var e=o("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]},d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,y=Object.prototype.hasOwnProperty,_=function(e,t){for(var r in t)d(e,r,{get:t[r],enumerable:!0})},f={};_(f,{DestinationMeta:function(){return h},default:function(){return D},destinationMeta:function(){return C},destinationMetaExamples:function(){return w}});var b=Object.getOwnPropertyNames,m=(e={"package.json":function(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.0",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[b(e)[0]])((t={exports:{}}).exports,t),t.exports}),g={merge:!0,shallow:!0,extend:!0},v=m().version,h={},w={};_(w,{destinationMetaExamples:function(){return E}});var j={};_(j,{AddToCart:function(){return c},InitiateCheckout:function(){return u},Purchase:function(){return i},ViewContent:function(){return s}});var k={};_(k,{AddToCart:function(){return S},InitiateCheckout:function(){return q},Purchase:function(){return x},ViewContent:function(){return A},config:function(){return P}});var O,x={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:function(e){return e.nested.filter(function(e){return"product"===e.entity}).length}}}}},S={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},q={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:function(e){return e.nested.filter(function(e){return"product"===e.entity}).length}}}}},A={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},P={order:{complete:x},product:{view:A,add:S},cart:{view:q}},E={events:j,mapping:k},C={type:"meta-pixel",config:{},init:function(e){var t=e.config,r=e.env,n=t.settings,o=void 0===n?{}:n,i=t.loadScript,c=o.pixelId;return i&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",r=a(e).document,n=r.createElement("script");n.src=t,n.async=!0,r.head.appendChild(n)}(r),!!c&&(function(e){var t=a(e).window;if(!t.fbq){var r=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.callMethod?r.callMethod.apply(r,t):r.queue.push(t)};t.fbq=r,t._fbq||(t._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}}(r),(0,a(r).window.fbq)("init",c),t)},push:function(e,t){t.config;var n=t.mapping,o=void 0===n?{}:n,i=t.data,c=t.env,u=o.settings||{},s=u.track,d=u.trackCustom,p=a(c).window.fbq;"page view"!==e.name||o.settings||(e.name="PageView");var l=s||d||e.name;p(d?"trackCustom":"track",String(l),r(i)?i:{},{eventID:e.id})}},D=C;return O=f,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var c,u=function(){var o=c.value;y.call(e,o)||o===r||d(e,o,{get:function(){return t[o]},enumerable:!(n=p(t,o))||n.enumerable})},s=l(t)[Symbol.iterator]();!(o=(c=s.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(a)throw i}}}return e}(d({},"__esModule",{value:!0}),O)}();
1
+ "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)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(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}var Destination=function(){var e,t,r=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.timestamp||(new Date).setHours(0,13,37,0),r=e.group||"gr0up",n=e.count||1,o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r=_object_spread({},m,r);var n=Object.entries(t).reduce(function(t,n){var o=_sliced_to_array(n,2),a=o[0],i=o[1],c=e[a];return r.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(r.extend||a in e)&&(t[a]=i),t},{});return r.shallow?_object_spread({},e,n):(Object.assign(e,n),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:"".concat(t,"-").concat(r,"-").concat(n),trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:r,count:n,version:{source:v,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){var a,i=_sliced_to_array(null!==(a=e.name.split(" "))&&void 0!==a?a:[],2),c=i[0],u=i[1];c&&u&&(o.entity=c,o.action=u)}return o},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"entity action",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.timestamp||(new Date).setHours(0,13,37,0),o={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},a={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return n(_object_spread_props(_object_spread({},{"cart view":{data:{currency:"EUR",value:2*o.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:_object_spread_props(_object_spread({},o.data),{quantity:2}),context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:o.data.price+a.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[_object_spread_props(_object_spread({entity:"product"},o),{context:{shopping:["checkout",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{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:[_object_spread_props(_object_spread({entity:"product"},o),{context:{shopping:["complete",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":_object_spread_props(_object_spread({},o),{context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"}),"product view":_object_spread_props(_object_spread({},o),{context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"}),"product visible":{data:_object_spread_props(_object_spread({},o.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:r,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],t),{name:e}))},a=function(e){var t={window:globalThis.window,document:globalThis.document};return e?_object_spread({},t,e):t},i=function(){var e=o("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(function(e){return"product"===e.entity}).map(function(e){return{id:e.data.id,quantity:1}}),content_type:"product",num_items:2},{eventID:e.id}]},c=function(){var e=o("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]},u=function(){var e=o("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(function(e){return"product"===e.entity}).map(function(e){return{id:e.data.id,quantity:e.data.quantity}}),num_items:e.nested.filter(function(e){return"product"===e.entity}).length},{eventID:e.id}]},s=function(){var e=o("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]},d=Object.defineProperty,p=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,y=Object.prototype.hasOwnProperty,_=function(e,t){for(var r in t)d(e,r,{get:t[r],enumerable:!0})},f={};_(f,{DestinationMeta:function(){return h},default:function(){return E},destinationMeta:function(){return C},examples:function(){return w}});var b=Object.getOwnPropertyNames,g=(e={"package.json":function(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[b(e)[0]])((t={exports:{}}).exports,t),t.exports}),m={merge:!0,shallow:!0,extend:!0},v=g().version,h={},w={};_(w,{events:function(){return j},mapping:function(){return k}});var j={};_(j,{AddToCart:function(){return c},InitiateCheckout:function(){return u},Purchase:function(){return i},ViewContent:function(){return s}});var k={};_(k,{AddToCart:function(){return S},InitiateCheckout:function(){return q},Purchase:function(){return x},ViewContent:function(){return A},config:function(){return P}});var O,x={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:function(e){return e.nested.filter(function(e){return"product"===e.entity}).length}}}}},S={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},q={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:function(e){return e.nested.filter(function(e){return"product"===e.entity}).length}}}}},A={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},P={order:{complete:x},product:{view:A,add:S},cart:{view:q}},C={type:"meta-pixel",config:{},init:function(e){var t=e.config,r=e.env,n=t.settings,o=void 0===n?{}:n,i=t.loadScript,c=o.pixelId;return i&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",r=a(e).document,n=r.createElement("script");n.src=t,n.async=!0,r.head.appendChild(n)}(r),!!c&&(function(e){var t=a(e).window;if(!t.fbq){var r=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.callMethod?r.callMethod.apply(r,t):r.queue.push(t)};t.fbq=r,t._fbq||(t._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}}(r),(0,a(r).window.fbq)("init",c),t)},push:function(e,t){t.config;var n=t.mapping,o=void 0===n?{}:n,i=t.data,c=t.env,u=o.settings||{},s=u.track,d=u.trackCustom,p=a(c).window.fbq;"page view"!==e.name||o.settings||(e.name="PageView");var l=s||d||e.name;p(d?"trackCustom":"track",String(l),r(i)?i:{},{eventID:e.id})}},E=C;return O=f,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var c,u=function(){var o=c.value;y.call(e,o)||o===r||d(e,o,{get:function(){return t[o]},enumerable:!(n=p(t,o))||n.enumerable})},s=l(t)[Symbol.iterator]();!(o=(c=s.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(a)throw i}}}return e}(d({},"__esModule",{value:!0}),O)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},i={};r(i,{DestinationMeta:()=>b,default:()=>U,destinationMeta:()=>R,destinationMetaExamples:()=>w}),module.exports=(e=i,((e,r,i,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of a(r))o.call(e,c)||c===i||t(e,c,{get:()=>r[c],enumerable:!(s=n(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s,c,d=require("@walkeros/web-core");var u=Object.getOwnPropertyNames,p=(s={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.0",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return c||(0,s[u(s)[0]])((c={exports:{}}).exports,c),c.exports}),l={merge:!0,shallow:!0,extend:!0};function g(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:m}=p();function y(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...l,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:m,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function h(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={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}};return y({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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],...t,name:e})}var v=require("@walkeros/web-core"),b={},w={};r(w,{destinationMetaExamples:()=>D});var f={};function k(){const e=h("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function x(){const e=h("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function q(){const e=h("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function E(){const e=h("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}r(f,{AddToCart:()=>x,InitiateCheckout:()=>q,Purchase:()=>k,ViewContent:()=>E});var O={};r(O,{AddToCart:()=>j,InitiateCheckout:()=>_,Purchase:()=>C,ViewContent:()=>S,config:()=>A});var C={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},j={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},_={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},S={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},A={order:{complete:C},product:{view:S,add:j},cart:{view:_}},D={events:f,mapping:O},R={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{pixelId:o}=n;if(a&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=(0,d.getEnvironment)(e),a=n.createElement("script");a.src=t,a.async=!0,n.head.appendChild(a)}(t),!o)return!1;!function(e){const{window:t}=(0,d.getEnvironment)(e),n=t;if(n.fbq)return;const a=function(...e){a.callMethod?a.callMethod.apply(a,e):a.queue.push(e)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(t);const{window:r}=(0,v.getEnvironment)(t);return(0,r.fbq)("init",o),e},push(e,{config:t,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=(0,v.getEnvironment)(o),c=s.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=r||i||e.name;c(i?"trackCustom":"track",String(d),g(a)?a:{},{eventID:e.id})}},U=R;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},i={};r(i,{DestinationMeta:()=>b,default:()=>R,destinationMeta:()=>D,examples:()=>w}),module.exports=(e=i,((e,r,i,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of a(r))o.call(e,c)||c===i||t(e,c,{get:()=>r[c],enumerable:!(s=n(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s,c,d=require("@walkeros/web-core");var u=Object.getOwnPropertyNames,p=(s={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return c||(0,s[u(s)[0]])((c={exports:{}}).exports,c),c.exports}),l={merge:!0,shallow:!0,extend:!0};function g(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:m}=p();function y(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...l,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:m,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function h(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={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}};return y({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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],...t,name:e})}var v=require("@walkeros/web-core"),b={},w={};r(w,{events:()=>f,mapping:()=>C});var f={};function k(){const e=h("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function x(){const e=h("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function q(){const e=h("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function O(){const e=h("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}r(f,{AddToCart:()=>x,InitiateCheckout:()=>q,Purchase:()=>k,ViewContent:()=>O});var C={};r(C,{AddToCart:()=>j,InitiateCheckout:()=>_,Purchase:()=>E,ViewContent:()=>S,config:()=>A});var E={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},j={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},_={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},S={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},A={order:{complete:E},product:{view:S,add:j},cart:{view:_}},D={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{pixelId:o}=n;if(a&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=(0,d.getEnvironment)(e),a=n.createElement("script");a.src=t,a.async=!0,n.head.appendChild(a)}(t),!o)return!1;!function(e){const{window:t}=(0,d.getEnvironment)(e),n=t;if(n.fbq)return;const a=function(...e){a.callMethod?a.callMethod.apply(a,e):a.queue.push(e)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(t);const{window:r}=(0,v.getEnvironment)(t);return(0,r.fbq)("init",o),e},push(e,{config:t,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=(0,v.getEnvironment)(o),c=s.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=r||i||e.name;c(i?"trackCustom":"track",String(d),g(a)?a:{},{eventID:e.id})}},R=D;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/setup.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/events.ts","../src/examples/mapping.ts"],"sourcesContent":["import type { Settings, Destination } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnvironment } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n// Examples\nexport * as destinationMetaExamples from './examples';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env }) {\n const { settings = {} as Partial<Settings>, loadScript } = config;\n const { pixelId } = settings;\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n fbq('init', pixelId);\n\n return config;\n },\n\n push(event, { config, mapping = {}, data, env }) {\n const { track, trackCustom } = mapping.settings || {};\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n\n // page view\n if (event.name === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnvironment } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Environment,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnvironment(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\ninterface FBQFunction {\n (...args: unknown[]): void;\n callMethod?: (this: FBQFunction, ...args: unknown[]) => void;\n queue: unknown[];\n push: FBQFunction;\n loaded: boolean;\n version: string;\n}\n\nexport function setup(env?: DestinationWeb.Environment) {\n const { window } = getEnvironment(env);\n const w = window as unknown as {\n fbq?: FBQFunction;\n _fbq?: FBQFunction;\n };\n if (w.fbq as unknown) return;\n\n const n = function (...args: unknown[]): void {\n n.callMethod ? n.callMethod.apply(n, args) : n.queue.push(args);\n } as FBQFunction;\n\n w.fbq = n;\n if (!w._fbq) w._fbq = n;\n n.push = n;\n n.loaded = true;\n n.version = '2.0';\n n.queue = [];\n}\n","import type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n // Augment the global WalkerOS namespace with destination-specific types\n namespace WalkerOS {\n interface Elb extends Elb.RegisterDestination<Destination, Config> {}\n }\n\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\n// Meta-specific environment that includes fbq\nexport interface MetaEnvironment {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: Document;\n}\n\nexport type Destination = DestinationWeb.Destination<Settings, Mapping>;\nexport type Config = DestinationWeb.Config<Settings, Mapping>;\n\n// Destination-specific settings (internal usage)\nexport interface Settings {\n pixelId?: string; // Required pixel id\n}\n\n// Single event transformation rule\nexport interface Mapping {\n track?: StandardEventNames; // Name of a standard event to track\n trackCustom?: string; // Name of a custom event to track\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n","import * as events from './events';\nimport * as mapping from './mapping';\n\nexport const destinationMetaExamples = {\n events,\n mapping,\n};\n","import { getEvent } from '@walkeros/core';\n\nexport function Purchase(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n 'track',\n 'Purchase',\n {\n value: event.data.total,\n currency: 'EUR',\n contents: event.nested\n .filter((item) => item.entity === 'product')\n .map((item) => ({ id: item.data.id, quantity: 1 })),\n content_type: 'product',\n num_items: 2,\n },\n { eventID: event.id },\n ];\n}\n\nexport function AddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n\nexport function InitiateCheckout(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: event.data.value,\n contents: event.nested\n .filter((entity) => entity.entity === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.entity === 'product')\n .length,\n },\n { eventID: event.id },\n ];\n}\n\nexport function ViewContent(): unknown[] {\n const event = getEvent('product view');\n\n return [\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n","import type { Mapping, WalkerOS } from '@walkeros/core';\nimport type { DestinationMeta } from '..';\nimport { isObject } from '@walkeros/core';\n\nexport const Purchase: DestinationMeta.Rule = {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.total',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const AddToCart: DestinationMeta.Rule = {\n name: 'AddToCart',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n },\n },\n};\n\nexport const InitiateCheckout: DestinationMeta.Rule = {\n name: 'InitiateCheckout',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const ViewContent: DestinationMeta.Rule = {\n name: 'ViewContent',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n content_type: { value: 'product' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n};\n\nexport const config = {\n order: { complete: Purchase },\n product: { view: ViewContent, add: AddToCart },\n cart: { view: InitiateCheckout },\n} satisfies DestinationMeta.Rules;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,sBAA+B;AAExB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,UAAAA,UAAS,QAAI,gCAAe,GAAG;AACvC,QAAM,SAASA,UAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,EAAAA,UAAS,KAAK,YAAY,MAAM;AAClC;AAWO,SAAS,MAAM,KAAkC;AACtD,QAAM,EAAE,OAAO,QAAI,gCAAe,GAAG;AACrC,QAAMC,KAAI;AAIV,MAAIA,GAAE,IAAgB;AAEtB,QAAMC,KAAI,YAAa,MAAuB;AAC5C,IAAAA,GAAE,aAAaA,GAAE,WAAW,MAAMA,IAAG,IAAI,IAAIA,GAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,EAAAD,GAAE,MAAMC;AACR,MAAI,CAACD,GAAE,KAAM,CAAAA,GAAE,OAAOC;AACtB,EAAAA,GAAE,OAAOA;AACT,EAAAA,GAAE,SAAS;AACX,EAAAA,GAAE,UAAU;AACZ,EAAAA,GAAE,QAAQ,CAAC;AACb;A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A;AACF;;;AHKO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAAE,SAAQ,IAAI,GAAG;AACpB,UAAM,EAAE,WAAW,CAAC,GAAwB,WAAW,IAAIA;AAC3D,UAAM,EAAE,QAAQ,IAAI;AAGpB,QAAI,WAAY,WAAU,GAAG;AAG7B,QAAI,CAAC,QAAS,QAAO;AAGrB,UAAM,GAAG;AAET,UAAM,EAAE,OAAO,QAAI,iCAAe,GAAG;AACrC,UAAM,MAAM,OAAO;AACnB,QAAI,QAAQ,OAAO;AAEnB,WAAOA;AAAA,EACT;AAAA,EAEA,KAAK,OAAO,EAAE,QAAAA,SAAQ,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AAC/C,UAAM,EAAE,OAAO,YAAY,IAAI,QAAQ,YAAY,CAAC;AACpD,UAAM,EAAE,OAAO,QAAI,iCAAe,GAAG;AACrC,UAAM,MAAM,OAAO;AAGnB,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AAEnD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,MAChB,EAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["document","w","n","import_web_core","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/setup.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/events.ts","../src/examples/mapping.ts"],"sourcesContent":["import type { Settings, Destination } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnvironment } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env }) {\n const { settings = {} as Partial<Settings>, loadScript } = config;\n const { pixelId } = settings;\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n fbq('init', pixelId);\n\n return config;\n },\n\n push(event, { config, mapping = {}, data, env }) {\n const { track, trackCustom } = mapping.settings || {};\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n\n // page view\n if (event.name === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnvironment } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Environment,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnvironment(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\ninterface FBQFunction {\n (...args: unknown[]): void;\n callMethod?: (this: FBQFunction, ...args: unknown[]) => void;\n queue: unknown[];\n push: FBQFunction;\n loaded: boolean;\n version: string;\n}\n\nexport function setup(env?: DestinationWeb.Environment) {\n const { window } = getEnvironment(env);\n const w = window as unknown as {\n fbq?: FBQFunction;\n _fbq?: FBQFunction;\n };\n if (w.fbq as unknown) return;\n\n const n = function (...args: unknown[]): void {\n n.callMethod ? n.callMethod.apply(n, args) : n.queue.push(args);\n } as FBQFunction;\n\n w.fbq = n;\n if (!w._fbq) w._fbq = n;\n n.push = n;\n n.loaded = true;\n n.version = '2.0';\n n.queue = [];\n}\n","import type { Mapping as WalkerOSMapping } from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\n// Meta-specific environment that includes fbq\nexport interface MetaEnvironment {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: Document;\n}\n\nexport type Destination = DestinationWeb.Destination<Settings, Mapping>;\nexport type Config = DestinationWeb.Config<Settings, Mapping>;\n\n// Destination-specific settings (internal usage)\nexport interface Settings {\n pixelId?: string; // Required pixel id\n}\n\n// Single event transformation rule\nexport interface Mapping {\n track?: StandardEventNames; // Name of a standard event to track\n trackCustom?: string; // Name of a custom event to track\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n","export * as events from './events';\nexport * as mapping from './mapping';\n","import { getEvent } from '@walkeros/core';\n\nexport function Purchase(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n 'track',\n 'Purchase',\n {\n value: event.data.total,\n currency: 'EUR',\n contents: event.nested\n .filter((item) => item.entity === 'product')\n .map((item) => ({ id: item.data.id, quantity: 1 })),\n content_type: 'product',\n num_items: 2,\n },\n { eventID: event.id },\n ];\n}\n\nexport function AddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n\nexport function InitiateCheckout(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: event.data.value,\n contents: event.nested\n .filter((entity) => entity.entity === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.entity === 'product')\n .length,\n },\n { eventID: event.id },\n ];\n}\n\nexport function ViewContent(): unknown[] {\n const event = getEvent('product view');\n\n return [\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n","import type { Mapping, WalkerOS } from '@walkeros/core';\nimport type { DestinationMeta } from '..';\nimport { isObject } from '@walkeros/core';\n\nexport const Purchase: DestinationMeta.Rule = {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.total',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const AddToCart: DestinationMeta.Rule = {\n name: 'AddToCart',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n },\n },\n};\n\nexport const InitiateCheckout: DestinationMeta.Rule = {\n name: 'InitiateCheckout',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const ViewContent: DestinationMeta.Rule = {\n name: 'ViewContent',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n content_type: { value: 'product' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n};\n\nexport const config = {\n order: { complete: Purchase },\n product: { view: ViewContent, add: AddToCart },\n cart: { view: InitiateCheckout },\n} satisfies DestinationMeta.Rules;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,sBAA+B;AAExB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,UAAAA,UAAS,QAAI,gCAAe,GAAG;AACvC,QAAM,SAASA,UAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,EAAAA,UAAS,KAAK,YAAY,MAAM;AAClC;AAWO,SAAS,MAAM,KAAkC;AACtD,QAAM,EAAE,OAAO,QAAI,gCAAe,GAAG;AACrC,QAAMC,KAAI;AAIV,MAAIA,GAAE,IAAgB;AAEtB,QAAMC,KAAI,YAAa,MAAuB;AAC5C,IAAAA,GAAE,aAAaA,GAAE,WAAW,MAAMA,IAAG,IAAI,IAAIA,GAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,EAAAD,GAAE,MAAMC;AACR,MAAI,CAACD,GAAE,KAAM,CAAAA,GAAE,OAAOC;AACtB,EAAAA,GAAE,OAAOA;AACT,EAAAA,GAAE,SAAS;AACX,EAAAA,GAAE,UAAU;AACZ,EAAAA,GAAE,QAAQ,CAAC;AACb;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ADtCA,IAAAC,mBAA+B;;;AEH/B;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AA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EAAE,QAAQ,IAAI;AAGpB,QAAI,WAAY,WAAU,GAAG;AAG7B,QAAI,CAAC,QAAS,QAAO;AAGrB,UAAM,GAAG;AAET,UAAM,EAAE,OAAO,QAAI,iCAAe,GAAG;AACrC,UAAM,MAAM,OAAO;AACnB,QAAI,QAAQ,OAAO;AAEnB,WAAOA;AAAA,EACT;AAAA,EAEA,KAAK,OAAO,EAAE,QAAAA,SAAQ,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AAC/C,UAAM,EAAE,OAAO,YAAY,IAAI,QAAQ,YAAY,CAAC;AACpD,UAAM,EAAE,OAAO,QAAI,iCAAe,GAAG;AACrC,UAAM,MAAM,OAAO;AAGnB,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AAEnD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,MAChB,EAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["document","w","n","import_web_core","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config"]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e,t,n=Object.defineProperty,a=(e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})};import{getEnvironment as o}from"@walkeros/web-core";var r=Object.getOwnPropertyNames,i=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.0",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[r(e)[0]])((t={exports:{}}).exports,t),t.exports}),s={merge:!0,shallow:!0,extend:!0};function c(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:d}=i();function p(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...s,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:d,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function u(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={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}};return p({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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],...t,name:e})}import{getEnvironment as l}from"@walkeros/web-core";var g={},m={};a(m,{destinationMetaExamples:()=>S});var y={};function h(){const e=u("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function v(){const e=u("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function b(){const e=u("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function w(){const e=u("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}a(y,{AddToCart:()=>v,InitiateCheckout:()=>b,Purchase:()=>h,ViewContent:()=>w});var f={};a(f,{AddToCart:()=>x,InitiateCheckout:()=>q,Purchase:()=>k,ViewContent:()=>C,config:()=>E});var k={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>c(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},x={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},q={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>c(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},C={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},E={order:{complete:k},product:{view:C,add:x},cart:{view:q}},S={events:y,mapping:f},_={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{pixelId:r}=n;if(a&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=o(e),a=n.createElement("script");a.src=t,a.async=!0,n.head.appendChild(a)}(t),!r)return!1;!function(e){const{window:t}=o(e),n=t;if(n.fbq)return;const a=function(...e){a.callMethod?a.callMethod.apply(a,e):a.queue.push(e)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(t);const{window:i}=l(t);return(0,i.fbq)("init",r),e},push(e,{config:t,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=l(o),d=s.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const p=r||i||e.name;d(i?"trackCustom":"track",String(p),c(a)?a:{},{eventID:e.id})}},j=_;export{g as DestinationMeta,j as default,_ as destinationMeta,m as destinationMetaExamples};//# sourceMappingURL=index.mjs.map
1
+ var e,t,n=Object.defineProperty,a=(e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})};import{getEnvironment as o}from"@walkeros/web-core";var r=Object.getOwnPropertyNames,i=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[r(e)[0]])((t={exports:{}}).exports,t),t.exports}),s={merge:!0,shallow:!0,extend:!0};function c(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:d}=i();function p(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...s,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],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:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:d,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[n,a]=null!=(t=e.name.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function u(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={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}};return p({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...a.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:a.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...a,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",...a,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.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...a,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...a,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...a.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:n,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],...t,name:e})}import{getEnvironment as l}from"@walkeros/web-core";var g={},m={};a(m,{events:()=>y,mapping:()=>f});var y={};function h(){const e=u("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function v(){const e=u("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function b(){const e=u("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.entity).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.entity).length},{eventID:e.id}]}function w(){const e=u("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}a(y,{AddToCart:()=>v,InitiateCheckout:()=>b,Purchase:()=>h,ViewContent:()=>w});var f={};a(f,{AddToCart:()=>x,InitiateCheckout:()=>q,Purchase:()=>k,ViewContent:()=>C,config:()=>S});var k={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>c(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},x={name:"AddToCart",data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"}}}},q={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>c(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},C={name:"ViewContent",data:{map:{value:"data.price",currency:{value:"EUR"},content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]}}}},S={order:{complete:k},product:{view:C,add:x},cart:{view:q}},E={type:"meta-pixel",config:{},init({config:e,env:t}){const{settings:n={},loadScript:a}=e,{pixelId:r}=n;if(a&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=o(e),a=n.createElement("script");a.src=t,a.async=!0,n.head.appendChild(a)}(t),!r)return!1;!function(e){const{window:t}=o(e),n=t;if(n.fbq)return;const a=function(...e){a.callMethod?a.callMethod.apply(a,e):a.queue.push(e)};n.fbq=a,n._fbq||(n._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[]}(t);const{window:i}=l(t);return(0,i.fbq)("init",r),e},push(e,{config:t,mapping:n={},data:a,env:o}){const{track:r,trackCustom:i}=n.settings||{},{window:s}=l(o),d=s.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const p=r||i||e.name;d(i?"trackCustom":"track",String(p),c(a)?a:{},{eventID:e.id})}},_=E;export{g as DestinationMeta,_ as default,E as destinationMeta,m as examples};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/setup.ts","../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/events.ts","../src/examples/mapping.ts"],"sourcesContent":["import type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnvironment } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Environment,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnvironment(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\ninterface FBQFunction {\n (...args: unknown[]): void;\n callMethod?: (this: FBQFunction, ...args: unknown[]) => void;\n queue: unknown[];\n push: FBQFunction;\n loaded: boolean;\n version: string;\n}\n\nexport function setup(env?: DestinationWeb.Environment) {\n const { window } = getEnvironment(env);\n const w = window as unknown as {\n fbq?: FBQFunction;\n _fbq?: FBQFunction;\n };\n if (w.fbq as unknown) return;\n\n const n = function (...args: unknown[]): void {\n n.callMethod ? n.callMethod.apply(n, args) : n.queue.push(args);\n } as FBQFunction;\n\n w.fbq = n;\n if (!w._fbq) w._fbq = n;\n n.push = n;\n n.loaded = true;\n n.version = '2.0';\n n.queue = [];\n}\n","import type { Settings, Destination } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnvironment } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n// Examples\nexport * as destinationMetaExamples from './examples';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env }) {\n const { settings = {} as Partial<Settings>, loadScript } = config;\n const { pixelId } = settings;\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n fbq('init', pixelId);\n\n return config;\n },\n\n push(event, { config, mapping = {}, data, env }) {\n const { track, trackCustom } = mapping.settings || {};\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n\n // page view\n if (event.name === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n // Augment the global WalkerOS namespace with destination-specific types\n namespace WalkerOS {\n interface Elb extends Elb.RegisterDestination<Destination, Config> {}\n }\n\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\n// Meta-specific environment that includes fbq\nexport interface MetaEnvironment {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: Document;\n}\n\nexport type Destination = DestinationWeb.Destination<Settings, Mapping>;\nexport type Config = DestinationWeb.Config<Settings, Mapping>;\n\n// Destination-specific settings (internal usage)\nexport interface Settings {\n pixelId?: string; // Required pixel id\n}\n\n// Single event transformation rule\nexport interface Mapping {\n track?: StandardEventNames; // Name of a standard event to track\n trackCustom?: string; // Name of a custom event to track\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n","import * as events from './events';\nimport * as mapping from './mapping';\n\nexport const destinationMetaExamples = {\n events,\n mapping,\n};\n","import { getEvent } from '@walkeros/core';\n\nexport function Purchase(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n 'track',\n 'Purchase',\n {\n value: event.data.total,\n currency: 'EUR',\n contents: event.nested\n .filter((item) => item.entity === 'product')\n .map((item) => ({ id: item.data.id, quantity: 1 })),\n content_type: 'product',\n num_items: 2,\n },\n { eventID: event.id },\n ];\n}\n\nexport function AddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n\nexport function InitiateCheckout(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: event.data.value,\n contents: event.nested\n .filter((entity) => entity.entity === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.entity === 'product')\n .length,\n },\n { eventID: event.id },\n ];\n}\n\nexport function ViewContent(): unknown[] {\n const event = getEvent('product view');\n\n return [\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n","import type { Mapping, WalkerOS } from '@walkeros/core';\nimport type { DestinationMeta } from '..';\nimport { isObject } from '@walkeros/core';\n\nexport const Purchase: DestinationMeta.Rule = {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.total',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const AddToCart: DestinationMeta.Rule = {\n name: 'AddToCart',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n },\n },\n};\n\nexport const InitiateCheckout: DestinationMeta.Rule = {\n name: 'InitiateCheckout',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const ViewContent: DestinationMeta.Rule = {\n name: 'ViewContent',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n content_type: { value: 'product' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n};\n\nexport const config = {\n order: { complete: Purchase },\n product: { view: ViewContent, add: AddToCart },\n cart: { view: InitiateCheckout },\n} satisfies DestinationMeta.Rules;\n"],"mappings":";;;;;;;AACA,SAAS,sBAAsB;AAExB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,UAAAA,UAAS,IAAI,eAAe,GAAG;AACvC,QAAM,SAASA,UAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,EAAAA,UAAS,KAAK,YAAY,MAAM;AAClC;AAWO,SAAS,MAAM,KAAkC;AACtD,QAAM,EAAE,OAAO,IAAI,eAAe,GAAG;AACrC,QAAMC,KAAI;AAIV,MAAIA,GAAE,IAAgB;AAEtB,QAAMC,KAAI,YAAa,MAAuB;AAC5C,IAAAA,GAAE,aAAaA,GAAE,WAAW,MAAMA,IAAG,IAAI,IAAIA,GAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,EAAAD,GAAE,MAAMC;AACR,MAAI,CAACD,GAAE,KAAM,CAAAA,GAAE,OAAOC;AACtB,EAAAA,GAAE,OAAOA;AACT,EAAAA,GAAE,SAAS;AACX,EAAAA,GAAE,UAAU;AACZ,EAAAA,GAAE,QAAQ,CAAC;AACb;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACtCA,SAAS,kBAAAC,uBAAsB;;;ACH/B;;;ACAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,WAAsB;AACpC,QAAM,QAAQ,EAAS,gBAAgB;AAEvC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO,MAAM,KAAK;AAAA,MAClB,UAAU;AAAA,MACV,UAAU,MAAM,OACb,OAAO,CAAC,SAAS,KAAK,WAAW,SAAS,EAC1C,IAAI,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,IAAI,UAAU,EAAE,EAAE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E,QAAAA,SAAQ,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AAC/C,UAAM,EAAE,OAAO,YAAY,IAAI,QAAQ,YAAY,CAAC;AACpD,UAAM,EAAE,OAAO,IAAIC,gBAAe,GAAG;AACrC,UAAM,MAAM,OAAO;AAGnB,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AAEnD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,MAChB,EAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["document","w","n","getEnvironment","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config","getEnvironment"]}
1
+ {"version":3,"sources":["../src/setup.ts","../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/events.ts","../src/examples/mapping.ts"],"sourcesContent":["import type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnvironment } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Environment,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnvironment(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\ninterface FBQFunction {\n (...args: unknown[]): void;\n callMethod?: (this: FBQFunction, ...args: unknown[]) => void;\n queue: unknown[];\n push: FBQFunction;\n loaded: boolean;\n version: string;\n}\n\nexport function setup(env?: DestinationWeb.Environment) {\n const { window } = getEnvironment(env);\n const w = window as unknown as {\n fbq?: FBQFunction;\n _fbq?: FBQFunction;\n };\n if (w.fbq as unknown) return;\n\n const n = function (...args: unknown[]): void {\n n.callMethod ? n.callMethod.apply(n, args) : n.queue.push(args);\n } as FBQFunction;\n\n w.fbq = n;\n if (!w._fbq) w._fbq = n;\n n.push = n;\n n.loaded = true;\n n.version = '2.0';\n n.queue = [];\n}\n","import type { Settings, Destination } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnvironment } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n// Examples\nexport * as examples from './examples';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env }) {\n const { settings = {} as Partial<Settings>, loadScript } = config;\n const { pixelId } = settings;\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n fbq('init', pixelId);\n\n return config;\n },\n\n push(event, { config, mapping = {}, data, env }) {\n const { track, trackCustom } = mapping.settings || {};\n const { window } = getEnvironment(env);\n const fbq = window.fbq as facebook.Pixel.Event;\n\n // page view\n if (event.name === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type { Mapping as WalkerOSMapping } from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\n// Meta-specific environment that includes fbq\nexport interface MetaEnvironment {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: Document;\n}\n\nexport type Destination = DestinationWeb.Destination<Settings, Mapping>;\nexport type Config = DestinationWeb.Config<Settings, Mapping>;\n\n// Destination-specific settings (internal usage)\nexport interface Settings {\n pixelId?: string; // Required pixel id\n}\n\n// Single event transformation rule\nexport interface Mapping {\n track?: StandardEventNames; // Name of a standard event to track\n trackCustom?: string; // Name of a custom event to track\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n","export * as events from './events';\nexport * as mapping from './mapping';\n","import { getEvent } from '@walkeros/core';\n\nexport function Purchase(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n 'track',\n 'Purchase',\n {\n value: event.data.total,\n currency: 'EUR',\n contents: event.nested\n .filter((item) => item.entity === 'product')\n .map((item) => ({ id: item.data.id, quantity: 1 })),\n content_type: 'product',\n num_items: 2,\n },\n { eventID: event.id },\n ];\n}\n\nexport function AddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n\nexport function InitiateCheckout(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: event.data.value,\n contents: event.nested\n .filter((entity) => entity.entity === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.entity === 'product')\n .length,\n },\n { eventID: event.id },\n ];\n}\n\nexport function ViewContent(): unknown[] {\n const event = getEvent('product view');\n\n return [\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: event.data.price,\n contents: [{ id: event.data.id, quantity: 1 }],\n content_type: 'product',\n },\n { eventID: event.id },\n ];\n}\n","import type { Mapping, WalkerOS } from '@walkeros/core';\nimport type { DestinationMeta } from '..';\nimport { isObject } from '@walkeros/core';\n\nexport const Purchase: DestinationMeta.Rule = {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.total',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const AddToCart: DestinationMeta.Rule = {\n name: 'AddToCart',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n },\n },\n};\n\nexport const InitiateCheckout: DestinationMeta.Rule = {\n name: 'InitiateCheckout',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n};\n\nexport const ViewContent: DestinationMeta.Rule = {\n name: 'ViewContent',\n data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n content_type: { value: 'product' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n};\n\nexport const config = {\n order: { complete: Purchase },\n product: { view: ViewContent, add: AddToCart },\n cart: { view: InitiateCheckout },\n} satisfies DestinationMeta.Rules;\n"],"mappings":";;;;;;;AACA,SAAS,sBAAsB;AAExB,SAAS,UACd,KACA,MAAM,kDACN;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nD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,MAChB,EAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["document","w","n","getEnvironment","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config","getEnvironment"]}
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.1.0",
4
+ "version": "0.1.2",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -30,7 +30,7 @@
30
30
  "update": "npx npm-check-updates -u && npm update"
31
31
  },
32
32
  "dependencies": {
33
- "@walkeros/web-core": "0.1.0"
33
+ "@walkeros/web-core": "0.1.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/facebook-pixel": "^0.0.31"