@walkeros/web-destination-meta 0.0.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ <p align="left">
2
+ <a href="https://elbwalker.com">
3
+ <img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
4
+ </a>
5
+ </p>
6
+
7
+ # Meta Pixel Destination for walkerOS
8
+
9
+ This package provides a Meta Pixel (formerly Facebook Pixel) destination for
10
+ walkerOS. It allows you to send events to Meta Pixel.
11
+
12
+ [View documentation](https://www.elbwalker.com/docs/destinations/web/meta/)
13
+
14
+ ## Role in walkerOS Ecosystem
15
+
16
+ walkerOS follows a **source → collector → destination** architecture:
17
+
18
+ - **Sources**: Capture events from various environments (browser DOM, dataLayer,
19
+ server requests)
20
+ - **Collector**: Processes, validates, and routes events with consent awareness
21
+ - **Destinations**: Send processed events to analytics platforms (GA4, Meta,
22
+ custom APIs)
23
+
24
+ This Meta Pixel destination receives processed events from the walkerOS
25
+ collector and transforms them into Meta's Pixel API format, handling conversion
26
+ events, custom events, and audience building data to optimize your Meta
27
+ advertising campaigns.
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ npm install @walkeros/web-destination-meta
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Here's a basic example of how to use the Meta Pixel destination:
38
+
39
+ ```typescript
40
+ import { elb } from '@walkeros/collector';
41
+ import { destinationMeta } from '@walkeros/web-destination-meta';
42
+
43
+ elb('walker destination', destinationMeta, {
44
+ custom: {
45
+ pixelId: '1234567890',
46
+ },
47
+ });
48
+ ```
49
+
50
+ ## Contribute
51
+
52
+ Feel free to contribute by submitting an
53
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
54
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
55
+ [contact](https://calendly.com/elb-alexander/30min).
56
+
57
+ ## License
58
+
59
+ This project is licensed under the MIT License.
@@ -0,0 +1,66 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
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
+ declare global {
14
+ namespace WalkerOS {
15
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
+ }
17
+ }
18
+ interface Window {
19
+ _fbq?: facebook.Pixel.Event;
20
+ fbq?: facebook.Pixel.Event;
21
+ }
22
+ }
23
+ type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
+ type Config = DestinationWeb.Config<Settings, Mapping>;
25
+ interface Settings {
26
+ pixelId?: string;
27
+ }
28
+ interface Mapping {
29
+ track?: StandardEventNames;
30
+ trackCustom?: string;
31
+ }
32
+ type Rule = Mapping$1.Rule<Mapping>;
33
+ type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
34
+
35
+ declare const Purchase: Rule;
36
+ declare const AddToCart: Rule;
37
+ declare const InitiateCheckout: Rule;
38
+ declare const ViewContent: Rule;
39
+ declare const config: {
40
+ order: {
41
+ complete: Rule;
42
+ };
43
+ product: {
44
+ view: Rule;
45
+ add: Rule;
46
+ };
47
+ cart: {
48
+ view: Rule;
49
+ };
50
+ };
51
+
52
+ declare const mapping_AddToCart: typeof AddToCart;
53
+ declare const mapping_InitiateCheckout: typeof InitiateCheckout;
54
+ declare const mapping_Purchase: typeof Purchase;
55
+ declare const mapping_ViewContent: typeof ViewContent;
56
+ declare const mapping_config: typeof config;
57
+ declare namespace mapping {
58
+ export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
+ }
60
+
61
+ declare const destinationMetaExamples: {
62
+ events: typeof events;
63
+ mapping: typeof mapping;
64
+ };
65
+
66
+ export { destinationMetaExamples };
@@ -0,0 +1,66 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
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
+ declare global {
14
+ namespace WalkerOS {
15
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
16
+ }
17
+ }
18
+ interface Window {
19
+ _fbq?: facebook.Pixel.Event;
20
+ fbq?: facebook.Pixel.Event;
21
+ }
22
+ }
23
+ type Destination = DestinationWeb.Destination<Settings, Mapping>;
24
+ type Config = DestinationWeb.Config<Settings, Mapping>;
25
+ interface Settings {
26
+ pixelId?: string;
27
+ }
28
+ interface Mapping {
29
+ track?: StandardEventNames;
30
+ trackCustom?: string;
31
+ }
32
+ type Rule = Mapping$1.Rule<Mapping>;
33
+ type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
34
+
35
+ declare const Purchase: Rule;
36
+ declare const AddToCart: Rule;
37
+ declare const InitiateCheckout: Rule;
38
+ declare const ViewContent: Rule;
39
+ declare const config: {
40
+ order: {
41
+ complete: Rule;
42
+ };
43
+ product: {
44
+ view: Rule;
45
+ add: Rule;
46
+ };
47
+ cart: {
48
+ view: Rule;
49
+ };
50
+ };
51
+
52
+ declare const mapping_AddToCart: typeof AddToCart;
53
+ declare const mapping_InitiateCheckout: typeof InitiateCheckout;
54
+ declare const mapping_Purchase: typeof Purchase;
55
+ declare const mapping_ViewContent: typeof ViewContent;
56
+ declare const mapping_config: typeof config;
57
+ declare namespace mapping {
58
+ export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
59
+ }
60
+
61
+ declare const destinationMetaExamples: {
62
+ events: typeof events;
63
+ mapping: typeof mapping;
64
+ };
65
+
66
+ export { destinationMetaExamples };
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/examples/index.ts
21
+ var examples_exports = {};
22
+ __export(examples_exports, {
23
+ destinationMetaExamples: () => destinationMetaExamples
24
+ });
25
+ module.exports = __toCommonJS(examples_exports);
26
+
27
+ // src/examples/events.ts
28
+ var events_exports = {};
29
+ __export(events_exports, {
30
+ AddToCart: () => AddToCart,
31
+ InitiateCheckout: () => InitiateCheckout,
32
+ Purchase: () => Purchase,
33
+ ViewContent: () => ViewContent
34
+ });
35
+
36
+ // ../../../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.0.7", 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;
51
+ }, {});
52
+ return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
53
+ }
54
+ function k(e2) {
55
+ return Array.isArray(e2);
56
+ }
57
+ function M(e2) {
58
+ return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
59
+ }
60
+ var { version: V } = r();
61
+ function H(e2 = {}) {
62
+ 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({ event: "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: [{ type: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: V, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
64
+ if (e2.event) {
65
+ const [t3, n3] = (_a = e2.event.split(" ")) != null ? _a : [];
66
+ t3 && n3 && (o.entity = t3, o.action = n3);
67
+ }
68
+ return o;
69
+ }
70
+ function z(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 H({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ type: "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: [{ type: "product", ...r2, context: { shopping: ["checkout", 0] }, nested: [] }, { type: "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: [{ type: "product", ...r2, context: { shopping: ["complete", 0] }, nested: [] }, { type: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { type: "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, event: e2 });
73
+ }
74
+
75
+ // src/examples/events.ts
76
+ function Purchase() {
77
+ const event = z("order complete");
78
+ return [
79
+ "track",
80
+ "Purchase",
81
+ {
82
+ value: event.data.total,
83
+ currency: "EUR",
84
+ contents: event.nested.filter((item) => item.type === "product").map((item) => ({ id: item.data.id, quantity: 1 })),
85
+ content_type: "product",
86
+ num_items: 2
87
+ },
88
+ { eventID: event.id }
89
+ ];
90
+ }
91
+ function AddToCart() {
92
+ const event = z("product add");
93
+ return [
94
+ "track",
95
+ "AddToCart",
96
+ {
97
+ currency: "EUR",
98
+ value: event.data.price,
99
+ contents: [{ id: event.data.id, quantity: 1 }],
100
+ content_type: "product"
101
+ },
102
+ { eventID: event.id }
103
+ ];
104
+ }
105
+ function InitiateCheckout() {
106
+ const event = z("cart view");
107
+ return [
108
+ "track",
109
+ "InitiateCheckout",
110
+ {
111
+ currency: "EUR",
112
+ value: event.data.value,
113
+ contents: event.nested.filter((entity) => entity.type === "product").map((entity) => ({
114
+ id: entity.data.id,
115
+ quantity: entity.data.quantity
116
+ })),
117
+ num_items: event.nested.filter((item) => item.type === "product").length
118
+ },
119
+ { eventID: event.id }
120
+ ];
121
+ }
122
+ function ViewContent() {
123
+ const event = z("product view");
124
+ return [
125
+ "track",
126
+ "ViewContent",
127
+ {
128
+ currency: "EUR",
129
+ value: event.data.price,
130
+ contents: [{ id: event.data.id, quantity: 1 }],
131
+ content_type: "product"
132
+ },
133
+ { eventID: event.id }
134
+ ];
135
+ }
136
+
137
+ // src/examples/mapping.ts
138
+ var mapping_exports = {};
139
+ __export(mapping_exports, {
140
+ AddToCart: () => AddToCart2,
141
+ InitiateCheckout: () => InitiateCheckout2,
142
+ Purchase: () => Purchase2,
143
+ ViewContent: () => ViewContent2,
144
+ config: () => config
145
+ });
146
+ var Purchase2 = {
147
+ name: "Purchase",
148
+ data: {
149
+ map: {
150
+ value: "data.total",
151
+ currency: { value: "EUR" },
152
+ contents: {
153
+ loop: [
154
+ "nested",
155
+ {
156
+ condition: (entity) => M(entity) && entity.type === "product",
157
+ map: {
158
+ id: "data.id",
159
+ quantity: { key: "data.quantity", value: 1 }
160
+ }
161
+ }
162
+ ]
163
+ },
164
+ content_type: { value: "product" },
165
+ num_items: {
166
+ fn: (event) => event.nested.filter(
167
+ (item) => item.type === "product"
168
+ ).length
169
+ }
170
+ }
171
+ }
172
+ };
173
+ var AddToCart2 = {
174
+ name: "AddToCart",
175
+ data: {
176
+ map: {
177
+ value: "data.price",
178
+ currency: { value: "EUR" },
179
+ contents: {
180
+ set: [
181
+ {
182
+ map: {
183
+ id: "data.id",
184
+ quantity: { key: "data.quantity", value: 1 }
185
+ }
186
+ }
187
+ ]
188
+ },
189
+ content_type: { value: "product" }
190
+ }
191
+ }
192
+ };
193
+ var InitiateCheckout2 = {
194
+ name: "InitiateCheckout",
195
+ data: {
196
+ map: {
197
+ value: "data.value",
198
+ currency: { value: "EUR" },
199
+ contents: {
200
+ loop: [
201
+ "nested",
202
+ {
203
+ condition: (entity) => M(entity) && entity.type === "product",
204
+ map: {
205
+ id: "data.id",
206
+ quantity: { key: "data.quantity", value: 1 }
207
+ }
208
+ }
209
+ ]
210
+ },
211
+ num_items: {
212
+ fn: (event) => event.nested.filter(
213
+ (item) => item.type === "product"
214
+ ).length
215
+ }
216
+ }
217
+ }
218
+ };
219
+ var ViewContent2 = {
220
+ name: "ViewContent",
221
+ data: {
222
+ map: {
223
+ value: "data.price",
224
+ currency: { value: "EUR" },
225
+ content_type: { value: "product" },
226
+ contents: {
227
+ set: [
228
+ {
229
+ map: {
230
+ id: "data.id",
231
+ quantity: { key: "data.quantity", value: 1 }
232
+ }
233
+ }
234
+ ]
235
+ }
236
+ }
237
+ }
238
+ };
239
+ var config = {
240
+ order: { complete: Purchase2 },
241
+ product: { view: ViewContent2, add: AddToCart2 },
242
+ cart: { view: InitiateCheckout2 }
243
+ };
244
+
245
+ // src/examples/index.ts
246
+ var destinationMetaExamples = {
247
+ events: events_exports,
248
+ mapping: mapping_exports
249
+ };
250
+ // Annotate the CommonJS export names for ESM import in node:
251
+ 0 && (module.exports = {
252
+ destinationMetaExamples
253
+ });
@@ -0,0 +1,232 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/examples/events.ts
8
+ var events_exports = {};
9
+ __export(events_exports, {
10
+ AddToCart: () => AddToCart,
11
+ InitiateCheckout: () => InitiateCheckout,
12
+ Purchase: () => Purchase,
13
+ ViewContent: () => ViewContent
14
+ });
15
+
16
+ // ../../../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.0.7", 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;
31
+ }, {});
32
+ return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
33
+ }
34
+ function k(e2) {
35
+ return Array.isArray(e2);
36
+ }
37
+ function M(e2) {
38
+ return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
39
+ }
40
+ var { version: V } = r();
41
+ function H(e2 = {}) {
42
+ var _a;
43
+ const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n2 = e2.group || "gr0up", r2 = e2.count || 1, o = v({ event: "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: [{ type: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t2}-${n2}-${r2}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n2, count: r2, version: { source: V, tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
44
+ if (e2.event) {
45
+ const [t3, n3] = (_a = e2.event.split(" ")) != null ? _a : [];
46
+ t3 && n3 && (o.entity = t3, o.action = n3);
47
+ }
48
+ return o;
49
+ }
50
+ function z(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 H({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r2.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ type: "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: [{ type: "product", ...r2, context: { shopping: ["checkout", 0] }, nested: [] }, { type: "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: [{ type: "product", ...r2, context: { shopping: ["complete", 0] }, nested: [] }, { type: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { type: "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, event: e2 });
53
+ }
54
+
55
+ // src/examples/events.ts
56
+ function Purchase() {
57
+ const event = z("order complete");
58
+ return [
59
+ "track",
60
+ "Purchase",
61
+ {
62
+ value: event.data.total,
63
+ currency: "EUR",
64
+ contents: event.nested.filter((item) => item.type === "product").map((item) => ({ id: item.data.id, quantity: 1 })),
65
+ content_type: "product",
66
+ num_items: 2
67
+ },
68
+ { eventID: event.id }
69
+ ];
70
+ }
71
+ function AddToCart() {
72
+ const event = z("product add");
73
+ return [
74
+ "track",
75
+ "AddToCart",
76
+ {
77
+ currency: "EUR",
78
+ value: event.data.price,
79
+ contents: [{ id: event.data.id, quantity: 1 }],
80
+ content_type: "product"
81
+ },
82
+ { eventID: event.id }
83
+ ];
84
+ }
85
+ function InitiateCheckout() {
86
+ const event = z("cart view");
87
+ return [
88
+ "track",
89
+ "InitiateCheckout",
90
+ {
91
+ currency: "EUR",
92
+ value: event.data.value,
93
+ contents: event.nested.filter((entity) => entity.type === "product").map((entity) => ({
94
+ id: entity.data.id,
95
+ quantity: entity.data.quantity
96
+ })),
97
+ num_items: event.nested.filter((item) => item.type === "product").length
98
+ },
99
+ { eventID: event.id }
100
+ ];
101
+ }
102
+ function ViewContent() {
103
+ const event = z("product view");
104
+ return [
105
+ "track",
106
+ "ViewContent",
107
+ {
108
+ currency: "EUR",
109
+ value: event.data.price,
110
+ contents: [{ id: event.data.id, quantity: 1 }],
111
+ content_type: "product"
112
+ },
113
+ { eventID: event.id }
114
+ ];
115
+ }
116
+
117
+ // src/examples/mapping.ts
118
+ var mapping_exports = {};
119
+ __export(mapping_exports, {
120
+ AddToCart: () => AddToCart2,
121
+ InitiateCheckout: () => InitiateCheckout2,
122
+ Purchase: () => Purchase2,
123
+ ViewContent: () => ViewContent2,
124
+ config: () => config
125
+ });
126
+ var Purchase2 = {
127
+ name: "Purchase",
128
+ data: {
129
+ map: {
130
+ value: "data.total",
131
+ currency: { value: "EUR" },
132
+ contents: {
133
+ loop: [
134
+ "nested",
135
+ {
136
+ condition: (entity) => M(entity) && entity.type === "product",
137
+ map: {
138
+ id: "data.id",
139
+ quantity: { key: "data.quantity", value: 1 }
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ content_type: { value: "product" },
145
+ num_items: {
146
+ fn: (event) => event.nested.filter(
147
+ (item) => item.type === "product"
148
+ ).length
149
+ }
150
+ }
151
+ }
152
+ };
153
+ var AddToCart2 = {
154
+ name: "AddToCart",
155
+ data: {
156
+ map: {
157
+ value: "data.price",
158
+ currency: { value: "EUR" },
159
+ contents: {
160
+ set: [
161
+ {
162
+ map: {
163
+ id: "data.id",
164
+ quantity: { key: "data.quantity", value: 1 }
165
+ }
166
+ }
167
+ ]
168
+ },
169
+ content_type: { value: "product" }
170
+ }
171
+ }
172
+ };
173
+ var InitiateCheckout2 = {
174
+ name: "InitiateCheckout",
175
+ data: {
176
+ map: {
177
+ value: "data.value",
178
+ currency: { value: "EUR" },
179
+ contents: {
180
+ loop: [
181
+ "nested",
182
+ {
183
+ condition: (entity) => M(entity) && entity.type === "product",
184
+ map: {
185
+ id: "data.id",
186
+ quantity: { key: "data.quantity", value: 1 }
187
+ }
188
+ }
189
+ ]
190
+ },
191
+ num_items: {
192
+ fn: (event) => event.nested.filter(
193
+ (item) => item.type === "product"
194
+ ).length
195
+ }
196
+ }
197
+ }
198
+ };
199
+ var ViewContent2 = {
200
+ name: "ViewContent",
201
+ data: {
202
+ map: {
203
+ value: "data.price",
204
+ currency: { value: "EUR" },
205
+ content_type: { value: "product" },
206
+ contents: {
207
+ set: [
208
+ {
209
+ map: {
210
+ id: "data.id",
211
+ quantity: { key: "data.quantity", value: 1 }
212
+ }
213
+ }
214
+ ]
215
+ }
216
+ }
217
+ }
218
+ };
219
+ var config = {
220
+ order: { complete: Purchase2 },
221
+ product: { view: ViewContent2, add: AddToCart2 },
222
+ cart: { view: InitiateCheckout2 }
223
+ };
224
+
225
+ // src/examples/index.ts
226
+ var destinationMetaExamples = {
227
+ events: events_exports,
228
+ mapping: mapping_exports
229
+ };
230
+ export {
231
+ destinationMetaExamples
232
+ };
@@ -0,0 +1 @@
1
+ "use strict";var Destination=(()=>{var e,t,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>{for(var a in t)n(e,a,{get:t[a],enumerable:!0})},s={};i(s,{DestinationMeta:()=>y,default:()=>A,destinationMeta:()=>D,destinationMetaExamples:()=>h});var c=Object.getOwnPropertyNames,d=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[c(e)[0]])((t={exports:{}}).exports,t),t.exports}),p={merge:!0,shallow:!0,extend:!0};function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:l}=d();function g(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...p,...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)}({event:"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:[{type:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${n}-${a}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:n,timing:3.14,group:a,count:o,version:{source:l,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.event){const[n,a]=null!=(t=e.event.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function m(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),a={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},o={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return g({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{type:"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:[{type:"product",...a,context:{shopping:["checkout",0]},nested:[]},{type:"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:[{type:"product",...a,context:{shopping:["complete",0]},nested:[]},{type:"product",...o,context:{shopping:["complete",0]},nested:[]},{type:"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,event:e})}var y={},h={};i(h,{destinationMetaExamples:()=>S});var v={};function b(){const e=m("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function f(){const e=m("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function w(){const e=m("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.type).length},{eventID:e.id}]}function k(){const e=m("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}i(v,{AddToCart:()=>f,InitiateCheckout:()=>w,Purchase:()=>b,ViewContent:()=>k});var x={};i(x,{AddToCart:()=>C,InitiateCheckout:()=>j,Purchase:()=>O,ViewContent:()=>_,config:()=>E});var q,O={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>u(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).length}}}},C={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"}}}},j={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>u(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).length}}}},_={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:O},product:{view:_,add:C},cart:{view:j}},S={events:v,mapping:x},D={type:"meta-pixel",config:{},init({config:e,wrap:t}){const{settings:n={},loadScript:a}=e,{pixelId:o}=n;if(a&&function(e="https://connect.facebook.net/en_US/fbevents.js"){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}(),!o)return!1;!function(){const e=window;if(e.fbq)return;const t=function(...e){t.callMethod?t.callMethod.apply(t,e):t.queue.push(e)};e.fbq=t,e._fbq||(e._fbq=t),t.push=t,t.loaded=!0,t.version="2.0",t.queue=[]}();t("fbq",window.fbq)("init",o)},push(e,{config:t,mapping:n={},data:a,wrap:o}){const{track:r,trackCustom:i}=n.settings||{},s=o("fbq",window.fbq);"page view"!==e.event||n.settings||(e.event="PageView");const c=r||i||e.event;s(i?"trackCustom":"track",String(c),u(a)?a:{},{eventID:e.id})}},A=D;return q=s,((e,t,i,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of o(t))r.call(e,c)||c===i||n(e,c,{get:()=>t[c],enumerable:!(s=a(t,c))||s.enumerable});return e})(n({},"__esModule",{value:!0}),q)})();
@@ -0,0 +1,85 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ namespace WalkerOS {
6
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
7
+ }
8
+ }
9
+ interface Window {
10
+ _fbq?: facebook.Pixel.Event;
11
+ fbq?: facebook.Pixel.Event;
12
+ }
13
+ }
14
+ type Destination = DestinationWeb.Destination<Settings, Mapping>;
15
+ type Config = DestinationWeb.Config<Settings, Mapping>;
16
+ interface Settings {
17
+ pixelId?: string;
18
+ }
19
+ interface Mapping {
20
+ track?: StandardEventNames;
21
+ trackCustom?: string;
22
+ }
23
+ type Rule = Mapping$1.Rule<Mapping>;
24
+ type Rules = Mapping$1.Rules<Rule>;
25
+ type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
26
+
27
+ type index$1_Config = Config;
28
+ type index$1_Destination = Destination;
29
+ type index$1_Mapping = Mapping;
30
+ type index$1_Rule = Rule;
31
+ type index$1_Rules = Rules;
32
+ type index$1_Settings = Settings;
33
+ type index$1_StandardEventNames = StandardEventNames;
34
+ declare namespace index$1 {
35
+ export type { index$1_Config as Config, index$1_Destination as Destination, 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 };
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
+
47
+ declare const Purchase: Rule;
48
+ declare const AddToCart: Rule;
49
+ declare const InitiateCheckout: Rule;
50
+ declare const ViewContent: Rule;
51
+ declare const config: {
52
+ order: {
53
+ complete: Rule;
54
+ };
55
+ product: {
56
+ view: Rule;
57
+ add: Rule;
58
+ };
59
+ cart: {
60
+ view: Rule;
61
+ };
62
+ };
63
+
64
+ declare const mapping_AddToCart: typeof AddToCart;
65
+ declare const mapping_InitiateCheckout: typeof InitiateCheckout;
66
+ declare const mapping_Purchase: typeof Purchase;
67
+ declare const mapping_ViewContent: typeof ViewContent;
68
+ declare const mapping_config: typeof config;
69
+ declare namespace mapping {
70
+ export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
71
+ }
72
+
73
+ declare const destinationMetaExamples: {
74
+ events: typeof events;
75
+ mapping: typeof mapping;
76
+ };
77
+
78
+ declare const index_destinationMetaExamples: typeof destinationMetaExamples;
79
+ declare namespace index {
80
+ export { index_destinationMetaExamples as destinationMetaExamples };
81
+ }
82
+
83
+ declare const destinationMeta: Destination;
84
+
85
+ export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
@@ -0,0 +1,85 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ namespace WalkerOS {
6
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
7
+ }
8
+ }
9
+ interface Window {
10
+ _fbq?: facebook.Pixel.Event;
11
+ fbq?: facebook.Pixel.Event;
12
+ }
13
+ }
14
+ type Destination = DestinationWeb.Destination<Settings, Mapping>;
15
+ type Config = DestinationWeb.Config<Settings, Mapping>;
16
+ interface Settings {
17
+ pixelId?: string;
18
+ }
19
+ interface Mapping {
20
+ track?: StandardEventNames;
21
+ trackCustom?: string;
22
+ }
23
+ type Rule = Mapping$1.Rule<Mapping>;
24
+ type Rules = Mapping$1.Rules<Rule>;
25
+ type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
26
+
27
+ type index$1_Config = Config;
28
+ type index$1_Destination = Destination;
29
+ type index$1_Mapping = Mapping;
30
+ type index$1_Rule = Rule;
31
+ type index$1_Rules = Rules;
32
+ type index$1_Settings = Settings;
33
+ type index$1_StandardEventNames = StandardEventNames;
34
+ declare namespace index$1 {
35
+ export type { index$1_Config as Config, index$1_Destination as Destination, 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 };
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
+
47
+ declare const Purchase: Rule;
48
+ declare const AddToCart: Rule;
49
+ declare const InitiateCheckout: Rule;
50
+ declare const ViewContent: Rule;
51
+ declare const config: {
52
+ order: {
53
+ complete: Rule;
54
+ };
55
+ product: {
56
+ view: Rule;
57
+ add: Rule;
58
+ };
59
+ cart: {
60
+ view: Rule;
61
+ };
62
+ };
63
+
64
+ declare const mapping_AddToCart: typeof AddToCart;
65
+ declare const mapping_InitiateCheckout: typeof InitiateCheckout;
66
+ declare const mapping_Purchase: typeof Purchase;
67
+ declare const mapping_ViewContent: typeof ViewContent;
68
+ declare const mapping_config: typeof config;
69
+ declare namespace mapping {
70
+ export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
71
+ }
72
+
73
+ declare const destinationMetaExamples: {
74
+ events: typeof events;
75
+ mapping: typeof mapping;
76
+ };
77
+
78
+ declare const index_destinationMetaExamples: typeof destinationMetaExamples;
79
+ declare namespace index {
80
+ export { index_destinationMetaExamples as destinationMetaExamples };
81
+ }
82
+
83
+ declare const destinationMeta: Destination;
84
+
85
+ export { index$1 as DestinationMeta, destinationMeta as default, destinationMeta, index as destinationMetaExamples };
@@ -0,0 +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)}({event:"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:[{type:"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:m,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.event){var a,i=_sliced_to_array(null!==(a=e.event.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:[{type:"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({type:"product"},o),{context:{shopping:["checkout",0]},nested:[]}),_object_spread_props(_object_spread({type:"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({type:"product"},o),{context:{shopping:["complete",0]},nested:[]}),_object_spread_props(_object_spread({type:"product"},a),{context:{shopping:["complete",0]},nested:[]}),{type:"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),{event:e}))},a=function(){var e=o("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(function(e){return"product"===e.type}).map(function(e){return{id:e.data.id,quantity:1}}),content_type:"product",num_items:2},{eventID:e.id}]},i=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}]},c=function(){var e=o("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(function(e){return"product"===e.type}).map(function(e){return{id:e.data.id,quantity:e.data.quantity}}),num_items:e.nested.filter(function(e){return"product"===e.type}).length},{eventID:e.id}]},u=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}]},s=Object.defineProperty,p=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,y=function(e,t){for(var r in t)s(e,r,{get:t[r],enumerable:!0})},_={};y(_,{DestinationMeta:function(){return v},default:function(){return C},destinationMeta:function(){return E},destinationMetaExamples:function(){return h}});var f=Object.getOwnPropertyNames,b=(e={"package.json":function(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",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[f(e)[0]])((t={exports:{}}).exports,t),t.exports}),g={merge:!0,shallow:!0,extend:!0},m=b().version,v={},h={};y(h,{destinationMetaExamples:function(){return P}});var w={};y(w,{AddToCart:function(){return i},InitiateCheckout:function(){return c},Purchase:function(){return a},ViewContent:function(){return u}});var j={};y(j,{AddToCart:function(){return x},InitiateCheckout:function(){return S},Purchase:function(){return O},ViewContent:function(){return q},config:function(){return A}});var k,O={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.type},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.type}).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"}}}},S={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:function(e){return r(e)&&"product"===e.type},map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:function(e){return e.nested.filter(function(e){return"product"===e.type}).length}}}}},q={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:O},product:{view:q,add:x},cart:{view:S}},P={events:w,mapping:j},E={type:"meta-pixel",config:{},init:function(e){var t=e.config,r=e.wrap,n=t.settings,o=void 0===n?{}:n,a=t.loadScript,i=o.pixelId;if(a&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://connect.facebook.net/en_US/fbevents.js",t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}(),!i)return!1;!function(){var e=window;if(!e.fbq){var t=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];t.callMethod?t.callMethod.apply(t,r):t.queue.push(r)};e.fbq=t,e._fbq||(e._fbq=t),t.push=t,t.loaded=!0,t.version="2.0",t.queue=[]}}(),r("fbq",window.fbq)("init",i)},push:function(e,t){t.config;var n=t.mapping,o=void 0===n?{}:n,a=t.data,i=t.wrap,c=o.settings||{},u=c.track,s=c.trackCustom,p=i("fbq",window.fbq);"page view"!==e.event||o.settings||(e.event="PageView");var d=u||s||e.event;p(s?"trackCustom":"track",String(d),r(a)?a:{},{eventID:e.id})}},C=E;return k=_,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;l.call(e,o)||o===r||s(e,o,{get:function(){return t[o]},enumerable:!(n=p(t,o))||n.enumerable})},y=d(t)[Symbol.iterator]();!(o=(c=y.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==y.return||y.return()}finally{if(a)throw i}}}return e}(s({},"__esModule",{value:!0}),k)}();
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t,n,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},c={};s(c,{DestinationMeta:()=>h,default:()=>D,destinationMeta:()=>A,destinationMetaExamples:()=>v}),module.exports=(e=c,((e,t,n,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of r(t))i.call(e,c)||c===n||a(e,c,{get:()=>t[c],enumerable:!(s=o(t,c))||s.enumerable});return e})(a({},"__esModule",{value:!0}),e));var d=Object.getOwnPropertyNames,p=(t={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",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 n||(0,t[d(t)[0]])((n={exports:{}}).exports,n),n.exports}),u={merge:!0,shallow:!0,extend:!0};function l(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:g}=p();function m(e={}){var t;const n=e.timestamp||(new Date).setHours(0,13,37,0),a=e.group||"gr0up",o=e.count||1,r=function(e,t={},n={}){n={...u,...n};const a=Object.entries(t).reduce((t,[a,o])=>{const r=e[a];return n.merge&&Array.isArray(r)&&Array.isArray(o)?t[a]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(n.extend||a in e)&&(t[a]=o),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}({event:"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:[{type:"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:g,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.event){const[n,a]=null!=(t=e.event.split(" "))?t:[];n&&a&&(r.entity=n,r.action=a)}return r}function y(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 m({...{"cart view":{data:{currency:"EUR",value:2*a.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{type:"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:[{type:"product",...a,context:{shopping:["checkout",0]},nested:[]},{type:"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:[{type:"product",...a,context:{shopping:["complete",0]},nested:[]},{type:"product",...o,context:{shopping:["complete",0]},nested:[]},{type:"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,event:e})}var h={},v={};s(v,{destinationMetaExamples:()=>S});var b={};function f(){const e=y("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function w(){const e=y("product add");return["track","AddToCart",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}function k(){const e=y("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.type).length},{eventID:e.id}]}function x(){const e=y("product view");return["track","ViewContent",{currency:"EUR",value:e.data.price,contents:[{id:e.data.id,quantity:1}],content_type:"product"},{eventID:e.id}]}s(b,{AddToCart:()=>w,InitiateCheckout:()=>k,Purchase:()=>f,ViewContent:()=>x});var q={};s(q,{AddToCart:()=>C,InitiateCheckout:()=>j,Purchase:()=>O,ViewContent:()=>_,config:()=>E});var O={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>l(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).length}}}},C={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"}}}},j={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>l(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).length}}}},_={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:O},product:{view:_,add:C},cart:{view:j}},S={events:b,mapping:q},A={type:"meta-pixel",config:{},init({config:e,wrap:t}){const{settings:n={},loadScript:a}=e,{pixelId:o}=n;if(a&&function(e="https://connect.facebook.net/en_US/fbevents.js"){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}(),!o)return!1;!function(){const e=window;if(e.fbq)return;const t=function(...e){t.callMethod?t.callMethod.apply(t,e):t.queue.push(e)};e.fbq=t,e._fbq||(e._fbq=t),t.push=t,t.loaded=!0,t.version="2.0",t.queue=[]}();t("fbq",window.fbq)("init",o)},push(e,{config:t,mapping:n={},data:a,wrap:o}){const{track:r,trackCustom:i}=n.settings||{},s=o("fbq",window.fbq);"page view"!==e.event||n.settings||(e.event="PageView");const c=r||i||e.event;s(i?"trackCustom":"track",String(c),l(a)?a:{},{eventID:e.id})}},D=A;//# sourceMappingURL=index.js.map
@@ -0,0 +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';\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, wrap }) {\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();\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup();\n\n const fbq = wrap('fbq', window.fbq);\n fbq('init', pixelId);\n },\n\n push(event, { config, mapping = {}, data, wrap }) {\n const { track, trackCustom } = mapping.settings || {};\n const fbq = wrap('fbq', window.fbq);\n\n // page view\n if (event.event === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.event = 'PageView';\n }\n\n const eventName = track || trackCustom || event.event;\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","export function addScript(\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\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() {\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\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.type === '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.type === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.type === 'product').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.type === '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.type === '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.type === '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.type === '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;;;ACAO,SAAS,UACd,MAAM,kDACN;AACA,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAWO,SAAS,QAAQ;AACtB,QAAMA,KAAI;AAIV,MAAIA,GAAE,IAAgB;AAEtB,QAAMC,KAAI,YAAa,MAAuB;AAC5C,IAAAA,GAAE,aAAaA,GAAE,WAAW,MAAMA,IAAG,IAAI,IAAIA,GAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,EAAAD,GAAE,MAAMC;AACR,MAAI,CAACD,GAAE,KAAM,CAAAA,GAAE,OAAOC;AACtB,EAAAA,GAAE,OAAOA;AACT,EAAAA,GAAE,SAAS;AACX,EAAAA,GAAE,UAAU;AACZ,EAAAA,GAAE,QAAQ,CAAC;AACb;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnCA;;;ACAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,WAAsB;AACpC,QAAM,QAAQ,EAAS,gBAAgB;AAEvC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO,MAAM,KAAK;AAAA,MAClB,UAAU;AAAA,MACV,UAAU,MAAM,OACb,OAAO,CA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,OAAO;AAAA,EACrB;AAAA,EAEA,KAAK,OAAO,EAAE,QAAAA,SAAQ,UAAU,CAAC,GAAG,MAAM,KAAK,GAAG;AAChD,UAAM,EAAE,OAAO,YAAY,IAAI,QAAQ,YAAY,CAAC;AACpD,UAAM,MAAM,KAAK,OAAO,OAAO,GAAG;AAGlC,QAAI,MAAM,UAAU,eAAe,CAAC,QAAQ,UAAU;AAEpD,YAAM,QAAQ;AAAA,IAChB;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":["w","n","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config"]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var e,t,a=Object.defineProperty,n=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})};var o=Object.getOwnPropertyNames,r=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",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[o(e)[0]])((t={exports:{}}).exports,t),t.exports}),i={merge:!0,shallow:!0,extend:!0};function s(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:c}=r();function d(e={}){var t;const a=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",o=e.count||1,r=function(e,t={},a={}){a={...i,...a};const n=Object.entries(t).reduce((t,[n,o])=>{const r=e[n];return a.merge&&Array.isArray(r)&&Array.isArray(o)?t[n]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...r]):(a.extend||n in e)&&(t[n]=o),t},{});return a.shallow?{...e,...n}:(Object.assign(e,n),e)}({event:"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:[{type:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${a}-${n}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:a,timing:3.14,group:n,count:o,version:{source:c,tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.event){const[a,n]=null!=(t=e.event.split(" "))?t:[];a&&n&&(r.entity=a,r.action=n)}return r}function p(e="entity action",t={}){const a=t.timestamp||(new Date).setHours(0,13,37,0),n={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 d({...{"cart view":{data:{currency:"EUR",value:2*n.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{type:"product",data:{...n.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:n.data.price+o.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{type:"product",...n,context:{shopping:["checkout",0]},nested:[]},{type:"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:[{type:"product",...n,context:{shopping:["complete",0]},nested:[]},{type:"product",...o,context:{shopping:["complete",0]},nested:[]},{type:"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":{...n,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...n,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...n.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:a,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,event:e})}var u={},l={};n(l,{destinationMetaExamples:()=>C});var g={};function m(){const e=p("order complete");return["track","Purchase",{value:e.data.total,currency:"EUR",contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:1})),content_type:"product",num_items:2},{eventID:e.id}]}function y(){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 h(){const e=p("cart view");return["track","InitiateCheckout",{currency:"EUR",value:e.data.value,contents:e.nested.filter(e=>"product"===e.type).map(e=>({id:e.data.id,quantity:e.data.quantity})),num_items:e.nested.filter(e=>"product"===e.type).length},{eventID:e.id}]}function v(){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}]}n(g,{AddToCart:()=>y,InitiateCheckout:()=>h,Purchase:()=>m,ViewContent:()=>v});var b={};n(b,{AddToCart:()=>f,InitiateCheckout:()=>k,Purchase:()=>w,ViewContent:()=>x,config:()=>q});var w={name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>s(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).length}}}},f={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"}}}},k={name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>s(e)&&"product"===e.type,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.type).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}}}]}}}},q={order:{complete:w},product:{view:x,add:f},cart:{view:k}},C={events:g,mapping:b},E={type:"meta-pixel",config:{},init({config:e,wrap:t}){const{settings:a={},loadScript:n}=e,{pixelId:o}=a;if(n&&function(e="https://connect.facebook.net/en_US/fbevents.js"){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}(),!o)return!1;!function(){const e=window;if(e.fbq)return;const t=function(...e){t.callMethod?t.callMethod.apply(t,e):t.queue.push(e)};e.fbq=t,e._fbq||(e._fbq=t),t.push=t,t.loaded=!0,t.version="2.0",t.queue=[]}();t("fbq",window.fbq)("init",o)},push(e,{config:t,mapping:a={},data:n,wrap:o}){const{track:r,trackCustom:i}=a.settings||{},c=o("fbq",window.fbq);"page view"!==e.event||a.settings||(e.event="PageView");const d=r||i||e.event;c(i?"trackCustom":"track",String(d),s(n)?n:{},{eventID:e.id})}},S=E;export{u as DestinationMeta,S as default,E as destinationMeta,l as destinationMetaExamples};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/setup.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/events.ts","../src/examples/mapping.ts","../src/index.ts"],"sourcesContent":["export function addScript(\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\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() {\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\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.type === '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.type === 'product')\n .map((entity) => ({\n id: entity.data.id,\n quantity: entity.data.quantity,\n })),\n num_items: event.nested.filter((item) => item.type === 'product').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.type === '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.type === '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.type === '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.type === '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","import type { Settings, Destination } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/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, wrap }) {\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();\n\n // Required pixel id\n if (!pixelId) return false;\n\n // fbq function setup\n setup();\n\n const fbq = wrap('fbq', window.fbq);\n fbq('init', pixelId);\n },\n\n push(event, { config, mapping = {}, data, wrap }) {\n const { track, trackCustom } = mapping.settings || {};\n const fbq = wrap('fbq', window.fbq);\n\n // page view\n if (event.event === 'page view' && !mapping.settings) {\n // Define a custom mapping\n event.event = 'PageView';\n }\n\n const eventName = track || trackCustom || event.event;\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"],"mappings":";;;;;;;AAAO,SAAS,UACd,MAAM,kDACN;AACA,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAWO,SAAS,QAAQ;AACtB,QAAMA,KAAI;AAIV,MAAIA,GAAE,IAAgB;AAEtB,QAAMC,KAAI,YAAa,MAAuB;AAC5C,IAAAA,GAAE,aAAaA,GAAE,WAAW,MAAMA,IAAG,IAAI,IAAIA,GAAE,MAAM,KAAK,IAAI;AAAA,EAChE;AAEA,EAAAD,GAAE,MAAMC;AACR,MAAI,CAACD,GAAE,KAAM,CAAAA,GAAE,OAAOC;AACtB,EAAAA,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,EAAE,MAAMC,kBAAiB;AACjC;;;AF1GO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AACF;;;AGIO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAAE,SAAQ,KAAK,GAAG;AACrB,UAAM,EAAE,WAAW,CAAC,GAAwB,WAAW,IAAIA;AAC3D,UAAM,EAAE,QAAQ,IAAI;AAGpB,QAAI,WAAY,WAAU;AAG1B,QAAI,CAAC,QAAS,QAAO;AAGrB,UAAM;AAEN,UAAM,MAAM,KAAK,OAAO,OAAO,GAAG;AAClC,QAAI,QAAQ,OAAO;AAAA,EACrB;AAAA,EAEA,KAAK,OAAO,EAAE,QAAAA,SAAQ,UAAU,CAAC,GAAG,MAAM,KAAK,GAAG;AAChD,UAAM,EAAE,OAAO,YAAY,IAAI,QAAQ,YAAY,CAAC;AACpD,UAAM,MAAM,KAAK,OAAO,OAAO,GAAG;AAGlC,QAAI,MAAM,UAAU,eAAe,CAAC,QAAQ,UAAU;AAEpD,YAAM,QAAQ;AAAA,IAChB;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":["w","n","AddToCart","InitiateCheckout","Purchase","ViewContent","Purchase","AddToCart","InitiateCheckout","ViewContent","config"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@walkeros/web-destination-meta",
3
+ "description": "Meta pixel web destination for walkerOS",
4
+ "version": "0.0.7",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./examples": {
16
+ "types": "./dist/examples/index.d.ts",
17
+ "import": "./dist/examples/index.mjs",
18
+ "require": "./dist/examples/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist/**"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup --silent",
26
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
27
+ "dev": "jest --watchAll --colors",
28
+ "lint": "tsc && eslint \"**/*.ts*\"",
29
+ "test": "jest",
30
+ "update": "npx npm-check-updates -u && npm update"
31
+ },
32
+ "dependencies": {
33
+ "@walkeros/web-core": "0.0.7"
34
+ },
35
+ "devDependencies": {
36
+ "@types/facebook-pixel": "^0.0.31"
37
+ },
38
+ "repository": {
39
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
40
+ "directory": "packages/web/destinations/meta"
41
+ },
42
+ "author": "elbwalker <hello@elbwalker.com>",
43
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/elbwalker/walkerOS/issues"
46
+ },
47
+ "keywords": [
48
+ "walker",
49
+ "walkerOS",
50
+ "destination",
51
+ "web",
52
+ "meta",
53
+ "pixel"
54
+ ],
55
+ "funding": [
56
+ {
57
+ "type": "GitHub Sponsors",
58
+ "url": "https://github.com/sponsors/elbwalker"
59
+ }
60
+ ]
61
+ }