@walkeros/web-destination-meta 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,222 +64,212 @@ var push = {
64
64
  }
65
65
  };
66
66
 
67
- // src/examples/events.ts
68
- var events_exports = {};
69
- __export(events_exports, {
70
- AddToCart: () => AddToCart,
71
- InitiateCheckout: () => InitiateCheckout,
72
- Purchase: () => Purchase,
73
- ViewContent: () => ViewContent
67
+ // src/examples/step.ts
68
+ var step_exports = {};
69
+ __export(step_exports, {
70
+ addToCart: () => addToCart,
71
+ initiateCheckout: () => initiateCheckout,
72
+ pageView: () => pageView,
73
+ purchase: () => purchase,
74
+ viewContent: () => viewContent
74
75
  });
75
76
 
76
77
  // ../../../core/dist/index.mjs
77
- var e = Object.defineProperty;
78
- var c = {};
79
- ((t, n) => {
80
- for (var o in n) e(t, o, { get: n[o], enumerable: true });
81
- })(c, { Level: () => u });
82
- var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(u || {});
83
- var A = { merge: true, shallow: true, extend: true };
84
- function P(e2, t = {}, n = {}) {
85
- n = { ...A, ...n };
86
- const o = Object.entries(t).reduce((t2, [o2, r]) => {
87
- const i = e2[o2];
88
- return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
78
+ var t = Object.defineProperty;
79
+ var a = {};
80
+ ((e, n) => {
81
+ for (var o in n) t(e, o, { get: n[o], enumerable: true });
82
+ })(a, { Level: () => u });
83
+ var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
84
+ var D = { merge: true, shallow: true, extend: true };
85
+ function H(t2, e = {}, n = {}) {
86
+ n = { ...D, ...n };
87
+ const o = Object.entries(e).reduce((e2, [o2, r]) => {
88
+ const i = t2[o2];
89
+ return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
89
90
  }, {});
90
- return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
91
+ return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
91
92
  }
92
- function _(e2) {
93
- return Array.isArray(e2);
93
+ function W(t2) {
94
+ return Array.isArray(t2);
94
95
  }
95
- function D(e2) {
96
- return "object" == typeof e2 && null !== e2 && !_(e2) && "[object Object]" === Object.prototype.toString.call(e2);
96
+ function Z(t2) {
97
+ return "object" == typeof t2 && null !== t2 && !W(t2) && "[object Object]" === Object.prototype.toString.call(t2);
97
98
  }
98
- function Z(e2 = {}) {
99
+ function nt(t2 = {}) {
99
100
  var _a;
100
- const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = P({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "2.0.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
101
- if (e2.name) {
102
- const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
103
- t2 && n2 && (r.entity = t2, r.action = n2);
101
+ const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
102
+ if (t2.name) {
103
+ const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
104
+ e2 && n2 && (r.entity = e2, r.action = n2);
104
105
  }
105
106
  return r;
106
107
  }
107
- function q(e2 = "entity action", t = {}) {
108
- const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
109
- return Z({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
108
+ function ot(t2 = "entity action", e = {}) {
109
+ const n = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
110
+ return nt({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[t2], ...e, name: t2 });
110
111
  }
111
112
 
112
- // src/examples/events.ts
113
- function Purchase() {
114
- const event = q("order complete");
115
- return [
113
+ // src/examples/step.ts
114
+ var purchase = {
115
+ in: ot("order complete", { timestamp: 17e8 }),
116
+ mapping: {
117
+ name: "Purchase",
118
+ data: {
119
+ map: {
120
+ value: "data.total",
121
+ currency: { value: "EUR" },
122
+ contents: {
123
+ loop: [
124
+ "nested",
125
+ {
126
+ condition: (entity) => Z(entity) && entity.entity === "product",
127
+ map: {
128
+ id: "data.id",
129
+ quantity: { key: "data.quantity", value: 1 }
130
+ }
131
+ }
132
+ ]
133
+ },
134
+ content_type: { value: "product" },
135
+ num_items: {
136
+ fn: (event) => event.nested.filter(
137
+ (item) => item.entity === "product"
138
+ ).length
139
+ }
140
+ }
141
+ }
142
+ },
143
+ out: [
116
144
  "track",
117
145
  "Purchase",
118
146
  {
119
- value: event.data.total,
147
+ value: 555,
120
148
  currency: "EUR",
121
- contents: event.nested.filter((item) => item.entity === "product").map((item) => ({ id: item.data.id, quantity: 1 })),
149
+ contents: [
150
+ { id: "ers", quantity: 1 },
151
+ { id: "cc", quantity: 1 }
152
+ ],
122
153
  content_type: "product",
123
154
  num_items: 2
124
155
  },
125
- { eventID: event.id }
126
- ];
127
- }
128
- function AddToCart() {
129
- const event = q("product add");
130
- return [
156
+ { eventID: "1700000000-gr0up-1" }
157
+ ]
158
+ };
159
+ var addToCart = {
160
+ in: ot("product add", { timestamp: 1700000001 }),
161
+ mapping: {
162
+ name: "AddToCart",
163
+ data: {
164
+ map: {
165
+ value: "data.price",
166
+ currency: { value: "EUR" },
167
+ contents: {
168
+ set: [
169
+ {
170
+ map: {
171
+ id: "data.id",
172
+ quantity: { key: "data.quantity", value: 1 }
173
+ }
174
+ }
175
+ ]
176
+ },
177
+ content_type: { value: "product" }
178
+ }
179
+ }
180
+ },
181
+ out: [
131
182
  "track",
132
183
  "AddToCart",
133
184
  {
134
185
  currency: "EUR",
135
- value: event.data.price,
136
- contents: [{ id: event.data.id, quantity: 1 }],
186
+ value: 420,
187
+ contents: [{ id: "ers", quantity: 1 }],
137
188
  content_type: "product"
138
189
  },
139
- { eventID: event.id }
140
- ];
141
- }
142
- function InitiateCheckout() {
143
- const event = q("cart view");
144
- return [
145
- "track",
146
- "InitiateCheckout",
147
- {
148
- currency: "EUR",
149
- value: event.data.value,
150
- contents: event.nested.filter((entity) => entity.entity === "product").map((entity) => ({
151
- id: entity.data.id,
152
- quantity: entity.data.quantity
153
- })),
154
- num_items: event.nested.filter((item) => item.entity === "product").length
155
- },
156
- { eventID: event.id }
157
- ];
158
- }
159
- function ViewContent() {
160
- const event = q("product view");
161
- return [
190
+ { eventID: "1700000001-gr0up-1" }
191
+ ]
192
+ };
193
+ var viewContent = {
194
+ in: ot("product view", { timestamp: 1700000002 }),
195
+ mapping: {
196
+ name: "ViewContent",
197
+ data: {
198
+ map: {
199
+ value: "data.price",
200
+ currency: { value: "EUR" },
201
+ content_type: { value: "product" },
202
+ contents: {
203
+ set: [
204
+ {
205
+ map: {
206
+ id: "data.id",
207
+ quantity: { key: "data.quantity", value: 1 }
208
+ }
209
+ }
210
+ ]
211
+ }
212
+ }
213
+ }
214
+ },
215
+ out: [
162
216
  "track",
163
217
  "ViewContent",
164
218
  {
165
219
  currency: "EUR",
166
- value: event.data.price,
167
- contents: [{ id: event.data.id, quantity: 1 }],
220
+ value: 420,
221
+ contents: [{ id: "ers", quantity: 1 }],
168
222
  content_type: "product"
169
223
  },
170
- { eventID: event.id }
171
- ];
172
- }
173
-
174
- // src/examples/mapping.ts
175
- var mapping_exports = {};
176
- __export(mapping_exports, {
177
- AddToCart: () => AddToCart2,
178
- InitiateCheckout: () => InitiateCheckout2,
179
- Purchase: () => Purchase2,
180
- ViewContent: () => ViewContent2,
181
- config: () => config
182
- });
183
- var Purchase2 = {
184
- name: "Purchase",
185
- data: {
186
- map: {
187
- value: "data.total",
188
- currency: { value: "EUR" },
189
- contents: {
190
- loop: [
191
- "nested",
192
- {
193
- condition: (entity) => D(entity) && entity.entity === "product",
194
- map: {
195
- id: "data.id",
196
- quantity: { key: "data.quantity", value: 1 }
197
- }
198
- }
199
- ]
200
- },
201
- content_type: { value: "product" },
202
- num_items: {
203
- fn: (event) => event.nested.filter(
204
- (item) => item.entity === "product"
205
- ).length
206
- }
207
- }
208
- }
209
- };
210
- var AddToCart2 = {
211
- name: "AddToCart",
212
- data: {
213
- map: {
214
- value: "data.price",
215
- currency: { value: "EUR" },
216
- contents: {
217
- set: [
218
- {
219
- map: {
220
- id: "data.id",
221
- quantity: { key: "data.quantity", value: 1 }
222
- }
223
- }
224
- ]
225
- },
226
- content_type: { value: "product" }
227
- }
228
- }
229
- };
230
- var InitiateCheckout2 = {
231
- name: "InitiateCheckout",
232
- data: {
233
- map: {
234
- value: "data.value",
235
- currency: { value: "EUR" },
236
- contents: {
237
- loop: [
238
- "nested",
239
- {
240
- condition: (entity) => D(entity) && entity.entity === "product",
241
- map: {
242
- id: "data.id",
243
- quantity: { key: "data.quantity", value: 1 }
244
- }
245
- }
246
- ]
247
- },
248
- num_items: {
249
- fn: (event) => event.nested.filter(
250
- (item) => item.entity === "product"
251
- ).length
252
- }
253
- }
254
- }
224
+ { eventID: "1700000002-gr0up-1" }
225
+ ]
255
226
  };
256
- var ViewContent2 = {
257
- name: "ViewContent",
258
- data: {
259
- map: {
260
- value: "data.price",
261
- currency: { value: "EUR" },
262
- content_type: { value: "product" },
263
- contents: {
264
- set: [
265
- {
266
- map: {
267
- id: "data.id",
268
- quantity: { key: "data.quantity", value: 1 }
227
+ var initiateCheckout = {
228
+ in: ot("cart view", { timestamp: 1700000003 }),
229
+ mapping: {
230
+ name: "InitiateCheckout",
231
+ data: {
232
+ map: {
233
+ value: "data.value",
234
+ currency: { value: "EUR" },
235
+ contents: {
236
+ loop: [
237
+ "nested",
238
+ {
239
+ condition: (entity) => Z(entity) && entity.entity === "product",
240
+ map: {
241
+ id: "data.id",
242
+ quantity: { key: "data.quantity", value: 1 }
243
+ }
269
244
  }
270
- }
271
- ]
245
+ ]
246
+ },
247
+ num_items: {
248
+ fn: (event) => event.nested.filter(
249
+ (item) => item.entity === "product"
250
+ ).length
251
+ }
272
252
  }
273
253
  }
274
- }
254
+ },
255
+ out: [
256
+ "track",
257
+ "InitiateCheckout",
258
+ {
259
+ currency: "EUR",
260
+ value: 840,
261
+ contents: [{ id: "ers", quantity: 2 }],
262
+ num_items: 1
263
+ },
264
+ { eventID: "1700000003-gr0up-1" }
265
+ ]
275
266
  };
276
- var config = {
277
- order: { complete: Purchase2 },
278
- product: { view: ViewContent2, add: AddToCart2 },
279
- cart: { view: InitiateCheckout2 }
267
+ var pageView = {
268
+ in: ot("page view", { timestamp: 1700000004 }),
269
+ mapping: void 0,
270
+ out: ["track", "PageView", {}, { eventID: "1700000004-gr0up-1" }]
280
271
  };
281
272
  export {
282
273
  env_exports as env,
283
- events_exports as events,
284
- mapping_exports as mapping
274
+ step_exports as step
285
275
  };
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationMeta:()=>d,default:()=>p,destinationMeta:()=>l});var r=Object.defineProperty;((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>a});var c,a=((c=a||{})[c.ERROR=0]="ERROR",c[c.INFO=1]="INFO",c[c.DEBUG=2]="DEBUG",c);function s(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}var f,d={},l={type:"meta-pixel",config:{},init({config:e,env:t,logger:n}){const{settings:o,loadScript:i}=e,{pixelId:r}=o||{};i&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=u(e),o=n.createElement("script");o.src=t,o.async=!0,n.head.appendChild(o)}(t),r||n.throw("Config settings pixelId missing"),function(e){const{window:t}=u(e),n=t;if(n.fbq)return;const o=function(...e){o.callMethod?o.callMethod.apply(o,e):o.queue.push(e)};n.fbq=o,n._fbq||(n._fbq=o),o.push=o,o.loaded=!0,o.version="2.0",o.queue=[]}(t);const{window:c}=u(t);(0,c.fbq)("init",r)},push(e,{config:t,rule:n={},data:o,env:i}){const{track:r,trackCustom:c}=n.settings||{},{window:a}=u(i),f=a.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=r||c||e.name;f(c?"trackCustom":"track",String(d),s(o)?o:{},{eventID:e.id})}},p=l;return f=i,((i,r,c,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of n(r))o.call(i,s)||s===c||e(i,s,{get:()=>r[s],enumerable:!(a=t(r,s))||a.enumerable});return i})(e({},"__esModule",{value:!0}),f)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationMeta:()=>d,default:()=>p,destinationMeta:()=>l});var r=Object.defineProperty;((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>a});var c,a=((c=a||{})[c.ERROR=0]="ERROR",c[c.WARN=1]="WARN",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c);function s(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}var f,d={},l={type:"meta-pixel",config:{},init({config:e,env:t,logger:n}){const{settings:o,loadScript:i}=e,{pixelId:r}=o||{};i&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=u(e),o=n.createElement("script");o.src=t,o.async=!0,n.head.appendChild(o)}(t),r||n.throw("Config settings pixelId missing"),function(e){const{window:t}=u(e),n=t;if(n.fbq)return;const o=function(...e){o.callMethod?o.callMethod.apply(o,e):o.queue.push(e)};n.fbq=o,n._fbq||(n._fbq=o),o.push=o,o.loaded=!0,o.version="2.0",o.queue=[]}(t);const{window:c}=u(t);(0,c.fbq)("init",r)},push(e,{config:t,rule:n={},data:o,env:i}){const{track:r,trackCustom:c}=n.settings||{},{window:a}=u(i),f=a.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const d=r||c||e.name;f(c?"trackCustom":"track",String(d),s(o)?o:{},{eventID:e.id})}},p=l;return f=i,((i,r,c,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of n(r))o.call(i,s)||s===c||e(i,s,{get:()=>r[s],enumerable:!(a=t(r,s))||a.enumerable});return i})(e({},"__esModule",{value:!0}),f)})();
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_define_property(e,t,n[t])})}return e}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Destination=function(){var e=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)},t=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u={};!function(e,t){for(var r in t)n(e,r,{get:t[r],enumerable:!0})}(u,{DestinationMeta:function(){return d},default:function(){return s},destinationMeta:function(){return p}});var c=Object.defineProperty;!function(e,t){for(var n in t)c(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return l}});var a,f,l=((a=l||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a),d={},p={type:"meta-pixel",config:{},init:function(e){var n=e.config,r=e.env,o=e.logger,i=n.settings,u=n.loadScript,c=(i||{}).pixelId;u&&function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",r=t(e).document,o=r.createElement("script");o.src=n,o.async=!0,r.head.appendChild(o)}(r),c||o.throw("Config settings pixelId missing"),function(e){var n=t(e).window;if(!n.fbq){var r=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.callMethod?r.callMethod.apply(r,t):r.queue.push(t)};n.fbq=r,n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}}(r),(0,t(r).window.fbq)("init",c)},push:function(n,r){r.config;var o=r.rule,i=void 0===o?{}:o,u=r.data,c=r.env,a=i.settings||{},f=a.track,l=a.trackCustom,d=t(c).window.fbq;"page view"!==n.name||i.settings||(n.name="PageView");var p=f||l||n.name;d(l?"trackCustom":"track",String(p),e(u)?u:{},{eventID:n.id})}},s=p;return f=u,function(e,t,u,c){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var a=!0,f=!1,l=void 0;try{for(var d,p=function(){var o=d.value;i.call(e,o)||o===u||n(e,o,{get:function(){return t[o]},enumerable:!(c=r(t,o))||c.enumerable})},s=o(t)[Symbol.iterator]();!(a=(d=s.next()).done);a=!0)p()}catch(e){f=!0,l=e}finally{try{a||null==s.return||s.return()}finally{if(f)throw l}}}return e}(n({},"__esModule",{value:!0}),f)}();
1
+ "use strict";function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_define_property(e,t,n[t])})}return e}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Destination=function(){var e=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)},t=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u={};!function(e,t){for(var r in t)n(e,r,{get:t[r],enumerable:!0})}(u,{DestinationMeta:function(){return d},default:function(){return s},destinationMeta:function(){return p}});var c=Object.defineProperty;!function(e,t){for(var n in t)c(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return l}});var a,f,l=((a=l||{})[a.ERROR=0]="ERROR",a[a.WARN=1]="WARN",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a),d={},p={type:"meta-pixel",config:{},init:function(e){var n=e.config,r=e.env,o=e.logger,i=n.settings,u=n.loadScript,c=(i||{}).pixelId;u&&function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",r=t(e).document,o=r.createElement("script");o.src=n,o.async=!0,r.head.appendChild(o)}(r),c||o.throw("Config settings pixelId missing"),function(e){var n=t(e).window;if(!n.fbq){var r=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.callMethod?r.callMethod.apply(r,t):r.queue.push(t)};n.fbq=r,n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}}(r),(0,t(r).window.fbq)("init",c)},push:function(n,r){r.config;var o=r.rule,i=void 0===o?{}:o,u=r.data,c=r.env,a=i.settings||{},f=a.track,l=a.trackCustom,d=t(c).window.fbq;"page view"!==n.name||i.settings||(n.name="PageView");var p=f||l||n.name;d(l?"trackCustom":"track",String(p),e(u)?u:{},{eventID:n.id})}},s=p;return f=u,function(e,t,u,c){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var a=!0,f=!1,l=void 0;try{for(var d,p=function(){var o=d.value;i.call(e,o)||o===u||n(e,o,{get:function(){return t[o]},enumerable:!(c=r(t,o))||c.enumerable})},s=o(t)[Symbol.iterator]();!(a=(d=s.next()).done);a=!0)p()}catch(e){f=!0,l=e}finally{try{a||null==s.return||s.return()}finally{if(f)throw l}}}return e}(n({},"__esModule",{value:!0}),f)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(i,{DestinationMeta:()=>p,default:()=>g,destinationMeta:()=>b}),module.exports=(e=i,((e,i,a,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of r(i))o.call(e,s)||s===a||t(e,s,{get:()=>i[s],enumerable:!(c=n(i,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("@walkeros/web-core");var c=Object.defineProperty;((e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>u});var s,u=((s=u||{})[s.ERROR=0]="ERROR",s[s.INFO=1]="INFO",s[s.DEBUG=2]="DEBUG",s);function l(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var f=require("@walkeros/web-core"),p={},b={type:"meta-pixel",config:{},init({config:e,env:t,logger:n}){const{settings:r,loadScript:o}=e,{pixelId:i}=r||{};o&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=(0,a.getEnv)(e),r=n.createElement("script");r.src=t,r.async=!0,n.head.appendChild(r)}(t),i||n.throw("Config settings pixelId missing"),function(e){const{window:t}=(0,a.getEnv)(e),n=t;if(n.fbq)return;const r=function(...e){r.callMethod?r.callMethod.apply(r,e):r.queue.push(e)};n.fbq=r,n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}(t);const{window:c}=(0,f.getEnv)(t);(0,c.fbq)("init",i)},push(e,{config:t,rule:n={},data:r,env:o}){const{track:i,trackCustom:a}=n.settings||{},{window:c}=(0,f.getEnv)(o),s=c.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const u=i||a||e.name;s(a?"trackCustom":"track",String(u),l(r)?r:{},{eventID:e.id})}},g=b;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(i,{DestinationMeta:()=>p,default:()=>g,destinationMeta:()=>b}),module.exports=(e=i,((e,i,a,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of r(i))o.call(e,s)||s===a||t(e,s,{get:()=>i[s],enumerable:!(c=n(i,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("@walkeros/web-core");var c=Object.defineProperty;((e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>u});var s,u=((s=u||{})[s.ERROR=0]="ERROR",s[s.WARN=1]="WARN",s[s.INFO=2]="INFO",s[s.DEBUG=3]="DEBUG",s);function l(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var f=require("@walkeros/web-core"),p={},b={type:"meta-pixel",config:{},init({config:e,env:t,logger:n}){const{settings:r,loadScript:o}=e,{pixelId:i}=r||{};o&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=(0,a.getEnv)(e),r=n.createElement("script");r.src=t,r.async=!0,n.head.appendChild(r)}(t),i||n.throw("Config settings pixelId missing"),function(e){const{window:t}=(0,a.getEnv)(e),n=t;if(n.fbq)return;const r=function(...e){r.callMethod?r.callMethod.apply(r,e):r.queue.push(e)};n.fbq=r,n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[]}(t);const{window:c}=(0,f.getEnv)(t);(0,c.fbq)("init",i)},push(e,{config:t,rule:n={},data:r,env:o}){const{track:i,trackCustom:a}=n.settings||{},{window:c}=(0,f.getEnv)(o),s=c.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const u=i||a||e.name;s(a?"trackCustom":"track",String(u),l(r)?r:{},{eventID:e.id})}},g=b;//# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{getEnv as e}from"@walkeros/web-core";var t=Object.defineProperty;((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{Level:()=>o});var n,o=((n=o||{})[n.ERROR=0]="ERROR",n[n.INFO=1]="INFO",n[n.DEBUG=2]="DEBUG",n);function i(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}import{getEnv as r}from"@walkeros/web-core";var a={},c={type:"meta-pixel",config:{},init({config:t,env:n,logger:o}){const{settings:i,loadScript:a}=t,{pixelId:c}=i||{};a&&function(t,n="https://connect.facebook.net/en_US/fbevents.js"){const{document:o}=e(t),i=o.createElement("script");i.src=n,i.async=!0,o.head.appendChild(i)}(n),c||o.throw("Config settings pixelId missing"),function(t){const{window:n}=e(t),o=n;if(o.fbq)return;const i=function(...e){i.callMethod?i.callMethod.apply(i,e):i.queue.push(e)};o.fbq=i,o._fbq||(o._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[]}(n);const{window:s}=r(n);(0,s.fbq)("init",c)},push(e,{config:t,rule:n={},data:o,env:a}){const{track:c,trackCustom:s}=n.settings||{},{window:f}=r(a),l=f.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const p=c||s||e.name;l(s?"trackCustom":"track",String(p),i(o)?o:{},{eventID:e.id})}},s=c;export{a as DestinationMeta,s as default,c as destinationMeta};//# sourceMappingURL=index.mjs.map
1
+ import{getEnv as e}from"@walkeros/web-core";var t=Object.defineProperty;((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{Level:()=>o});var n,o=((n=o||{})[n.ERROR=0]="ERROR",n[n.WARN=1]="WARN",n[n.INFO=2]="INFO",n[n.DEBUG=3]="DEBUG",n);function i(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}import{getEnv as r}from"@walkeros/web-core";var a={},c={type:"meta-pixel",config:{},init({config:t,env:n,logger:o}){const{settings:i,loadScript:a}=t,{pixelId:c}=i||{};a&&function(t,n="https://connect.facebook.net/en_US/fbevents.js"){const{document:o}=e(t),i=o.createElement("script");i.src=n,i.async=!0,o.head.appendChild(i)}(n),c||o.throw("Config settings pixelId missing"),function(t){const{window:n}=e(t),o=n;if(o.fbq)return;const i=function(...e){i.callMethod?i.callMethod.apply(i,e):i.queue.push(e)};o.fbq=i,o._fbq||(o._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[]}(n);const{window:s}=r(n);(0,s.fbq)("init",c)},push(e,{config:t,rule:n={},data:o,env:a}){const{track:c,trackCustom:s}=n.settings||{},{window:f}=r(a),l=f.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const p=c||s||e.name;l(s?"trackCustom":"track",String(p),i(o)?o:{},{eventID:e.id})}},s=c;export{a as DestinationMeta,s as default,c as destinationMeta};//# sourceMappingURL=index.mjs.map