@walkeros/server-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.
@@ -0,0 +1,311 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationServer } from '@walkeros/server-core';
3
+
4
+ declare global {
5
+ namespace WalkerOS {
6
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
7
+ }
8
+ }
9
+ }
10
+ interface Destination extends DestinationServer.Destination<Settings, Mapping> {
11
+ init: DestinationServer.InitFn<Settings, Mapping>;
12
+ }
13
+ type Config = {
14
+ settings: Settings;
15
+ } & DestinationServer.Config<Settings, Mapping>;
16
+ interface Settings {
17
+ accessToken: string;
18
+ pixelId: string;
19
+ action_source?: ActionSource;
20
+ doNotHash?: string[];
21
+ test_event_code?: string;
22
+ url?: string;
23
+ user_data?: Mapping$1.Map;
24
+ }
25
+ interface Mapping {
26
+ }
27
+ type Rule = Mapping$1.Rule<Mapping>;
28
+ interface BodyParameters {
29
+ data: Array<ServerEventParameters>;
30
+ test_event_code?: string;
31
+ }
32
+ /**
33
+ * Represents the top‑level parameters for a server event sent via Meta's Conversions API.
34
+ * https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event
35
+ */
36
+ interface ServerEventParameters extends StandardParameters {
37
+ /** The event name or custom event identifier. Required for deduplication. */
38
+ event_name: EventName;
39
+ /** Unix timestamp (in seconds) when the event actually occurred. GMT timezone. */
40
+ event_time: number;
41
+ /** Map of customer information for matching (emails, phone, etc.). */
42
+ user_data: CustomerInformationParameters;
43
+ /** Additional business data about the event. */
44
+ custom_data?: Record<string, unknown>;
45
+ /** URL of the page where the event occurred. */
46
+ event_source_url?: string;
47
+ /** If true, exclude this event from ads optimization (only attribution). */
48
+ opt_out?: boolean;
49
+ /** Unique ID for deduplication across Pixel and CAPI. */
50
+ event_id?: string;
51
+ /** Source of the event (e.g., website, app). */
52
+ action_source: ActionSource;
53
+ /** Processing options (e.g., ['LDU'] for CCPA limited data use). */
54
+ data_processing_options?: DataProcessingOption[];
55
+ /** Country code for data processing option (1 = USA, 0 = auto‑geolocate). */
56
+ data_processing_options_country?: number;
57
+ /** State code for data processing option (1000 = California, 0 = auto). */
58
+ data_processing_options_state?: number;
59
+ /** App‑specific data (required if action_source is 'app'). */
60
+ app_data?: AppData;
61
+ /** HTTP referrer header of the event. */
62
+ referrer_url?: string;
63
+ /** Metadata to link delayed events to past acquisition events. */
64
+ original_event_data?: OriginalEventDataParameters;
65
+ /** User segment for more context about the customer's relationship. */
66
+ customer_segmentation?: CustomerSegmentation;
67
+ }
68
+ type EventName = 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
69
+ type ActionSource = 'email' | 'website' | 'app' | 'phone_call' | 'chat' | 'physical_store' | 'system_generated' | 'business_messaging' | 'other';
70
+ type DataProcessingOption = 'LDU';
71
+ type CustomerSegmentation = 'new_customer_to_business' | 'new_customer_to_business_line' | 'new_customer_to_product_area' | 'new_customer_to_medium' | 'existing_customer_to_business' | 'existing_customer_to_business_line' | 'existing_customer_to_product_area' | 'existing_customer_to_medium' | 'customer_in_loyalty_program';
72
+ /** Extended device info for app events (Android version 'a2', iOS 'i2') */
73
+ interface AppData {
74
+ /**
75
+ * Comma-separated array of strings with fixed order:
76
+ * [sdk_version, os_version, device_model, device_brand,
77
+ * screen_width, screen_height, ...]
78
+ */
79
+ extinfo: string[];
80
+ }
81
+ interface CustomerInformationParameters {
82
+ /** Email(s), SHA-256 hashed, lowercase and trimmed */
83
+ em?: string | string[];
84
+ /** Phone number(s), SHA-256 hashed, E.164 format (no leading 0s or symbols) */
85
+ ph?: string | string[];
86
+ /** First name(s), SHA-256 hashed, lowercase */
87
+ fn?: string | string[];
88
+ /** Last name(s), SHA-256 hashed, lowercase */
89
+ ln?: string | string[];
90
+ /** Date(s) of birth in YYYYMMDD, SHA-256 hashed */
91
+ db?: string | string[];
92
+ /** Gender(s) in lowercase single letter ("m", "f", etc.), SHA-256 hashed */
93
+ ge?: string | string[];
94
+ /** City name(s), SHA-256 hashed, lowercase */
95
+ ct?: string | string[];
96
+ /** State abbreviation(s), SHA-256 hashed, lowercase (e.g., "ca", "ny") */
97
+ st?: string | string[];
98
+ /** ZIP or postal code(s), SHA-256 hashed, lowercase */
99
+ zp?: string | string[];
100
+ /** Country code(s), SHA-256 hashed, lowercase (ISO 3166-1 alpha-2) */
101
+ country?: string | string[];
102
+ /** External IDs, unique per user. SHA-256 hash recommended */
103
+ external_id?: string | string[];
104
+ /** IPv4 or IPv6 address of client. Do NOT hash. */
105
+ client_ip_address?: string;
106
+ /** User agent string from browser. Do NOT hash. */
107
+ client_user_agent?: string;
108
+ /** fbclid parameter value from the URL. Do NOT hash. */
109
+ fbclid?: string;
110
+ /** Facebook click ID (_fbc cookie). Do NOT hash. */
111
+ fbc?: string;
112
+ /** Facebook browser ID (_fbp cookie). Do NOT hash. */
113
+ fbp?: string;
114
+ /** Subscription ID for the transaction. Do NOT hash. */
115
+ subscription_id?: string;
116
+ /** Facebook login ID (App-Scoped ID). Do NOT hash. */
117
+ fb_login_id?: number;
118
+ /** Meta Lead Ad lead ID. Do NOT hash. */
119
+ lead_id?: number;
120
+ /** Anonymous install ID. App events only. Do NOT hash. */
121
+ anon_id?: string;
122
+ /** Mobile advertiser ID (GAID/IDFA). Do NOT hash. */
123
+ madid?: string;
124
+ /** Facebook Page ID. Do NOT hash. */
125
+ page_id?: string;
126
+ /** Messenger Page-scoped user ID. Do NOT hash. */
127
+ page_scoped_user_id?: string;
128
+ /** Click to WhatsApp ad click ID. Do NOT hash. */
129
+ ctwa_clid?: string;
130
+ /** Instagram business account ID. Do NOT hash. */
131
+ ig_account_id?: string;
132
+ /** Instagram-scoped user ID. Do NOT hash. */
133
+ ig_sid?: string;
134
+ }
135
+ interface StandardParameters {
136
+ availability?: string;
137
+ body_style?: string;
138
+ checkin_date?: string;
139
+ city?: string;
140
+ condition_of_vehicle?: string;
141
+ content_ids?: string[];
142
+ content_type?: 'product' | 'product_group' | string;
143
+ contents?: Array<{
144
+ id: string;
145
+ quantity?: number;
146
+ item_price?: number;
147
+ delivery_category?: string;
148
+ }>;
149
+ country?: string;
150
+ currency?: string;
151
+ delivery_category?: 'in_store' | 'curbside' | 'home_delivery' | string;
152
+ departing_arrival_date?: string;
153
+ departing_departure_date?: string;
154
+ destination_airport?: string;
155
+ destination_ids?: string[];
156
+ dma_code?: string;
157
+ drivetrain?: string;
158
+ exterior_color?: string;
159
+ fuel_type?: string;
160
+ hotel_score?: number;
161
+ interior_color?: string;
162
+ lead_event_source?: string;
163
+ lease_end_date?: string;
164
+ lease_start_date?: string;
165
+ listing_type?: string;
166
+ make?: string;
167
+ 'mileage.unit'?: string;
168
+ 'mileage.value'?: number;
169
+ model?: string;
170
+ neighborhood?: string;
171
+ net_revenue?: number;
172
+ num_adults?: number;
173
+ num_children?: number;
174
+ num_infants?: number;
175
+ num_items?: number;
176
+ order_id?: string;
177
+ origin_airport?: string;
178
+ postal_code?: string;
179
+ predicted_ltv?: number;
180
+ preferred_baths_range?: string;
181
+ preferred_beds_range?: string;
182
+ preferred_neighborhoods?: string[];
183
+ preferred_num_stops?: number;
184
+ preferred_price_range?: string;
185
+ preferred_star_ratings?: [number, number];
186
+ price?: string;
187
+ product_catalog_id?: string;
188
+ property_type?: string;
189
+ region?: string;
190
+ returning_arrival_date?: string;
191
+ returning_departure_date?: string;
192
+ search_string?: string;
193
+ state_of_vehicle?: string;
194
+ suggested_destinations?: string[];
195
+ suggested_home_listings?: string[];
196
+ suggested_hotels?: string[];
197
+ suggested_jobs?: string[];
198
+ suggested_local_service_businesses?: string[];
199
+ suggested_location_based_items?: string[];
200
+ suggested_vehicles?: string[];
201
+ transmission?: string;
202
+ travel_class?: string;
203
+ travel_end?: string;
204
+ travel_start?: string;
205
+ trim?: string;
206
+ fb_availability?: string;
207
+ fb_body_style?: string;
208
+ fb_checkin_date?: string;
209
+ fb_city?: string;
210
+ fb_condition_of_vehicle?: string;
211
+ fb_content_ids?: string[];
212
+ fb_content_type?: string;
213
+ fb_contents?: Array<{
214
+ id: string;
215
+ quantity?: number;
216
+ item_price?: number;
217
+ }>;
218
+ fb_country?: string;
219
+ fb_currency?: string;
220
+ fb_delivery_category?: string;
221
+ fb_departing_arrival_date?: string;
222
+ fb_departing_departure_date?: string;
223
+ fb_destination_airport?: string;
224
+ fb_destination_ids?: string[];
225
+ fb_dma_code?: string;
226
+ fb_drivetrain?: string;
227
+ fb_exterior_color?: string;
228
+ fb_fuel_type?: string;
229
+ fb_hotel_score?: number;
230
+ fb_interior_color?: string;
231
+ fb_lease_end_date?: string;
232
+ fb_lease_start_date?: string;
233
+ fb_listing_type?: string;
234
+ fb_make?: string;
235
+ 'fb_mileage.unit'?: string;
236
+ 'fb_mileage.value'?: number;
237
+ fb_model?: string;
238
+ fb_neighborhood?: string;
239
+ fb_num_adults?: number;
240
+ fb_num_children?: number;
241
+ fb_num_infants?: number;
242
+ fb_num_items?: number;
243
+ fb_order_id?: string;
244
+ fb_origin_airport?: string;
245
+ fb_postal_code?: string;
246
+ fb_predicted_ltv?: number;
247
+ fb_preferred_baths_range?: string;
248
+ fb_preferred_beds_range?: string;
249
+ fb_preferred_neighborhoods?: string[];
250
+ fb_preferred_num_stops?: number;
251
+ fb_preferred_price_range?: string;
252
+ fb_preferred_star_ratings?: [number, number];
253
+ fb_price?: string;
254
+ fb_product_catalog_id?: string;
255
+ fb_property_type?: string;
256
+ fb_region?: string;
257
+ fb_returning_arrival_date?: string;
258
+ fb_returning_departure_date?: string;
259
+ fb_search_string?: string;
260
+ fb_state_of_vehicle?: string;
261
+ fb_suggested_destinations?: string[];
262
+ fb_suggested_home_listings?: string[];
263
+ fb_suggested_hotels?: string[];
264
+ fb_suggested_jobs?: string[];
265
+ fb_suggested_local_service_businesses?: string[];
266
+ fb_suggested_location_based_items?: string[];
267
+ fb_suggested_vehicles?: string[];
268
+ fb_transmission?: string;
269
+ fb_travel_class?: string;
270
+ fb_travel_end?: string;
271
+ fb_travel_start?: string;
272
+ user_bucket?: string;
273
+ value?: number;
274
+ vin?: string;
275
+ year?: number;
276
+ item_number?: string;
277
+ }
278
+ interface OriginalEventDataParameters {
279
+ event_name?: EventName;
280
+ event_time?: number;
281
+ order_id?: number;
282
+ event_id?: string;
283
+ }
284
+
285
+ declare function Purchase$1(): BodyParameters;
286
+
287
+ declare namespace events {
288
+ export { Purchase$1 as Purchase };
289
+ }
290
+
291
+ declare const InitUserData: Settings;
292
+ declare const Purchase: Rule;
293
+ declare const config: {
294
+ order: {
295
+ complete: Rule;
296
+ };
297
+ };
298
+
299
+ declare const mapping_InitUserData: typeof InitUserData;
300
+ declare const mapping_Purchase: typeof Purchase;
301
+ declare const mapping_config: typeof config;
302
+ declare namespace mapping {
303
+ export { mapping_InitUserData as InitUserData, mapping_Purchase as Purchase, mapping_config as config };
304
+ }
305
+
306
+ declare const destinationMetaExamples: {
307
+ events: typeof events;
308
+ mapping: typeof mapping;
309
+ };
310
+
311
+ export { destinationMetaExamples };
@@ -0,0 +1,157 @@
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
+ Purchase: () => Purchase
31
+ });
32
+
33
+ // ../../../core/dist/index.mjs
34
+ var e;
35
+ var t;
36
+ var n = Object.getOwnPropertyNames;
37
+ var r = (e = { "package.json"(e2, t2) {
38
+ 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" }] };
39
+ } }, function() {
40
+ return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
41
+ });
42
+ var w = { merge: true, shallow: true, extend: true };
43
+ function v(e2, t2 = {}, n2 = {}) {
44
+ n2 = { ...w, ...n2 };
45
+ const r2 = Object.entries(t2).reduce((t3, [r3, o]) => {
46
+ const i = e2[r3];
47
+ 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;
48
+ }, {});
49
+ return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
50
+ }
51
+ function k(e2) {
52
+ return Array.isArray(e2);
53
+ }
54
+ function M(e2) {
55
+ return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
56
+ }
57
+ var { version: V } = r();
58
+ function H(e2 = {}) {
59
+ var _a;
60
+ 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 });
61
+ if (e2.event) {
62
+ const [t3, n3] = (_a = e2.event.split(" ")) != null ? _a : [];
63
+ t3 && n3 && (o.entity = t3, o.action = n3);
64
+ }
65
+ return o;
66
+ }
67
+ function z(e2 = "entity action", t2 = {}) {
68
+ 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 } };
69
+ 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 });
70
+ }
71
+
72
+ // src/examples/events.ts
73
+ function Purchase() {
74
+ const event = z("order complete");
75
+ return {
76
+ data: [
77
+ {
78
+ event_name: "Purchase",
79
+ event_time: event.timestamp / 1e3,
80
+ event_id: event.id,
81
+ event_source_url: event.source.id,
82
+ action_source: "website",
83
+ user_data: {
84
+ external_id: [
85
+ "cc8e27118413234d4297ed00a02711365312c79325df9b5b8f4199cbd0b96e7e",
86
+ "9176e6f336dbdb4f99b0e45cbd7e41e0e2323812b236822842a61ffbd362ac8c"
87
+ ]
88
+ },
89
+ order_id: String(event.data.id),
90
+ currency: "EUR",
91
+ value: Number(event.data.total),
92
+ contents: event.nested.filter((item) => item.type === "product").map((item) => ({
93
+ id: String(item.data.id),
94
+ quantity: Number(item.data.quantity) || 1,
95
+ item_price: Number(item.data.price)
96
+ })),
97
+ num_items: 2
98
+ }
99
+ ]
100
+ };
101
+ }
102
+
103
+ // src/examples/mapping.ts
104
+ var mapping_exports = {};
105
+ __export(mapping_exports, {
106
+ InitUserData: () => InitUserData,
107
+ Purchase: () => Purchase2,
108
+ config: () => config
109
+ });
110
+ var InitUserData = {
111
+ pixelId: "p1x3l1d",
112
+ accessToken: "s3cr3t",
113
+ user_data: {
114
+ external_id: { set: ["user.device", "user.session"] }
115
+ }
116
+ };
117
+ var Purchase2 = {
118
+ name: "Purchase",
119
+ data: {
120
+ map: {
121
+ order_id: "data.id",
122
+ currency: { key: "data.currency", value: "EUR" },
123
+ value: "data.total",
124
+ contents: {
125
+ loop: [
126
+ "nested",
127
+ {
128
+ condition: (entity) => M(entity) && entity.type === "product",
129
+ map: {
130
+ id: "data.id",
131
+ item_price: "data.price",
132
+ quantity: { key: "data.quantity", value: 1 }
133
+ }
134
+ }
135
+ ]
136
+ },
137
+ num_items: {
138
+ fn: (event) => event.nested.filter(
139
+ (item) => item.type === "product"
140
+ ).length
141
+ }
142
+ }
143
+ }
144
+ };
145
+ var config = {
146
+ order: { complete: Purchase2 }
147
+ };
148
+
149
+ // src/examples/index.ts
150
+ var destinationMetaExamples = {
151
+ events: events_exports,
152
+ mapping: mapping_exports
153
+ };
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ destinationMetaExamples
157
+ });
@@ -0,0 +1,136 @@
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
+ Purchase: () => Purchase
11
+ });
12
+
13
+ // ../../../core/dist/index.mjs
14
+ var e;
15
+ var t;
16
+ var n = Object.getOwnPropertyNames;
17
+ var r = (e = { "package.json"(e2, t2) {
18
+ 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" }] };
19
+ } }, function() {
20
+ return t || (0, e[n(e)[0]])((t = { exports: {} }).exports, t), t.exports;
21
+ });
22
+ var w = { merge: true, shallow: true, extend: true };
23
+ function v(e2, t2 = {}, n2 = {}) {
24
+ n2 = { ...w, ...n2 };
25
+ const r2 = Object.entries(t2).reduce((t3, [r3, o]) => {
26
+ const i = e2[r3];
27
+ 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;
28
+ }, {});
29
+ return n2.shallow ? { ...e2, ...r2 } : (Object.assign(e2, r2), e2);
30
+ }
31
+ function k(e2) {
32
+ return Array.isArray(e2);
33
+ }
34
+ function M(e2) {
35
+ return "object" == typeof e2 && null !== e2 && !k(e2) && "[object Object]" === Object.prototype.toString.call(e2);
36
+ }
37
+ var { version: V } = r();
38
+ function H(e2 = {}) {
39
+ var _a;
40
+ 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 });
41
+ if (e2.event) {
42
+ const [t3, n3] = (_a = e2.event.split(" ")) != null ? _a : [];
43
+ t3 && n3 && (o.entity = t3, o.action = n3);
44
+ }
45
+ return o;
46
+ }
47
+ function z(e2 = "entity action", t2 = {}) {
48
+ 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 } };
49
+ 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 });
50
+ }
51
+
52
+ // src/examples/events.ts
53
+ function Purchase() {
54
+ const event = z("order complete");
55
+ return {
56
+ data: [
57
+ {
58
+ event_name: "Purchase",
59
+ event_time: event.timestamp / 1e3,
60
+ event_id: event.id,
61
+ event_source_url: event.source.id,
62
+ action_source: "website",
63
+ user_data: {
64
+ external_id: [
65
+ "cc8e27118413234d4297ed00a02711365312c79325df9b5b8f4199cbd0b96e7e",
66
+ "9176e6f336dbdb4f99b0e45cbd7e41e0e2323812b236822842a61ffbd362ac8c"
67
+ ]
68
+ },
69
+ order_id: String(event.data.id),
70
+ currency: "EUR",
71
+ value: Number(event.data.total),
72
+ contents: event.nested.filter((item) => item.type === "product").map((item) => ({
73
+ id: String(item.data.id),
74
+ quantity: Number(item.data.quantity) || 1,
75
+ item_price: Number(item.data.price)
76
+ })),
77
+ num_items: 2
78
+ }
79
+ ]
80
+ };
81
+ }
82
+
83
+ // src/examples/mapping.ts
84
+ var mapping_exports = {};
85
+ __export(mapping_exports, {
86
+ InitUserData: () => InitUserData,
87
+ Purchase: () => Purchase2,
88
+ config: () => config
89
+ });
90
+ var InitUserData = {
91
+ pixelId: "p1x3l1d",
92
+ accessToken: "s3cr3t",
93
+ user_data: {
94
+ external_id: { set: ["user.device", "user.session"] }
95
+ }
96
+ };
97
+ var Purchase2 = {
98
+ name: "Purchase",
99
+ data: {
100
+ map: {
101
+ order_id: "data.id",
102
+ currency: { key: "data.currency", value: "EUR" },
103
+ value: "data.total",
104
+ contents: {
105
+ loop: [
106
+ "nested",
107
+ {
108
+ condition: (entity) => M(entity) && entity.type === "product",
109
+ map: {
110
+ id: "data.id",
111
+ item_price: "data.price",
112
+ quantity: { key: "data.quantity", value: 1 }
113
+ }
114
+ }
115
+ ]
116
+ },
117
+ num_items: {
118
+ fn: (event) => event.nested.filter(
119
+ (item) => item.type === "product"
120
+ ).length
121
+ }
122
+ }
123
+ }
124
+ };
125
+ var config = {
126
+ order: { complete: Purchase2 }
127
+ };
128
+
129
+ // src/examples/index.ts
130
+ var destinationMetaExamples = {
131
+ events: events_exports,
132
+ mapping: mapping_exports
133
+ };
134
+ export {
135
+ destinationMetaExamples
136
+ };