@walkeros/web-destination-meta 4.8.1-next-1792019907609 → 4.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,50 @@
1
1
  # @walkeros/web-destination-meta
2
2
 
3
- ## 4.8.1-next-1792019907609
3
+ ## 4.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2374f54: A destination with `config.consent` now tells the vendor about
8
+ consent changes: Meta calls `fbq('consent', 'revoke' | 'grant')`, Matomo
9
+ `forgetConsentGiven` and `setConsentGiven`, Clarity sends ConsentV2, FullStory
10
+ stops and starts capture, and Piwik PRO turns off the link tracking it
11
+ enabled.
12
+ - 2374f54: A failed vendor call, a missing required setting (`config`) and an
13
+ event that cannot be sent (`missing-input`) are reported as failed pushes,
14
+ with the dead-letter queue and one ERROR line, instead of counting as
15
+ delivered. Rules with `silent: true` send no event. Settings schemas reject
16
+ unknown keys.
17
+ - b1d65e2: Web destinations that load a vendor script inject it through the
18
+ document of their `env`, so simulation and server-side rendering work without
19
+ a browser page. A page still gets the script in its own document by default,
20
+ and a missing document fails the push with `vendor-not-ready`.
21
+ - 2374f54: Vendor scripts load through walkerOS: a blocked or slow script fails
22
+ later events visibly (`vendor-not-loaded`, `vendor-timeout`) instead of losing
23
+ them. Pushes made while the script loads wait for it, and each script is
24
+ injected once per page.
25
+ - Updated dependencies [2374f54]
26
+ - Updated dependencies [7e5fc27]
27
+ - Updated dependencies [2374f54]
28
+ - Updated dependencies [964590a]
29
+ - Updated dependencies [4100ede]
30
+ - Updated dependencies [2374f54]
31
+ - Updated dependencies [2374f54]
32
+ - Updated dependencies [15eb7b2]
33
+ - Updated dependencies [33a2779]
34
+ - Updated dependencies [33a2779]
35
+ - Updated dependencies [b1d65e2]
36
+ - Updated dependencies [964590a]
37
+ - Updated dependencies [2374f54]
38
+ - @walkeros/core@4.8.2
39
+ - @walkeros/web-core@4.8.2
40
+
41
+ ## 4.8.1
4
42
 
5
43
  ### Patch Changes
6
44
 
7
45
  - Updated dependencies [1062e99]
8
- - @walkeros/core@4.8.1-next-1792019907609
9
- - @walkeros/web-core@4.8.1-next-1792019907609
46
+ - @walkeros/core@4.8.1
47
+ - @walkeros/web-core@4.8.1
10
48
 
11
49
  ## 4.8.0
12
50
 
package/README.md CHANGED
@@ -32,7 +32,7 @@ npm install @walkeros/web-destination-meta
32
32
  "destinations": {
33
33
  "meta": {
34
34
  "package": "@walkeros/web-destination-meta",
35
- "config": {}
35
+ "config": { "settings": { "pixelId": "YOUR_PIXEL_ID" } }
36
36
  }
37
37
  }
38
38
  }
package/dist/dev.d.mts CHANGED
@@ -40,7 +40,7 @@ declare const CustomEventName: z.ZodString;
40
40
 
41
41
  declare const SettingsSchema: z.ZodObject<{
42
42
  pixelId: z.ZodString;
43
- }, z.core.$strip>;
43
+ }, z.core.$strict>;
44
44
  type Settings = z.infer<typeof SettingsSchema>;
45
45
 
46
46
  declare const MappingSchema: z.ZodObject<{
@@ -95,17 +95,6 @@ interface Env extends DestinationWeb.Env {
95
95
  fbq?: facebook.Pixel.Event;
96
96
  _fbq?: facebook.Pixel.Event;
97
97
  };
98
- document: {
99
- createElement: (tagName: string) => {
100
- src: string;
101
- async: boolean;
102
- setAttribute: (name: string, value: string) => void;
103
- removeAttribute: (name: string) => void;
104
- };
105
- head: {
106
- appendChild: (node: unknown) => void;
107
- };
108
- };
109
98
  }
110
99
 
111
100
  declare const init$1: Env | undefined;
@@ -135,16 +124,25 @@ declare const viewContent: Flow.StepExample;
135
124
  declare const initiateCheckout: Flow.StepExample;
136
125
  declare const pageView: Flow.StepExample;
137
126
  declare const customEventWithTrackCustom: Flow.StepExample;
127
+ /** A silent rule sends no fbq event. */
128
+ declare const silentRule: Flow.StepExample;
129
+ /**
130
+ * A revocation of the consent the destination requires pauses the pixel's
131
+ * own fires: config.consent { marketing: true }, granted first, then revoked.
132
+ */
133
+ declare const consentRevoke: Flow.StepExample;
138
134
 
139
135
  declare const step_addToCart: typeof addToCart;
136
+ declare const step_consentRevoke: typeof consentRevoke;
140
137
  declare const step_customEventWithTrackCustom: typeof customEventWithTrackCustom;
141
138
  declare const step_init: typeof init;
142
139
  declare const step_initiateCheckout: typeof initiateCheckout;
143
140
  declare const step_pageView: typeof pageView;
144
141
  declare const step_purchase: typeof purchase;
142
+ declare const step_silentRule: typeof silentRule;
145
143
  declare const step_viewContent: typeof viewContent;
146
144
  declare namespace step {
147
- export { step_addToCart as addToCart, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_viewContent as viewContent };
145
+ export { step_addToCart as addToCart, step_consentRevoke as consentRevoke, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule, step_viewContent as viewContent };
148
146
  }
149
147
 
150
148
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -40,7 +40,7 @@ declare const CustomEventName: z.ZodString;
40
40
 
41
41
  declare const SettingsSchema: z.ZodObject<{
42
42
  pixelId: z.ZodString;
43
- }, z.core.$strip>;
43
+ }, z.core.$strict>;
44
44
  type Settings = z.infer<typeof SettingsSchema>;
45
45
 
46
46
  declare const MappingSchema: z.ZodObject<{
@@ -95,17 +95,6 @@ interface Env extends DestinationWeb.Env {
95
95
  fbq?: facebook.Pixel.Event;
96
96
  _fbq?: facebook.Pixel.Event;
97
97
  };
98
- document: {
99
- createElement: (tagName: string) => {
100
- src: string;
101
- async: boolean;
102
- setAttribute: (name: string, value: string) => void;
103
- removeAttribute: (name: string) => void;
104
- };
105
- head: {
106
- appendChild: (node: unknown) => void;
107
- };
108
- };
109
98
  }
110
99
 
111
100
  declare const init$1: Env | undefined;
@@ -135,16 +124,25 @@ declare const viewContent: Flow.StepExample;
135
124
  declare const initiateCheckout: Flow.StepExample;
136
125
  declare const pageView: Flow.StepExample;
137
126
  declare const customEventWithTrackCustom: Flow.StepExample;
127
+ /** A silent rule sends no fbq event. */
128
+ declare const silentRule: Flow.StepExample;
129
+ /**
130
+ * A revocation of the consent the destination requires pauses the pixel's
131
+ * own fires: config.consent { marketing: true }, granted first, then revoked.
132
+ */
133
+ declare const consentRevoke: Flow.StepExample;
138
134
 
139
135
  declare const step_addToCart: typeof addToCart;
136
+ declare const step_consentRevoke: typeof consentRevoke;
140
137
  declare const step_customEventWithTrackCustom: typeof customEventWithTrackCustom;
141
138
  declare const step_init: typeof init;
142
139
  declare const step_initiateCheckout: typeof initiateCheckout;
143
140
  declare const step_pageView: typeof pageView;
144
141
  declare const step_purchase: typeof purchase;
142
+ declare const step_silentRule: typeof silentRule;
145
143
  declare const step_viewContent: typeof viewContent;
146
144
  declare namespace step {
147
- export { step_addToCart as addToCart, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_viewContent as viewContent };
145
+ export { step_addToCart as addToCart, step_consentRevoke as consentRevoke, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule, step_viewContent as viewContent };
148
146
  }
149
147
 
150
148
  declare const index_env: typeof env;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},o={};r(o,{examples:()=>w,schemas:()=>d}),module.exports=(e=o,((e,r,o,d)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of i(r))n.call(e,c)||c===o||t(e,c,{get:()=>r[c],enumerable:!(d=a(r,c))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};r(d,{CustomEventName:()=>m,MappingSchema:()=>g,PixelId:()=>p,SettingsSchema:()=>v,StandardEventName:()=>l,mapping:()=>y,settings:()=>h});var c=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),s=require("@walkeros/core/dev"),p=s.z.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),l=s.z.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),m=s.z.string().min(1),v=u.z.object({pixelId:p.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")}),g=require("@walkeros/core/dev").z.object({track:l.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:m.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),h=(0,c.zodToSchema)(v),y=(0,c.zodToSchema)(g),w={};r(w,{env:()=>b,step:()=>f});var b={};r(b,{init:()=>q,push:()=>C,simulation:()=>P});var k=()=>{},q={window:{},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},C={window:{fbq:Object.assign(k,{callMethod:k,queue:[],push:k,loaded:!0,version:"2.0"}),_fbq:Object.assign(k,{callMethod:k,queue:[],push:k,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},P=["call:window.fbq"],f={};r(f,{addToCart:()=>I,customEventWithTrackCustom:()=>V,init:()=>E,initiateCheckout:()=>M,pageView:()=>S,purchase:()=>A,viewContent:()=>_});var x=require("@walkeros/core"),E={title:"Pixel init",description:"The destination loads the Meta Pixel script and initializes it with the configured pixelId.",in:{loadScript:!0,settings:{pixelId:"1234567890"}},out:[["fbq","init","1234567890"]]},A={title:"Purchase",description:"An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.",in:(0,x.getEvent)("order complete",{timestamp:17e8,id:"1700000000-gr0up-1"}),mapping:{name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,x.isObject)(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","Purchase",{value:555,currency:"EUR",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],content_type:"product",num_items:2},{eventID:"1700000000-gr0up-1"}]]},I={title:"Add to cart",description:"A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.",in:(0,x.getEvent)("product add",{timestamp:1700000001,id:"1700000001-gr0up-1"}),mapping:{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"}}}},out:[["fbq","track","AddToCart",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000001-gr0up-1"}]]},_={title:"View content",description:"A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.",in:(0,x.getEvent)("product view",{timestamp:1700000002,id:"1700000002-gr0up-1"}),mapping:{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}}}]}}}},out:[["fbq","track","ViewContent",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000002-gr0up-1"}]]},M={title:"Initiate checkout",description:"A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.",in:(0,x.getEvent)("cart view",{timestamp:1700000003,id:"1700000003-gr0up-1"}),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,x.isObject)(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"1700000003-gr0up-1"}]]},S={title:"Page view",description:"A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.",in:(0,x.getEvent)("page view",{timestamp:1700000004,id:"1700000004-gr0up-1"}),mapping:void 0,out:[["fbq","track","PageView",{},{eventID:"1700000004-gr0up-1"}]]},V={title:"Custom event",description:"A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",in:(0,x.getEvent)("video complete",{timestamp:1700000005,id:"1700000005-gr0up-1",data:{video_id:"v1d30",duration:120}}),mapping:{settings:{trackCustom:"VideoComplete"},data:{map:{video_id:"data.video_id",duration:"data.duration"}}},out:[["fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,i)=>{for(var a in i)t(e,a,{get:i[a],enumerable:!0})},r={};o(r,{examples:()=>y,schemas:()=>d}),module.exports=(e=r,((e,o,r,d)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of a(o))n.call(e,c)||c===r||t(e,c,{get:()=>o[c],enumerable:!(d=i(o,c))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};o(d,{CustomEventName:()=>m,MappingSchema:()=>g,PixelId:()=>p,SettingsSchema:()=>v,StandardEventName:()=>l,mapping:()=>w,settings:()=>h});var c=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),s=require("@walkeros/core/dev"),p=s.z.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),l=s.z.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),m=s.z.string().min(1),v=u.z.object({pixelId:p.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")}).strict(),g=require("@walkeros/core/dev").z.object({track:l.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:m.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),h=(0,c.zodToSchema)(v),w=(0,c.zodToSchema)(g),y={};o(y,{env:()=>k,step:()=>C});var k={};o(k,{init:()=>q,push:()=>f,simulation:()=>P});var b=()=>{},q={window:{}},f={window:{fbq:Object.assign(b,{callMethod:b,queue:[],push:b,loaded:!0,version:"2.0"}),_fbq:Object.assign(b,{callMethod:b,queue:[],push:b,loaded:!0,version:"2.0"})}},P=["call:window.fbq"],C={};o(C,{addToCart:()=>_,consentRevoke:()=>O,customEventWithTrackCustom:()=>V,init:()=>E,initiateCheckout:()=>M,pageView:()=>S,purchase:()=>I,silentRule:()=>j,viewContent:()=>A});var x=require("@walkeros/core"),E={title:"Pixel init",description:"The destination loads the Meta Pixel script and initializes it with the configured pixelId.",in:{loadScript:!0,settings:{pixelId:"1234567890"}},out:[["fbq","init","1234567890"]]},I={title:"Purchase",description:"An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.",in:(0,x.getEvent)("order complete",{timestamp:17e8,id:"1700000000-gr0up-1"}),mapping:{name:"Purchase",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,x.isObject)(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","Purchase",{value:555,currency:"EUR",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],content_type:"product",num_items:2},{eventID:"1700000000-gr0up-1"}]]},_={title:"Add to cart",description:"A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.",in:(0,x.getEvent)("product add",{timestamp:1700000001,id:"1700000001-gr0up-1"}),mapping:{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"}}}},out:[["fbq","track","AddToCart",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000001-gr0up-1"}]]},A={title:"View content",description:"A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.",in:(0,x.getEvent)("product view",{timestamp:1700000002,id:"1700000002-gr0up-1"}),mapping:{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}}}]}}}},out:[["fbq","track","ViewContent",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000002-gr0up-1"}]]},M={title:"Initiate checkout",description:"A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.",in:(0,x.getEvent)("cart view",{timestamp:1700000003,id:"1700000003-gr0up-1"}),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,x.isObject)(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"1700000003-gr0up-1"}]]},S={title:"Page view",description:"A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.",in:(0,x.getEvent)("page view",{timestamp:1700000004,id:"1700000004-gr0up-1"}),mapping:void 0,out:[["fbq","track","PageView",{},{eventID:"1700000004-gr0up-1"}]]},V={title:"Custom event",description:"A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",in:(0,x.createEvent)({name:"video complete",timestamp:1700000005,id:"1700000005-gr0up-1",data:{video_id:"v1d30",duration:120}}),mapping:{settings:{trackCustom:"VideoComplete"},data:{map:{video_id:"data.video_id",duration:"data.duration"}}},out:[["fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]},j={public:!1,description:"A rule with silent: true sends no fbq event.",in:(0,x.getEvent)("page view",{timestamp:1700000006,id:"1700000006-gr0up-1"}),mapping:{silent:!0},out:[]},O={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.",command:"consent",in:{marketing:!1},out:[["window.fbq","consent","revoke"]]};//# sourceMappingURL=dev.js.map
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { PixelId } from './primitives';\n\nexport const SettingsSchema = z.object({\n pixelId: PixelId.describe(\n 'Your Meta Pixel ID from Facebook Business Manager (like 1234567890)',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Pixel ID\n * Must be a numeric string (Facebook Pixel IDs are numeric)\n */\nexport const PixelId = z\n .string()\n .min(1)\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits');\n\n/**\n * Meta Pixel Standard Event Names\n * https://developers.facebook.com/docs/meta-pixel/reference\n */\nexport const StandardEventName = z.enum([\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]);\n\n/**\n * Custom Event Name\n * Any string for custom tracking\n */\nexport const CustomEventName = z.string().min(1);\n","import { z } from '@walkeros/core/dev';\nimport { StandardEventName, CustomEventName } from './primitives';\n\nexport const MappingSchema = z.object({\n track: StandardEventName.describe(\n 'Meta Pixel standard event name to send (like PageView or Purchase)',\n ).optional(),\n trackCustom: CustomEventName.describe(\n 'Custom event name for tracking non-standard events (like NewsletterSignup)',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq/_fbq absent until setup() runs)\n window: {},\n document: {\n createElement: () => ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.fbq', // Track fbq function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId). Reproduce by passing the same settings to\n * `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Pixel init',\n description:\n 'The destination loads the Meta Pixel script and initializes it with the configured pixelId.',\n in: {\n loadScript: true,\n settings: {\n pixelId: '1234567890',\n },\n },\n out: [['fbq', 'init', '1234567890']],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.',\n in: getEvent('order complete', {\n timestamp: 1700000000,\n id: '1700000000-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'Purchase',\n {\n value: 555,\n currency: 'EUR',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n content_type: 'product',\n num_items: 2,\n },\n { eventID: '1700000000-gr0up-1' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.',\n in: getEvent('product add', {\n timestamp: 1700000001,\n id: '1700000001-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000001-gr0up-1' },\n ],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.',\n in: getEvent('product view', {\n timestamp: 1700000002,\n id: '1700000002-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000002-gr0up-1' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n title: 'Initiate checkout',\n description:\n 'A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.',\n in: getEvent('cart view', {\n timestamp: 1700000003,\n id: '1700000003-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: 840,\n contents: [{ id: 'ers', quantity: 2 }],\n num_items: 1,\n },\n { eventID: '1700000003-gr0up-1' },\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.',\n in: getEvent('page view', {\n timestamp: 1700000004,\n id: '1700000004-gr0up-1',\n }),\n mapping: undefined,\n out: [['fbq', 'track', 'PageView', {}, { eventID: '1700000004-gr0up-1' }]],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.',\n in: getEvent('video complete', {\n timestamp: 1700000005,\n id: '1700000005-gr0up-1',\n data: { video_id: 'v1d30', duration: 120 },\n }),\n mapping: {\n settings: { trackCustom: 'VideoComplete' },\n data: {\n map: {\n video_id: 'data.video_id',\n duration: 'data.duration',\n },\n },\n },\n out: [\n [\n 'fbq',\n 'trackCustom',\n 'VideoComplete',\n { video_id: 'v1d30', duration: 120 },\n { eventID: '1700000005-gr0up-1' },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAMX,IAAM,UAAU,aACpB,OAAO,EACP,IAAI,CAAC,EACL,MAAM,YAAY,mCAAmC;AAMjD,IAAM,oBAAoB,aAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,OAAO,EAAE,IAAI,CAAC;;;ADrCxC,IAAM,iBAAiB,cAAE,OAAO;AAAA,EACrC,SAAS,QAAQ;AAAA,IACf;AAAA,EACF;AACF,CAAC;;;AEPD,IAAAC,cA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;AAAA,MACb;AAAA,MACA,EAAE,SAAS,qBAAqB;AAAA,IAClC;AAAA,EACF;AACF;AAEO,IAAM,WAA6B;AAAA,EACxC,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK,CAAC,CAAC,OAAO,SAAS,YAAY,CAAC,GAAG,EAAE,SAAS,qBAAqB,CAAC,CAAC;AAC3E;AAEO,IAAM,6BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,MAAM,EAAE,UAAU,SAAS,UAAU,IAAI;AAAA,EAC3C,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU,EAAE,aAAa,gBAAgB;AAAA,IACzC,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA,EAAE,UAAU,SAAS,UAAU,IAAI;AAAA,MACnC,EAAE,SAAS,qBAAqB;AAAA,IAClC;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev","init"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { PixelId } from './primitives';\n\nexport const SettingsSchema = z\n .object({\n pixelId: PixelId.describe(\n 'Your Meta Pixel ID from Facebook Business Manager (like 1234567890)',\n ),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Pixel ID\n * Must be a numeric string (Facebook Pixel IDs are numeric)\n */\nexport const PixelId = z\n .string()\n .min(1)\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits');\n\n/**\n * Meta Pixel Standard Event Names\n * https://developers.facebook.com/docs/meta-pixel/reference\n */\nexport const StandardEventName = z.enum([\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]);\n\n/**\n * Custom Event Name\n * Any string for custom tracking\n */\nexport const CustomEventName = z.string().min(1);\n","import { z } from '@walkeros/core/dev';\nimport { StandardEventName, CustomEventName } from './primitives';\n\nexport const MappingSchema = z.object({\n track: StandardEventName.describe(\n 'Meta Pixel standard event name to send (like PageView or Purchase)',\n ).optional(),\n trackCustom: CustomEventName.describe(\n 'Custom event name for tracking non-standard events (like NewsletterSignup)',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq/_fbq absent until setup() runs)\n window: {},\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.fbq', // Track fbq function calls\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId). Reproduce by passing the same settings to\n * `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Pixel init',\n description:\n 'The destination loads the Meta Pixel script and initializes it with the configured pixelId.',\n in: {\n loadScript: true,\n settings: {\n pixelId: '1234567890',\n },\n },\n out: [['fbq', 'init', '1234567890']],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.',\n in: getEvent('order complete', {\n timestamp: 1700000000,\n id: '1700000000-gr0up-1',\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'Purchase',\n {\n value: 555,\n currency: 'EUR',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n content_type: 'product',\n num_items: 2,\n },\n { eventID: '1700000000-gr0up-1' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.',\n in: getEvent('product add', {\n timestamp: 1700000001,\n id: '1700000001-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000001-gr0up-1' },\n ],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.',\n in: getEvent('product view', {\n timestamp: 1700000002,\n id: '1700000002-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000002-gr0up-1' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n title: 'Initiate checkout',\n description:\n 'A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.',\n in: getEvent('cart view', {\n timestamp: 1700000003,\n id: '1700000003-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: 840,\n contents: [{ id: 'ers', quantity: 2 }],\n num_items: 1,\n },\n { eventID: '1700000003-gr0up-1' },\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.',\n in: getEvent('page view', {\n timestamp: 1700000004,\n id: '1700000004-gr0up-1',\n }),\n mapping: undefined,\n out: [['fbq', 'track', 'PageView', {}, { eventID: '1700000004-gr0up-1' }]],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.',\n in: createEvent({\n name: 'video complete',\n timestamp: 1700000005,\n id: '1700000005-gr0up-1',\n data: { video_id: 'v1d30', duration: 120 },\n }),\n mapping: {\n settings: { trackCustom: 'VideoComplete' },\n data: {\n map: {\n video_id: 'data.video_id',\n duration: 'data.duration',\n },\n },\n },\n out: [\n [\n 'fbq',\n 'trackCustom',\n 'VideoComplete',\n { video_id: 'v1d30', duration: 120 },\n { eventID: '1700000005-gr0up-1' },\n ],\n ],\n};\n\n/** A silent rule sends no fbq event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no fbq event.',\n in: getEvent('page view', {\n timestamp: 1700000006,\n id: '1700000006-gr0up-1',\n }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A revocation of the consent the destination requires pauses the pixel's\n * own fires: config.consent { marketing: true }, granted first, then revoked.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.',\n command: 'consent',\n in: { marketing: false },\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AAA,EACN,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAMO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,cAAc,WAAW,QAAQ,CAAC;AAC3C;","names":["import_dev","import_dev","import_dev","init"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var t=Object.defineProperty,e=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},a={};e(a,{CustomEventName:()=>c,MappingSchema:()=>p,PixelId:()=>r,SettingsSchema:()=>u,StandardEventName:()=>d,mapping:()=>l,settings:()=>m});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),d=o.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),c=o.string().min(1),u=n.object({pixelId:r.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")});import{z as s}from"@walkeros/core/dev";var p=s.object({track:d.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:c.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),m=i(u),l=i(p),v={};e(v,{env:()=>g,step:()=>C});var g={};e(g,{init:()=>y,push:()=>w,simulation:()=>k});var h=()=>{},y={window:{},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},w={window:{fbq:Object.assign(h,{callMethod:h,queue:[],push:h,loaded:!0,version:"2.0"}),_fbq:Object.assign(h,{callMethod:h,queue:[],push:h,loaded:!0,version:"2.0"})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},k=["call:window.fbq"],C={};e(C,{addToCart:()=>x,customEventWithTrackCustom:()=>E,init:()=>P,initiateCheckout:()=>I,pageView:()=>_,purchase:()=>q,viewContent:()=>A});import{getEvent as b,isObject as f}from"@walkeros/core";var P={title:"Pixel init",description:"The destination loads the Meta Pixel script and initializes it with the configured pixelId.",in:{loadScript:!0,settings:{pixelId:"1234567890"}},out:[["fbq","init","1234567890"]]},q={title:"Purchase",description:"An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.",in:b("order complete",{timestamp:17e8,id:"1700000000-gr0up-1"}),mapping:{name:"Purchase",data:{map:{value:"data.total",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>f(t)&&"product"===t.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:t=>t.nested.filter(t=>"product"===t.entity).length}}}},out:[["fbq","track","Purchase",{value:555,currency:"EUR",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],content_type:"product",num_items:2},{eventID:"1700000000-gr0up-1"}]]},x={title:"Add to cart",description:"A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.",in:b("product add",{timestamp:1700000001,id:"1700000001-gr0up-1"}),mapping:{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"}}}},out:[["fbq","track","AddToCart",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000001-gr0up-1"}]]},A={title:"View content",description:"A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.",in:b("product view",{timestamp:1700000002,id:"1700000002-gr0up-1"}),mapping:{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}}}]}}}},out:[["fbq","track","ViewContent",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000002-gr0up-1"}]]},I={title:"Initiate checkout",description:"A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.",in:b("cart view",{timestamp:1700000003,id:"1700000003-gr0up-1"}),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:t=>f(t)&&"product"===t.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:t=>t.nested.filter(t=>"product"===t.entity).length}}}},out:[["fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"1700000003-gr0up-1"}]]},_={title:"Page view",description:"A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.",in:b("page view",{timestamp:1700000004,id:"1700000004-gr0up-1"}),mapping:void 0,out:[["fbq","track","PageView",{},{eventID:"1700000004-gr0up-1"}]]},E={title:"Custom event",description:"A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",in:b("video complete",{timestamp:1700000005,id:"1700000005-gr0up-1",data:{video_id:"v1d30",duration:120}}),mapping:{settings:{trackCustom:"VideoComplete"},data:{map:{video_id:"data.video_id",duration:"data.duration"}}},out:[["fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]};export{v as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,i)=>{for(var a in i)e(t,a,{get:i[a],enumerable:!0})},i={};t(i,{CustomEventName:()=>c,MappingSchema:()=>p,PixelId:()=>r,SettingsSchema:()=>s,StandardEventName:()=>d,mapping:()=>m,settings:()=>l});import{zodToSchema as a}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),d=o.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),c=o.string().min(1),s=n.object({pixelId:r.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")}).strict();import{z as u}from"@walkeros/core/dev";var p=u.object({track:d.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:c.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),l=a(s),m=a(p),v={};t(v,{env:()=>g,step:()=>f});var g={};t(g,{init:()=>w,push:()=>y,simulation:()=>k});var h=()=>{},w={window:{}},y={window:{fbq:Object.assign(h,{callMethod:h,queue:[],push:h,loaded:!0,version:"2.0"}),_fbq:Object.assign(h,{callMethod:h,queue:[],push:h,loaded:!0,version:"2.0"})}},k=["call:window.fbq"],f={};t(f,{addToCart:()=>I,consentRevoke:()=>R,customEventWithTrackCustom:()=>V,init:()=>P,initiateCheckout:()=>_,pageView:()=>M,purchase:()=>x,silentRule:()=>E,viewContent:()=>A});import{createEvent as b,getEvent as q,isObject as C}from"@walkeros/core";var P={title:"Pixel init",description:"The destination loads the Meta Pixel script and initializes it with the configured pixelId.",in:{loadScript:!0,settings:{pixelId:"1234567890"}},out:[["fbq","init","1234567890"]]},x={title:"Purchase",description:"An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.",in:q("order complete",{timestamp:17e8,id:"1700000000-gr0up-1"}),mapping:{name:"Purchase",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>C(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},content_type:{value:"product"},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","Purchase",{value:555,currency:"EUR",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],content_type:"product",num_items:2},{eventID:"1700000000-gr0up-1"}]]},I={title:"Add to cart",description:"A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.",in:q("product add",{timestamp:1700000001,id:"1700000001-gr0up-1"}),mapping:{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"}}}},out:[["fbq","track","AddToCart",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000001-gr0up-1"}]]},A={title:"View content",description:"A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.",in:q("product view",{timestamp:1700000002,id:"1700000002-gr0up-1"}),mapping:{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}}}]}}}},out:[["fbq","track","ViewContent",{currency:"EUR",value:420,contents:[{id:"ers",quantity:1}],content_type:"product"},{eventID:"1700000002-gr0up-1"}]]},_={title:"Initiate checkout",description:"A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.",in:q("cart view",{timestamp:1700000003,id:"1700000003-gr0up-1"}),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>C(e)&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:[["fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"1700000003-gr0up-1"}]]},M={title:"Page view",description:"A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.",in:q("page view",{timestamp:1700000004,id:"1700000004-gr0up-1"}),mapping:void 0,out:[["fbq","track","PageView",{},{eventID:"1700000004-gr0up-1"}]]},V={title:"Custom event",description:"A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",in:b({name:"video complete",timestamp:1700000005,id:"1700000005-gr0up-1",data:{video_id:"v1d30",duration:120}}),mapping:{settings:{trackCustom:"VideoComplete"},data:{map:{video_id:"data.video_id",duration:"data.duration"}}},out:[["fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]},E={public:!1,description:"A rule with silent: true sends no fbq event.",in:q("page view",{timestamp:1700000006,id:"1700000006-gr0up-1"}),mapping:{silent:!0},out:[]},R={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.",command:"consent",in:{marketing:!1},out:[["window.fbq","consent","revoke"]]};export{v as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
package/dist/dev.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { PixelId } from './primitives';\n\nexport const SettingsSchema = z.object({\n pixelId: PixelId.describe(\n 'Your Meta Pixel ID from Facebook Business Manager (like 1234567890)',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Pixel ID\n * Must be a numeric string (Facebook Pixel IDs are numeric)\n */\nexport const PixelId = z\n .string()\n .min(1)\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits');\n\n/**\n * Meta Pixel Standard Event Names\n * https://developers.facebook.com/docs/meta-pixel/reference\n */\nexport const StandardEventName = z.enum([\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]);\n\n/**\n * Custom Event Name\n * Any string for custom tracking\n */\nexport const CustomEventName = z.string().min(1);\n","import { z } from '@walkeros/core/dev';\nimport { StandardEventName, CustomEventName } from './primitives';\n\nexport const MappingSchema = z.object({\n track: StandardEventName.describe(\n 'Meta Pixel standard event name to send (like PageView or Purchase)',\n ).optional(),\n trackCustom: CustomEventName.describe(\n 'Custom event name for tracking non-standard events (like NewsletterSignup)',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq/_fbq absent until setup() runs)\n window: {},\n document: {\n createElement: () => ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.fbq', // Track fbq function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId). Reproduce by passing the same settings to\n * `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Pixel init',\n description:\n 'The destination loads the Meta Pixel script and initializes it with the configured pixelId.',\n in: {\n loadScript: true,\n settings: {\n pixelId: '1234567890',\n },\n },\n out: [['fbq', 'init', '1234567890']],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.',\n in: getEvent('order complete', {\n timestamp: 1700000000,\n id: '1700000000-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'Purchase',\n {\n value: 555,\n currency: 'EUR',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n content_type: 'product',\n num_items: 2,\n },\n { eventID: '1700000000-gr0up-1' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.',\n in: getEvent('product add', {\n timestamp: 1700000001,\n id: '1700000001-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000001-gr0up-1' },\n ],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.',\n in: getEvent('product view', {\n timestamp: 1700000002,\n id: '1700000002-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000002-gr0up-1' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n title: 'Initiate checkout',\n description:\n 'A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.',\n in: getEvent('cart view', {\n timestamp: 1700000003,\n id: '1700000003-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: 840,\n contents: [{ id: 'ers', quantity: 2 }],\n num_items: 1,\n },\n { eventID: '1700000003-gr0up-1' },\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.',\n in: getEvent('page view', {\n timestamp: 1700000004,\n id: '1700000004-gr0up-1',\n }),\n mapping: undefined,\n out: [['fbq', 'track', 'PageView', {}, { eventID: '1700000004-gr0up-1' }]],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.',\n in: getEvent('video complete', {\n timestamp: 1700000005,\n id: '1700000005-gr0up-1',\n data: { video_id: 'v1d30', duration: 120 },\n }),\n mapping: {\n settings: { trackCustom: 'VideoComplete' },\n data: {\n map: {\n video_id: 'data.video_id',\n duration: 'data.duration',\n },\n },\n },\n out: [\n [\n 'fbq',\n 'trackCustom',\n 'VideoComplete',\n { video_id: 'v1d30', duration: 120 },\n { eventID: '1700000005-gr0up-1' },\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAMX,IAAM,UAAU,EACpB,OAAO,EACP,IAAI,CAAC,EACL,MAAM,YAAY,mCAAmC;AAMjD,IAAM,oBAAoB,EAAE,KAAK;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC;;;ADrCxC,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,SAAS,QAAQ;AAAA,IACf;AAAA,EACF;AACF,CAAC;;;AEPD,SAAS,KAAAC,UAAS;AAGX,IAAM,gBAA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MACA,EAAE,SAAS,qBAAqB;AAAA,IAClC;AAAA,EACF;AACF;AAEO,IAAM,WAA6B;AAAA,EACxC,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK,CAAC,CAAC,OAAO,SAAS,YAAY,CAAC,GAAG,EAAE,SAAS,qBAAqB,CAAC,CAAC;AAC3E;AAEO,IAAM,6BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,MAAM,EAAE,UAAU,SAAS,UAAU,IAAI;AAAA,EAC3C,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU,EAAE,aAAa,gBAAgB;AAAA,IACzC,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU;AAAA,QACV,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA,EAAE,UAAU,SAAS,UAAU,IAAI;AAAA,MACnC,EAAE,SAAS,qBAAqB;AAAA,IAClC;AAAA,EACF;AACF;","names":["z","z","z","z","init"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { PixelId } from './primitives';\n\nexport const SettingsSchema = z\n .object({\n pixelId: PixelId.describe(\n 'Your Meta Pixel ID from Facebook Business Manager (like 1234567890)',\n ),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Pixel ID\n * Must be a numeric string (Facebook Pixel IDs are numeric)\n */\nexport const PixelId = z\n .string()\n .min(1)\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits');\n\n/**\n * Meta Pixel Standard Event Names\n * https://developers.facebook.com/docs/meta-pixel/reference\n */\nexport const StandardEventName = z.enum([\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]);\n\n/**\n * Custom Event Name\n * Any string for custom tracking\n */\nexport const CustomEventName = z.string().min(1);\n","import { z } from '@walkeros/core/dev';\nimport { StandardEventName, CustomEventName } from './primitives';\n\nexport const MappingSchema = z.object({\n track: StandardEventName.describe(\n 'Meta Pixel standard event name to send (like PageView or Purchase)',\n ).optional(),\n trackCustom: CustomEventName.describe(\n 'Custom event name for tracking non-standard events (like NewsletterSignup)',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Pixel destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n // Environment before initialization (fbq/_fbq absent until setup() runs)\n window: {},\n};\n\nexport const push: Env = {\n // Standard mock environment for testing\n window: {\n fbq: Object.assign(noop, {\n // Add Meta Pixel specific properties\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n _fbq: Object.assign(noop, {\n callMethod: noop,\n queue: [],\n push: noop,\n loaded: true,\n version: '2.0',\n }),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.fbq', // Track fbq function calls\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { createEvent, getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId). Reproduce by passing the same settings to\n * `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Pixel init',\n description:\n 'The destination loads the Meta Pixel script and initializes it with the configured pixelId.',\n in: {\n loadScript: true,\n settings: {\n pixelId: '1234567890',\n },\n },\n out: [['fbq', 'init', '1234567890']],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete event is mapped to the Meta Pixel Purchase standard event with value, currency, and product contents.',\n in: getEvent('order complete', {\n timestamp: 1700000000,\n id: '1700000000-gr0up-1',\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n value: 'data.value',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n content_type: { value: 'product' },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'Purchase',\n {\n value: 555,\n currency: 'EUR',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n content_type: 'product',\n num_items: 2,\n },\n { eventID: '1700000000-gr0up-1' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add event is mapped to the Meta Pixel AddToCart standard event with product contents and value.',\n in: getEvent('product add', {\n timestamp: 1700000001,\n id: '1700000001-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'AddToCart',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000001-gr0up-1' },\n ],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.',\n in: getEvent('product view', {\n timestamp: 1700000002,\n id: '1700000002-gr0up-1',\n }),\n mapping: {\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 out: [\n [\n 'fbq',\n 'track',\n 'ViewContent',\n {\n currency: 'EUR',\n value: 420,\n contents: [{ id: 'ers', quantity: 1 }],\n content_type: 'product',\n },\n { eventID: '1700000002-gr0up-1' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n title: 'Initiate checkout',\n description:\n 'A cart view event is mapped to the Meta Pixel InitiateCheckout standard event with value and product contents.',\n in: getEvent('cart view', {\n timestamp: 1700000003,\n id: '1700000003-gr0up-1',\n }),\n mapping: {\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: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: [\n [\n 'fbq',\n 'track',\n 'InitiateCheckout',\n {\n currency: 'EUR',\n value: 840,\n contents: [{ id: 'ers', quantity: 2 }],\n num_items: 1,\n },\n { eventID: '1700000003-gr0up-1' },\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view event is forwarded to Meta Pixel as the PageView standard event with no extra parameters.',\n in: getEvent('page view', {\n timestamp: 1700000004,\n id: '1700000004-gr0up-1',\n }),\n mapping: undefined,\n out: [['fbq', 'track', 'PageView', {}, { eventID: '1700000004-gr0up-1' }]],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.',\n in: createEvent({\n name: 'video complete',\n timestamp: 1700000005,\n id: '1700000005-gr0up-1',\n data: { video_id: 'v1d30', duration: 120 },\n }),\n mapping: {\n settings: { trackCustom: 'VideoComplete' },\n data: {\n map: {\n video_id: 'data.video_id',\n duration: 'data.duration',\n },\n },\n },\n out: [\n [\n 'fbq',\n 'trackCustom',\n 'VideoComplete',\n { video_id: 'v1d30', duration: 120 },\n { eventID: '1700000005-gr0up-1' },\n ],\n ],\n};\n\n/** A silent rule sends no fbq event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no fbq event.',\n in: getEvent('page view', {\n timestamp: 1700000006,\n id: '1700000006-gr0up-1',\n }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A revocation of the consent the destination requires pauses the pixel's\n * own fires: config.consent { marketing: true }, granted first, then revoked.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.',\n command: 'consent',\n in: { marketing: false },\n out: [['window.fbq', 'consent', 'revoke']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA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EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,cAAc,WAAW,QAAQ,CAAC;AAC3C;","names":["z","z","z","z","init"]}
@@ -12,17 +12,6 @@ interface Env extends DestinationWeb.Env {
12
12
  fbq?: facebook.Pixel.Event;
13
13
  _fbq?: facebook.Pixel.Event;
14
14
  };
15
- document: {
16
- createElement: (tagName: string) => {
17
- src: string;
18
- async: boolean;
19
- setAttribute: (name: string, value: string) => void;
20
- removeAttribute: (name: string) => void;
21
- };
22
- head: {
23
- appendChild: (node: unknown) => void;
24
- };
25
- };
26
15
  }
27
16
 
28
17
  declare const init$1: Env | undefined;
@@ -52,16 +41,25 @@ declare const viewContent: Flow.StepExample;
52
41
  declare const initiateCheckout: Flow.StepExample;
53
42
  declare const pageView: Flow.StepExample;
54
43
  declare const customEventWithTrackCustom: Flow.StepExample;
44
+ /** A silent rule sends no fbq event. */
45
+ declare const silentRule: Flow.StepExample;
46
+ /**
47
+ * A revocation of the consent the destination requires pauses the pixel's
48
+ * own fires: config.consent { marketing: true }, granted first, then revoked.
49
+ */
50
+ declare const consentRevoke: Flow.StepExample;
55
51
 
56
52
  declare const step_addToCart: typeof addToCart;
53
+ declare const step_consentRevoke: typeof consentRevoke;
57
54
  declare const step_customEventWithTrackCustom: typeof customEventWithTrackCustom;
58
55
  declare const step_init: typeof init;
59
56
  declare const step_initiateCheckout: typeof initiateCheckout;
60
57
  declare const step_pageView: typeof pageView;
61
58
  declare const step_purchase: typeof purchase;
59
+ declare const step_silentRule: typeof silentRule;
62
60
  declare const step_viewContent: typeof viewContent;
63
61
  declare namespace step {
64
- export { step_addToCart as addToCart, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_viewContent as viewContent };
62
+ export { step_addToCart as addToCart, step_consentRevoke as consentRevoke, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule, step_viewContent as viewContent };
65
63
  }
66
64
 
67
65
  export { env, step };
@@ -12,17 +12,6 @@ interface Env extends DestinationWeb.Env {
12
12
  fbq?: facebook.Pixel.Event;
13
13
  _fbq?: facebook.Pixel.Event;
14
14
  };
15
- document: {
16
- createElement: (tagName: string) => {
17
- src: string;
18
- async: boolean;
19
- setAttribute: (name: string, value: string) => void;
20
- removeAttribute: (name: string) => void;
21
- };
22
- head: {
23
- appendChild: (node: unknown) => void;
24
- };
25
- };
26
15
  }
27
16
 
28
17
  declare const init$1: Env | undefined;
@@ -52,16 +41,25 @@ declare const viewContent: Flow.StepExample;
52
41
  declare const initiateCheckout: Flow.StepExample;
53
42
  declare const pageView: Flow.StepExample;
54
43
  declare const customEventWithTrackCustom: Flow.StepExample;
44
+ /** A silent rule sends no fbq event. */
45
+ declare const silentRule: Flow.StepExample;
46
+ /**
47
+ * A revocation of the consent the destination requires pauses the pixel's
48
+ * own fires: config.consent { marketing: true }, granted first, then revoked.
49
+ */
50
+ declare const consentRevoke: Flow.StepExample;
55
51
 
56
52
  declare const step_addToCart: typeof addToCart;
53
+ declare const step_consentRevoke: typeof consentRevoke;
57
54
  declare const step_customEventWithTrackCustom: typeof customEventWithTrackCustom;
58
55
  declare const step_init: typeof init;
59
56
  declare const step_initiateCheckout: typeof initiateCheckout;
60
57
  declare const step_pageView: typeof pageView;
61
58
  declare const step_purchase: typeof purchase;
59
+ declare const step_silentRule: typeof silentRule;
62
60
  declare const step_viewContent: typeof viewContent;
63
61
  declare namespace step {
64
- export { step_addToCart as addToCart, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_viewContent as viewContent };
62
+ export { step_addToCart as addToCart, step_consentRevoke as consentRevoke, step_customEventWithTrackCustom as customEventWithTrackCustom, step_init as init, step_initiateCheckout as initiateCheckout, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule, step_viewContent as viewContent };
65
63
  }
66
64
 
67
65
  export { env, step };
@@ -36,19 +36,7 @@ var noop = () => {
36
36
  };
37
37
  var init = {
38
38
  // Environment before initialization (fbq/_fbq absent until setup() runs)
39
- window: {},
40
- document: {
41
- createElement: () => ({
42
- src: "",
43
- async: false,
44
- setAttribute: () => {
45
- },
46
- removeAttribute: () => {
47
- }
48
- }),
49
- head: { appendChild: () => {
50
- } }
51
- }
39
+ window: {}
52
40
  };
53
41
  var push = {
54
42
  // Standard mock environment for testing
@@ -68,18 +56,6 @@ var push = {
68
56
  loaded: true,
69
57
  version: "2.0"
70
58
  })
71
- },
72
- document: {
73
- createElement: () => ({
74
- src: "",
75
- async: false,
76
- setAttribute: () => {
77
- },
78
- removeAttribute: () => {
79
- }
80
- }),
81
- head: { appendChild: () => {
82
- } }
83
59
  }
84
60
  };
85
61
  var simulation = [
@@ -91,11 +67,13 @@ var simulation = [
91
67
  var step_exports = {};
92
68
  __export(step_exports, {
93
69
  addToCart: () => addToCart,
70
+ consentRevoke: () => consentRevoke,
94
71
  customEventWithTrackCustom: () => customEventWithTrackCustom,
95
72
  init: () => init2,
96
73
  initiateCheckout: () => initiateCheckout,
97
74
  pageView: () => pageView,
98
75
  purchase: () => purchase,
76
+ silentRule: () => silentRule,
99
77
  viewContent: () => viewContent
100
78
  });
101
79
  var import_core = require("@walkeros/core");
@@ -121,7 +99,7 @@ var purchase = {
121
99
  name: "Purchase",
122
100
  data: {
123
101
  map: {
124
- value: "data.total",
102
+ value: "data.value",
125
103
  currency: { value: "EUR" },
126
104
  contents: {
127
105
  loop: [
@@ -308,7 +286,8 @@ var pageView = {
308
286
  var customEventWithTrackCustom = {
309
287
  title: "Custom event",
310
288
  description: "A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",
311
- in: (0, import_core.getEvent)("video complete", {
289
+ in: (0, import_core.createEvent)({
290
+ name: "video complete",
312
291
  timestamp: 1700000005,
313
292
  id: "1700000005-gr0up-1",
314
293
  data: { video_id: "v1d30", duration: 120 }
@@ -332,6 +311,23 @@ var customEventWithTrackCustom = {
332
311
  ]
333
312
  ]
334
313
  };
314
+ var silentRule = {
315
+ public: false,
316
+ description: "A rule with silent: true sends no fbq event.",
317
+ in: (0, import_core.getEvent)("page view", {
318
+ timestamp: 1700000006,
319
+ id: "1700000006-gr0up-1"
320
+ }),
321
+ mapping: { silent: true },
322
+ out: []
323
+ };
324
+ var consentRevoke = {
325
+ public: false,
326
+ description: "For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.",
327
+ command: "consent",
328
+ in: { marketing: false },
329
+ out: [["window.fbq", "consent", "revoke"]]
330
+ };
335
331
  // Annotate the CommonJS export names for ESM import in node:
336
332
  0 && (module.exports = {
337
333
  env,
@@ -15,19 +15,7 @@ var noop = () => {
15
15
  };
16
16
  var init = {
17
17
  // Environment before initialization (fbq/_fbq absent until setup() runs)
18
- window: {},
19
- document: {
20
- createElement: () => ({
21
- src: "",
22
- async: false,
23
- setAttribute: () => {
24
- },
25
- removeAttribute: () => {
26
- }
27
- }),
28
- head: { appendChild: () => {
29
- } }
30
- }
18
+ window: {}
31
19
  };
32
20
  var push = {
33
21
  // Standard mock environment for testing
@@ -47,18 +35,6 @@ var push = {
47
35
  loaded: true,
48
36
  version: "2.0"
49
37
  })
50
- },
51
- document: {
52
- createElement: () => ({
53
- src: "",
54
- async: false,
55
- setAttribute: () => {
56
- },
57
- removeAttribute: () => {
58
- }
59
- }),
60
- head: { appendChild: () => {
61
- } }
62
38
  }
63
39
  };
64
40
  var simulation = [
@@ -70,14 +46,16 @@ var simulation = [
70
46
  var step_exports = {};
71
47
  __export(step_exports, {
72
48
  addToCart: () => addToCart,
49
+ consentRevoke: () => consentRevoke,
73
50
  customEventWithTrackCustom: () => customEventWithTrackCustom,
74
51
  init: () => init2,
75
52
  initiateCheckout: () => initiateCheckout,
76
53
  pageView: () => pageView,
77
54
  purchase: () => purchase,
55
+ silentRule: () => silentRule,
78
56
  viewContent: () => viewContent
79
57
  });
80
- import { getEvent, isObject } from "@walkeros/core";
58
+ import { createEvent, getEvent, isObject } from "@walkeros/core";
81
59
  var init2 = {
82
60
  title: "Pixel init",
83
61
  description: "The destination loads the Meta Pixel script and initializes it with the configured pixelId.",
@@ -100,7 +78,7 @@ var purchase = {
100
78
  name: "Purchase",
101
79
  data: {
102
80
  map: {
103
- value: "data.total",
81
+ value: "data.value",
104
82
  currency: { value: "EUR" },
105
83
  contents: {
106
84
  loop: [
@@ -287,7 +265,8 @@ var pageView = {
287
265
  var customEventWithTrackCustom = {
288
266
  title: "Custom event",
289
267
  description: "A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",
290
- in: getEvent("video complete", {
268
+ in: createEvent({
269
+ name: "video complete",
291
270
  timestamp: 1700000005,
292
271
  id: "1700000005-gr0up-1",
293
272
  data: { video_id: "v1d30", duration: 120 }
@@ -311,6 +290,23 @@ var customEventWithTrackCustom = {
311
290
  ]
312
291
  ]
313
292
  };
293
+ var silentRule = {
294
+ public: false,
295
+ description: "A rule with silent: true sends no fbq event.",
296
+ in: getEvent("page view", {
297
+ timestamp: 1700000006,
298
+ id: "1700000006-gr0up-1"
299
+ }),
300
+ mapping: { silent: true },
301
+ out: []
302
+ };
303
+ var consentRevoke = {
304
+ public: false,
305
+ description: "For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.",
306
+ command: "consent",
307
+ in: { marketing: false },
308
+ out: [["window.fbq", "consent", "revoke"]]
309
+ };
314
310
  export {
315
311
  env_exports as env,
316
312
  step_exports as step
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(o,{DestinationMeta:()=>_,default:()=>A,destinationMeta:()=>D});var c=Object.defineProperty,i=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})};function s(t,e){if("collector"===t)return"collector";if(!e)throw new Error(`stepId(${t}) requires an id`);return`${t}.${e}`}i({},{stepId:()=>s});function f(t,e){const n=t.destinations[e];if(!n)throw new Error(`Destination not found: ${e}`);return n}i({},{getDestination:()=>f});i({},{Level:()=>a});var u,a=((u=a||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function l(t,e){const n=t.transformers[e];if(!n)throw new Error(`Transformer not found: ${e}`);return n}i({},{getTransformer:()=>l});function p(t,e){const n=t.sources[e];if(!n)throw new Error(`Source not found: ${e}`);return n}i({},{getSource:()=>p});function g(t,e){const n=t.stores[e];if(!n)throw new Error(`Store not found: ${e}`);return n}async function d(t,e){return await t.get(e)}function y(t){return"object"==typeof t&&null!==t&&"then"in t&&"function"==typeof t.then}function w(t){return"object"==typeof t&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)}i({},{getStore:()=>g,getStoreValue:()=>d});var h="observe";function b(t){const e=(t.startsWith("call:")?t.slice(5):t).split(".");return e.some(t=>""===t)?[]:e}function O(t){return"function"==typeof t}function v(t){return"object"==typeof t&&null!==t}var m=["name","length","prototype","arguments","caller"];function R(t,e){if(-1!==m.indexOf(e))return!1;let n=t;for(;O(n);){if(Object.prototype.hasOwnProperty.call(n,e))return!0;const t=Object.getPrototypeOf(n);if(!O(t)||!O(Object.getPrototypeOf(t)))return!1;n=t}return!1}function j(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function P(t,e){let n=t;for(const t of e){if(O(n)){if(!R(n,t))return!0;if(!j(n,t))return!1}else if(y(n)){if(!(t in n))return!0}else if(!v(n)||!(t in n))return!1;n=Reflect.get(n,t)}return O(n)}function E(t){const e={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...t},n=t&&t[h];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(t){if("object"!=typeof t||null===t)return!1;if(!("paths"in t)||!("record"in t))return!1;const{paths:e,record:n}=t;return Array.isArray(e)&&e.every(t=>"string"==typeof t)&&"function"==typeof n}(n)){delete e[h];const t=function(t,e,n){const r=[],o=[],c=[];for(const n of e){const e=b(n);if(0===e.length)continue;const r=e.join(".");c.push({rest:e,fn:r}),P(t,e)||o.push(r)}const i=new WeakMap,s=new WeakSet;function f(t,e){for(const o of t)if(n)try{n(o,e)}catch(t){}else r.push({fn:o,args:e,ts:Date.now()})}function u(t,e){return 0===e.length||a(t)?t:y(t)&&!e.some(e=>e.rest[0]in t)?Promise.resolve(t).then(t=>u(t,e)):O(t)?h(t,[],e):v(t)?p(t,e):t}function a(t){return(v(t)||O(t))&&s.has(t)}function l(t,e){const n=[],r=[];for(const o of t)o.rest[0]===e&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function p(t,e){var n;const r=e.map(t=>`${t.fn}:${t.rest.join(".")}`).join("|"),o=null!=(n=i.get(t))?n:new Map;i.set(t,o);const c=o.get(r);if(c)return c;const s=g(t,e);return o.set(r,s),s}function g(t,e){return O(t)?d(t,e):e.some(e=>!j(t,e.rest[0]))?function(t,e){const n=Object.create(Object.getPrototypeOf(t)),r=w(t,e,()=>o),o=new Proxy(n,{get:(t,e)=>r.get(e),set:(e,n,r)=>Reflect.set(t,n,r,t),has:(e,n)=>Reflect.has(t,n),ownKeys:()=>Reflect.ownKeys(t),getOwnPropertyDescriptor(e,n){const r=Reflect.getOwnPropertyDescriptor(t,n);return r&&{...r,configurable:!0}},defineProperty:(e,n,r)=>Reflect.defineProperty(t,n,r),deleteProperty:(e,n)=>Reflect.deleteProperty(t,n)});return s.add(o),o}(t,e):d(t,e)}function d(t,e){const n=w(t,e,()=>r),r=new Proxy(t,{get:(t,e)=>"string"!=typeof e||j(t,e)?n.get(e):Reflect.get(t,e,t),set:(t,e,n)=>Reflect.set(t,e,n,t)});return s.add(r),r}function w(t,e,n){const r=new Map;return{get(o){const c=Reflect.get(t,o,t);if("string"!=typeof o)return c;if(!O(c)&&!v(c))return c;if(a(c))return c;const i=r.get(o);if(i&&i.value===c)return i.out;const{leafs:s,deeper:f}=l(e,o);if(!(s.length>0||f.length>0)&&(!O(c)||function(t){if(Array.isArray(t))return!0;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}(t)))return c;let u=c;return O(c)?u=h(c,s,f,{proxy:n(),target:t}):f.length>0&&(u=p(c,f)),r.set(o,{value:c,out:u}),u}}}function h(t,e,n,r){const o=()=>n.filter(e=>!R(t,e.rest[0])),c=new Map,i=new Proxy(t,{get(t,e){const r=Reflect.get(t,e,t);if("string"!=typeof e||!j(t,e))return r;if(!R(t,e))return r;const{leafs:o,deeper:s}=l(n,e);if(0===o.length&&0===s.length)return r;if(a(r))return r;const f=c.get(e);if(f&&f.value===r)return f.out;let u=r;return O(r)?u=h(r,o,s,{proxy:i,target:t}):v(r)&&s.length>0&&(u=p(r,s)),c.set(e,{value:r,out:u}),u},set:(t,e,n)=>Reflect.set(t,e,n,t),apply(t,n,c){f(e,c);const i=!r||n!==r.proxy&&void 0!==n?n:r.target;return u(Reflect.apply(t,i,c),o())},construct(t,n,r){f(e,n);const c=Reflect.construct(t,n,r===i?t:r),s=u(c,o());return v(s)||O(s)?s:c}});return s.add(i),i}return{env:g(t,c),calls:r,unresolved:o}}(e,n.paths,n.record).env,r=new Set;for(const t of n.paths){const n=b(t)[0];if(void 0===n)continue;const o=e[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,e=>[e,t[e]]);for(const[t,n]of o)e[t]=n}return e}var S,_={},D={type:"meta-pixel",config:{},init({config:t,env:e,logger:n}){const{settings:r,loadScript:o}=t,{pixelId:c}=r||{};o&&function(t,e="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=E(t),r=n.createElement("script");r.src=e,r.async=!0,n.head.appendChild(r)}(e),c||n.throw("Config settings pixelId missing"),function(t){const{window:e}=E(t);if(e.fbq)return;const n=Object.assign(function(...t){n.callMethod?n.callMethod.apply(n,t):n.queue.push(t)},{queue:[]});n.push=n,n.loaded=!0,n.version="2.0",e.fbq=n,e._fbq||(e._fbq=n)}(e);const{window:i}=E(e);i.fbq("init",c)},push(t,{config:e,rule:n={},data:r,env:o}){const{track:c,trackCustom:i}=n.settings||{},{window:s}=E(o),f=s.fbq;"page view"!==t.name||n.settings||(t.name="PageView");const u=c||i||t.name;f(i?"trackCustom":"track",String(u),w(r)?r:{},{eventID:t.id})}},A=D;return S=o,((o,c,i,s)=>{if(c&&"object"==typeof c||"function"==typeof c)for(let f of n(c))r.call(o,f)||f===i||t(o,f,{get:()=>c[f],enumerable:!(s=e(c,f))||s.enumerable});return o})(t({},"__esModule",{value:!0}),S)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r),i={};((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(i,{DestinationMeta:()=>V,default:()=>N,destinationMeta:()=>L});var c=Object.defineProperty,s=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})};function u(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}s({},{stepId:()=>u});function a(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}s({},{getDestination:()=>a});s({},{Level:()=>l});var f,l=((f=l||{})[f.ERROR=0]="ERROR",f[f.WARN=1]="WARN",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f);function d(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}s({},{getTransformer:()=>d});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}s({},{getSource:()=>p});function y(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function g(e,t){return await e.get(t)}s({},{getStore:()=>y,getStoreValue:()=>g});var w="\\$flow\\.([a-zA-Z_][a-zA-Z0-9_-]*)(?:\\.([a-zA-Z0-9_.]+))?";new RegExp(`^${w}$`),new RegExp(w,"g");function h(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function b(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var v=["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"],m=class extends Error{constructor(e,t){super(e),o(this,"code"),o(this,"status"),o(this,"retryable"),o(this,"body"),void 0!==t.cause&&function(e,t){Object.defineProperty(e,"cause",{value:t,writable:!0,configurable:!0})}(this,t.cause),this.name="StepError",this.code=t.code,void 0!==t.status&&(this.status=t.status),this.retryable=function(e){if(void 0!==e.retryable)return e.retryable;const{status:t}=e;if(void 0!==t){if(429===t||t>=500&&t<600)return!0;if(t>=400&&t<500)return!1}return v.includes(e.code)}(t),void 0!==t.body&&(this.body=t.body),Object.setPrototypeOf(this,new.target.prototype)}};async function O(e,t,n){try{return await e()}catch(e){if(e instanceof m)throw e;throw new m(n,{code:t,cause:e})}}var j="observe";function P(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function R(e){return"function"==typeof e}function E(e){return"object"==typeof e&&null!==e}var x=["name","length","prototype","arguments","caller"];function A(e,t){if(-1!==x.indexOf(t))return!1;let n=e;for(;R(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!R(e)||!R(Object.getPrototypeOf(e)))return!1;n=e}return!1}function k(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function _(e,t){let n=e;for(const e of t){if(R(n)){if(!A(n,e))return!0;if(!k(n,e))return!1}else if(h(n)){if(!(e in n))return!0}else if(!E(n)||!(e in n))return!1;n=Reflect.get(n,e)}return R(n)}function S(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[j];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[j];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=P(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),_(e,t)||o.push(r)}const c=new WeakMap,s=new WeakSet;function u(e,t){for(const o of e)if(n)try{n(o,t)}catch(e){}else r.push({fn:o,args:t,ts:Date.now()})}function a(e,t){return 0===t.length||f(e)?e:h(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>a(e,t)):R(e)?w(e,[],t):E(e)?d(e,t):e}function f(e){return(E(e)||R(e))&&s.has(e)}function l(e,t){const n=[],r=[];for(const o of e)o.rest[0]===t&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function d(e,t){var n;const r=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),o=null!=(n=c.get(e))?n:new Map;c.set(e,o);const i=o.get(r);if(i)return i;const s=p(e,t);return o.set(r,s),s}function p(e,t){return R(e)?y(e,t):t.some(t=>!k(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=g(e,t,()=>o),o=new Proxy(n,{get:(e,t)=>r.get(t),set:(t,n,r)=>Reflect.set(e,n,r,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},defineProperty:(t,n,r)=>Reflect.defineProperty(e,n,r),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return s.add(o),o}(e,t):y(e,t)}function y(e,t){const n=g(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||k(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return s.add(r),r}function g(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!R(i)&&!E(i))return i;if(f(i))return i;const c=r.get(o);if(c&&c.value===i)return c.out;const{leafs:s,deeper:u}=l(t,o);if(!(s.length>0||u.length>0)&&(!R(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let a=i;return R(i)?a=w(i,s,u,{proxy:n(),target:e}):u.length>0&&(a=d(i,u)),r.set(o,{value:i,out:a}),a}}}function w(e,t,n,r){const o=()=>n.filter(t=>!A(e,t.rest[0])),i=new Map,c=new Proxy(e,{get(e,t){const r=Reflect.get(e,t,e);if("string"!=typeof t||!k(e,t))return r;if(!A(e,t))return r;const{leafs:o,deeper:s}=l(n,t);if(0===o.length&&0===s.length)return r;if(f(r))return r;const u=i.get(t);if(u&&u.value===r)return u.out;let a=r;return R(r)?a=w(r,o,s,{proxy:c,target:e}):E(r)&&s.length>0&&(a=d(r,s)),i.set(t,{value:r,out:a}),a},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){u(t,i);const c=!r||n!==r.proxy&&void 0!==n?n:r.target;return a(Reflect.apply(e,c,i),o())},construct(e,n,r){u(t,n);const i=Reflect.construct(e,n,r===c?e:r),s=a(i,o());return E(s)||R(s)?s:i}});return s.add(c),c}return{env:p(e,i),calls:r,unresolved:o}}(t,n.paths,n.record).env,r=new Set;for(const e of n.paths){const n=P(e)[0];if(void 0===n)continue;const o=t[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,t=>[t,e[t]]);for(const[e,n]of o)t[e]=n}return t}var M="data-walkeros-vendor",$=new WeakMap;var q=()=>new m("Vendor script failed to load",{code:"vendor-not-loaded"});function D(e,t,n={}){var r,o;const i=()=>null!=t();let c;if(e){const t=null!=(r=n.document)?r:"undefined"!=typeof document?document:void 0;if(!t)throw new m(`Vendor script ${e} has no document to go into`,{code:"vendor-not-ready"});c=function(e,t,n,r,o){const i=function(e,t){const n=e.querySelectorAll(`script[${M}]`);return Array.from(n).find(e=>e.getAttribute("src")===t)}(e,t),c=i&&$.get(i);if(c)return c;const s={state:"loading",expired:!1,timeout:n,waiting:[]};if(i&&o())return s.state="loaded",$.set(i,s),s;const u=null!=i?i:e.createElement("script"),a=e=>{const t=s.waiting;s.waiting=[],t.forEach(t=>t(e))},f=setTimeout(()=>{s.expired=!0,a("expired")},n);if($.set(u,s),u.addEventListener("load",()=>{clearTimeout(f),s.state="loaded",a("loaded")}),u.addEventListener("error",()=>{clearTimeout(f),s.state="failed",a("failed")}),!i){for(const[e,t]of Object.entries(r))u.setAttribute(e,t);u.src=t,u.async=!0,u.setAttribute(M,""),e.head.appendChild(u)}return s}(t,e,function(e){return"number"==typeof e&&e>0?e:1e4}(n.timeout),null!=(o=n.attributes)?o:{},i)}const s=()=>{const e=t();return null==e?Promise.reject(new m("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(e)};return{ready:()=>c?"failed"===c.state?Promise.reject(q()):"loaded"===c.state||c.expired?s():new Promise((e,t)=>{c.waiting.push(n=>{var r;"failed"===n?t(q()):"expired"===n?t((r=c.timeout,new m(`Vendor script did not load within ${r}ms`,{code:"vendor-timeout"}))):s().then(e,t)})}):s(),check(){if("failed"===(null==c?void 0:c.state))throw q()}}}var V={};function W(e,t){return D(e.loadScript?"https://connect.facebook.net/en_US/fbevents.js":void 0,()=>S(t).window.fbq,{timeout:e.timeout,document:S(t).document})}function I(e){const{fbq:t}=S(e).window;if(!t)throw new m("Meta Pixel not ready: window.fbq is missing",{code:"vendor-not-ready"});return t}var T,L={type:"meta-pixel",config:{},async init({config:e,env:t}){const{pixelId:n}=e.settings||{};if(!n)throw new m("Meta Pixel needs settings.pixelId",{code:"config"});!function(e){const{window:t}=S(e);if(t.fbq)return;const n=Object.assign(function(...e){n.callMethod?n.callMethod.apply(n,e):n.queue.push(e)},{queue:[]});n.push=n,n.loaded=!0,n.version="2.0",t.fbq=n,t._fbq||(t._fbq=n)}(t),W(e,t);const r=I(t);await O(()=>r("init",n),"vendor-not-ready","Meta Pixel init call failed")},async push(e,{config:t,rule:n={},data:r,env:o}){W(t,o).check();const i=I(o),{track:c,trackCustom:s}=n.settings||{};"page view"!==e.name||n.settings||(e.name="PageView");const u=c||s||e.name;n.silent||await O(()=>i(s?"trackCustom":"track",String(u),b(r)?r:{},{eventID:e.id}),"transport","Meta Pixel call failed")},async on(e,{config:t,data:n,env:r,collector:o}){const i=t.consent;if("consent"!==e||!i||!b(n))return;if(!Object.keys(i).some(e=>e in n))return;const c=!1!==function(e,t={},n={}){const r={...t,...n},o={};let i=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}(i,o.consent),{fbq:s}=S(r).window;"function"==typeof s&&await O(()=>s("consent",c?"grant":"revoke"),"consent-not-applied","Meta Pixel did not take the consent update")}},N=L;return T=i,((o,i,c,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let u of n(i))r.call(o,u)||u===c||e(o,u,{get:()=>i[u],enumerable:!(s=t(i,u))||s.enumerable});return o})(e({},"__esModule",{value:!0}),T)})();
package/dist/index.d.mts CHANGED
@@ -20,17 +20,6 @@ interface Env extends DestinationWeb.Env {
20
20
  fbq?: facebook.Pixel.Event;
21
21
  _fbq?: facebook.Pixel.Event;
22
22
  };
23
- document: {
24
- createElement: (tagName: string) => {
25
- src: string;
26
- async: boolean;
27
- setAttribute: (name: string, value: string) => void;
28
- removeAttribute: (name: string) => void;
29
- };
30
- head: {
31
- appendChild: (node: unknown) => void;
32
- };
33
- };
34
23
  }
35
24
  type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
36
25
  type Destination = DestinationWeb.Destination<Types>;
package/dist/index.d.ts CHANGED
@@ -20,17 +20,6 @@ interface Env extends DestinationWeb.Env {
20
20
  fbq?: facebook.Pixel.Event;
21
21
  _fbq?: facebook.Pixel.Event;
22
22
  };
23
- document: {
24
- createElement: (tagName: string) => {
25
- src: string;
26
- async: boolean;
27
- setAttribute: (name: string, value: string) => void;
28
- removeAttribute: (name: string) => void;
29
- };
30
- head: {
31
- appendChild: (node: unknown) => void;
32
- };
33
- };
34
23
  }
35
24
  type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
36
25
  type Destination = DestinationWeb.Destination<Types>;
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){asyncGeneratorStep(i,n,o,u,a,"next",e)}function a(e){asyncGeneratorStep(i,n,o,u,a,"throw",e)}u(void 0)})}}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_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}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 _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 _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}}function _ts_generator(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var r=e.destinations[t];if(!r)throw new Error("Destination not found: ".concat(t));return r},r=function(e,t){var r=e.transformers[t];if(!r)throw new Error("Transformer not found: ".concat(t));return r},n=function(e,t){var r=e.sources[t];if(!r)throw new Error("Source not found: ".concat(t));return r},o=function(e,t){var r=e.stores[t];if(!r)throw new Error("Store not found: ".concat(t));return r},i=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,e.get(t)];case 1:return[2,r.sent()]}})})()},u=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&"then"in e&&"function"==typeof e.then},a=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)},c=function(e){var t=(e.startsWith(R)?e.slice(5):e).split(".");return t.some(function(e){return""===e})?[]:t},f=function(e){return"function"==typeof e},l=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e},s=function(e,t){if(-1!==x.indexOf(t))return!1;for(var r=e;f(r);){if(Object.prototype.hasOwnProperty.call(r,t))return!0;var n=Object.getPrototypeOf(r);if(!f(n)||!f(Object.getPrototypeOf(n)))return!1;r=n}return!1},y=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},p=function(e,t){var r=e,n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done);n=!0){var p=a.value;if(f(r)){if(!s(r,p))return!0;if(!y(r,p))return!1}else if(u(r)){if(!(p in r))return!0}else if(!l(r)||!(p in r))return!1;r=Reflect.get(r,p)}}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return f(r)},v=function(e){var t=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e),r=e&&e[P];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;var t=e.paths,r=e.record;return Array.isArray(t)&&t.every(function(e){return"string"==typeof e})&&"function"==typeof r}(r)){delete t[P];var n=function(e,t,r){var n=[],o=[],i=[],a=!0,v=!1,d=void 0;try{for(var b,_=t[Symbol.iterator]();!(a=(b=_.next()).done);a=!0){var g=b.value,h=c(g);if(0!==h.length){var w=h.join(".");i.push({rest:h,fn:w}),p(e,h)||o.push(w)}}}catch(e){v=!0,d=e}finally{try{a||null==_.return||_.return()}finally{if(v)throw d}}var O=new WeakMap,m=new WeakSet;function j(e,t){var o=!0,i=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;if(r)try{r(f,t)}catch(e){}else n.push({fn:f,args:t,ts:Date.now()})}}catch(e){i=!0,u=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}}function S(e,t){return 0===t.length||P(e)?e:u(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return S(e,t)}):f(e)?k(e,[],t):l(e)?x(e,t):e}function P(e){return(l(e)||f(e))&&m.has(e)}function R(e,t){var r=[],n=[],o=!0,i=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;f.rest[0]===t&&(1===f.rest.length?r.includes(f.fn)||r.push(f.fn):n.push({rest:f.rest.slice(1),fn:f.fn}))}}catch(e){i=!0,u=e}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}return{leafs:r,deeper:n}}function x(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=O.get(e))&&void 0!==r?r:new Map;O.set(e,o);var i=o.get(n);if(i)return i;var u=E(e,t);return o.set(n,u),u}function E(e,t){return f(e)?A(e,t):t.some(function(t){return!y(e,t.rest[0])})?function(e,t){var r=Object.create(Object.getPrototypeOf(e)),n=D(e,t,function(){return o}),o=new Proxy(r,{get:function(e,t){return n.get(t)},set:function(t,r,n){return Reflect.set(e,r,n,e)},has:function(t,r){return Reflect.has(e,r)},ownKeys:function(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(t,r){var n=Reflect.getOwnPropertyDescriptor(e,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(t,r,n){return Reflect.defineProperty(e,r,n)},deleteProperty:function(t,r){return Reflect.deleteProperty(e,r)}});return m.add(o),o}(e,t):A(e,t)}function A(e,t){var r=D(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||y(e,t)?r.get(t):Reflect.get(e,t,e)},set:function(e,t,r){return Reflect.set(e,t,r,e)}});return m.add(n),n}function D(e,t,r){var n=new Map;return{get:function(o){var i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!f(i)&&!l(i))return i;if(P(i))return i;var u=n.get(o);if(u&&u.value===i)return u.out;var a=R(t,o),c=a.leafs,s=a.deeper;if(!(c.length>0||s.length>0)&&(!f(i)||function(e){if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;var y=i;return f(i)?y=k(i,c,s,{proxy:r(),target:e}):s.length>0&&(y=x(i,s)),n.set(o,{value:i,out:y}),y}}}function k(e,t,r,n){var o=function(){return r.filter(function(t){return!s(e,t.rest[0])})},i=new Map,u=new Proxy(e,{get:function(e,t){var n=Reflect.get(e,t,e);if("string"!=typeof t||!y(e,t))return n;if(!s(e,t))return n;var o=R(r,t),a=o.leafs,c=o.deeper;if(0===a.length&&0===c.length)return n;if(P(n))return n;var p=i.get(t);if(p&&p.value===n)return p.out;var v=n;return f(n)?v=k(n,a,c,{proxy:u,target:e}):l(n)&&c.length>0&&(v=x(n,c)),i.set(t,{value:n,out:v}),v},set:function(e,t,r){return Reflect.set(e,t,r,e)},apply:function(e,r,i){j(t,i);var u=!n||r!==n.proxy&&void 0!==r?r:n.target;return S(Reflect.apply(e,u,i),o())},construct:function(e,r,n){j(t,r);var i=Reflect.construct(e,r,n===u?e:n),a=S(i,o());return l(a)||f(a)?a:i}});return m.add(u),u}return{env:E(e,i),calls:n,unresolved:o}}(t,r.paths,r.record).env,o=new Set,i=!0,a=!1,v=void 0;try{for(var d,b=r.paths[Symbol.iterator]();!(i=(d=b.next()).done);i=!0){var _=d.value,g=c(_)[0];if(void 0!==g){var h=t[g];null!==h&&"object"==(void 0===h?"undefined":_type_of(h))&&o.add(g)}}}catch(e){a=!0,v=e}finally{try{i||null==b.return||b.return()}finally{if(a)throw v}}var w=Array.from(o,function(e){return[e,n[e]]}),O=!0,m=!1,j=void 0;try{for(var S,R=w[Symbol.iterator]();!(O=(S=R.next()).done);O=!0){var x=_sliced_to_array(S.value,2),E=x[0],A=x[1];t[E]=A}}catch(e){m=!0,j=e}finally{try{O||null==R.return||R.return()}finally{if(m)throw j}}}return t},d=Object.defineProperty,b=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,h={};!function(e,t){for(var r in t)d(e,r,{get:t[r],enumerable:!0})}(h,{DestinationMeta:function(){return E},default:function(){return D},destinationMeta:function(){return A}});var w=Object.defineProperty,O=function(e,t){for(var r in t)w(e,r,{get:t[r],enumerable:!0})};O({},{stepId:function(){return e}});O({},{getDestination:function(){return t}});O({},{Level:function(){return j}});var m,j=((m=j||{})[m.ERROR=0]="ERROR",m[m.WARN=1]="WARN",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m);O({},{getTransformer:function(){return r}});O({},{getSource:function(){return n}});O({},{getStore:function(){return o},getStoreValue:function(){return i}});var S,P="observe",R="call:",x=["name","length","prototype","arguments","caller"],E={},A={type:"meta-pixel",config:{},init:function(e){var t=e.config,r=e.env,n=e.logger,o=t.settings,i=t.loadScript,u=(o||{}).pixelId;i&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://connect.facebook.net/en_US/fbevents.js",r=v(e).document,n=r.createElement("script");n.src=t,n.async=!0,r.head.appendChild(n)}(r),u||n.throw("Config settings pixelId missing"),function(e){var t=v(e).window;if(!t.fbq){var r=Object.assign(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)},{queue:[]});r.push=r,r.loaded=!0,r.version="2.0",t.fbq=r,t._fbq||(t._fbq=r)}}(r),v(r).window.fbq("init",u)},push:function(e,t){t.config;var r=t.rule,n=void 0===r?{}:r,o=t.data,i=t.env,u=n.settings||{},c=u.track,f=u.trackCustom,l=v(i).window.fbq;"page view"!==e.name||n.settings||(e.name="PageView");var s=c||f||e.name;l(f?"trackCustom":"track",String(s),a(o)?o:{},{eventID:e.id})}},D=A;return S=h,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,i=!1,u=void 0;try{for(var a,c=function(){var o=a.value;g.call(e,o)||o===r||d(e,o,{get:function(){return t[o]},enumerable:!(n=b(t,o))||n.enumerable})},f=_(t)[Symbol.iterator]();!(o=(a=f.next()).done);o=!0)c()}catch(e){i=!0,u=e}finally{try{o||null==f.return||f.return()}finally{if(i)throw u}}}return e}(d({},"__esModule",{value:!0}),S)}();
1
+ "use strict";function _array_like_to_array(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _array_with_holes(t){if(Array.isArray(t))return t}function _assert_this_initialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function asyncGeneratorStep(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function _async_to_generator(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){asyncGeneratorStep(i,n,o,u,a,"next",t)}function a(t){asyncGeneratorStep(i,n,o,u,a,"throw",t)}u(void 0)})}}function _call_super(t,e,r){return e=_get_prototype_of(e),_possible_constructor_return(t,_is_native_reflect_construct()?Reflect.construct(e,r||[],_get_prototype_of(t).constructor):e.apply(t,r))}function _class_call_check(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _construct(t,e,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}function _define_property(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _get_prototype_of(t){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_get_prototype_of(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_set_prototype_of(t,e)}function _instanceof(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function _is_native_function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _iterable_to_array_limit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}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 _object_spread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){_define_property(t,e,r[e])})}return t}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function _possible_constructor_return(t,e){return!e||"object"!==_type_of(e)&&"function"!=typeof e?_assert_this_initialized(t):e}function _set_prototype_of(t,e){return _set_prototype_of=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_set_prototype_of(t,e)}function _sliced_to_array(t,e){return _array_with_holes(t)||_iterable_to_array_limit(t,e)||_unsupported_iterable_to_array(t,e)||_non_iterable_rest()}function _type_of(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _unsupported_iterable_to_array(t,e){if(t){if("string"==typeof t)return _array_like_to_array(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.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(t,e):void 0}}function _wrap_native_super(t){var e="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(t){if(null===t||!_is_native_function(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return _construct(t,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,t)},_wrap_native_super(t)}function _is_native_reflect_construct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_is_native_reflect_construct=function(){return!!t})()}function _ts_generator(t,e){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var Destination=function(){var t=function(t,e){if("collector"===t)return"collector";if(!e)throw new Error("stepId(".concat(t,") requires an id"));return"".concat(t,".").concat(e)},e=function(t,e){var r=t.destinations[e];if(!r)throw new Error("Destination not found: ".concat(e));return r},r=function(t,e){var r=t.transformers[e];if(!r)throw new Error("Transformer not found: ".concat(e));return r},n=function(t,e){var r=t.sources[e];if(!r)throw new Error("Source not found: ".concat(e));return r},o=function(t,e){var r=t.stores[e];if(!r)throw new Error("Store not found: ".concat(e));return r},i=function(t,e){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent()]}})})()},u=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&"then"in t&&"function"==typeof t.then},a=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)},c=function(t,e,r){return _async_to_generator(function(){var n;return _ts_generator(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,t()];case 1:return[2,o.sent()];case 2:if(_instanceof(n=o.sent(),D))throw n;throw new D(r,{code:e,cause:n});case 3:return[2]}})})()},f=function(t){var e=(t.startsWith(q)?t.slice(5):t).split(".");return e.some(function(t){return""===t})?[]:e},l=function(t){return"function"==typeof t},s=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t},p=function(t,e){if(-1!==T.indexOf(e))return!1;for(var r=t;l(r);){if(Object.prototype.hasOwnProperty.call(r,e))return!0;var n=Object.getPrototypeOf(r);if(!l(n)||!l(Object.getPrototypeOf(n)))return!1;r=n}return!1},y=function(t,e){var r=Reflect.getOwnPropertyDescriptor(t,e);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},d=function(t,e){var r=t,n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done);n=!0){var f=a.value;if(l(r)){if(!p(r,f))return!0;if(!y(r,f))return!1}else if(u(r)){if(!(f in r))return!0}else if(!s(r)||!(f in r))return!1;r=Reflect.get(r,f)}}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return l(r)},_=function(t){var e=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},t),r=t&&t[I];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(t){if("object"!=(void 0===t?"undefined":_type_of(t))||null===t)return!1;if(!("paths"in t)||!("record"in t))return!1;var e=t.paths,r=t.record;return Array.isArray(e)&&e.every(function(t){return"string"==typeof t})&&"function"==typeof r}(r)){delete e[I];var n=function(t,e,r){var n=[],o=[],i=[],a=!0,c=!1,_=void 0;try{for(var v,b=e[Symbol.iterator]();!(a=(v=b.next()).done);a=!0){var h=v.value,g=f(h);if(0!==g.length){var w=g.join(".");i.push({rest:g,fn:w}),d(t,g)||o.push(w)}}}catch(t){c=!0,_=t}finally{try{a||null==b.return||b.return()}finally{if(c)throw _}}var m=new WeakMap,O=new WeakSet;function j(t,e){var o=!0,i=!1,u=void 0;try{for(var a,c=t[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;if(r)try{r(f,e)}catch(t){}else n.push({fn:f,args:e,ts:Date.now()})}}catch(t){i=!0,u=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}}function P(t,e){return 0===e.length||S(t)?t:u(t)&&!e.some(function(e){return e.rest[0]in t})?Promise.resolve(t).then(function(t){return P(t,e)}):l(t)?M(t,[],e):s(t)?R(t,e):t}function S(t){return(s(t)||l(t))&&O.has(t)}function x(t,e){var r=[],n=[],o=!0,i=!1,u=void 0;try{for(var a,c=t[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;f.rest[0]===e&&(1===f.rest.length?r.includes(f.fn)||r.push(f.fn):n.push({rest:f.rest.slice(1),fn:f.fn}))}}catch(t){i=!0,u=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}return{leafs:r,deeper:n}}function R(t,e){var r,n=e.map(function(t){return"".concat(t.fn,":").concat(t.rest.join("."))}).join("|"),o=null!==(r=m.get(t))&&void 0!==r?r:new Map;m.set(t,o);var i=o.get(n);if(i)return i;var u=E(t,e);return o.set(n,u),u}function E(t,e){return l(t)?k(t,e):e.some(function(e){return!y(t,e.rest[0])})?function(t,e){var r=Object.create(Object.getPrototypeOf(t)),n=A(t,e,function(){return o}),o=new Proxy(r,{get:function(t,e){return n.get(e)},set:function(e,r,n){return Reflect.set(t,r,n,t)},has:function(e,r){return Reflect.has(t,r)},ownKeys:function(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor:function(e,r){var n=Reflect.getOwnPropertyDescriptor(t,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(e,r,n){return Reflect.defineProperty(t,r,n)},deleteProperty:function(e,r){return Reflect.deleteProperty(t,r)}});return O.add(o),o}(t,e):k(t,e)}function k(t,e){var r=A(t,e,function(){return n}),n=new Proxy(t,{get:function(t,e){return"string"!=typeof e||y(t,e)?r.get(e):Reflect.get(t,e,t)},set:function(t,e,r){return Reflect.set(t,e,r,t)}});return O.add(n),n}function A(t,e,r){var n=new Map;return{get:function(o){var i=Reflect.get(t,o,t);if("string"!=typeof o)return i;if(!l(i)&&!s(i))return i;if(S(i))return i;var u=n.get(o);if(u&&u.value===i)return u.out;var a=x(e,o),c=a.leafs,f=a.deeper;if(!(c.length>0||f.length>0)&&(!l(i)||function(t){if(Array.isArray(t))return!0;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}(t)))return i;var p=i;return l(i)?p=M(i,c,f,{proxy:r(),target:t}):f.length>0&&(p=R(i,f)),n.set(o,{value:i,out:p}),p}}}function M(t,e,r,n){var o=function(){return r.filter(function(e){return!p(t,e.rest[0])})},i=new Map,u=new Proxy(t,{get:function(t,e){var n=Reflect.get(t,e,t);if("string"!=typeof e||!y(t,e))return n;if(!p(t,e))return n;var o=x(r,e),a=o.leafs,c=o.deeper;if(0===a.length&&0===c.length)return n;if(S(n))return n;var f=i.get(e);if(f&&f.value===n)return f.out;var d=n;return l(n)?d=M(n,a,c,{proxy:u,target:t}):s(n)&&c.length>0&&(d=R(n,c)),i.set(e,{value:n,out:d}),d},set:function(t,e,r){return Reflect.set(t,e,r,t)},apply:function(t,r,i){j(e,i);var u=!n||r!==n.proxy&&void 0!==r?r:n.target;return P(Reflect.apply(t,u,i),o())},construct:function(t,r,n){j(e,r);var i=Reflect.construct(t,r,n===u?t:n),a=P(i,o());return s(a)||l(a)?a:i}});return O.add(u),u}return{env:E(t,i),calls:n,unresolved:o}}(e,r.paths,r.record).env,o=new Set,i=!0,a=!1,c=void 0;try{for(var _,v=r.paths[Symbol.iterator]();!(i=(_=v.next()).done);i=!0){var b=_.value,h=f(b)[0];if(void 0!==h){var g=e[h];null!==g&&"object"==(void 0===g?"undefined":_type_of(g))&&o.add(h)}}}catch(t){a=!0,c=t}finally{try{i||null==v.return||v.return()}finally{if(a)throw c}}var w=Array.from(o,function(t){return[t,n[t]]}),m=!0,O=!1,j=void 0;try{for(var P,S=w[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var x=_sliced_to_array(P.value,2),R=x[0],E=x[1];e[R]=E}}catch(t){O=!0,j=t}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return e},v=function(t,e){var r,n,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t){var u=null!=(r=i.document)?r:"undefined"!=typeof document?document:void 0;if(!u)throw new D("Vendor script ".concat(t," has no document to go into"),{code:"vendor-not-ready"});o=function(t,e,r,n,o){var i=function(t,e){var r=t.querySelectorAll("script[".concat(V,"]"));return Array.from(r).find(function(t){return t.getAttribute("src")===e})}(t,e),u=i&&W.get(i);if(u)return u;var a={state:"loading",expired:!1,timeout:r,waiting:[]};if(i&&o())return a.state="loaded",W.set(i,a),a;var c=null!=i?i:t.createElement("script"),f=function(t){var e=a.waiting;a.waiting=[],e.forEach(function(e){return e(t)})},l=setTimeout(function(){a.expired=!0,f("expired")},r);if(W.set(c,a),c.addEventListener("load",function(){clearTimeout(l),a.state="loaded",f("loaded")}),c.addEventListener("error",function(){clearTimeout(l),a.state="failed",f("failed")}),!i){var s=!0,p=!1,y=void 0;try{for(var d,_=Object.entries(n)[Symbol.iterator]();!(s=(d=_.next()).done);s=!0){var v=_sliced_to_array(d.value,2),b=v[0],h=v[1];c.setAttribute(b,h)}}catch(t){p=!0,y=t}finally{try{s||null==_.return||_.return()}finally{if(p)throw y}}c.src=e,c.async=!0,c.setAttribute(V,""),t.head.appendChild(c)}return a}(u,t,function(t){return"number"==typeof t&&t>0?t:1e4}(i.timeout),null!=(n=i.attributes)?n:{},function(){return null!=e()})}var a=function(){var t=e();return null==t?Promise.reject(new D("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(t)};return{ready:function(){return o?"failed"===o.state?Promise.reject(B()):"loaded"===o.state||o.expired?a():new Promise(function(t,e){o.waiting.push(function(r){var n;"failed"===r?e(B()):"expired"===r?e((n=o.timeout,new D("Vendor script did not load within ".concat(n,"ms"),{code:"vendor-timeout"}))):a().then(t,e)})}):a()},check:function(){if("failed"===(null==o?void 0:o.state))throw B()}}},b=function(t,e){return v(t.loadScript?G:void 0,function(){return _(e).window.fbq},{timeout:t.timeout,document:_(e).document})},h=function(t){var e=_(t).window.fbq;if(!e)throw new D("Meta Pixel not ready: window.fbq is missing",{code:"vendor-not-ready"});return e},g=Object.defineProperty,w=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,O=Object.prototype.hasOwnProperty,j=function(t,e,r){return function(t,e,r){return e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r}(t,"symbol"!==(void 0===e?"undefined":_type_of(e))?e+"":e,r)},P={};!function(t,e){for(var r in e)g(t,r,{get:e[r],enumerable:!0})}(P,{DestinationMeta:function(){return K},default:function(){return C},destinationMeta:function(){return z}});var S=Object.defineProperty,x=function(t,e){for(var r in e)S(t,r,{get:e[r],enumerable:!0})};x({},{stepId:function(){return t}});x({},{getDestination:function(){return e}});x({},{Level:function(){return E}});var R,E=((R=E||{})[R.ERROR=0]="ERROR",R[R.WARN=1]="WARN",R[R.INFO=2]="INFO",R[R.DEBUG=3]="DEBUG",R);x({},{getTransformer:function(){return r}});x({},{getSource:function(){return n}});x({},{getStore:function(){return o},getStoreValue:function(){return i}});var k,A="\\$flow\\.(".concat("[a-zA-Z_][a-zA-Z0-9_-]*",")(?:\\.([a-zA-Z0-9_.]+))?"),M=(new RegExp("^".concat(A,"$")),new RegExp(A,"g"),["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"]),D=function(t){function e(t,r){var n;return _class_call_check(this,e),n=_call_super(this,e,[t]),j(n,"code"),j(n,"status"),j(n,"retryable"),j(n,"body"),void 0!==r.cause&&function(t,e){Object.defineProperty(t,"cause",{value:e,writable:!0,configurable:!0})}(n,r.cause),n.name="StepError",n.code=r.code,void 0!==r.status&&(n.status=r.status),n.retryable=function(t){if(void 0!==t.retryable)return t.retryable;var e=t.status;if(void 0!==e){if(429===e||e>=500&&e<600)return!0;if(e>=400&&e<500)return!1}return M.includes(t.code)}(r),void 0!==r.body&&(n.body=r.body),Object.setPrototypeOf(n,(_instanceof(this,e)?this.constructor:void 0).prototype),n}return _inherits(e,t),e}(_wrap_native_super(Error)),I="observe",q="call:",T=["name","length","prototype","arguments","caller"],V="data-walkeros-vendor",W=new WeakMap,B=function(){return new D("Vendor script failed to load",{code:"vendor-not-loaded"})},G="https://connect.facebook.net/en_US/fbevents.js",K={},z={type:"meta-pixel",config:{},init:function(t){return _async_to_generator(function(t){var e,r,n,o;return _ts_generator(this,function(i){switch(i.label){case 0:if(e=t.config,r=t.env,!(n=(e.settings||{}).pixelId))throw new D("Meta Pixel needs settings.pixelId",{code:"config"});return function(t){var e=_(t).window;if(!e.fbq){var r=Object.assign(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r.callMethod?r.callMethod.apply(r,e):r.queue.push(e)},{queue:[]});r.push=r,r.loaded=!0,r.version="2.0",e.fbq=r,e._fbq||(e._fbq=r)}}(r),b(e,r),o=h(r),[4,c(function(){return o("init",n)},"vendor-not-ready","Meta Pixel init call failed")];case 1:return i.sent(),[2]}})}).apply(this,arguments)},push:function(t,e){return _async_to_generator(function(t,e){var r,n,o,i,u,f,l,s,p,y;return _ts_generator(this,function(d){switch(d.label){case 0:return r=e.config,n=e.rule,o=void 0===n?{}:n,i=e.data,u=e.env,b(r,u).check(),f=h(u),l=o.settings||{},s=l.track,p=l.trackCustom,"page view"!==t.name||o.settings||(t.name="PageView"),y=s||p||t.name,o.silent?[3,2]:[4,c(function(){return f(p?"trackCustom":"track",String(y),a(i)?i:{},{eventID:t.id})},"transport","Meta Pixel call failed")];case 1:d.sent(),d.label=2;case 2:return[2]}})}).apply(this,arguments)},on:function(t,e){return _async_to_generator(function(t,e){var r,n,o,i,u,f,l;return _ts_generator(this,function(s){switch(s.label){case 0:return r=e.config,n=e.data,o=e.env,i=e.collector,u=r.consent,"consent"===t&&u&&a(n)?Object.keys(u).some(function(t){return t in n})?(f=!1!==function(t){var e=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=!t||0===Object.keys(t).length;return Object.keys(e).forEach(function(o){e[o]&&(r[o]=!0,t&&t[o]&&(n=!0))}),!!n&&r}(u,i.consent),"function"!=typeof(l=_(o).window.fbq)?[2]:[4,c(function(){return l("consent",f?"grant":"revoke")},"consent-not-applied","Meta Pixel did not take the consent update")]):[2]:[2];case 1:return s.sent(),[2]}})}).apply(this,arguments)}},C=z;return k=P,function(t,e,r,n){if(e&&"object"===(void 0===e?"undefined":_type_of(e))||"function"==typeof e){var o=!0,i=!1,u=void 0;try{for(var a,c=function(){var o=a.value;O.call(t,o)||o===r||g(t,o,{get:function(){return e[o]},enumerable:!(n=w(e,o))||n.enumerable})},f=m(e)[Symbol.iterator]();!(o=(a=f.next()).done);o=!0)c()}catch(t){i=!0,u=t}finally{try{o||null==f.return||f.return()}finally{if(i)throw u}}}return t}(g({},"__esModule",{value:!0}),k)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(i,{DestinationMeta:()=>u,default:()=>f,destinationMeta:()=>l}),module.exports=(e=i,((e,i,s,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of o(i))r.call(e,c)||c===s||t(e,c,{get:()=>i[c],enumerable:!(a=n(i,c))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s=require("@walkeros/web-core");var a=require("@walkeros/core"),c=require("@walkeros/web-core"),u={},l={type:"meta-pixel",config:{},init({config:e,env:t,logger:n}){const{settings:o,loadScript:r}=e,{pixelId:i}=o||{};r&&function(e,t="https://connect.facebook.net/en_US/fbevents.js"){const{document:n}=(0,s.getEnv)(e),o=n.createElement("script");o.src=t,o.async=!0,n.head.appendChild(o)}(t),i||n.throw("Config settings pixelId missing"),function(e){const{window:t}=(0,s.getEnv)(e);if(t.fbq)return;const n=Object.assign(function(...e){n.callMethod?n.callMethod.apply(n,e):n.queue.push(e)},{queue:[]});n.push=n,n.loaded=!0,n.version="2.0",t.fbq=n,t._fbq||(t._fbq=n)}(t);const{window:a}=(0,c.getEnv)(t);a.fbq("init",i)},push(e,{config:t,rule:n={},data:o,env:r}){const{track:i,trackCustom:s}=n.settings||{},{window:u}=(0,c.getEnv)(r),l=u.fbq;"page view"!==e.name||n.settings||(e.name="PageView");const f=i||s||e.name;l(s?"trackCustom":"track",String(f),(0,a.isObject)(o)?o:{},{eventID:e.id})}},f=l;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(r,{DestinationMeta:()=>l,default:()=>p,destinationMeta:()=>f}),module.exports=(e=r,((e,r,a,c)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of o(r))i.call(e,s)||s===a||t(e,s,{get:()=>r[s],enumerable:!(c=n(r,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("@walkeros/web-core");var c=require("@walkeros/core"),s=require("@walkeros/web-core"),l={};function d(e,t){return(0,s.loadVendor)(e.loadScript?"https://connect.facebook.net/en_US/fbevents.js":void 0,()=>(0,s.getEnv)(t).window.fbq,{timeout:e.timeout,document:(0,s.getEnv)(t).document})}function u(e){const{fbq:t}=(0,s.getEnv)(e).window;if(!t)throw new c.StepError("Meta Pixel not ready: window.fbq is missing",{code:"vendor-not-ready"});return t}var f={type:"meta-pixel",config:{},async init({config:e,env:t}){const{pixelId:n}=e.settings||{};if(!n)throw new c.StepError("Meta Pixel needs settings.pixelId",{code:"config"});!function(e){const{window:t}=(0,a.getEnv)(e);if(t.fbq)return;const n=Object.assign(function(...e){n.callMethod?n.callMethod.apply(n,e):n.queue.push(e)},{queue:[]});n.push=n,n.loaded=!0,n.version="2.0",t.fbq=n,t._fbq||(t._fbq=n)}(t),d(e,t);const o=u(t);await(0,c.stepCall)(()=>o("init",n),"vendor-not-ready","Meta Pixel init call failed")},async push(e,{config:t,rule:n={},data:o,env:i}){d(t,i).check();const r=u(i),{track:a,trackCustom:s}=n.settings||{};"page view"!==e.name||n.settings||(e.name="PageView");const l=a||s||e.name;n.silent||await(0,c.stepCall)(()=>r(s?"trackCustom":"track",String(l),(0,c.isObject)(o)?o:{},{eventID:e.id}),"transport","Meta Pixel call failed")},async on(e,{config:t,data:n,env:o,collector:i}){const r=t.consent;if("consent"!==e||!r||!(0,c.isObject)(n))return;if(!Object.keys(r).some(e=>e in n))return;const a=!1!==(0,c.getGrantedConsent)(r,i.consent),{fbq:l}=(0,s.getEnv)(o).window;"function"==typeof l&&await(0,c.stepCall)(()=>l("consent",a?"grant":"revoke"),"consent-not-applied","Meta Pixel did not take the consent update")}},p=f;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/setup.ts","../src/types/index.ts"],"sourcesContent":["import type { Destination, Env } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env, logger }) {\n const { settings, loadScript } = config;\n const { pixelId } = settings || {};\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) logger.throw('Config settings pixelId missing');\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnv<Env>(env);\n window.fbq!('init', pixelId!);\n },\n\n push(event, { config, rule = {}, data, env }) {\n const { track, trackCustom } = rule.settings || {};\n const { window } = getEnv<Env>(env);\n const fbq = window.fbq!;\n\n // page view\n if (event.name === 'page view' && !rule.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type { Env } from './types';\nimport { getEnv } from '@walkeros/web-core';\n\nexport function addScript(\n env?: Env,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnv<Env>(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\n/**\n * The fbevents.js bootstrap stub: a callable that queues calls until the real\n * library loads and installs `callMethod`. The intersection captures both the\n * public `fbq` call signature and the internal queue properties the snippet\n * mutates.\n */\ntype FbqStub = facebook.Pixel.Event & {\n callMethod?: (...args: unknown[]) => void;\n queue: unknown[];\n push?: facebook.Pixel.Event;\n loaded?: boolean;\n version?: string;\n};\n\nexport function setup(env?: Env) {\n const { window } = getEnv<Env>(env);\n if (window.fbq) return;\n\n const fbq: FbqStub = Object.assign(\n function (...args: unknown[]): void {\n fbq.callMethod ? fbq.callMethod.apply(fbq, args) : fbq.queue.push(args);\n },\n { queue: [] },\n );\n fbq.push = fbq;\n fbq.loaded = true;\n fbq.version = '2.0';\n\n window.fbq = fbq;\n if (!window._fbq) window._fbq = fbq;\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\nexport interface Settings {\n pixelId: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n // Optional: the SDK global is absent until `setup` installs the stub.\n fbq?: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: {\n createElement: (tagName: string) => {\n src: string;\n async: boolean;\n setAttribute: (name: string, value: string) => void;\n removeAttribute: (name: string) => void;\n };\n head: { appendChild: (node: unknown) => void };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,sBAAuB;AAEhB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,SAAS,QAAI,wBAAY,GAAG;AACpC,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAgBO,SAAS,MAAM,KAAW;AAC/B,QAAM,EAAE,OAAO,QAAI,wBAAY,GAAG;AAClC,MAAI,OAAO,IAAK;AAEhB,QAAM,MAAe,OAAO;AAAA,IAC1B,YAAa,MAAuB;AAClC,UAAI,aAAa,IAAI,WAAW,MAAM,KAAK,IAAI,IAAI,IAAI,MAAM,KAAK,IAAI;AAAA,IACxE;AAAA,IACA,EAAE,OAAO,CAAC,EAAE;AAAA,EACd;AACA,MAAI,OAAO;AACX,MAAI,SAAS;AACb,MAAI,UAAU;AAEd,SAAO,MAAM;AACb,MAAI,CAAC,OAAO,KAAM,QAAO,OAAO;AAClC;;;AD1CA,kBAAyB;AACzB,IAAAA,mBAAuB;;;AEHvB;;;AFQO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG;AAC5B,UAAM,EAAE,UAAU,WAAW,IAAI;AACjC,UAAM,EAAE,QAAQ,IAAI,YAAY,CAAC;AAGjC,QAAI,WAAY,WAAU,GAAG;AAG7B,QAAI,CAAC,QAAS,QAAO,MAAM,iCAAiC;AAG5D,UAAM,GAAG;AAET,UAAM,EAAE,OAAO,QAAI,yBAAY,GAAG;AAClC,WAAO,IAAK,QAAQ,OAAQ;AAAA,EAC9B;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,OAAO,CAAC,GAAG,MAAM,IAAI,GAAG;AAC5C,UAAM,EAAE,OAAO,YAAY,IAAI,KAAK,YAAY,CAAC;AACjD,UAAM,EAAE,OAAO,QAAI,yBAAY,GAAG;AAClC,UAAM,MAAM,OAAO;AAGnB,QAAI,MAAM,SAAS,eAAe,CAAC,KAAK,UAAU;AAEhD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,UAChB,sBAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["import_web_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/setup.ts","../src/types/index.ts"],"sourcesContent":["import type { Config, Destination, Env } from './types';\nimport { SCRIPT_SRC, setup } from './setup';\nimport {\n getGrantedConsent,\n isObject,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n/**\n * The script `loadVendor` injects with `loadScript`. fbq replays its own stub,\n * so it is called synchronously and only a failed script is reported.\n */\nfunction vendor(config: Config, env?: Env) {\n return loadVendor(\n config.loadScript ? SCRIPT_SRC : undefined,\n () => getEnv<Env>(env).window.fbq,\n { timeout: config.timeout, document: getEnv<Env>(env).document },\n );\n}\n\n/** The fbq stub or library, or a StepError when it is not there. */\nfunction pixel(env?: Env): facebook.Pixel.Event {\n const { fbq } = getEnv<Env>(env).window;\n if (!fbq)\n throw new StepError('Meta Pixel not ready: window.fbq is missing', {\n code: 'vendor-not-ready',\n });\n return fbq;\n}\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n async init({ config, env }) {\n const { pixelId } = config.settings || {};\n if (!pixelId)\n throw new StepError('Meta Pixel needs settings.pixelId', {\n code: 'config',\n });\n\n // The fbq stub first, so calls queue until fbevents.js replays them\n setup(env);\n vendor(config, env);\n\n const fbq = pixel(env);\n await stepCall(\n () => fbq('init', pixelId),\n 'vendor-not-ready',\n 'Meta Pixel init call failed',\n );\n },\n\n async push(event, { config, rule = {}, data, env }) {\n vendor(config, env).check();\n const fbq = pixel(env);\n const { track, trackCustom } = rule.settings || {};\n\n // page view\n if (event.name === 'page view' && !rule.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n if (!rule.silent)\n await stepCall(\n () =>\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n ),\n 'transport',\n 'Meta Pixel call failed',\n );\n },\n\n // The destination's required consent decides, as it gates the pushes: a\n // revocation pauses the pixel's own fires, a grant resumes them.\n async on(type, { config, data, env, collector }) {\n const required = config.consent;\n if (type !== 'consent' || !required || !isObject(data)) return;\n if (!Object.keys(required).some((key) => key in data)) return;\n\n const granted = getGrantedConsent(required, collector.consent) !== false;\n const { fbq } = getEnv(env).window;\n if (typeof fbq !== 'function') return;\n\n await stepCall(\n () => fbq('consent', granted ? 'grant' : 'revoke'),\n 'consent-not-applied',\n 'Meta Pixel did not take the consent update',\n );\n },\n};\n\nexport default destinationMeta;\n","import type { Env } from './types';\nimport { getEnv } from '@walkeros/web-core';\n\n/** The Meta Pixel library, loaded through `loadVendor`. */\nexport const SCRIPT_SRC = 'https://connect.facebook.net/en_US/fbevents.js';\n\n/**\n * The fbevents.js bootstrap stub: a callable that queues calls until the real\n * library loads and installs `callMethod`. The intersection captures both the\n * public `fbq` call signature and the internal queue properties the snippet\n * mutates.\n */\ntype FbqStub = facebook.Pixel.Event & {\n callMethod?: (...args: unknown[]) => void;\n queue: unknown[];\n push?: facebook.Pixel.Event;\n loaded?: boolean;\n version?: string;\n};\n\nexport function setup(env?: Env) {\n const { window } = getEnv<Env>(env);\n if (window.fbq) return;\n\n const fbq: FbqStub = Object.assign(\n function (...args: unknown[]): void {\n fbq.callMethod ? fbq.callMethod.apply(fbq, args) : fbq.queue.push(args);\n },\n { queue: [] },\n );\n fbq.push = fbq;\n fbq.loaded = true;\n fbq.version = '2.0';\n\n window.fbq = fbq;\n if (!window._fbq) window._fbq = fbq;\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\nexport interface Settings {\n pixelId: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n // Optional: the SDK global is absent until `setup` installs the stub.\n fbq?: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\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EACF;AACF;AAEA,IAAO,gBAAQ;","names":["import_web_core"]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{getEnv as e}from"@walkeros/web-core";import{isObject as t}from"@walkeros/core";import{getEnv as n}from"@walkeros/web-core";var o={},i={type:"meta-pixel",config:{},init({config:t,env:o,logger:i}){const{settings:s,loadScript:a}=t,{pixelId:c}=s||{};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)}(o),c||i.throw("Config settings pixelId missing"),function(t){const{window:n}=e(t);if(n.fbq)return;const o=Object.assign(function(...e){o.callMethod?o.callMethod.apply(o,e):o.queue.push(e)},{queue:[]});o.push=o,o.loaded=!0,o.version="2.0",n.fbq=o,n._fbq||(n._fbq=o)}(o);const{window:r}=n(o);r.fbq("init",c)},push(e,{config:o,rule:i={},data:s,env:a}){const{track:c,trackCustom:r}=i.settings||{},{window:f}=n(a),p=f.fbq;"page view"!==e.name||i.settings||(e.name="PageView");const l=c||r||e.name;p(r?"trackCustom":"track",String(l),t(s)?s:{},{eventID:e.id})}},s=i;export{o as DestinationMeta,s as default,i as destinationMeta};//# sourceMappingURL=index.mjs.map
1
+ import{getEnv as e}from"@walkeros/web-core";import{getGrantedConsent as t,isObject as n,StepError as o,stepCall as i}from"@walkeros/core";import{getEnv as a,loadVendor as c}from"@walkeros/web-core";var s={};function r(e,t){return c(e.loadScript?"https://connect.facebook.net/en_US/fbevents.js":void 0,()=>a(t).window.fbq,{timeout:e.timeout,document:a(t).document})}function d(e){const{fbq:t}=a(e).window;if(!t)throw new o("Meta Pixel not ready: window.fbq is missing",{code:"vendor-not-ready"});return t}var f={type:"meta-pixel",config:{},async init({config:t,env:n}){const{pixelId:a}=t.settings||{};if(!a)throw new o("Meta Pixel needs settings.pixelId",{code:"config"});!function(t){const{window:n}=e(t);if(n.fbq)return;const o=Object.assign(function(...e){o.callMethod?o.callMethod.apply(o,e):o.queue.push(e)},{queue:[]});o.push=o,o.loaded=!0,o.version="2.0",n.fbq=o,n._fbq||(n._fbq=o)}(n),r(t,n);const c=d(n);await i(()=>c("init",a),"vendor-not-ready","Meta Pixel init call failed")},async push(e,{config:t,rule:o={},data:a,env:c}){r(t,c).check();const s=d(c),{track:f,trackCustom:l}=o.settings||{};"page view"!==e.name||o.settings||(e.name="PageView");const u=f||l||e.name;o.silent||await i(()=>s(l?"trackCustom":"track",String(u),n(a)?a:{},{eventID:e.id}),"transport","Meta Pixel call failed")},async on(e,{config:o,data:c,env:s,collector:r}){const d=o.consent;if("consent"!==e||!d||!n(c))return;if(!Object.keys(d).some(e=>e in c))return;const f=!1!==t(d,r.consent),{fbq:l}=a(s).window;"function"==typeof l&&await i(()=>l("consent",f?"grant":"revoke"),"consent-not-applied","Meta Pixel did not take the consent update")}},l=f;export{s as DestinationMeta,l as default,f as destinationMeta};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/setup.ts","../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Env } from './types';\nimport { getEnv } from '@walkeros/web-core';\n\nexport function addScript(\n env?: Env,\n src = 'https://connect.facebook.net/en_US/fbevents.js',\n) {\n const { document } = getEnv<Env>(env);\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n document.head.appendChild(script);\n}\n\n/**\n * The fbevents.js bootstrap stub: a callable that queues calls until the real\n * library loads and installs `callMethod`. The intersection captures both the\n * public `fbq` call signature and the internal queue properties the snippet\n * mutates.\n */\ntype FbqStub = facebook.Pixel.Event & {\n callMethod?: (...args: unknown[]) => void;\n queue: unknown[];\n push?: facebook.Pixel.Event;\n loaded?: boolean;\n version?: string;\n};\n\nexport function setup(env?: Env) {\n const { window } = getEnv<Env>(env);\n if (window.fbq) return;\n\n const fbq: FbqStub = Object.assign(\n function (...args: unknown[]): void {\n fbq.callMethod ? fbq.callMethod.apply(fbq, args) : fbq.queue.push(args);\n },\n { queue: [] },\n );\n fbq.push = fbq;\n fbq.loaded = true;\n fbq.version = '2.0';\n\n window.fbq = fbq;\n if (!window._fbq) window._fbq = fbq;\n}\n","import type { Destination, Env } from './types';\nimport { addScript, setup } from './setup';\nimport { isObject } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n init({ config, env, logger }) {\n const { settings, loadScript } = config;\n const { pixelId } = settings || {};\n\n // Load Meta Pixel script if required (fbevents.js)\n if (loadScript) addScript(env);\n\n // Required pixel id\n if (!pixelId) logger.throw('Config settings pixelId missing');\n\n // fbq function setup\n setup(env);\n\n const { window } = getEnv<Env>(env);\n window.fbq!('init', pixelId!);\n },\n\n push(event, { config, rule = {}, data, env }) {\n const { track, trackCustom } = rule.settings || {};\n const { window } = getEnv<Env>(env);\n const fbq = window.fbq!;\n\n // page view\n if (event.name === 'page view' && !rule.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n );\n },\n};\n\nexport default destinationMeta;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\nexport interface Settings {\n pixelId: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n // Optional: the SDK global is absent until `setup` installs the stub.\n fbq?: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n document: {\n createElement: (tagName: string) => {\n src: string;\n async: boolean;\n setAttribute: (name: string, value: string) => void;\n removeAttribute: (name: string) => void;\n };\n head: { appendChild: (node: unknown) => void };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | 'Lead'\n | 'Purchase'\n | 'Schedule'\n | 'Search'\n | 'StartTrial'\n | 'SubmitApplication'\n | 'Subscribe'\n | 'ViewContent'\n | string;\n"],"mappings":";AACA,SAAS,cAAc;AAEhB,SAAS,UACd,KACA,MAAM,kDACN;AACA,QAAM,EAAE,SAAS,IAAI,OAAY,GAAG;AACpC,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAgBO,SAAS,MAAM,KAAW;AAC/B,QAAM,EAAE,OAAO,IAAI,OAAY,GAAG;AAClC,MAAI,OAAO,IAAK;AAEhB,QAAM,MAAe,OAAO;AAAA,IAC1B,YAAa,MAAuB;AAClC,UAAI,aAAa,IAAI,WAAW,MAAM,KAAK,IAAI,IAAI,IAAI,MAAM,KAAK,IAAI;AAAA,IACxE;AAAA,IACA,EAAE,OAAO,CAAC,EAAE;AAAA,EACd;AACA,MAAI,OAAO;AACX,MAAI,SAAS;AACb,MAAI,UAAU;AAEd,SAAO,MAAM;AACb,MAAI,CAAC,OAAO,KAAM,QAAO,OAAO;AAClC;;;AC1CA,SAAS,gBAAgB;AACzB,SAAS,UAAAA,eAAc;;;ACHvB;;;ADQO,IAAM,kBAA+B;AAAA,EAC1C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG;AAC5B,UAAM,EAAE,UAAU,WAAW,IAAI;AACjC,UAAM,EAAE,QAAQ,IAAI,YAAY,CAAC;AAGjC,QAAI,WAAY,WAAU,GAAG;AAG7B,QAAI,CAAC,QAAS,QAAO,MAAM,iCAAiC;AAG5D,UAAM,GAAG;AAET,UAAM,EAAE,OAAO,IAAIC,QAAY,GAAG;AAClC,WAAO,IAAK,QAAQ,OAAQ;AAAA,EAC9B;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,OAAO,CAAC,GAAG,MAAM,IAAI,GAAG;AAC5C,UAAM,EAAE,OAAO,YAAY,IAAI,KAAK,YAAY,CAAC;AACjD,UAAM,EAAE,OAAO,IAAIA,QAAY,GAAG;AAClC,UAAM,MAAM,OAAO;AAGnB,QAAI,MAAM,SAAS,eAAe,CAAC,KAAK,UAAU;AAEhD,YAAM,OAAO;AAAA,IACf;AAEA,UAAM,YAAY,SAAS,eAAe,MAAM;AAEhD;AAAA,MACE,cAAc,gBAAgB;AAAA,MAC9B,OAAO,SAAS;AAAA,MAChB,SAAS,IAAI,IAAI,OAAO,CAAC;AAAA,MACzB,EAAE,SAAS,MAAM,GAAG;AAAA,IACtB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["getEnv","getEnv"]}
1
+ {"version":3,"sources":["../src/setup.ts","../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Env } from './types';\nimport { getEnv } from '@walkeros/web-core';\n\n/** The Meta Pixel library, loaded through `loadVendor`. */\nexport const SCRIPT_SRC = 'https://connect.facebook.net/en_US/fbevents.js';\n\n/**\n * The fbevents.js bootstrap stub: a callable that queues calls until the real\n * library loads and installs `callMethod`. The intersection captures both the\n * public `fbq` call signature and the internal queue properties the snippet\n * mutates.\n */\ntype FbqStub = facebook.Pixel.Event & {\n callMethod?: (...args: unknown[]) => void;\n queue: unknown[];\n push?: facebook.Pixel.Event;\n loaded?: boolean;\n version?: string;\n};\n\nexport function setup(env?: Env) {\n const { window } = getEnv<Env>(env);\n if (window.fbq) return;\n\n const fbq: FbqStub = Object.assign(\n function (...args: unknown[]): void {\n fbq.callMethod ? fbq.callMethod.apply(fbq, args) : fbq.queue.push(args);\n },\n { queue: [] },\n );\n fbq.push = fbq;\n fbq.loaded = true;\n fbq.version = '2.0';\n\n window.fbq = fbq;\n if (!window._fbq) window._fbq = fbq;\n}\n","import type { Config, Destination, Env } from './types';\nimport { SCRIPT_SRC, setup } from './setup';\nimport {\n getGrantedConsent,\n isObject,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationMeta from './types';\n\n/**\n * The script `loadVendor` injects with `loadScript`. fbq replays its own stub,\n * so it is called synchronously and only a failed script is reported.\n */\nfunction vendor(config: Config, env?: Env) {\n return loadVendor(\n config.loadScript ? SCRIPT_SRC : undefined,\n () => getEnv<Env>(env).window.fbq,\n { timeout: config.timeout, document: getEnv<Env>(env).document },\n );\n}\n\n/** The fbq stub or library, or a StepError when it is not there. */\nfunction pixel(env?: Env): facebook.Pixel.Event {\n const { fbq } = getEnv<Env>(env).window;\n if (!fbq)\n throw new StepError('Meta Pixel not ready: window.fbq is missing', {\n code: 'vendor-not-ready',\n });\n return fbq;\n}\n\nexport const destinationMeta: Destination = {\n type: 'meta-pixel',\n\n config: {},\n\n async init({ config, env }) {\n const { pixelId } = config.settings || {};\n if (!pixelId)\n throw new StepError('Meta Pixel needs settings.pixelId', {\n code: 'config',\n });\n\n // The fbq stub first, so calls queue until fbevents.js replays them\n setup(env);\n vendor(config, env);\n\n const fbq = pixel(env);\n await stepCall(\n () => fbq('init', pixelId),\n 'vendor-not-ready',\n 'Meta Pixel init call failed',\n );\n },\n\n async push(event, { config, rule = {}, data, env }) {\n vendor(config, env).check();\n const fbq = pixel(env);\n const { track, trackCustom } = rule.settings || {};\n\n // page view\n if (event.name === 'page view' && !rule.settings) {\n // Define a custom mapping\n event.name = 'PageView';\n }\n\n const eventName = track || trackCustom || event.name;\n\n if (!rule.silent)\n await stepCall(\n () =>\n fbq(\n trackCustom ? 'trackCustom' : 'track',\n String(eventName),\n isObject(data) ? data : {},\n { eventID: event.id },\n ),\n 'transport',\n 'Meta Pixel call failed',\n );\n },\n\n // The destination's required consent decides, as it gates the pushes: a\n // revocation pauses the pixel's own fires, a grant resumes them.\n async on(type, { config, data, env, collector }) {\n const required = config.consent;\n if (type !== 'consent' || !required || !isObject(data)) return;\n if (!Object.keys(required).some((key) => key in data)) return;\n\n const granted = getGrantedConsent(required, collector.consent) !== false;\n const { fbq } = getEnv(env).window;\n if (typeof fbq !== 'function') return;\n\n await stepCall(\n () => fbq('consent', granted ? 'grant' : 'revoke'),\n 'consent-not-applied',\n 'Meta Pixel did not take the consent update',\n );\n },\n};\n\nexport default destinationMeta;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _fbq?: facebook.Pixel.Event;\n fbq?: facebook.Pixel.Event;\n }\n}\n\nexport interface Settings {\n pixelId: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n track?: StandardEventNames;\n trackCustom?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n // Optional: the SDK global is absent until `setup` installs the stub.\n fbq?: facebook.Pixel.Event;\n _fbq?: facebook.Pixel.Event;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport type StandardEventNames =\n | 'PageView'\n | 'AddPaymentInfo'\n | 'AddToCart'\n | 'AddToWishlist'\n | 'CompleteRegistration'\n | 'Contact'\n | 'CustomizeProduct'\n | 'Donate'\n | 'FindLocation'\n | 'InitiateCheckout'\n | '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;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["getEnv","getEnv"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-meta",
4
- "version": "4.8.1-next-1792019907609",
4
+ "version": "4.8.2",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -67,17 +67,7 @@
67
67
  "examples": {
68
68
  "env": {
69
69
  "init": {
70
- "window": {},
71
- "document": {
72
- "createElement": {
73
- "$code": "()=>({src:\"\",async:!1,setAttribute:()=>{},removeAttribute:()=>{}})"
74
- },
75
- "head": {
76
- "appendChild": {
77
- "$code": "()=>{}"
78
- }
79
- }
80
- }
70
+ "window": {}
81
71
  },
82
72
  "push": {
83
73
  "window": {
@@ -87,16 +77,6 @@
87
77
  "_fbq": {
88
78
  "$code": "()=>{}"
89
79
  }
90
- },
91
- "document": {
92
- "createElement": {
93
- "$code": "()=>({src:\"\",async:!1,setAttribute:()=>{},removeAttribute:()=>{}})"
94
- },
95
- "head": {
96
- "appendChild": {
97
- "$code": "()=>{}"
98
- }
99
- }
100
80
  }
101
81
  },
102
82
  "simulation": [
@@ -199,6 +179,21 @@
199
179
  ]
200
180
  ]
201
181
  },
182
+ "consentRevoke": {
183
+ "public": false,
184
+ "description": "For a destination with config.consent { marketing: true }, revoking marketing calls fbq consent revoke, so the pixel stops its own fires too.",
185
+ "command": "consent",
186
+ "in": {
187
+ "marketing": false
188
+ },
189
+ "out": [
190
+ [
191
+ "window.fbq",
192
+ "consent",
193
+ "revoke"
194
+ ]
195
+ ]
196
+ },
202
197
  "customEventWithTrackCustom": {
203
198
  "title": "Custom event",
204
199
  "description": "A video complete event is sent as a Meta Pixel trackCustom call with a custom event name and parameters.",
@@ -367,7 +362,7 @@
367
362
  "nested",
368
363
  {
369
364
  "condition": {
370
- "$code": "t=>f(t)&&\"product\"===t.entity"
365
+ "$code": "e=>C(e)&&\"product\"===e.entity"
371
366
  },
372
367
  "map": {
373
368
  "id": "data.id",
@@ -381,7 +376,7 @@
381
376
  },
382
377
  "num_items": {
383
378
  "fn": {
384
- "$code": "t=>t.nested.filter(t=>\"product\"===t.entity).length"
379
+ "$code": "e=>e.nested.filter(e=>\"product\"===e.entity).length"
385
380
  }
386
381
  }
387
382
  }
@@ -485,7 +480,7 @@
485
480
  "currency": "EUR",
486
481
  "shipping": 5.22,
487
482
  "taxes": 73.76,
488
- "total": 555
483
+ "value": 555
489
484
  },
490
485
  "context": {
491
486
  "shopping": [
@@ -572,7 +567,7 @@
572
567
  "name": "Purchase",
573
568
  "data": {
574
569
  "map": {
575
- "value": "data.total",
570
+ "value": "data.value",
576
571
  "currency": {
577
572
  "value": "EUR"
578
573
  },
@@ -581,7 +576,7 @@
581
576
  "nested",
582
577
  {
583
578
  "condition": {
584
- "$code": "t=>f(t)&&\"product\"===t.entity"
579
+ "$code": "e=>C(e)&&\"product\"===e.entity"
585
580
  },
586
581
  "map": {
587
582
  "id": "data.id",
@@ -598,7 +593,7 @@
598
593
  },
599
594
  "num_items": {
600
595
  "fn": {
601
- "$code": "t=>t.nested.filter(t=>\"product\"===t.entity).length"
596
+ "$code": "e=>e.nested.filter(e=>\"product\"===e.entity).length"
602
597
  }
603
598
  }
604
599
  }
@@ -631,6 +626,65 @@
631
626
  ]
632
627
  ]
633
628
  },
629
+ "silentRule": {
630
+ "public": false,
631
+ "description": "A rule with silent: true sends no fbq event.",
632
+ "in": {
633
+ "name": "page view",
634
+ "data": {
635
+ "domain": "www.example.com",
636
+ "title": "walkerOS documentation",
637
+ "referrer": "https://www.walkeros.io/",
638
+ "search": "?foo=bar",
639
+ "hash": "#hash",
640
+ "id": "/docs/"
641
+ },
642
+ "context": {
643
+ "dev": [
644
+ "test",
645
+ 1
646
+ ]
647
+ },
648
+ "globals": {
649
+ "pagegroup": "docs"
650
+ },
651
+ "custom": {
652
+ "completely": "random"
653
+ },
654
+ "user": {
655
+ "id": "us3r",
656
+ "device": "c00k13",
657
+ "session": "s3ss10n"
658
+ },
659
+ "nested": [
660
+ {
661
+ "entity": "child",
662
+ "data": {
663
+ "is": "subordinated"
664
+ }
665
+ }
666
+ ],
667
+ "consent": {
668
+ "functional": true
669
+ },
670
+ "id": "1700000006-gr0up-1",
671
+ "trigger": "load",
672
+ "entity": "page",
673
+ "action": "view",
674
+ "timestamp": 1700000006,
675
+ "timing": 3.14,
676
+ "source": {
677
+ "count": 1,
678
+ "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
679
+ "type": "collector",
680
+ "schema": "4"
681
+ }
682
+ },
683
+ "mapping": {
684
+ "silent": true
685
+ },
686
+ "out": []
687
+ },
634
688
  "viewContent": {
635
689
  "title": "View content",
636
690
  "description": "A product view event is mapped to the Meta Pixel ViewContent standard event with single-product contents.",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-meta",
3
3
  "description": "Meta pixel web destination for walkerOS",
4
- "version": "4.8.1-next-1792019907609",
4
+ "version": "4.8.2",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -38,12 +38,12 @@
38
38
  "update": "npx npm-check-updates -u && npm update"
39
39
  },
40
40
  "dependencies": {
41
- "@walkeros/core": "4.8.1-next-1792019907609",
42
- "@walkeros/web-core": "4.8.1-next-1792019907609"
41
+ "@walkeros/core": "4.8.2",
42
+ "@walkeros/web-core": "4.8.2"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/facebook-pixel": "^0.0.31",
46
- "@walkeros/collector": "4.8.1-next-1792019907609"
46
+ "@walkeros/collector": "4.8.2"
47
47
  },
48
48
  "repository": {
49
49
  "url": "git+https://github.com/elbwalker/walkerOS.git",