@walkeros/web-destination-meta 4.8.2 → 4.8.3-next-1793115089237
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 +36 -3
- package/README.md +7 -1
- package/dist/dev.d.mts +18 -6
- package/dist/dev.d.ts +18 -6
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +17 -6
- package/dist/examples/index.d.ts +17 -6
- package/dist/examples/index.js +79 -87
- package/dist/examples/index.mjs +79 -88
- package/dist/walkerOS.json +82 -65
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @walkeros/web-destination-meta
|
|
2
2
|
|
|
3
|
+
## 4.8.3-next-1793115089237
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5313635: The sample events from `getEvent` now use the standard event names:
|
|
8
|
+
`checkout start` replaces `checkout view`, an order carries `tax` and `total`,
|
|
9
|
+
a promotion names its placement `slot`, and product events carry `currency`.
|
|
10
|
+
Order `value` is now the merchandise value: the `order complete` sample goes
|
|
11
|
+
from 555 to 462, and the gross amount charged is `total` (467.22). The
|
|
12
|
+
destination examples read `data.tax`, `data.slot` and the search keys
|
|
13
|
+
`data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
|
|
14
|
+
read `data.total` first, then `data.value`. The CLI ships default event
|
|
15
|
+
contracts for common site types in `examples/contracts/`.
|
|
16
|
+
- 5313635: The package publishes a minimal example: the Pixel ID, with the Pixel
|
|
17
|
+
script loaded by the destination is all Meta Pixel needs to deliver. The docs
|
|
18
|
+
page renders the install line, the integrated code and the flow from it, and
|
|
19
|
+
the package test runs the same settings, so the setup a reader copies is the
|
|
20
|
+
one that was tested.
|
|
21
|
+
- 34fd225: The Meta Pixel examples cover page view, product view, product add
|
|
22
|
+
and order complete as PageView, ViewContent, AddToCart and Purchase with
|
|
23
|
+
`content_type`, `contents`, currency, value and the event id for
|
|
24
|
+
deduplication, recorded as `window.fbq` calls. Their mapping functions now
|
|
25
|
+
also work when copied from the published examples.
|
|
26
|
+
- Updated dependencies [29d2218]
|
|
27
|
+
- Updated dependencies [34fd225]
|
|
28
|
+
- Updated dependencies [5313635]
|
|
29
|
+
- Updated dependencies [5313635]
|
|
30
|
+
- Updated dependencies [5313635]
|
|
31
|
+
- Updated dependencies [5313635]
|
|
32
|
+
- Updated dependencies [5313635]
|
|
33
|
+
- Updated dependencies [34fd225]
|
|
34
|
+
- Updated dependencies [5313635]
|
|
35
|
+
- Updated dependencies [5313635]
|
|
36
|
+
- @walkeros/web-core@4.8.3-next-1793115089237
|
|
37
|
+
- @walkeros/core@4.8.3-next-1793115089237
|
|
38
|
+
|
|
3
39
|
## 4.8.2
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -282,9 +318,6 @@
|
|
|
282
318
|
and `event.context` remain required.
|
|
283
319
|
- Each source self-registers via TypeScript module augmentation of `SourceMap`
|
|
284
320
|
in `@walkeros/core`.
|
|
285
|
-
- App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
|
|
286
|
-
part of this release. Telemetry from v4 CLI/MCP will not validate against
|
|
287
|
-
the existing app schema until that follow-up ships.
|
|
288
321
|
- `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
|
|
289
322
|
configs using `skip: true` in mapping rules must rename to `silent: true`.
|
|
290
323
|
Hard cut: no legacy alias, the field is gone.
|
package/README.md
CHANGED
|
@@ -32,7 +32,10 @@ npm install @walkeros/web-destination-meta
|
|
|
32
32
|
"destinations": {
|
|
33
33
|
"meta": {
|
|
34
34
|
"package": "@walkeros/web-destination-meta",
|
|
35
|
-
"config": {
|
|
35
|
+
"config": {
|
|
36
|
+
"loadScript": true,
|
|
37
|
+
"settings": { "pixelId": "1234567890" }
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -40,6 +43,9 @@ npm install @walkeros/web-destination-meta
|
|
|
40
43
|
}
|
|
41
44
|
```
|
|
42
45
|
|
|
46
|
+
This quick start sets no consent: add `consent: { marketing: true }` to `config`
|
|
47
|
+
before you go live, see the docs.
|
|
48
|
+
|
|
43
49
|
## Documentation
|
|
44
50
|
|
|
45
51
|
Full configuration, mapping, and examples live in the docs:
|
package/dist/dev.d.mts
CHANGED
|
@@ -111,18 +111,26 @@ declare namespace env {
|
|
|
111
111
|
export { init$1 as init, env_push as push, env_simulation as simulation };
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Meta Pixel step examples. The four standard events follow Meta's Pixel
|
|
116
|
+
* reference, run with the settings `{ pixelId: '1234567890' }`. Each out is
|
|
117
|
+
* the call recorded on `window.fbq`; the fourth argument carries the walkerOS
|
|
118
|
+
* event id as `eventID`, so the Conversions API can deduplicate it.
|
|
119
|
+
*
|
|
120
|
+
* Functions in mappings are published as source code, so they must not use
|
|
121
|
+
* imported helpers.
|
|
122
|
+
*/
|
|
114
123
|
/**
|
|
115
124
|
* Destination bootstrap.
|
|
116
125
|
* Given the canonical settings, init loads the Meta Pixel script and calls
|
|
117
|
-
* fbq('init', pixelId).
|
|
118
|
-
* `startFlow` as the destination config.
|
|
126
|
+
* fbq('init', pixelId).
|
|
119
127
|
*/
|
|
120
128
|
declare const init: Flow.StepExample;
|
|
121
|
-
declare const
|
|
122
|
-
declare const addToCart: Flow.StepExample;
|
|
129
|
+
declare const pageView: Flow.StepExample;
|
|
123
130
|
declare const viewContent: Flow.StepExample;
|
|
131
|
+
declare const addToCart: Flow.StepExample;
|
|
132
|
+
declare const purchase: Flow.StepExample;
|
|
124
133
|
declare const initiateCheckout: Flow.StepExample;
|
|
125
|
-
declare const pageView: Flow.StepExample;
|
|
126
134
|
declare const customEventWithTrackCustom: Flow.StepExample;
|
|
127
135
|
/** A silent rule sends no fbq event. */
|
|
128
136
|
declare const silentRule: Flow.StepExample;
|
|
@@ -145,10 +153,14 @@ declare namespace step {
|
|
|
145
153
|
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 };
|
|
146
154
|
}
|
|
147
155
|
|
|
156
|
+
/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */
|
|
157
|
+
declare const minimal: Flow.MinimalExample;
|
|
158
|
+
|
|
148
159
|
declare const index_env: typeof env;
|
|
160
|
+
declare const index_minimal: typeof minimal;
|
|
149
161
|
declare const index_step: typeof step;
|
|
150
162
|
declare namespace index {
|
|
151
|
-
export { index_env as env, index_step as step };
|
|
163
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
152
164
|
}
|
|
153
165
|
|
|
154
166
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -111,18 +111,26 @@ declare namespace env {
|
|
|
111
111
|
export { init$1 as init, env_push as push, env_simulation as simulation };
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Meta Pixel step examples. The four standard events follow Meta's Pixel
|
|
116
|
+
* reference, run with the settings `{ pixelId: '1234567890' }`. Each out is
|
|
117
|
+
* the call recorded on `window.fbq`; the fourth argument carries the walkerOS
|
|
118
|
+
* event id as `eventID`, so the Conversions API can deduplicate it.
|
|
119
|
+
*
|
|
120
|
+
* Functions in mappings are published as source code, so they must not use
|
|
121
|
+
* imported helpers.
|
|
122
|
+
*/
|
|
114
123
|
/**
|
|
115
124
|
* Destination bootstrap.
|
|
116
125
|
* Given the canonical settings, init loads the Meta Pixel script and calls
|
|
117
|
-
* fbq('init', pixelId).
|
|
118
|
-
* `startFlow` as the destination config.
|
|
126
|
+
* fbq('init', pixelId).
|
|
119
127
|
*/
|
|
120
128
|
declare const init: Flow.StepExample;
|
|
121
|
-
declare const
|
|
122
|
-
declare const addToCart: Flow.StepExample;
|
|
129
|
+
declare const pageView: Flow.StepExample;
|
|
123
130
|
declare const viewContent: Flow.StepExample;
|
|
131
|
+
declare const addToCart: Flow.StepExample;
|
|
132
|
+
declare const purchase: Flow.StepExample;
|
|
124
133
|
declare const initiateCheckout: Flow.StepExample;
|
|
125
|
-
declare const pageView: Flow.StepExample;
|
|
126
134
|
declare const customEventWithTrackCustom: Flow.StepExample;
|
|
127
135
|
/** A silent rule sends no fbq event. */
|
|
128
136
|
declare const silentRule: Flow.StepExample;
|
|
@@ -145,10 +153,14 @@ declare namespace step {
|
|
|
145
153
|
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 };
|
|
146
154
|
}
|
|
147
155
|
|
|
156
|
+
/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */
|
|
157
|
+
declare const minimal: Flow.MinimalExample;
|
|
158
|
+
|
|
148
159
|
declare const index_env: typeof env;
|
|
160
|
+
declare const index_minimal: typeof minimal;
|
|
149
161
|
declare const index_step: typeof step;
|
|
150
162
|
declare namespace index {
|
|
151
|
-
export { index_env as env, index_step as step };
|
|
163
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
152
164
|
}
|
|
153
165
|
|
|
154
166
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},r={};o(r,{examples:()=>h,schemas:()=>d}),module.exports=(e=r,((e,o,r,d)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of i(o))a.call(e,c)||c===r||t(e,c,{get:()=>o[c],enumerable:!(d=n(o,c))||d.enumerable});return e})(t({},"__esModule",{value:!0}),e));var d={};o(d,{CustomEventName:()=>v,MappingSchema:()=>y,PixelId:()=>l,SettingsSchema:()=>m,StandardEventName:()=>p,mapping:()=>g,settings:()=>w});var c=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),s=require("@walkeros/core/dev"),l=s.z.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),p=s.z.enum(["PageView","AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),v=s.z.string().min(1),m=u.z.object({pixelId:l.describe("Your Meta Pixel ID from Facebook Business Manager (like 1234567890)")}).strict(),y=require("@walkeros/core/dev").z.object({track:p.describe("Meta Pixel standard event name to send (like PageView or Purchase)").optional(),trackCustom:v.describe("Custom event name for tracking non-standard events (like NewsletterSignup)").optional()}),w=(0,c.zodToSchema)(m),g=(0,c.zodToSchema)(y),h={};o(h,{env:()=>f,minimal:()=>T,step:()=>C});var f={};o(f,{init:()=>k,push:()=>q,simulation:()=>P});var b=()=>{},k={window:{}},q={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:()=>R,customEventWithTrackCustom:()=>S,init:()=>A,initiateCheckout:()=>M,pageView:()=>I,purchase:()=>j,silentRule:()=>V,viewContent:()=>E});var x=require("@walkeros/core"),A={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:[["window.fbq","init","1234567890"]]},I={title:"Page view",description:"A page view is sent to Meta Pixel as the PageView standard event, with the event id for deduplication.",in:(0,x.getEvent)("page view"),out:[["window.fbq","track","PageView",{},{eventID:"f0cc5f6fec3d8eeb"}]]},E={title:"View content",description:"A product view is mapped to the Meta Pixel ViewContent standard event with product contents, currency and value.",in:(0,x.getEvent)("product view"),mapping:{name:"ViewContent",data:{map:{content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},value:"data.price"}}},out:[["window.fbq","track","ViewContent",{content_type:"product",contents:[{id:"ers",quantity:1}],currency:"EUR",value:420},{eventID:"db22fb16c70f663d"}]]},_={title:"Add to cart",description:"A product add is mapped to the Meta Pixel AddToCart standard event with product contents, currency and value.",in:(0,x.getEvent)("product add"),mapping:{name:"AddToCart",data:{map:{content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},value:"data.price"}}},out:[["window.fbq","track","AddToCart",{content_type:"product",contents:[{id:"ers",quantity:1}],currency:"EUR",value:420},{eventID:"83e860384d50953f"}]]},j={title:"Purchase",description:"An order complete is mapped to the Meta Pixel Purchase standard event with value, currency, product contents and item count.",in:(0,x.getEvent)("order complete"),mapping:{name:"Purchase",data:{map:{content_type:{value:"product"},contents:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},num_items:{fn:e=>"object"==typeof e&&null!==e&&"nested"in e&&Array.isArray(e.nested)?e.nested.filter(e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity).length:0},value:"data.value"}}},out:[["window.fbq","track","Purchase",{content_type:"product",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],currency:"EUR",num_items:2,value:462},{eventID:"235d0d7bd7a213f2"}]]},M={public:!1,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"),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>"object"==typeof e&&null!==e&&"nested"in e&&Array.isArray(e.nested)?e.nested.filter(e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity).length:0}}}},out:[["window.fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"17fc82ac689238a0"}]]},S={public:!1,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",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:[["window.fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]},V={public:!1,description:"A rule with silent: true sends no fbq event.",in:(0,x.getEvent)("page view"),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"]]},T={settings:{pixelId:"1234567890"},config:{loadScript:!0}};//# 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\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;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,cAC3B,OAAO;AAAA,EACN,SAAS,QAAQ;AAAA,IACf;AAAA,EACF;AACF,CAAC,EACA,OAAO;;;AETV,IAAAC,cAAkB;AAGX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,OAAO,kBAAkB;AAAA,IACvB;AAAA,EACF,EAAE,SAAS;AAAA,EACX,aAAa,gBAAgB;AAAA,IAC3B;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AHAM,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AIXhD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEb,IAAM,OAAwB;AAAA;AAAA,EAEnC,QAAQ,CAAC;AACX;AAEO,IAAM,OAAY;AAAA;AAAA,EAEvB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Q;AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,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"]}
|
|
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","../src/examples/minimal.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';\nexport { minimal } from './minimal';\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 } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Meta Pixel step examples. The four standard events follow Meta's Pixel\n * reference, run with the settings `{ pixelId: '1234567890' }`. Each out is\n * the call recorded on `window.fbq`; the fourth argument carries the walkerOS\n * event id as `eventID`, so the Conversions API can deduplicate it.\n *\n * Functions in mappings are published as source code, so they must not use\n * imported helpers.\n */\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId).\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: [['window.fbq', 'init', '1234567890']],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is sent to Meta Pixel as the PageView standard event, with the event id for deduplication.',\n in: getEvent('page view'),\n out: [\n ['window.fbq', 'track', 'PageView', {}, { eventID: 'f0cc5f6fec3d8eeb' }],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view is mapped to the Meta Pixel ViewContent standard event with product contents, currency and value.',\n in: getEvent('product view'),\n mapping: {\n name: 'ViewContent',\n data: {\n map: {\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 currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.price',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'ViewContent',\n {\n content_type: 'product',\n contents: [{ id: 'ers', quantity: 1 }],\n currency: 'EUR',\n value: 420,\n },\n { eventID: 'db22fb16c70f663d' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add is mapped to the Meta Pixel AddToCart standard event with product contents, currency and value.',\n in: getEvent('product add'),\n mapping: {\n name: 'AddToCart',\n data: {\n map: {\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 currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.price',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'AddToCart',\n {\n content_type: 'product',\n contents: [{ id: 'ers', quantity: 1 }],\n currency: 'EUR',\n value: 420,\n },\n { eventID: '83e860384d50953f' },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete is mapped to the Meta Pixel Purchase standard event with value, currency, product contents and item count.',\n in: getEvent('order complete'),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n content_type: { value: 'product' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n currency: { key: 'data.currency', value: 'EUR' },\n num_items: {\n fn: (event: unknown) =>\n typeof event === 'object' &&\n event !== null &&\n 'nested' in event &&\n Array.isArray(event.nested)\n ? event.nested.filter(\n (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n ).length\n : 0,\n },\n value: 'data.value',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'Purchase',\n {\n content_type: 'product',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n currency: 'EUR',\n num_items: 2,\n value: 462,\n },\n { eventID: '235d0d7bd7a213f2' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n public: false,\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 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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 typeof event === 'object' &&\n event !== null &&\n 'nested' in event &&\n Array.isArray(event.nested)\n ? event.nested.filter(\n (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n ).length\n : 0,\n },\n },\n },\n },\n out: [\n [\n 'window.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: '17fc82ac689238a0' },\n ],\n ],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n public: false,\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 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 'window.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 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","import type { Flow } from '@walkeros/core';\n\n/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */\nexport const minimal: Flow.MinimalExample = {\n settings: { pixelId: '1234567890' },\n config: { loadScript: true },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AA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A,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;;;AC1SO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,SAAS,aAAa;AAAA,EAClC,QAAQ,EAAE,YAAY,KAAK;AAC7B;","names":["import_dev","import_dev","import_dev","init"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{for(var i in n)e(t,i,{get:n[i],enumerable:!0})},n={};t(n,{CustomEventName:()=>c,MappingSchema:()=>p,PixelId:()=>d,SettingsSchema:()=>s,StandardEventName:()=>r,mapping:()=>m,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var d=o.string().min(1).regex(/^[0-9]+$/,"Pixel ID must contain only digits"),r=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=a.object({pixelId:d.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:r.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=i(s),m=i(p),v={};t(v,{env:()=>y,minimal:()=>j,step:()=>k});var y={};t(y,{init:()=>f,push:()=>h,simulation:()=>g});var w=()=>{},f={window:{}},h={window:{fbq:Object.assign(w,{callMethod:w,queue:[],push:w,loaded:!0,version:"2.0"}),_fbq:Object.assign(w,{callMethod:w,queue:[],push:w,loaded:!0,version:"2.0"})}},g=["call:window.fbq"],k={};t(k,{addToCart:()=>A,consentRevoke:()=>V,customEventWithTrackCustom:()=>M,init:()=>C,initiateCheckout:()=>_,pageView:()=>P,purchase:()=>I,silentRule:()=>S,viewContent:()=>x});import{createEvent as b,getEvent as q}from"@walkeros/core";var C={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:[["window.fbq","init","1234567890"]]},P={title:"Page view",description:"A page view is sent to Meta Pixel as the PageView standard event, with the event id for deduplication.",in:q("page view"),out:[["window.fbq","track","PageView",{},{eventID:"f0cc5f6fec3d8eeb"}]]},x={title:"View content",description:"A product view is mapped to the Meta Pixel ViewContent standard event with product contents, currency and value.",in:q("product view"),mapping:{name:"ViewContent",data:{map:{content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},value:"data.price"}}},out:[["window.fbq","track","ViewContent",{content_type:"product",contents:[{id:"ers",quantity:1}],currency:"EUR",value:420},{eventID:"db22fb16c70f663d"}]]},A={title:"Add to cart",description:"A product add is mapped to the Meta Pixel AddToCart standard event with product contents, currency and value.",in:q("product add"),mapping:{name:"AddToCart",data:{map:{content_type:{value:"product"},contents:{set:[{map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},value:"data.price"}}},out:[["window.fbq","track","AddToCart",{content_type:"product",contents:[{id:"ers",quantity:1}],currency:"EUR",value:420},{eventID:"83e860384d50953f"}]]},I={title:"Purchase",description:"An order complete is mapped to the Meta Pixel Purchase standard event with value, currency, product contents and item count.",in:q("order complete"),mapping:{name:"Purchase",data:{map:{content_type:{value:"product"},contents:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},currency:{key:"data.currency",value:"EUR"},num_items:{fn:e=>"object"==typeof e&&null!==e&&"nested"in e&&Array.isArray(e.nested)?e.nested.filter(e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity).length:0},value:"data.value"}}},out:[["window.fbq","track","Purchase",{content_type:"product",contents:[{id:"ers",quantity:1},{id:"cc",quantity:1}],currency:"EUR",num_items:2,value:462},{eventID:"235d0d7bd7a213f2"}]]},_={public:!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"),mapping:{name:"InitiateCheckout",data:{map:{value:"data.value",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{id:"data.id",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>"object"==typeof e&&null!==e&&"nested"in e&&Array.isArray(e.nested)?e.nested.filter(e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity).length:0}}}},out:[["window.fbq","track","InitiateCheckout",{currency:"EUR",value:840,contents:[{id:"ers",quantity:2}],num_items:1},{eventID:"17fc82ac689238a0"}]]},M={public:!1,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",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:[["window.fbq","trackCustom","VideoComplete",{video_id:"v1d30",duration:120},{eventID:"1700000005-gr0up-1"}]]},S={public:!1,description:"A rule with silent: true sends no fbq event.",in:q("page view"),mapping:{silent:!0},out:[]},V={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"]]},j={settings:{pixelId:"1234567890"},config:{loadScript:!0}};export{v as examples,n 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\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;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,GAC3B,OAAO;AAAA,EACN,SAAS,QAAQ;AAAA,IACf;AAAA,EACF;AACF,CAAC,EACA,OAAO;;;AETV,SAAS,KAAAC,UAAS;AAGX,IAAM,gBAAgBC,GAAE,OAAO;AAAA,EACpC,OAAO,kBAAkB;AAAA,IACvB;AAAA,EACF,EAAE,SAAS;AAAA,EACX,aAAa,gBAAgB;AAAA,IAC3B;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AHAM,IAAM,WAAW,YAAY,cAAc;AAC3C,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A,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;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,IAAI;AAAA,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":["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","../src/examples/minimal.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';\nexport { minimal } from './minimal';\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 } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Meta Pixel step examples. The four standard events follow Meta's Pixel\n * reference, run with the settings `{ pixelId: '1234567890' }`. Each out is\n * the call recorded on `window.fbq`; the fourth argument carries the walkerOS\n * event id as `eventID`, so the Conversions API can deduplicate it.\n *\n * Functions in mappings are published as source code, so they must not use\n * imported helpers.\n */\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Meta Pixel script and calls\n * fbq('init', pixelId).\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: [['window.fbq', 'init', '1234567890']],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is sent to Meta Pixel as the PageView standard event, with the event id for deduplication.',\n in: getEvent('page view'),\n out: [\n ['window.fbq', 'track', 'PageView', {}, { eventID: 'f0cc5f6fec3d8eeb' }],\n ],\n};\n\nexport const viewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view is mapped to the Meta Pixel ViewContent standard event with product contents, currency and value.',\n in: getEvent('product view'),\n mapping: {\n name: 'ViewContent',\n data: {\n map: {\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 currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.price',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'ViewContent',\n {\n content_type: 'product',\n contents: [{ id: 'ers', quantity: 1 }],\n currency: 'EUR',\n value: 420,\n },\n { eventID: 'db22fb16c70f663d' },\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add is mapped to the Meta Pixel AddToCart standard event with product contents, currency and value.',\n in: getEvent('product add'),\n mapping: {\n name: 'AddToCart',\n data: {\n map: {\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 currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.price',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'AddToCart',\n {\n content_type: 'product',\n contents: [{ id: 'ers', quantity: 1 }],\n currency: 'EUR',\n value: 420,\n },\n { eventID: '83e860384d50953f' },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order complete is mapped to the Meta Pixel Purchase standard event with value, currency, product contents and item count.',\n in: getEvent('order complete'),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n content_type: { value: 'product' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n id: 'data.id',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n currency: { key: 'data.currency', value: 'EUR' },\n num_items: {\n fn: (event: unknown) =>\n typeof event === 'object' &&\n event !== null &&\n 'nested' in event &&\n Array.isArray(event.nested)\n ? event.nested.filter(\n (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n ).length\n : 0,\n },\n value: 'data.value',\n },\n },\n },\n out: [\n [\n 'window.fbq',\n 'track',\n 'Purchase',\n {\n content_type: 'product',\n contents: [\n { id: 'ers', quantity: 1 },\n { id: 'cc', quantity: 1 },\n ],\n currency: 'EUR',\n num_items: 2,\n value: 462,\n },\n { eventID: '235d0d7bd7a213f2' },\n ],\n ],\n};\n\nexport const initiateCheckout: Flow.StepExample = {\n public: false,\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 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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 typeof event === 'object' &&\n event !== null &&\n 'nested' in event &&\n Array.isArray(event.nested)\n ? event.nested.filter(\n (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n ).length\n : 0,\n },\n },\n },\n },\n out: [\n [\n 'window.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: '17fc82ac689238a0' },\n ],\n ],\n};\n\nexport const customEventWithTrackCustom: Flow.StepExample = {\n public: false,\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 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 'window.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 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","import type { Flow } from '@walkeros/core';\n\n/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */\nexport const minimal: Flow.MinimalExample = {\n settings: { pixelId: '1234567890' },\n config: { loadScript: true },\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,GAC3B,OAAO;AAAA,EACN,SAAS,QAAQ;AAAA,IACf;AAAA,EACF;AACF,CAAC,EACA,OAAO;;;AETV,SAAS,KAAAC,UAAS;AAGX,IAAM,gBAAgBC,GAAE,OAAO;AAAA,EACpC,OAAO,kBAAkB;AAAA,IACvB;AAAA,EACF,EAAE,SAAS;AAAA,EACX,aAAa,gBAAgB;AAAA,IAC3B;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AHAM,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AIXhD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEb,IAAM,OAAwB;AAAA;AAAA,EAEnC,QAAQ,CAAC;AACX;AAEO,IAAM,OAAY;AAAA;AAAA,EAEvB,QAAQ;AAAA,IACN,KAAK,OAA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EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,WAAW;AAAA,EACxB,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;;;AC1SO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,SAAS,aAAa;AAAA,EAClC,QAAQ,EAAE,YAAY,KAAK;AAC7B;","names":["z","z","z","z","init"]}
|
|
@@ -28,18 +28,26 @@ declare namespace env {
|
|
|
28
28
|
export { init$1 as init, env_push as push, env_simulation as simulation };
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Meta Pixel step examples. The four standard events follow Meta's Pixel
|
|
33
|
+
* reference, run with the settings `{ pixelId: '1234567890' }`. Each out is
|
|
34
|
+
* the call recorded on `window.fbq`; the fourth argument carries the walkerOS
|
|
35
|
+
* event id as `eventID`, so the Conversions API can deduplicate it.
|
|
36
|
+
*
|
|
37
|
+
* Functions in mappings are published as source code, so they must not use
|
|
38
|
+
* imported helpers.
|
|
39
|
+
*/
|
|
31
40
|
/**
|
|
32
41
|
* Destination bootstrap.
|
|
33
42
|
* Given the canonical settings, init loads the Meta Pixel script and calls
|
|
34
|
-
* fbq('init', pixelId).
|
|
35
|
-
* `startFlow` as the destination config.
|
|
43
|
+
* fbq('init', pixelId).
|
|
36
44
|
*/
|
|
37
45
|
declare const init: Flow.StepExample;
|
|
38
|
-
declare const
|
|
39
|
-
declare const addToCart: Flow.StepExample;
|
|
46
|
+
declare const pageView: Flow.StepExample;
|
|
40
47
|
declare const viewContent: Flow.StepExample;
|
|
48
|
+
declare const addToCart: Flow.StepExample;
|
|
49
|
+
declare const purchase: Flow.StepExample;
|
|
41
50
|
declare const initiateCheckout: Flow.StepExample;
|
|
42
|
-
declare const pageView: Flow.StepExample;
|
|
43
51
|
declare const customEventWithTrackCustom: Flow.StepExample;
|
|
44
52
|
/** A silent rule sends no fbq event. */
|
|
45
53
|
declare const silentRule: Flow.StepExample;
|
|
@@ -62,4 +70,7 @@ declare namespace step {
|
|
|
62
70
|
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 };
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */
|
|
74
|
+
declare const minimal: Flow.MinimalExample;
|
|
75
|
+
|
|
76
|
+
export { env, minimal, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -28,18 +28,26 @@ declare namespace env {
|
|
|
28
28
|
export { init$1 as init, env_push as push, env_simulation as simulation };
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Meta Pixel step examples. The four standard events follow Meta's Pixel
|
|
33
|
+
* reference, run with the settings `{ pixelId: '1234567890' }`. Each out is
|
|
34
|
+
* the call recorded on `window.fbq`; the fourth argument carries the walkerOS
|
|
35
|
+
* event id as `eventID`, so the Conversions API can deduplicate it.
|
|
36
|
+
*
|
|
37
|
+
* Functions in mappings are published as source code, so they must not use
|
|
38
|
+
* imported helpers.
|
|
39
|
+
*/
|
|
31
40
|
/**
|
|
32
41
|
* Destination bootstrap.
|
|
33
42
|
* Given the canonical settings, init loads the Meta Pixel script and calls
|
|
34
|
-
* fbq('init', pixelId).
|
|
35
|
-
* `startFlow` as the destination config.
|
|
43
|
+
* fbq('init', pixelId).
|
|
36
44
|
*/
|
|
37
45
|
declare const init: Flow.StepExample;
|
|
38
|
-
declare const
|
|
39
|
-
declare const addToCart: Flow.StepExample;
|
|
46
|
+
declare const pageView: Flow.StepExample;
|
|
40
47
|
declare const viewContent: Flow.StepExample;
|
|
48
|
+
declare const addToCart: Flow.StepExample;
|
|
49
|
+
declare const purchase: Flow.StepExample;
|
|
41
50
|
declare const initiateCheckout: Flow.StepExample;
|
|
42
|
-
declare const pageView: Flow.StepExample;
|
|
43
51
|
declare const customEventWithTrackCustom: Flow.StepExample;
|
|
44
52
|
/** A silent rule sends no fbq event. */
|
|
45
53
|
declare const silentRule: Flow.StepExample;
|
|
@@ -62,4 +70,7 @@ declare namespace step {
|
|
|
62
70
|
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 };
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
/** The settings the Meta Pixel needs to deliver: the Pixel ID, with the Pixel script loaded by the destination. */
|
|
74
|
+
declare const minimal: Flow.MinimalExample;
|
|
75
|
+
|
|
76
|
+
export { env, minimal, step };
|