@walkeros/web-destination-meta 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,10 +30,10 @@ npm install @walkeros/web-destination-meta
30
30
  Here's a basic example of how to use the Meta Pixel destination:
31
31
 
32
32
  ```typescript
33
- import { createCollector } from '@walkeros/collector';
33
+ import { startFlow } from '@walkeros/collector';
34
34
  import { destinationMeta } from '@walkeros/web-destination-meta';
35
35
 
36
- const { elb } = await createCollector();
36
+ const { elb } = await startFlow();
37
37
 
38
38
  elb('walker destination', destinationMeta, {
39
39
  settings: {
@@ -1,37 +1,49 @@
1
1
  import { Mapping as Mapping$1 } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
- declare function Purchase$1(): unknown[];
5
- declare function AddToCart$1(): unknown[];
6
- declare function InitiateCheckout$1(): unknown[];
7
- declare function ViewContent$1(): unknown[];
8
-
9
- declare namespace events {
10
- export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
11
- }
12
-
13
4
  declare global {
14
- namespace WalkerOS {
15
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
- }
17
- }
18
5
  interface Window {
19
6
  _fbq?: facebook.Pixel.Event;
20
7
  fbq?: facebook.Pixel.Event;
21
8
  }
22
9
  }
23
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
- type Config = DestinationWeb.Config<Settings, Mapping>;
25
- interface Settings {
26
- pixelId?: string;
27
- }
28
10
  interface Mapping {
29
11
  track?: StandardEventNames;
30
12
  trackCustom?: string;
31
13
  }
14
+ interface Env extends DestinationWeb.Env {
15
+ window: {
16
+ fbq: facebook.Pixel.Event;
17
+ _fbq?: facebook.Pixel.Event;
18
+ };
19
+ document: {
20
+ createElement: (tagName: string) => Element;
21
+ head: {
22
+ appendChild: (node: unknown) => void;
23
+ };
24
+ };
25
+ }
32
26
  type Rule = Mapping$1.Rule<Mapping>;
33
27
  type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
34
28
 
29
+ declare const init: Env | undefined;
30
+ declare const push: Env;
31
+
32
+ declare const env_init: typeof init;
33
+ declare const env_push: typeof push;
34
+ declare namespace env {
35
+ export { env_init as init, env_push as push };
36
+ }
37
+
38
+ declare function Purchase$1(): unknown[];
39
+ declare function AddToCart$1(): unknown[];
40
+ declare function InitiateCheckout$1(): unknown[];
41
+ declare function ViewContent$1(): unknown[];
42
+
43
+ declare namespace events {
44
+ export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
45
+ }
46
+
35
47
  declare const Purchase: Rule;
36
48
  declare const AddToCart: Rule;
37
49
  declare const InitiateCheckout: Rule;
@@ -58,9 +70,4 @@ declare namespace mapping {
58
70
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
71
  }
60
72
 
61
- declare const destinationMetaExamples: {
62
- events: typeof events;
63
- mapping: typeof mapping;
64
- };
65
-
66
- export { destinationMetaExamples };
73
+ export { env, events, mapping };
@@ -1,37 +1,49 @@
1
1
  import { Mapping as Mapping$1 } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
3
 
4
- declare function Purchase$1(): unknown[];
5
- declare function AddToCart$1(): unknown[];
6
- declare function InitiateCheckout$1(): unknown[];
7
- declare function ViewContent$1(): unknown[];
8
-
9
- declare namespace events {
10
- export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
11
- }
12
-
13
4
  declare global {
14
- namespace WalkerOS {
15
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
- }
17
- }
18
5
  interface Window {
19
6
  _fbq?: facebook.Pixel.Event;
20
7
  fbq?: facebook.Pixel.Event;
21
8
  }
22
9
  }
23
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
- type Config = DestinationWeb.Config<Settings, Mapping>;
25
- interface Settings {
26
- pixelId?: string;
27
- }
28
10
  interface Mapping {
29
11
  track?: StandardEventNames;
30
12
  trackCustom?: string;
31
13
  }
14
+ interface Env extends DestinationWeb.Env {
15
+ window: {
16
+ fbq: facebook.Pixel.Event;
17
+ _fbq?: facebook.Pixel.Event;
18
+ };
19
+ document: {
20
+ createElement: (tagName: string) => Element;
21
+ head: {
22
+ appendChild: (node: unknown) => void;
23
+ };
24
+ };
25
+ }
32
26
  type Rule = Mapping$1.Rule<Mapping>;
33
27
  type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
34
28
 
29
+ declare const init: Env | undefined;
30
+ declare const push: Env;
31
+
32
+ declare const env_init: typeof init;
33
+ declare const env_push: typeof push;
34
+ declare namespace env {
35
+ export { env_init as init, env_push as push };
36
+ }
37
+
38
+ declare function Purchase$1(): unknown[];
39
+ declare function AddToCart$1(): unknown[];
40
+ declare function InitiateCheckout$1(): unknown[];
41
+ declare function ViewContent$1(): unknown[];
42
+
43
+ declare namespace events {
44
+ export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
45
+ }
46
+
35
47
  declare const Purchase: Rule;
36
48
  declare const AddToCart: Rule;
37
49
  declare const InitiateCheckout: Rule;
@@ -58,9 +70,4 @@ declare namespace mapping {
58
70
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
71
  }
60
72
 
61
- declare const destinationMetaExamples: {
62
- events: typeof events;
63
- mapping: typeof mapping;
64
- };
65
-
66
- export { destinationMetaExamples };
73
+ export { env, events, mapping };
@@ -20,10 +20,72 @@ 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
+ env: () => env_exports,
24
+ events: () => events_exports,
25
+ mapping: () => mapping_exports
24
26
  });
25
27
  module.exports = __toCommonJS(examples_exports);
26
28
 
29
+ // src/examples/env.ts
30
+ var env_exports = {};
31
+ __export(env_exports, {
32
+ init: () => init,
33
+ push: () => push
34
+ });
35
+ var noop = () => {
36
+ };
37
+ var init = {
38
+ // Environment before initialization (fbq not loaded yet)
39
+ window: {
40
+ fbq: void 0,
41
+ _fbq: void 0
42
+ },
43
+ document: {
44
+ createElement: () => ({
45
+ src: "",
46
+ async: false,
47
+ setAttribute: () => {
48
+ },
49
+ removeAttribute: () => {
50
+ }
51
+ }),
52
+ head: { appendChild: () => {
53
+ } }
54
+ }
55
+ };
56
+ var push = {
57
+ // Standard mock environment for testing
58
+ window: {
59
+ fbq: Object.assign(noop, {
60
+ // Add Meta Pixel specific properties
61
+ callMethod: noop,
62
+ queue: [],
63
+ push: noop,
64
+ loaded: true,
65
+ version: "2.0"
66
+ }),
67
+ _fbq: Object.assign(noop, {
68
+ callMethod: noop,
69
+ queue: [],
70
+ push: noop,
71
+ loaded: true,
72
+ version: "2.0"
73
+ })
74
+ },
75
+ document: {
76
+ createElement: () => ({
77
+ src: "",
78
+ async: false,
79
+ setAttribute: () => {
80
+ },
81
+ removeAttribute: () => {
82
+ }
83
+ }),
84
+ head: { appendChild: () => {
85
+ } }
86
+ }
87
+ };
88
+
27
89
  // src/examples/events.ts
28
90
  var events_exports = {};
29
91
  __export(events_exports, {
@@ -34,47 +96,38 @@ __export(events_exports, {
34
96
  });
35
97
 
36
98
  // ../../../core/dist/index.mjs
37
- var e;
38
- var t;
39
- var n = Object.getOwnPropertyNames;
40
- 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.1", 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
- } }, function() {
43
- return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
44
- });
45
- var w = { merge: true, shallow: true, extend: true };
46
- function v(e2, t2 = {}, n2 = {}) {
47
- n2 = { ...w, ...n2 };
48
- const r2 = Object.entries(t2).reduce((t3, [r3, o]) => {
49
- const i = e2[r3];
50
- return n2.merge && Array.isArray(i) && Array.isArray(o) ? t3[r3] = o.reduce((e3, t4) => e3.includes(t4) ? e3 : [...e3, t4], [...i]) : (n2.extend || r3 in e2) && (t3[r3] = o), t3;
99
+ var m = { merge: true, shallow: true, extend: true };
100
+ function y(e, t = {}, n = {}) {
101
+ n = { ...m, ...n };
102
+ const r = Object.entries(t).reduce((t2, [r2, o]) => {
103
+ const i = e[r2];
104
+ return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e2, t3) => e2.includes(t3) ? e2 : [...e2, t3], [...i]) : (n.extend || r2 in e) && (t2[r2] = o), t2;
51
105
  }, {});
52
- return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
106
+ return n.shallow ? { ...e, ...r } : (Object.assign(e, r), e);
53
107
  }
54
- function k(e2) {
55
- return Array.isArray(e2);
108
+ function b(e) {
109
+ return Array.isArray(e);
56
110
  }
57
- function M(e2) {
58
- return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
111
+ function O(e) {
112
+ return "object" == typeof e && null !== e && !b(e) && "[object Object]" === Object.prototype.toString.call(e);
59
113
  }
60
- var { version: R } = r();
61
- function V(e2 = {}) {
114
+ function C(e = {}) {
62
115
  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: R, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
64
- if (e2.name) {
65
- const [t3, n3] = (_a = e2.name.split(" ")) != null ? _a : [];
66
- t3 && n3 && (o.entity = t3, o.action = n3);
116
+ const t = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e.group || "gr0up", r = e.count || 1, o = y({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.2.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e, { merge: false });
117
+ if (e.name) {
118
+ const [t2, n2] = (_a = e.name.split(" ")) != null ? _a : [];
119
+ t2 && n2 && (o.entity = t2, o.action = n2);
67
120
  }
68
121
  return o;
69
122
  }
70
- function H(e2 = "entity action", t2 = {}) {
71
- 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 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 });
123
+ function _(e = "entity action", t = {}) {
124
+ const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
125
+ return C({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e], ...t, name: e });
73
126
  }
74
127
 
75
128
  // src/examples/events.ts
76
129
  function Purchase() {
77
- const event = H("order complete");
130
+ const event = _("order complete");
78
131
  return [
79
132
  "track",
80
133
  "Purchase",
@@ -89,7 +142,7 @@ function Purchase() {
89
142
  ];
90
143
  }
91
144
  function AddToCart() {
92
- const event = H("product add");
145
+ const event = _("product add");
93
146
  return [
94
147
  "track",
95
148
  "AddToCart",
@@ -103,7 +156,7 @@ function AddToCart() {
103
156
  ];
104
157
  }
105
158
  function InitiateCheckout() {
106
- const event = H("cart view");
159
+ const event = _("cart view");
107
160
  return [
108
161
  "track",
109
162
  "InitiateCheckout",
@@ -120,7 +173,7 @@ function InitiateCheckout() {
120
173
  ];
121
174
  }
122
175
  function ViewContent() {
123
- const event = H("product view");
176
+ const event = _("product view");
124
177
  return [
125
178
  "track",
126
179
  "ViewContent",
@@ -153,7 +206,7 @@ var Purchase2 = {
153
206
  loop: [
154
207
  "nested",
155
208
  {
156
- condition: (entity) => M(entity) && entity.entity === "product",
209
+ condition: (entity) => O(entity) && entity.entity === "product",
157
210
  map: {
158
211
  id: "data.id",
159
212
  quantity: { key: "data.quantity", value: 1 }
@@ -200,7 +253,7 @@ var InitiateCheckout2 = {
200
253
  loop: [
201
254
  "nested",
202
255
  {
203
- condition: (entity) => M(entity) && entity.entity === "product",
256
+ condition: (entity) => O(entity) && entity.entity === "product",
204
257
  map: {
205
258
  id: "data.id",
206
259
  quantity: { key: "data.quantity", value: 1 }
@@ -241,13 +294,9 @@ var config = {
241
294
  product: { view: ViewContent2, add: AddToCart2 },
242
295
  cart: { view: InitiateCheckout2 }
243
296
  };
244
-
245
- // src/examples/index.ts
246
- var destinationMetaExamples = {
247
- events: events_exports,
248
- mapping: mapping_exports
249
- };
250
297
  // Annotate the CommonJS export names for ESM import in node:
251
298
  0 && (module.exports = {
252
- destinationMetaExamples
299
+ env,
300
+ events,
301
+ mapping
253
302
  });
@@ -4,6 +4,66 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
+ // src/examples/env.ts
8
+ var env_exports = {};
9
+ __export(env_exports, {
10
+ init: () => init,
11
+ push: () => push
12
+ });
13
+ var noop = () => {
14
+ };
15
+ var init = {
16
+ // Environment before initialization (fbq not loaded yet)
17
+ window: {
18
+ fbq: void 0,
19
+ _fbq: void 0
20
+ },
21
+ document: {
22
+ createElement: () => ({
23
+ src: "",
24
+ async: false,
25
+ setAttribute: () => {
26
+ },
27
+ removeAttribute: () => {
28
+ }
29
+ }),
30
+ head: { appendChild: () => {
31
+ } }
32
+ }
33
+ };
34
+ var push = {
35
+ // Standard mock environment for testing
36
+ window: {
37
+ fbq: Object.assign(noop, {
38
+ // Add Meta Pixel specific properties
39
+ callMethod: noop,
40
+ queue: [],
41
+ push: noop,
42
+ loaded: true,
43
+ version: "2.0"
44
+ }),
45
+ _fbq: Object.assign(noop, {
46
+ callMethod: noop,
47
+ queue: [],
48
+ push: noop,
49
+ loaded: true,
50
+ version: "2.0"
51
+ })
52
+ },
53
+ document: {
54
+ createElement: () => ({
55
+ src: "",
56
+ async: false,
57
+ setAttribute: () => {
58
+ },
59
+ removeAttribute: () => {
60
+ }
61
+ }),
62
+ head: { appendChild: () => {
63
+ } }
64
+ }
65
+ };
66
+
7
67
  // src/examples/events.ts
8
68
  var events_exports = {};
9
69
  __export(events_exports, {
@@ -14,47 +74,38 @@ __export(events_exports, {
14
74
  });
15
75
 
16
76
  // ../../../core/dist/index.mjs
17
- var e;
18
- var t;
19
- var n = Object.getOwnPropertyNames;
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.1", 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
- } }, function() {
23
- return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
24
- });
25
- var w = { merge: true, shallow: true, extend: true };
26
- function v(e2, t2 = {}, n2 = {}) {
27
- n2 = { ...w, ...n2 };
28
- const r2 = Object.entries(t2).reduce((t3, [r3, o]) => {
29
- const i = e2[r3];
30
- return n2.merge && Array.isArray(i) && Array.isArray(o) ? t3[r3] = o.reduce((e3, t4) => e3.includes(t4) ? e3 : [...e3, t4], [...i]) : (n2.extend || r3 in e2) && (t3[r3] = o), t3;
77
+ var m = { merge: true, shallow: true, extend: true };
78
+ function y(e, t = {}, n = {}) {
79
+ n = { ...m, ...n };
80
+ const r = Object.entries(t).reduce((t2, [r2, o]) => {
81
+ const i = e[r2];
82
+ return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e2, t3) => e2.includes(t3) ? e2 : [...e2, t3], [...i]) : (n.extend || r2 in e) && (t2[r2] = o), t2;
31
83
  }, {});
32
- return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
84
+ return n.shallow ? { ...e, ...r } : (Object.assign(e, r), e);
33
85
  }
34
- function k(e2) {
35
- return Array.isArray(e2);
86
+ function b(e) {
87
+ return Array.isArray(e);
36
88
  }
37
- function M(e2) {
38
- return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
89
+ function O(e) {
90
+ return "object" == typeof e && null !== e && !b(e) && "[object Object]" === Object.prototype.toString.call(e);
39
91
  }
40
- var { version: R } = r();
41
- function V(e2 = {}) {
92
+ function C(e = {}) {
42
93
  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: R, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
44
- if (e2.name) {
45
- const [t3, n3] = (_a = e2.name.split(" ")) != null ? _a : [];
46
- t3 && n3 && (o.entity = t3, o.action = n3);
94
+ const t = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e.group || "gr0up", r = e.count || 1, o = y({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.2.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e, { merge: false });
95
+ if (e.name) {
96
+ const [t2, n2] = (_a = e.name.split(" ")) != null ? _a : [];
97
+ t2 && n2 && (o.entity = t2, o.action = n2);
47
98
  }
48
99
  return o;
49
100
  }
50
- function H(e2 = "entity action", t2 = {}) {
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 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 });
101
+ function _(e = "entity action", t = {}) {
102
+ const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
103
+ return C({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e], ...t, name: e });
53
104
  }
54
105
 
55
106
  // src/examples/events.ts
56
107
  function Purchase() {
57
- const event = H("order complete");
108
+ const event = _("order complete");
58
109
  return [
59
110
  "track",
60
111
  "Purchase",
@@ -69,7 +120,7 @@ function Purchase() {
69
120
  ];
70
121
  }
71
122
  function AddToCart() {
72
- const event = H("product add");
123
+ const event = _("product add");
73
124
  return [
74
125
  "track",
75
126
  "AddToCart",
@@ -83,7 +134,7 @@ function AddToCart() {
83
134
  ];
84
135
  }
85
136
  function InitiateCheckout() {
86
- const event = H("cart view");
137
+ const event = _("cart view");
87
138
  return [
88
139
  "track",
89
140
  "InitiateCheckout",
@@ -100,7 +151,7 @@ function InitiateCheckout() {
100
151
  ];
101
152
  }
102
153
  function ViewContent() {
103
- const event = H("product view");
154
+ const event = _("product view");
104
155
  return [
105
156
  "track",
106
157
  "ViewContent",
@@ -133,7 +184,7 @@ var Purchase2 = {
133
184
  loop: [
134
185
  "nested",
135
186
  {
136
- condition: (entity) => M(entity) && entity.entity === "product",
187
+ condition: (entity) => O(entity) && entity.entity === "product",
137
188
  map: {
138
189
  id: "data.id",
139
190
  quantity: { key: "data.quantity", value: 1 }
@@ -180,7 +231,7 @@ var InitiateCheckout2 = {
180
231
  loop: [
181
232
  "nested",
182
233
  {
183
- condition: (entity) => M(entity) && entity.entity === "product",
234
+ condition: (entity) => O(entity) && entity.entity === "product",
184
235
  map: {
185
236
  id: "data.id",
186
237
  quantity: { key: "data.quantity", value: 1 }
@@ -221,12 +272,8 @@ var config = {
221
272
  product: { view: ViewContent2, add: AddToCart2 },
222
273
  cart: { view: InitiateCheckout2 }
223
274
  };
224
-
225
- // src/examples/index.ts
226
- var destinationMetaExamples = {
227
- events: events_exports,
228
- mapping: mapping_exports
229
- };
230
275
  export {
231
- destinationMetaExamples
276
+ env_exports as env,
277
+ events_exports as events,
278
+ mapping_exports as mapping
232
279
  };
@@ -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.1",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 t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},i={};o(i,{DestinationMeta:()=>p,default:()=>D,destinationMeta:()=>j,examples:()=>l});var r={merge:!0,shallow:!0,extend:!0};function c(t){return"object"==typeof t&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)}function s(t={}){var e;const n=t.timestamp||(new Date).setHours(0,13,37,0),a=t.group||"gr0up",o=t.count||1,i=function(t,e={},n={}){n={...r,...n};const a=Object.entries(e).reduce((e,[a,o])=>{const i=t[a];return n.merge&&Array.isArray(i)&&Array.isArray(o)?e[a]=o.reduce((t,e)=>t.includes(e)?t:[...t,e],[...i]):(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:"0.2.0",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&&(i.entity=n,i.action=a)}return i}function d(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 s({...{"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 u(t){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...t}}var p={},l={};o(l,{env:()=>g,events:()=>v,mapping:()=>q});var g={};o(g,{init:()=>y,push:()=>h});var m=()=>{},y={window:{fbq:void 0,_fbq:void 0},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},h={window:{fbq:Object.assign(m,{callMethod:m,queue:[],push:m,loaded:!0,version:"2.0"}),_fbq:Object.assign(m,{callMethod:m,queue:[],push:m,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},v={};function b(){const t=d("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=d("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 w(){const t=d("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 k(){const t=d("product view");return["track","ViewContent",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]}o(v,{AddToCart:()=>f,InitiateCheckout:()=>w,Purchase:()=>b,ViewContent:()=>k});var q={};o(q,{AddToCart:()=>_,InitiateCheckout:()=>E,Purchase:()=>C,ViewContent:()=>A,config:()=>O});var x,C={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>c(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}}}},_={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"}}}},E={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>c(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}}}},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}}}]}}}},O={order:{complete:C},product:{view:A,add:_},cart:{view:E}},j={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}=u(t),a=n.createElement("script");a.src=e,a.async=!0,n.head.appendChild(a)}(e),!o)return!1;!function(t){const{window:e}=u(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:i}=u(e);return(0,i.fbq)("init",o),t},push(t,{config:e,mapping:n={},data:a,env:o}){const{track:i,trackCustom:r}=n.settings||{},{window:s}=u(o),d=s.fbq;"page view"!==t.name||n.settings||(t.name="PageView");const p=i||r||t.name;d(r?"trackCustom":"track",String(p),c(a)?a:{},{eventID:t.id})}},D=j;return x=i,((o,i,r,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of n(i))a.call(o,s)||s===r||t(o,s,{get:()=>i[s],enumerable:!(c=e(i,s))||c.enumerable});return o})(t({},"__esModule",{value:!0}),x)})();
package/dist/index.d.mts CHANGED
@@ -1,25 +1,12 @@
1
- import { Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { Destination as Destination$1, 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;
12
8
  }
13
9
  }
14
- interface MetaEnvironment {
15
- window: {
16
- fbq: facebook.Pixel.Event;
17
- _fbq?: facebook.Pixel.Event;
18
- };
19
- document: Document;
20
- }
21
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
22
- type Config = DestinationWeb.Config<Settings, Mapping>;
23
10
  interface Settings {
24
11
  pixelId?: string;
25
12
  }
@@ -27,20 +14,45 @@ interface Mapping {
27
14
  track?: StandardEventNames;
28
15
  trackCustom?: string;
29
16
  }
17
+ interface Env extends DestinationWeb.Env {
18
+ window: {
19
+ fbq: facebook.Pixel.Event;
20
+ _fbq?: facebook.Pixel.Event;
21
+ };
22
+ document: {
23
+ createElement: (tagName: string) => Element;
24
+ head: {
25
+ appendChild: (node: unknown) => void;
26
+ };
27
+ };
28
+ }
29
+ type Types = Destination$1.Types<Settings, Mapping, Env>;
30
+ type Destination = DestinationWeb.Destination<Types>;
31
+ type Config = DestinationWeb.Config<Types>;
30
32
  type Rule = Mapping$1.Rule<Mapping>;
31
33
  type Rules = Mapping$1.Rules<Rule>;
32
34
  type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
33
35
 
34
36
  type index$1_Config = Config;
35
37
  type index$1_Destination = Destination;
38
+ type index$1_Env = Env;
36
39
  type index$1_Mapping = Mapping;
37
- type index$1_MetaEnvironment = MetaEnvironment;
38
40
  type index$1_Rule = Rule;
39
41
  type index$1_Rules = Rules;
40
42
  type index$1_Settings = Settings;
41
43
  type index$1_StandardEventNames = StandardEventNames;
44
+ type index$1_Types = Types;
42
45
  declare namespace index$1 {
43
- export type { index$1_Config as Config, index$1_Destination as Destination, index$1_Mapping as Mapping, index$1_MetaEnvironment as MetaEnvironment, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings, index$1_StandardEventNames as StandardEventNames };
46
+ export type { index$1_Config as Config, index$1_Destination as Destination, index$1_Env as Env, index$1_Mapping as Mapping, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings, index$1_StandardEventNames as StandardEventNames, index$1_Types as Types };
47
+ }
48
+
49
+ declare const init: Env | undefined;
50
+ declare const push: Env;
51
+
52
+ declare const env_init: typeof init;
53
+ declare const env_push: typeof push;
54
+ declare namespace env {
55
+ export { env_init as init, env_push as push };
44
56
  }
45
57
 
46
58
  declare function Purchase$1(): unknown[];
@@ -78,16 +90,13 @@ declare namespace mapping {
78
90
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
79
91
  }
80
92
 
81
- declare const destinationMetaExamples: {
82
- events: typeof events;
83
- mapping: typeof mapping;
84
- };
85
-
86
- declare const index_destinationMetaExamples: typeof destinationMetaExamples;
93
+ declare const index_env: typeof env;
94
+ declare const index_events: typeof events;
95
+ declare const index_mapping: typeof mapping;
87
96
  declare namespace index {
88
- export { index_destinationMetaExamples as destinationMetaExamples };
97
+ export { index_env as env, index_events as events, index_mapping as mapping };
89
98
  }
90
99
 
91
100
  declare const destinationMeta: Destination;
92
101
 
93
- export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
102
+ export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as examples };
package/dist/index.d.ts CHANGED
@@ -1,25 +1,12 @@
1
- import { Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { Destination as Destination$1, 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;
12
8
  }
13
9
  }
14
- interface MetaEnvironment {
15
- window: {
16
- fbq: facebook.Pixel.Event;
17
- _fbq?: facebook.Pixel.Event;
18
- };
19
- document: Document;
20
- }
21
- type Destination = DestinationWeb.Destination<Settings, Mapping>;
22
- type Config = DestinationWeb.Config<Settings, Mapping>;
23
10
  interface Settings {
24
11
  pixelId?: string;
25
12
  }
@@ -27,20 +14,45 @@ interface Mapping {
27
14
  track?: StandardEventNames;
28
15
  trackCustom?: string;
29
16
  }
17
+ interface Env extends DestinationWeb.Env {
18
+ window: {
19
+ fbq: facebook.Pixel.Event;
20
+ _fbq?: facebook.Pixel.Event;
21
+ };
22
+ document: {
23
+ createElement: (tagName: string) => Element;
24
+ head: {
25
+ appendChild: (node: unknown) => void;
26
+ };
27
+ };
28
+ }
29
+ type Types = Destination$1.Types<Settings, Mapping, Env>;
30
+ type Destination = DestinationWeb.Destination<Types>;
31
+ type Config = DestinationWeb.Config<Types>;
30
32
  type Rule = Mapping$1.Rule<Mapping>;
31
33
  type Rules = Mapping$1.Rules<Rule>;
32
34
  type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
33
35
 
34
36
  type index$1_Config = Config;
35
37
  type index$1_Destination = Destination;
38
+ type index$1_Env = Env;
36
39
  type index$1_Mapping = Mapping;
37
- type index$1_MetaEnvironment = MetaEnvironment;
38
40
  type index$1_Rule = Rule;
39
41
  type index$1_Rules = Rules;
40
42
  type index$1_Settings = Settings;
41
43
  type index$1_StandardEventNames = StandardEventNames;
44
+ type index$1_Types = Types;
42
45
  declare namespace index$1 {
43
- export type { index$1_Config as Config, index$1_Destination as Destination, index$1_Mapping as Mapping, index$1_MetaEnvironment as MetaEnvironment, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings, index$1_StandardEventNames as StandardEventNames };
46
+ export type { index$1_Config as Config, index$1_Destination as Destination, index$1_Env as Env, index$1_Mapping as Mapping, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings, index$1_StandardEventNames as StandardEventNames, index$1_Types as Types };
47
+ }
48
+
49
+ declare const init: Env | undefined;
50
+ declare const push: Env;
51
+
52
+ declare const env_init: typeof init;
53
+ declare const env_push: typeof push;
54
+ declare namespace env {
55
+ export { env_init as init, env_push as push };
44
56
  }
45
57
 
46
58
  declare function Purchase$1(): unknown[];
@@ -78,16 +90,13 @@ declare namespace mapping {
78
90
  export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
79
91
  }
80
92
 
81
- declare const destinationMetaExamples: {
82
- events: typeof events;
83
- mapping: typeof mapping;
84
- };
85
-
86
- declare const index_destinationMetaExamples: typeof destinationMetaExamples;
93
+ declare const index_env: typeof env;
94
+ declare const index_events: typeof events;
95
+ declare const index_mapping: typeof mapping;
87
96
  declare namespace index {
88
- export { index_destinationMetaExamples as destinationMetaExamples };
97
+ export { index_env as env, index_events as events, index_mapping as mapping };
89
98
  }
90
99
 
91
100
  declare const destinationMeta: Destination;
92
101
 
93
- export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
102
+ 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.1",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(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _array_with_holes(t){if(Array.isArray(t))return t}function _array_without_holes(t){if(Array.isArray(t))return _array_like_to_array(t)}function _define_property(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _iterable_to_array(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _iterable_to_array_limit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){c=!0,o=t}finally{try{i||null==n.return||n.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(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){_define_property(t,e,n[e])})}return t}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function _object_spread_props(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}function _sliced_to_array(t,e){return _array_with_holes(t)||_iterable_to_array_limit(t,e)||_unsupported_iterable_to_array(t,e)||_non_iterable_rest()}function _to_consumable_array(t){return _array_without_holes(t)||_iterable_to_array(t)||_unsupported_iterable_to_array(t)||_non_iterable_spread()}function _type_of(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _unsupported_iterable_to_array(t,e){if(t){if("string"==typeof t)return _array_like_to_array(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(t,e):void 0}}var Destination=function(){var t=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)},e=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.timestamp||(new Date).setHours(0,13,37,0),n=t.group||"gr0up",r=t.count||1,o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=_object_spread({},_,n);var r=Object.entries(e).reduce(function(e,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1],c=t[a];return n.merge&&Array.isArray(c)&&Array.isArray(i)?e[a]=i.reduce(function(t,e){return t.includes(e)?t:_to_consumable_array(t).concat([e])},_to_consumable_array(c)):(n.extend||a in t)&&(e[a]=i),e},{});return n.shallow?_object_spread({},t,r):(Object.assign(t,r),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:"".concat(e,"-").concat(n,"-").concat(r),trigger:"test",entity:"entity",action:"action",timestamp:e,timing:3.14,group:n,count:r,version:{source:"0.2.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},t,{merge:!1});if(t.name){var a,i=_sliced_to_array(null!==(a=t.name.split(" "))&&void 0!==a?a:[],2),c=i[0],u=i[1];c&&u&&(o.entity=c,o.action=u)}return o},n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"entity action",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.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 e(_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"}}}[t],n),{name:t}))},r=function(t){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},t)},o=function(){var t=n("order complete");return["track","Purchase",{value:t.data.total,currency:"EUR",contents:t.nested.filter(function(t){return"product"===t.entity}).map(function(t){return{id:t.data.id,quantity:1}}),content_type:"product",num_items:2},{eventID:t.id}]},a=function(){var t=n("product add");return["track","AddToCart",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]},i=function(){var t=n("cart view");return["track","InitiateCheckout",{currency:"EUR",value:t.data.value,contents:t.nested.filter(function(t){return"product"===t.entity}).map(function(t){return{id:t.data.id,quantity:t.data.quantity}}),num_items:t.nested.filter(function(t){return"product"===t.entity}).length},{eventID:t.id}]},c=function(){var t=n("product view");return["track","ViewContent",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]},u=Object.defineProperty,s=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,l=function(t,e){for(var n in e)u(t,n,{get:e[n],enumerable:!0})},y={};l(y,{DestinationMeta:function(){return f},default:function(){return E},destinationMeta:function(){return C},examples:function(){return b}});var _={merge:!0,shallow:!0,extend:!0},f={},b={};l(b,{env:function(){return g},events:function(){return w},mapping:function(){return j}});var g={};l(g,{init:function(){return v},push:function(){return h}});var m=function(){},v={window:{fbq:void 0,_fbq:void 0},document:{createElement:function(){return{src:"",async:!1,setAttribute:function(){},removeAttribute:function(){}}},head:{appendChild:function(){}}}},h={window:{fbq:Object.assign(m,{callMethod:m,queue:[],push:m,loaded:!0,version:"2.0"}),_fbq:Object.assign(m,{callMethod:m,queue:[],push:m,loaded:!0,version:"2.0"})},document:{createElement:function(){return{src:"",async:!1,setAttribute:function(){},removeAttribute:function(){}}},head:{appendChild:function(){}}}},w={};l(w,{AddToCart:function(){return a},InitiateCheckout:function(){return i},Purchase:function(){return o},ViewContent:function(){return c}});var j={};l(j,{AddToCart:function(){return q},InitiateCheckout:function(){return x},Purchase:function(){return k},ViewContent:function(){return S},config:function(){return A}});var O,k={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return t(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:function(t){return t.nested.filter(function(t){return"product"===t.entity}).length}}}}},q={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"}}}},x={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return t(e)&&"product"===e.entity},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:function(t){return t.nested.filter(function(t){return"product"===t.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:k},product:{view:S,add:q},cart:{view:x}},C={type:"meta-pixel",config:{},init:function(t){var e=t.config,n=t.env,o=e.settings,a=void 0===o?{}:o,i=e.loadScript,c=a.pixelId;return i&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",n=r(t).document,o=n.createElement("script");o.src=e,o.async=!0,n.head.appendChild(o)}(n),!!c&&(function(t){var e=r(t).window;if(!e.fbq){var n=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];n.callMethod?n.callMethod.apply(n,e):n.queue.push(e)};e.fbq=n,e._fbq||(e._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[]}}(n),(0,r(n).window.fbq)("init",c),e)},push:function(e,n){n.config;var o=n.mapping,a=void 0===o?{}:o,i=n.data,c=n.env,u=a.settings||{},s=u.track,d=u.trackCustom,p=r(c).window.fbq;"page view"!==e.name||a.settings||(e.name="PageView");var l=s||d||e.name;p(d?"trackCustom":"track",String(l),t(i)?i:{},{eventID:e.id})}},E=C;return O=y,function(t,e,n,r){if(e&&"object"===(void 0===e?"undefined":_type_of(e))||"function"==typeof e){var o=!0,a=!1,i=void 0;try{for(var c,l=function(){var o=c.value;p.call(t,o)||o===n||u(t,o,{get:function(){return e[o]},enumerable:!(r=s(e,o))||r.enumerable})},y=d(e)[Symbol.iterator]();!(o=(c=y.next()).done);o=!0)l()}catch(t){a=!0,i=t}finally{try{o||null==y.return||y.return()}finally{if(a)throw i}}}return t}(u({},"__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.1",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:()=>g,default:()=>U,destinationMeta:()=>R,examples:()=>m}),module.exports=(e=i,((e,r,i,c)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of a(r))o.call(e,s)||s===i||t(e,s,{get:()=>r[s],enumerable:!(c=n(r,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c=require("@walkeros/web-core");var s={merge:!0,shallow:!0,extend:!0};function d(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(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:"0.2.0",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 p(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 u({...{"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 l=require("@walkeros/web-core"),g={},m={};r(m,{env:()=>y,events:()=>f,mapping:()=>E});var y={};r(y,{init:()=>h,push:()=>b});var v=()=>{},h={window:{fbq:void 0,_fbq:void 0},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},b={window:{fbq:Object.assign(v,{callMethod:v,queue:[],push:v,loaded:!0,version:"2.0"}),_fbq:Object.assign(v,{callMethod:v,queue:[],push:v,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},f={};function w(){const e=p("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 k(){const e=p("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=p("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=p("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:()=>k,InitiateCheckout:()=>q,Purchase:()=>w,ViewContent:()=>x});var E={};r(E,{AddToCart:()=>_,InitiateCheckout:()=>A,Purchase:()=>C,ViewContent:()=>O,config:()=>j});var C={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>d(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}}}},_={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"}}}},A={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>d(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}}}},O={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}}}]}}}},j={order:{complete:C},product:{view:O,add:_},cart:{view:A}},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,c.getEnv)(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,c.getEnv)(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,l.getEnv)(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:c}=(0,l.getEnv)(o),s=c.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const u=r||i||e.name;s(i?"trackCustom":"track",String(u),d(a)?a:{},{eventID:e.id})}},U=R;//# 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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,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/env.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 { getEnv } 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 } = getEnv(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 } = getEnv(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 { getEnv } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Env,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnv(env);\n const script = (document as Document).createElement('script');\n script.src = src;\n script.async = true;\n (document as 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.Env) {\n const { window } = getEnv(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 {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} 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\nexport interface Settings {\n pixelId?: string;\n}\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: {\n createElement: (tagName: string) => Element;\n head: { appendChild: (node: unknown) => void };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\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 env from './env';\nexport * as events from './events';\nexport * as mapping from './mapping';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq not loaded yet)\n window: {\n fbq: undefined as unknown as Env['window']['fbq'],\n _fbq: undefined,\n },\n document: {\n createElement: () =>\n ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }) as unknown as Element,\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [] as unknown[],\n push: noop,\n loaded: true,\n version: '2.0',\n }) as unknown as Env['window']['fbq'],\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [] as unknown[],\n push: noop,\n loaded: true,\n version: '2.0',\n }) as unknown as Env['window']['_fbq'],\n },\n document: {\n createElement: () =>\n ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }) as unknown as Element,\n head: { appendChild: () => {} },\n },\n};\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\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,sBAAuB;AAEhB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,UAAAA,UAAS,QAAI,wBAAO,GAAG;AAC/B,QAAM,SAAUA,UAAsB,cAAc,QAAQ;AAC5D,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,EAACA,UAAsB,KAAK,YAAY,MAAM;AAChD;AAWO,SAAS,MAAM,KAA0B;AAC9C,QAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,QAAM,IAAI;AAIV,MAAI,EAAE,IAAgB;AAEtB,QAAM,IAAI,YAAa,MAAuB;AAC5C,MAAE,aAAa,EAAE,WAAW,MAAM,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,IAAE,MAAM;AACR,MAAI,CAAC,EAAE,KAAM,GAAE,OAAO;AAC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AAG;AAG7B,QAAI,CAAC,QAAS,QAAO;AAGrB,UAAM,GAAG;AAET,UAAM,EAAE,OAAO,QAAI,yBAAO,GAAG;AAC7B,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,yBAAO,GAAG;AAC7B,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","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.1",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 t=Object.defineProperty,e=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})};import{getEnv as n}from"@walkeros/web-core";var a={merge:!0,shallow:!0,extend:!0};function o(t){return"object"==typeof t&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)}function i(t={}){var e;const n=t.timestamp||(new Date).setHours(0,13,37,0),o=t.group||"gr0up",i=t.count||1,r=function(t,e={},n={}){n={...a,...n};const o=Object.entries(e).reduce((e,[a,o])=>{const i=t[a];return n.merge&&Array.isArray(i)&&Array.isArray(o)?e[a]=o.reduce((t,e)=>t.includes(e)?t:[...t,e],[...i]):(n.extend||a in t)&&(e[a]=o),e},{});return n.shallow?{...t,...o}:(Object.assign(t,o),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}-${o}-${i}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:o,count:i,version:{source:"0.2.0",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 r(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 i({...{"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})}import{getEnv as c}from"@walkeros/web-core";var s={},d={};e(d,{env:()=>u,events:()=>m,mapping:()=>f});var u={};e(u,{init:()=>l,push:()=>g});var p=()=>{},l={window:{fbq:void 0,_fbq:void 0},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},g={window:{fbq:Object.assign(p,{callMethod:p,queue:[],push:p,loaded:!0,version:"2.0"}),_fbq:Object.assign(p,{callMethod:p,queue:[],push:p,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},m={};function y(){const t=r("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 h(){const t=r("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 v(){const t=r("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 b(){const t=r("product view");return["track","ViewContent",{currency:"EUR",value:t.data.price,contents:[{id:t.data.id,quantity:1}],content_type:"product"},{eventID:t.id}]}e(m,{AddToCart:()=>h,InitiateCheckout:()=>v,Purchase:()=>y,ViewContent:()=>b});var f={};e(f,{AddToCart:()=>k,InitiateCheckout:()=>q,Purchase:()=>w,ViewContent:()=>x,config:()=>C});var w={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>o(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}}}},k={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:t=>o(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}}}},x={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}}}]}}}},C={order:{complete:w},product:{view:x,add:k},cart:{view:q}},E={type:"meta-pixel",config:{},init({config:t,env:e}){const{settings:a={},loadScript:o}=t,{pixelId:i}=a;if(o&&function(t,e="https://connect.facebook.net/en_US/fbevents.js"){const{document:a}=n(t),o=a.createElement("script");o.src=e,o.async=!0,a.head.appendChild(o)}(e),!i)return!1;!function(t){const{window:e}=n(t),a=e;if(a.fbq)return;const o=function(...t){o.callMethod?o.callMethod.apply(o,t):o.queue.push(t)};a.fbq=o,a._fbq||(a._fbq=o),o.push=o,o.loaded=!0,o.version="2.0",o.queue=[]}(e);const{window:r}=c(e);return(0,r.fbq)("init",i),t},push(t,{config:e,mapping:n={},data:a,env:i}){const{track:r,trackCustom:s}=n.settings||{},{window:d}=c(i),u=d.fbq;"page view"!==t.name||n.settings||(t.name="PageView");const p=r||s||t.name;u(s?"trackCustom":"track",String(p),o(a)?a:{},{eventID:t.id})}},_=E;export{s as DestinationMeta,_ as default,E as destinationMeta,d 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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;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/env.ts","../src/examples/events.ts","../src/examples/mapping.ts"],"sourcesContent":["import type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnv } from '@walkeros/web-core';\n\nexport function addScript(\n env?: DestinationWeb.Env,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnv(env);\n const script = (document as Document).createElement('script');\n script.src = src;\n script.async = true;\n (document as 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.Env) {\n const { window } = getEnv(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 { getEnv } 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 } = getEnv(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 } = getEnv(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 {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} 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\nexport interface Settings {\n pixelId?: string;\n}\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n fbq: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: {\n createElement: (tagName: string) => Element;\n head: { appendChild: (node: unknown) => void };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\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 env from './env';\nexport * as events from './events';\nexport * as mapping from './mapping';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq not loaded yet)\n window: {\n fbq: undefined as unknown as Env['window']['fbq'],\n _fbq: undefined,\n },\n document: {\n createElement: () =>\n ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }) as unknown as Element,\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [] as unknown[],\n push: noop,\n loaded: true,\n version: '2.0',\n }) as unknown as Env['window']['fbq'],\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [] as unknown[],\n push: noop,\n loaded: true,\n version: '2.0',\n }) as unknown as Env['window']['_fbq'],\n },\n document: {\n createElement: () =>\n ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }) as unknown as Element,\n head: { appendChild: () => {} },\n },\n};\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\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,cAAc;AAEhB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,UAAAA,UAAS,IAAI,OAAO,GAAG;AAC/B,QAAM,SAAUA,UAAsB,cAAc,QAAQ;AAC5D,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,EAACA,UAAsB,KAAK,YAAY,MAAM;AAChD;AAWO,SAAS,MAAM,KAA0B;AAC9C,QAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,QAAM,IAAI;AAIV,MAAI,EAAE,IAAgB;AAEtB,QAAM,IAAI,YAAa,MAAuB;AAC5C,MAAE,aAAa,EAAE,WAAW,MAAM,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,IAAE,MAAM;AACR,MAAI,CAAC,EAAE,KAAM,GAAE,OAAO;AACtB,IAAE,OAAO;AACT,IAAE,SAAS;AACX,IAAE,UAAU;AACZ,IAAE,QAAQ,CAAC;AACb;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACtCA,SAAS,UAAAC,eAAc;;;ACHvB;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEb,IAAM,OAAwB;AAAA;AAAA,EAEnC,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,MAAM;AAAA,EACR;A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AO,GAAG;AAC7B,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","getEnv","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config","getEnv"]}
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.1",
4
+ "version": "0.2.0",
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.1"
33
+ "@walkeros/web-core": "0.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/facebook-pixel": "^0.0.31"