@walkeros/web-destination-pinterest 4.8.1 → 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 +77 -3
- package/README.md +1 -1
- package/dist/dev.d.mts +20 -6
- package/dist/dev.d.ts +20 -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 +18 -5
- package/dist/examples/index.d.ts +18 -5
- package/dist/examples/index.js +62 -63
- package/dist/examples/index.mjs +62 -64
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +135 -59
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @walkeros/web-destination-pinterest
|
|
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
|
+
- 9316f2a: The `identify` description matches the destination: init calls
|
|
17
|
+
`pintrk('load', tagId)` without an identity, which is sent with
|
|
18
|
+
`pintrk('set', ...)` when it changes, and the tag takes a plain or hashed
|
|
19
|
+
email. The checkout example's condition works as published, and the commerce
|
|
20
|
+
examples send product fields inside `line_items`, with `product_name` taken
|
|
21
|
+
from the product name.
|
|
22
|
+
- 5313635: The package publishes a minimal example: the Tag ID is all Pinterest
|
|
23
|
+
needs to deliver. The docs page renders the install line, the integrated code
|
|
24
|
+
and the flow from it, and the package test runs the same settings, so the
|
|
25
|
+
setup a reader copies is the one that was tested.
|
|
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
|
+
|
|
39
|
+
## 4.8.2
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 7e5fc27: A consent handler decides on the whole consent state against the
|
|
44
|
+
destination's own `config.consent` and acts only when a change touches its
|
|
45
|
+
required keys. Optimizely keeps its client across a revoke and a grant,
|
|
46
|
+
instead of closing it.
|
|
47
|
+
- 7e5fc27: A silent rule whose identify, group or similar mapping resolves to
|
|
48
|
+
nothing sends nothing, counts as delivered and writes one DEBUG line naming
|
|
49
|
+
the call and mapping key, never the value. An identity or group that is
|
|
50
|
+
already current writes nothing.
|
|
51
|
+
- 2374f54: A failed vendor call, a missing required setting (`config`) and an
|
|
52
|
+
event that cannot be sent (`missing-input`) are reported as failed pushes,
|
|
53
|
+
with the dead-letter queue and one ERROR line, instead of counting as
|
|
54
|
+
delivered. Rules with `silent: true` send no event. Settings schemas reject
|
|
55
|
+
unknown keys.
|
|
56
|
+
- b1d65e2: Web destinations that load a vendor script inject it through the
|
|
57
|
+
document of their `env`, so simulation and server-side rendering work without
|
|
58
|
+
a browser page. A page still gets the script in its own document by default,
|
|
59
|
+
and a missing document fails the push with `vendor-not-ready`.
|
|
60
|
+
- 2374f54: Vendor scripts load through walkerOS: a blocked or slow script fails
|
|
61
|
+
later events visibly (`vendor-not-loaded`, `vendor-timeout`) instead of losing
|
|
62
|
+
them. Pushes made while the script loads wait for it, and each script is
|
|
63
|
+
injected once per page.
|
|
64
|
+
- Updated dependencies [2374f54]
|
|
65
|
+
- Updated dependencies [7e5fc27]
|
|
66
|
+
- Updated dependencies [2374f54]
|
|
67
|
+
- Updated dependencies [964590a]
|
|
68
|
+
- Updated dependencies [4100ede]
|
|
69
|
+
- Updated dependencies [2374f54]
|
|
70
|
+
- Updated dependencies [2374f54]
|
|
71
|
+
- Updated dependencies [15eb7b2]
|
|
72
|
+
- Updated dependencies [33a2779]
|
|
73
|
+
- Updated dependencies [33a2779]
|
|
74
|
+
- Updated dependencies [b1d65e2]
|
|
75
|
+
- Updated dependencies [964590a]
|
|
76
|
+
- Updated dependencies [2374f54]
|
|
77
|
+
- @walkeros/core@4.8.2
|
|
78
|
+
- @walkeros/web-core@4.8.2
|
|
79
|
+
|
|
3
80
|
## 4.8.1
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
|
@@ -241,9 +318,6 @@
|
|
|
241
318
|
and `event.context` remain required.
|
|
242
319
|
- Each source self-registers via TypeScript module augmentation of `SourceMap`
|
|
243
320
|
in `@walkeros/core`.
|
|
244
|
-
- App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
|
|
245
|
-
part of this release. Telemetry from v4 CLI/MCP will not validate against
|
|
246
|
-
the existing app schema until that follow-up ships.
|
|
247
321
|
- `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
|
|
248
322
|
configs using `skip: true` in mapping rules must rename to `silent: true`.
|
|
249
323
|
Hard cut: no legacy alias, the field is gone.
|
package/README.md
CHANGED
package/dist/dev.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
7
7
|
apiKey: z.ZodString;
|
|
8
8
|
pageview: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
10
|
-
}, z.core.$
|
|
10
|
+
}, z.core.$strict>;
|
|
11
11
|
type Settings = z.infer<typeof SettingsSchema>;
|
|
12
12
|
|
|
13
13
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -112,12 +112,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
* Pre-init environment
|
|
115
|
+
* Pre-init environment: pintrk is not yet on the window.
|
|
116
116
|
* Used to validate the init path that creates the queue function.
|
|
117
117
|
*/
|
|
118
118
|
declare const init: Env;
|
|
119
119
|
/**
|
|
120
|
-
* Post-init environment
|
|
120
|
+
* Post-init environment: pintrk is available as a spy-able function.
|
|
121
121
|
* Tests clone this and replace `pintrk` with a jest.fn() to record calls.
|
|
122
122
|
*/
|
|
123
123
|
declare const push: Env;
|
|
@@ -155,7 +155,7 @@ declare const wildcardIgnored: Flow.StepExample;
|
|
|
155
155
|
*/
|
|
156
156
|
declare const pageViewRename: Flow.StepExample;
|
|
157
157
|
/**
|
|
158
|
-
* Search - walkerOS
|
|
158
|
+
* Search - walkerOS search submit → Pinterest "search" with search_query.
|
|
159
159
|
* Illustrates single-field mapping.data resolution.
|
|
160
160
|
*/
|
|
161
161
|
declare const siteSearch: Flow.StepExample;
|
|
@@ -190,26 +190,40 @@ declare const consentRevoke: Flow.StepExample;
|
|
|
190
190
|
* Consent grant - explicit opt-in.
|
|
191
191
|
*/
|
|
192
192
|
declare const consentGrant: Flow.StepExample;
|
|
193
|
+
/** A silent rule sends no track call and no identity. */
|
|
194
|
+
declare const silentRule: Flow.StepExample;
|
|
195
|
+
/**
|
|
196
|
+
* The silent identify rule of identifyOnlySilent on an update without data:
|
|
197
|
+
* no identity resolves and the rule suppresses the track, so nothing is
|
|
198
|
+
* sent. A declared skip: an unmet mapping, not a failure.
|
|
199
|
+
*/
|
|
200
|
+
declare const identifyOnlySilentWithoutData: Flow.StepExample;
|
|
193
201
|
|
|
194
202
|
declare const step_consentGrant: typeof consentGrant;
|
|
195
203
|
declare const step_consentRevoke: typeof consentRevoke;
|
|
196
204
|
declare const step_defaultForward: typeof defaultForward;
|
|
197
205
|
declare const step_identifyOnlySilent: typeof identifyOnlySilent;
|
|
206
|
+
declare const step_identifyOnlySilentWithoutData: typeof identifyOnlySilentWithoutData;
|
|
198
207
|
declare const step_orderCompleteCheckout: typeof orderCompleteCheckout;
|
|
199
208
|
declare const step_pageViewRename: typeof pageViewRename;
|
|
200
209
|
declare const step_productAddToCart: typeof productAddToCart;
|
|
201
210
|
declare const step_productViewContent: typeof productViewContent;
|
|
211
|
+
declare const step_silentRule: typeof silentRule;
|
|
202
212
|
declare const step_siteSearch: typeof siteSearch;
|
|
203
213
|
declare const step_userLoginLead: typeof userLoginLead;
|
|
204
214
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
205
215
|
declare namespace step {
|
|
206
|
-
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
216
|
+
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_identifyOnlySilentWithoutData as identifyOnlySilentWithoutData, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_silentRule as silentRule, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
207
217
|
}
|
|
208
218
|
|
|
219
|
+
/** The settings the Pinterest Tag needs to deliver: the Tag ID. */
|
|
220
|
+
declare const minimal: Flow.MinimalExample;
|
|
221
|
+
|
|
209
222
|
declare const index_env: typeof env;
|
|
223
|
+
declare const index_minimal: typeof minimal;
|
|
210
224
|
declare const index_step: typeof step;
|
|
211
225
|
declare namespace index {
|
|
212
|
-
export { index_env as env, index_step as step };
|
|
226
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
213
227
|
}
|
|
214
228
|
|
|
215
229
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
7
7
|
apiKey: z.ZodString;
|
|
8
8
|
pageview: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
10
|
-
}, z.core.$
|
|
10
|
+
}, z.core.$strict>;
|
|
11
11
|
type Settings = z.infer<typeof SettingsSchema>;
|
|
12
12
|
|
|
13
13
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -112,12 +112,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
* Pre-init environment
|
|
115
|
+
* Pre-init environment: pintrk is not yet on the window.
|
|
116
116
|
* Used to validate the init path that creates the queue function.
|
|
117
117
|
*/
|
|
118
118
|
declare const init: Env;
|
|
119
119
|
/**
|
|
120
|
-
* Post-init environment
|
|
120
|
+
* Post-init environment: pintrk is available as a spy-able function.
|
|
121
121
|
* Tests clone this and replace `pintrk` with a jest.fn() to record calls.
|
|
122
122
|
*/
|
|
123
123
|
declare const push: Env;
|
|
@@ -155,7 +155,7 @@ declare const wildcardIgnored: Flow.StepExample;
|
|
|
155
155
|
*/
|
|
156
156
|
declare const pageViewRename: Flow.StepExample;
|
|
157
157
|
/**
|
|
158
|
-
* Search - walkerOS
|
|
158
|
+
* Search - walkerOS search submit → Pinterest "search" with search_query.
|
|
159
159
|
* Illustrates single-field mapping.data resolution.
|
|
160
160
|
*/
|
|
161
161
|
declare const siteSearch: Flow.StepExample;
|
|
@@ -190,26 +190,40 @@ declare const consentRevoke: Flow.StepExample;
|
|
|
190
190
|
* Consent grant - explicit opt-in.
|
|
191
191
|
*/
|
|
192
192
|
declare const consentGrant: Flow.StepExample;
|
|
193
|
+
/** A silent rule sends no track call and no identity. */
|
|
194
|
+
declare const silentRule: Flow.StepExample;
|
|
195
|
+
/**
|
|
196
|
+
* The silent identify rule of identifyOnlySilent on an update without data:
|
|
197
|
+
* no identity resolves and the rule suppresses the track, so nothing is
|
|
198
|
+
* sent. A declared skip: an unmet mapping, not a failure.
|
|
199
|
+
*/
|
|
200
|
+
declare const identifyOnlySilentWithoutData: Flow.StepExample;
|
|
193
201
|
|
|
194
202
|
declare const step_consentGrant: typeof consentGrant;
|
|
195
203
|
declare const step_consentRevoke: typeof consentRevoke;
|
|
196
204
|
declare const step_defaultForward: typeof defaultForward;
|
|
197
205
|
declare const step_identifyOnlySilent: typeof identifyOnlySilent;
|
|
206
|
+
declare const step_identifyOnlySilentWithoutData: typeof identifyOnlySilentWithoutData;
|
|
198
207
|
declare const step_orderCompleteCheckout: typeof orderCompleteCheckout;
|
|
199
208
|
declare const step_pageViewRename: typeof pageViewRename;
|
|
200
209
|
declare const step_productAddToCart: typeof productAddToCart;
|
|
201
210
|
declare const step_productViewContent: typeof productViewContent;
|
|
211
|
+
declare const step_silentRule: typeof silentRule;
|
|
202
212
|
declare const step_siteSearch: typeof siteSearch;
|
|
203
213
|
declare const step_userLoginLead: typeof userLoginLead;
|
|
204
214
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
205
215
|
declare namespace step {
|
|
206
|
-
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
216
|
+
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_identifyOnlySilentWithoutData as identifyOnlySilentWithoutData, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_silentRule as silentRule, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
207
217
|
}
|
|
208
218
|
|
|
219
|
+
/** The settings the Pinterest Tag needs to deliver: the Tag ID. */
|
|
220
|
+
declare const minimal: Flow.MinimalExample;
|
|
221
|
+
|
|
209
222
|
declare const index_env: typeof env;
|
|
223
|
+
declare const index_minimal: typeof minimal;
|
|
210
224
|
declare const index_step: typeof step;
|
|
211
225
|
declare namespace index {
|
|
212
|
-
export { index_env as env, index_step as step };
|
|
226
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
213
227
|
}
|
|
214
228
|
|
|
215
229
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,
|
|
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})},d={};r(d,{examples:()=>g,schemas:()=>o}),module.exports=(e=d,((e,r,d,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of i(r))n.call(e,c)||c===d||t(e,c,{get:()=>r[c],enumerable:!(o=a(r,c))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>l,SettingsSchema:()=>p,mapping:()=>v,settings:()=>m});var c=require("@walkeros/core/dev"),s=require("@walkeros/core/dev"),p=s.z.object({apiKey:s.z.string().regex(/^\d+$/,"Must be a numeric Pinterest Tag ID").min(6).describe('Your Pinterest Tag ID (numeric string, e.g. "2612345678901"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk("load", tagId).'),pageview:s.z.boolean().describe('Call pintrk("page") once in init, as Pinterest\'s base code does. Default true. Set false to leave the call out.').optional(),identify:s.z.unknown().describe('walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. The Pinterest tag takes em plain (it hashes it with SHA-256 in the browser) or already hashed. Resolved on each event and sent with pintrk("set", data) when it changes; init calls pintrk("load", tagId) without it.').optional()}).strict(),u=require("@walkeros/core/dev"),l=u.z.object({identify:u.z.unknown().describe('Per-event identity override. Resolves to { em?, external_id? } and fires pintrk("set", data) when the resolved value differs from the current state.').optional()}),m=(0,c.zodToSchema)(p),v=(0,c.zodToSchema)(l),g={};r(g,{env:()=>h,minimal:()=>I,step:()=>f});var h={};r(h,{init:()=>_,push:()=>y,simulation:()=>w});var k=Object.assign(()=>{},{queue:[],version:"3.0"}),_={window:{pintrk:void 0}},y={window:{pintrk:k}},w=["call:window.pintrk"],f={};r(f,{consentGrant:()=>z,consentRevoke:()=>C,defaultForward:()=>E,identifyOnlySilent:()=>O,identifyOnlySilentWithoutData:()=>D,orderCompleteCheckout:()=>R,pageViewRename:()=>q,productAddToCart:()=>A,productViewContent:()=>j,silentRule:()=>T,siteSearch:()=>S,userLoginLead:()=>x,wildcardIgnored:()=>P});var b=require("@walkeros/core"),E={title:"Default forward",description:"Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.",in:(0,b.getEvent)("page view",{timestamp:1700000100,id:"ev-1700000100"}),mapping:void 0,out:[["pintrk","track","page view",{event_id:"ev-1700000100"}]]},P={public:!1,in:(0,b.createEvent)({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},q={title:"Page visit",description:"A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.",in:(0,b.getEvent)("page view",{timestamp:1700000102,id:"ev-1700000102"}),mapping:{name:"pagevisit"},out:[["pintrk","track","pagevisit",{event_id:"ev-1700000102"}]]},S={title:"Search",description:"A search submit fires Pinterest search with the search_query field resolved from event data.",in:(0,b.createEvent)({name:"search submit",timestamp:1700000103,id:"ev-1700000103",data:{term:"leather jacket"}}),mapping:{name:"search",data:{map:{search_query:"data.term"}}},out:[["pintrk","track","search",{search_query:"leather jacket",event_id:"ev-1700000103"}]]},j={title:"View content",description:"A product view fires Pinterest viewcontent with value, currency, and a single-item line_items array.",in:(0,b.getEvent)("product view",{timestamp:1700000104,id:"ev-1700000104"}),mapping:{name:"viewcontent",data:{map:{value:"data.price",currency:{key:"data.currency",value:"EUR"},line_items:{set:[{map:{product_id:"data.id",product_name:"data.name",product_price:"data.price"}}]}}}},out:[["pintrk","track","viewcontent",{value:420,currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420}],event_id:"ev-1700000104"}]]},A={title:"Add to cart",description:"A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.",in:(0,b.getEvent)("product add",{timestamp:1700000105,id:"ev-1700000105"}),mapping:{name:"addtocart",data:{map:{value:"data.price",order_quantity:{value:1},currency:{key:"data.currency",value:"EUR"},line_items:{set:[{map:{product_id:"data.id",product_name:"data.name",product_price:"data.price",product_quantity:{value:1}}}]}}}},out:[["pintrk","track","addtocart",{value:420,order_quantity:1,currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420,product_quantity:1}],event_id:"ev-1700000105"}]]},R={title:"Checkout",description:"A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.",in:(0,b.getEvent)("order complete",{timestamp:1700000106,id:"ev-1700000106"}),mapping:{name:"checkout",data:{map:{value:"data.value",order_id:"data.id",currency:{key:"data.currency",value:"EUR"},line_items:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"data"in e&&"object"==typeof e.data&&null!==e.data&&"price"in e.data&&"number"==typeof e.data.price,map:{product_id:"data.id",product_name:"data.name",product_price:"data.price",product_quantity:{value:1}}}]}}}},out:[["pintrk","track","checkout",{value:462,order_id:"0rd3r1d",currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420,product_quantity:1},{product_id:"cc",product_name:"Cool Cap",product_price:42,product_quantity:1}],event_id:"ev-1700000106"}]]},x={title:"Lead with matching",description:"A user login fires pintrk set for enhanced matching and then a lead conversion track call.",in:(0,b.createEvent)({name:"user login",timestamp:1700000107,id:"ev-1700000107",data:{id:"usr_123",email:"jane@example.com"}}),mapping:{name:"lead",settings:{identify:{map:{em:"data.email",external_id:"data.id"}}},data:{map:{lead_type:{value:"login"}}}},out:[["pintrk","set",{em:"jane@example.com",external_id:"usr_123"}],["pintrk","track","lead",{lead_type:"login",event_id:"ev-1700000107"}]]},O={title:"Identify only",description:"A user update fires pintrk set for enhanced matching without a track call via mapping silent.",in:(0,b.createEvent)({name:"user update",timestamp:1700000108,id:"ev-1700000108",data:{id:"usr_456",email:"new@example.com"}}),mapping:{silent:!0,settings:{identify:{map:{em:"data.email",external_id:"data.id"}}}},out:[["pintrk","set",{em:"new@example.com",external_id:"usr_456"}]]},C={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the destination stops sending track calls itself.",command:"consent",in:{marketing:!1},out:[]},z={public:!1,description:"A grant of the required consent lets the destination send track calls again; Pinterest has no consent call to make.",command:"consent",in:{marketing:!0},out:[]},T={public:!1,description:"A rule with silent: true sends no pintrk track call.",in:(0,b.createEvent)({name:"page view",timestamp:1700000109}),mapping:{silent:!0},out:[]},D={public:!1,description:"A silent rule whose identify mapping finds no email or id sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"user update",entity:"user",action:"update"},mapping:O.mapping,out:[]},I={settings:{apiKey:"2612345678901"}};//# 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/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 { 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';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .regex(/^\\d+$/, 'Must be a numeric Pinterest Tag ID')\n .min(6)\n .describe(\n 'Your Pinterest Tag ID (numeric string, e.g. \"2612345678901\"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk(\"load\", tagId).',\n ),\n pageview: z\n .boolean()\n .describe(\n 'Fire pintrk(\"page\") once in init after core.js loads. Default true (matches Pinterest\\'s base code convention). Set false when walkerOS sources already emit page view events and you would otherwise get a duplicate initial fire.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. em is auto-hashed by the Pinterest JS tag — do not hash before passing. Passed to pintrk(\"load\", tagId, data) on init and pintrk(\"set\", data) when the resolved value changes.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity override. Resolves to { em?, external_id? } and fires pintrk(\"set\", data) when the resolved value differs from the current state.',\n )\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, Pintrk } from '../types';\n\n/**\n * Example environment configurations for the Pinterest destination.\n *\n * These mock window.pintrk and document, allowing tests to run in a pure\n * Node environment without jsdom and without touching the real Pinterest\n * CDN. Tests replace env.window.pintrk with a jest.fn() spy.\n */\n\nconst noop = () => {};\n\nconst noopPintrk: Pintrk = Object.assign(noop, {\n queue: [] as unknown[][],\n version: '3.0',\n}) as unknown as Pintrk;\n\n/**\n * Pre-init environment — pintrk is not yet on the window.\n * Used to validate the init path that creates the queue function.\n */\nexport const init: Env = {\n window: {\n pintrk: undefined,\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n getElementsByTagName: () => [\n {\n parentNode: { insertBefore: () => {} },\n },\n ],\n querySelector: () => null,\n },\n};\n\n/**\n * Post-init environment — pintrk is available as a spy-able function.\n * Tests clone this and replace `pintrk` with a jest.fn() to record calls.\n */\nexport const push: Env = {\n window: {\n pintrk: noopPintrk,\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n getElementsByTagName: () => [\n {\n parentNode: { insertBefore: () => {} },\n },\n ],\n querySelector: () => null,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = ['call:window.pintrk'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Output convention:\n * - Single SDK call: out = [['pintrk', 'track', 'checkout', { ... }]]\n * - Multiple SDK calls: out = [['pintrk', ...], ['pintrk', ...]]\n * - Zero SDK calls: out = []\n */\n\n/**\n * Default event forwarding - no rule. Without a mapping.name, the walkerOS\n * event name is forwarded as-is. Pinterest accepts it but won't match a\n * standard conversion event. event_id is auto-attached for deduplication.\n */\nexport const defaultForward: Flow.StepExample = {\n title: 'Default forward',\n description:\n 'Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.',\n in: getEvent('page view', { timestamp: 1700000100, id: 'ev-1700000100' }),\n mapping: undefined,\n out: [['pintrk', 'track', 'page view', { event_id: 'ev-1700000100' }]],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy\n * events. `mapping.ignore: true` at rule level produces zero SDK calls.\n */\nexport const wildcardIgnored: Flow.StepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Standard Pinterest event rename via mapping.name. walkerOS \"page view\"\n * → Pinterest \"pagevisit\". The ONLY way to get Pinterest to recognize\n * a conversion event - the destination never auto-maps.\n */\nexport const pageViewRename: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.',\n in: getEvent('page view', { timestamp: 1700000102, id: 'ev-1700000102' }),\n mapping: { name: 'pagevisit' },\n out: [['pintrk', 'track', 'pagevisit', { event_id: 'ev-1700000102' }]],\n};\n\n/**\n * Search - walkerOS site search → Pinterest \"search\" with search_query.\n * Illustrates single-field mapping.data resolution.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Search',\n description:\n 'A site search fires Pinterest search with the search_query field resolved from event data.',\n in: getEvent('site search', {\n timestamp: 1700000103,\n id: 'ev-1700000103',\n data: { query: 'leather jacket' },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n search_query: 'data.query',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'search',\n {\n search_query: 'leather jacket',\n event_id: 'ev-1700000103',\n },\n ],\n ],\n};\n\n/**\n * Single-product viewcontent.\n */\nexport const productViewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view fires Pinterest viewcontent with value, currency, product_id, and product_name.',\n in: getEvent('product view', {\n timestamp: 1700000104,\n id: 'ev-1700000104',\n }),\n mapping: {\n name: 'viewcontent',\n data: {\n map: {\n value: 'data.price',\n currency: { key: 'data.currency', value: 'EUR' },\n product_id: 'data.id',\n product_name: 'data.color',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'viewcontent',\n {\n value: 420,\n currency: 'EUR',\n product_id: 'ers',\n product_name: 'black',\n event_id: 'ev-1700000104',\n },\n ],\n ],\n};\n\n/**\n * Add-to-cart with an inline line_items array.\n */\nexport const productAddToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.',\n in: getEvent('product add', {\n timestamp: 1700000105,\n id: 'ev-1700000105',\n }),\n mapping: {\n name: 'addtocart',\n data: {\n map: {\n value: 'data.price',\n order_quantity: { value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.color',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'addtocart',\n {\n value: 420,\n order_quantity: 1,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'black',\n product_price: 420,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000105',\n },\n ],\n ],\n};\n\n/**\n * Multi-product checkout - the canonical Pinterest ecommerce pattern.\n */\nexport const orderCompleteCheckout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.',\n in: getEvent('order complete', {\n timestamp: 1700000106,\n id: 'ev-1700000106',\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n value: 'data.total',\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n product_name: 'data.color',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'checkout',\n {\n value: 555,\n order_id: '0rd3r1d',\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'black',\n product_price: 420,\n product_quantity: 1,\n },\n {\n product_id: 'cc',\n product_price: 42,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000106',\n },\n ],\n ],\n};\n\n/**\n * Lead conversion with per-event enhanced matching update.\n */\nexport const userLoginLead: Flow.StepExample = {\n title: 'Lead with matching',\n description:\n 'A user login fires pintrk set for enhanced matching and then a lead conversion track call.',\n in: getEvent('user login', {\n timestamp: 1700000107,\n id: 'ev-1700000107',\n data: {\n id: 'usr_123',\n email: 'jane@example.com',\n },\n }),\n mapping: {\n name: 'lead',\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n data: {\n map: {\n lead_type: { value: 'login' },\n },\n },\n },\n out: [\n ['pintrk', 'set', { em: 'jane@example.com', external_id: 'usr_123' }],\n [\n 'pintrk',\n 'track',\n 'lead',\n {\n lead_type: 'login',\n event_id: 'ev-1700000107',\n },\n ],\n ],\n};\n\n/**\n * mapping.silent - processes side effects (identify set) but suppresses\n * the default pintrk('track', ...) call.\n */\nexport const identifyOnlySilent: Flow.StepExample = {\n title: 'Identify only',\n description:\n 'A user update fires pintrk set for enhanced matching without a track call via mapping silent.',\n in: getEvent('user update', {\n timestamp: 1700000108,\n id: 'ev-1700000108',\n data: {\n id: 'usr_456',\n email: 'new@example.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n },\n out: [['pintrk', 'set', { em: 'new@example.com', external_id: 'usr_456' }]],\n};\n\n/**\n * Consent revocation - walkerOS walker consent { marketing: false }.\n * The destination's on('consent') handler flips the runtime state flag\n * and stops calling pintrk('track', ...) for subsequent events.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n command: 'consent',\n in: { marketing: false } as WalkerOS.Consent,\n out: [],\n};\n\n/**\n * Consent grant - explicit opt-in.\n */\nexport const consentGrant: Flow.StepExample = {\n public: false,\n command: 'consent',\n in: { marketing: true } as WalkerOS.Consent,\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,MAAM,SAAS,oCAAoC,EACnD,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACtBD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,UAAU,cACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFDM,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,aAAqB,OAAO,OAAO,MAAM;AAAA,EAC7C,OAAO,CAAC;AAAA,EACR,SAAS;AACX,CAAC;AAMM,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,KAAK;AAAA,MACL,OAAO;AAAA,MACP,SAAS,CAAC;AAAA,MACV,cAAc,MAAM;AAAA,MAAC;AAAA,MACrB,iBAAiB,MAAM;AAAA,MAAC;AAAA,IAC1B;AAAA,IACA,MAAM,EAAE,aAAa,MAAM;AAAA,IAAC,EAAE;AAAA,IAC9B,sBAAsB,MAAM;AAAA,M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EACP,aACE;AAAA,EACF,QAAI,sBAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,IAAI;AAAA,IACJ,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,MACR,UAAU;AAAA,QACR,KAAK;AAAA,UACH,IAAI;AAAA,UACJ,aAAa;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,UAAU,OAAO,EAAE,IAAI,mBAAmB,aAAa,UAAU,CAAC,CAAC;AAC5E;AAOO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;AAKO,IAAM,eAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.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 { 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';\n\nexport const SettingsSchema = z\n .object({\n apiKey: z\n .string()\n .regex(/^\\d+$/, 'Must be a numeric Pinterest Tag ID')\n .min(6)\n .describe(\n 'Your Pinterest Tag ID (numeric string, e.g. \"2612345678901\"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk(\"load\", tagId).',\n ),\n pageview: z\n .boolean()\n .describe(\n 'Call pintrk(\"page\") once in init, as Pinterest\\'s base code does. Default true. Set false to leave the call out.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. The Pinterest tag takes em plain (it hashes it with SHA-256 in the browser) or already hashed. Resolved on each event and sent with pintrk(\"set\", data) when it changes; init calls pintrk(\"load\", tagId) without it.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity override. Resolves to { em?, external_id? } and fires pintrk(\"set\", data) when the resolved value differs from the current state.',\n )\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, Pintrk } from '../types';\n\n/**\n * Example environment configurations for the Pinterest destination.\n *\n * These mock window.pintrk, allowing tests to run in a pure\n * Node environment without jsdom and without touching the real Pinterest\n * CDN. Tests replace env.window.pintrk with a jest.fn() spy.\n */\n\nconst noop = () => {};\n\nconst noopPintrk: Pintrk = Object.assign(noop, {\n queue: [],\n version: '3.0',\n});\n\n/**\n * Pre-init environment: pintrk is not yet on the window.\n * Used to validate the init path that creates the queue function.\n */\nexport const init: Env = {\n window: {\n pintrk: undefined,\n },\n};\n\n/**\n * Post-init environment: pintrk is available as a spy-able function.\n * Tests clone this and replace `pintrk` with a jest.fn() to record calls.\n */\nexport const push: Env = {\n window: {\n pintrk: noopPintrk,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = ['call:window.pintrk'];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Output convention:\n * - Single SDK call: out = [['pintrk', 'track', 'checkout', { ... }]]\n * - Multiple SDK calls: out = [['pintrk', ...], ['pintrk', ...]]\n * - Zero SDK calls: out = []\n */\n\n/**\n * Default event forwarding - no rule. Without a mapping.name, the walkerOS\n * event name is forwarded as-is. Pinterest accepts it but won't match a\n * standard conversion event. event_id is auto-attached for deduplication.\n */\nexport const defaultForward: Flow.StepExample = {\n title: 'Default forward',\n description:\n 'Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.',\n in: getEvent('page view', { timestamp: 1700000100, id: 'ev-1700000100' }),\n mapping: undefined,\n out: [['pintrk', 'track', 'page view', { event_id: 'ev-1700000100' }]],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy\n * events. `mapping.ignore: true` at rule level produces zero SDK calls.\n */\nexport const wildcardIgnored: Flow.StepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Standard Pinterest event rename via mapping.name. walkerOS \"page view\"\n * → Pinterest \"pagevisit\". The ONLY way to get Pinterest to recognize\n * a conversion event - the destination never auto-maps.\n */\nexport const pageViewRename: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.',\n in: getEvent('page view', { timestamp: 1700000102, id: 'ev-1700000102' }),\n mapping: { name: 'pagevisit' },\n out: [['pintrk', 'track', 'pagevisit', { event_id: 'ev-1700000102' }]],\n};\n\n/**\n * Search - walkerOS search submit → Pinterest \"search\" with search_query.\n * Illustrates single-field mapping.data resolution.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Search',\n description:\n 'A search submit fires Pinterest search with the search_query field resolved from event data.',\n in: createEvent({\n name: 'search submit',\n timestamp: 1700000103,\n id: 'ev-1700000103',\n data: { term: 'leather jacket' },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n search_query: 'data.term',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'search',\n {\n search_query: 'leather jacket',\n event_id: 'ev-1700000103',\n },\n ],\n ],\n};\n\n/**\n * Single-product viewcontent.\n */\nexport const productViewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view fires Pinterest viewcontent with value, currency, and a single-item line_items array.',\n in: getEvent('product view', {\n timestamp: 1700000104,\n id: 'ev-1700000104',\n }),\n mapping: {\n name: 'viewcontent',\n data: {\n map: {\n value: 'data.price',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'viewcontent',\n {\n value: 420,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n },\n ],\n event_id: 'ev-1700000104',\n },\n ],\n ],\n};\n\n/**\n * Add-to-cart with an inline line_items array.\n */\nexport const productAddToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.',\n in: getEvent('product add', {\n timestamp: 1700000105,\n id: 'ev-1700000105',\n }),\n mapping: {\n name: 'addtocart',\n data: {\n map: {\n value: 'data.price',\n order_quantity: { value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'addtocart',\n {\n value: 420,\n order_quantity: 1,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000105',\n },\n ],\n ],\n};\n\n/**\n * Multi-product checkout - the canonical Pinterest ecommerce pattern.\n */\nexport const orderCompleteCheckout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.',\n in: getEvent('order complete', {\n timestamp: 1700000106,\n id: 'ev-1700000106',\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n value: 'data.value',\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) =>\n typeof value === 'object' &&\n value !== null &&\n 'data' in value &&\n typeof value.data === 'object' &&\n value.data !== null &&\n 'price' in value.data &&\n typeof value.data.price === 'number',\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'checkout',\n {\n value: 462,\n order_id: '0rd3r1d',\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n product_quantity: 1,\n },\n {\n product_id: 'cc',\n product_name: 'Cool Cap',\n product_price: 42,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000106',\n },\n ],\n ],\n};\n\n/**\n * Lead conversion with per-event enhanced matching update.\n */\nexport const userLoginLead: Flow.StepExample = {\n title: 'Lead with matching',\n description:\n 'A user login fires pintrk set for enhanced matching and then a lead conversion track call.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000107,\n id: 'ev-1700000107',\n data: {\n id: 'usr_123',\n email: 'jane@example.com',\n },\n }),\n mapping: {\n name: 'lead',\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n data: {\n map: {\n lead_type: { value: 'login' },\n },\n },\n },\n out: [\n ['pintrk', 'set', { em: 'jane@example.com', external_id: 'usr_123' }],\n [\n 'pintrk',\n 'track',\n 'lead',\n {\n lead_type: 'login',\n event_id: 'ev-1700000107',\n },\n ],\n ],\n};\n\n/**\n * mapping.silent - processes side effects (identify set) but suppresses\n * the default pintrk('track', ...) call.\n */\nexport const identifyOnlySilent: Flow.StepExample = {\n title: 'Identify only',\n description:\n 'A user update fires pintrk set for enhanced matching without a track call via mapping silent.',\n in: createEvent({\n name: 'user update',\n timestamp: 1700000108,\n id: 'ev-1700000108',\n data: {\n id: 'usr_456',\n email: 'new@example.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n },\n out: [['pintrk', 'set', { em: 'new@example.com', external_id: 'usr_456' }]],\n};\n\n/**\n * Consent revocation - walkerOS walker consent { marketing: false }.\n * The destination's on('consent') handler flips the runtime state flag\n * and stops calling pintrk('track', ...) for subsequent events.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the destination stops sending track calls itself.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n\n/**\n * Consent grant - explicit opt-in.\n */\nexport const consentGrant: Flow.StepExample = {\n public: false,\n description:\n 'A grant of the required consent lets the destination send track calls again; Pinterest has no consent call to make.',\n command: 'consent',\n in: { marketing: true },\n out: [],\n};\n\n/** A silent rule sends no track call and no identity. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no pintrk track call.',\n in: createEvent({ name: 'page view', timestamp: 1700000109 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent identify rule of identifyOnlySilent on an update without data:\n * no identity resolves and the rule suppresses the track, so nothing is\n * sent. A declared skip: an unmet mapping, not a failure.\n */\nexport const identifyOnlySilentWithoutData: Flow.StepExample = {\n public: false,\n description:\n 'A silent rule whose identify mapping finds no email or id sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'user update', entity: 'user', action: 'update' },\n mapping: identifyOnlySilent.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings the Pinterest Tag needs to deliver: the Tag ID. */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: '2612345678901' },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAA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EAC5C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC;AACR;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAI,yBAAY,EAAE,MAAM,aAAa,WAAW,WAAW,CAAC;AAAA,EAC5D,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,gCAAkD;AAAA,EAC7D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,EAAE,MAAM,eAAe,QAAQ,QAAQ,QAAQ,SAAS;AAAA,EAC5D,SAAS,mBAAmB;AAAA,EAC5B,KAAK,CAAC;AACR;;;AChYO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,gBAAgB;AACtC;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>r,mapping:()=>s,settings:()=>c});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var r=n.object({apiKey:n.string().regex(/^\d+$/,"Must be a numeric Pinterest Tag ID").min(6).describe('Your Pinterest Tag ID (numeric string, e.g. "2612345678901"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk("load", tagId).'),pageview:n.boolean().describe('Call pintrk("page") once in init, as Pinterest\'s base code does. Default true. Set false to leave the call out.').optional(),identify:n.unknown().describe('walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. The Pinterest tag takes em plain (it hashes it with SHA-256 in the browser) or already hashed. Resolved on each event and sent with pintrk("set", data) when it changes; init calls pintrk("load", tagId) without it.').optional()}).strict();import{z as d}from"@walkeros/core/dev";var o=d.object({identify:d.unknown().describe('Per-event identity override. Resolves to { em?, external_id? } and fires pintrk("set", data) when the resolved value differs from the current state.').optional()}),c=i(r),s=i(o),p={};t(p,{env:()=>u,minimal:()=>I,step:()=>k});var u={};t(u,{init:()=>m,push:()=>v,simulation:()=>g});var l=Object.assign(()=>{},{queue:[],version:"3.0"}),m={window:{pintrk:void 0}},v={window:{pintrk:l}},g=["call:window.pintrk"],k={};t(k,{consentGrant:()=>j,consentRevoke:()=>q,defaultForward:()=>y,identifyOnlySilent:()=>S,identifyOnlySilentWithoutData:()=>E,orderCompleteCheckout:()=>R,pageViewRename:()=>f,productAddToCart:()=>A,productViewContent:()=>P,silentRule:()=>C,siteSearch:()=>b,userLoginLead:()=>x,wildcardIgnored:()=>w});import{createEvent as h,getEvent as _}from"@walkeros/core";var y={title:"Default forward",description:"Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.",in:_("page view",{timestamp:1700000100,id:"ev-1700000100"}),mapping:void 0,out:[["pintrk","track","page view",{event_id:"ev-1700000100"}]]},w={public:!1,in:h({name:"debug noise",timestamp:1700000101}),mapping:{ignore:!0},out:[]},f={title:"Page visit",description:"A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.",in:_("page view",{timestamp:1700000102,id:"ev-1700000102"}),mapping:{name:"pagevisit"},out:[["pintrk","track","pagevisit",{event_id:"ev-1700000102"}]]},b={title:"Search",description:"A search submit fires Pinterest search with the search_query field resolved from event data.",in:h({name:"search submit",timestamp:1700000103,id:"ev-1700000103",data:{term:"leather jacket"}}),mapping:{name:"search",data:{map:{search_query:"data.term"}}},out:[["pintrk","track","search",{search_query:"leather jacket",event_id:"ev-1700000103"}]]},P={title:"View content",description:"A product view fires Pinterest viewcontent with value, currency, and a single-item line_items array.",in:_("product view",{timestamp:1700000104,id:"ev-1700000104"}),mapping:{name:"viewcontent",data:{map:{value:"data.price",currency:{key:"data.currency",value:"EUR"},line_items:{set:[{map:{product_id:"data.id",product_name:"data.name",product_price:"data.price"}}]}}}},out:[["pintrk","track","viewcontent",{value:420,currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420}],event_id:"ev-1700000104"}]]},A={title:"Add to cart",description:"A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.",in:_("product add",{timestamp:1700000105,id:"ev-1700000105"}),mapping:{name:"addtocart",data:{map:{value:"data.price",order_quantity:{value:1},currency:{key:"data.currency",value:"EUR"},line_items:{set:[{map:{product_id:"data.id",product_name:"data.name",product_price:"data.price",product_quantity:{value:1}}}]}}}},out:[["pintrk","track","addtocart",{value:420,order_quantity:1,currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420,product_quantity:1}],event_id:"ev-1700000105"}]]},R={title:"Checkout",description:"A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.",in:_("order complete",{timestamp:1700000106,id:"ev-1700000106"}),mapping:{name:"checkout",data:{map:{value:"data.value",order_id:"data.id",currency:{key:"data.currency",value:"EUR"},line_items:{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"data"in e&&"object"==typeof e.data&&null!==e.data&&"price"in e.data&&"number"==typeof e.data.price,map:{product_id:"data.id",product_name:"data.name",product_price:"data.price",product_quantity:{value:1}}}]}}}},out:[["pintrk","track","checkout",{value:462,order_id:"0rd3r1d",currency:"EUR",line_items:[{product_id:"ers",product_name:"Everyday Ruck Snack",product_price:420,product_quantity:1},{product_id:"cc",product_name:"Cool Cap",product_price:42,product_quantity:1}],event_id:"ev-1700000106"}]]},x={title:"Lead with matching",description:"A user login fires pintrk set for enhanced matching and then a lead conversion track call.",in:h({name:"user login",timestamp:1700000107,id:"ev-1700000107",data:{id:"usr_123",email:"jane@example.com"}}),mapping:{name:"lead",settings:{identify:{map:{em:"data.email",external_id:"data.id"}}},data:{map:{lead_type:{value:"login"}}}},out:[["pintrk","set",{em:"jane@example.com",external_id:"usr_123"}],["pintrk","track","lead",{lead_type:"login",event_id:"ev-1700000107"}]]},S={title:"Identify only",description:"A user update fires pintrk set for enhanced matching without a track call via mapping silent.",in:h({name:"user update",timestamp:1700000108,id:"ev-1700000108",data:{id:"usr_456",email:"new@example.com"}}),mapping:{silent:!0,settings:{identify:{map:{em:"data.email",external_id:"data.id"}}}},out:[["pintrk","set",{em:"new@example.com",external_id:"usr_456"}]]},q={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the destination stops sending track calls itself.",command:"consent",in:{marketing:!1},out:[]},j={public:!1,description:"A grant of the required consent lets the destination send track calls again; Pinterest has no consent call to make.",command:"consent",in:{marketing:!0},out:[]},C={public:!1,description:"A rule with silent: true sends no pintrk track call.",in:h({name:"page view",timestamp:1700000109}),mapping:{silent:!0},out:[]},E={public:!1,description:"A silent rule whose identify mapping finds no email or id sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"user update",entity:"user",action:"update"},mapping:S.mapping,out:[]},I={settings:{apiKey:"2612345678901"}};export{p as examples,a 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/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 { 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';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .regex(/^\\d+$/, 'Must be a numeric Pinterest Tag ID')\n .min(6)\n .describe(\n 'Your Pinterest Tag ID (numeric string, e.g. \"2612345678901\"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk(\"load\", tagId).',\n ),\n pageview: z\n .boolean()\n .describe(\n 'Fire pintrk(\"page\") once in init after core.js loads. Default true (matches Pinterest\\'s base code convention). Set false when walkerOS sources already emit page view events and you would otherwise get a duplicate initial fire.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. em is auto-hashed by the Pinterest JS tag — do not hash before passing. Passed to pintrk(\"load\", tagId, data) on init and pintrk(\"set\", data) when the resolved value changes.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity override. Resolves to { em?, external_id? } and fires pintrk(\"set\", data) when the resolved value differs from the current state.',\n )\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, Pintrk } from '../types';\n\n/**\n * Example environment configurations for the Pinterest destination.\n *\n * These mock window.pintrk and document, allowing tests to run in a pure\n * Node environment without jsdom and without touching the real Pinterest\n * CDN. Tests replace env.window.pintrk with a jest.fn() spy.\n */\n\nconst noop = () => {};\n\nconst noopPintrk: Pintrk = Object.assign(noop, {\n queue: [] as unknown[][],\n version: '3.0',\n}) as unknown as Pintrk;\n\n/**\n * Pre-init environment — pintrk is not yet on the window.\n * Used to validate the init path that creates the queue function.\n */\nexport const init: Env = {\n window: {\n pintrk: undefined,\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n getElementsByTagName: () => [\n {\n parentNode: { insertBefore: () => {} },\n },\n ],\n querySelector: () => null,\n },\n};\n\n/**\n * Post-init environment — pintrk is available as a spy-able function.\n * Tests clone this and replace `pintrk` with a jest.fn() to record calls.\n */\nexport const push: Env = {\n window: {\n pintrk: noopPintrk,\n },\n document: {\n createElement: () => ({\n src: '',\n async: false,\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n getElementsByTagName: () => [\n {\n parentNode: { insertBefore: () => {} },\n },\n ],\n querySelector: () => null,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = ['call:window.pintrk'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Output convention:\n * - Single SDK call: out = [['pintrk', 'track', 'checkout', { ... }]]\n * - Multiple SDK calls: out = [['pintrk', ...], ['pintrk', ...]]\n * - Zero SDK calls: out = []\n */\n\n/**\n * Default event forwarding - no rule. Without a mapping.name, the walkerOS\n * event name is forwarded as-is. Pinterest accepts it but won't match a\n * standard conversion event. event_id is auto-attached for deduplication.\n */\nexport const defaultForward: Flow.StepExample = {\n title: 'Default forward',\n description:\n 'Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.',\n in: getEvent('page view', { timestamp: 1700000100, id: 'ev-1700000100' }),\n mapping: undefined,\n out: [['pintrk', 'track', 'page view', { event_id: 'ev-1700000100' }]],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy\n * events. `mapping.ignore: true` at rule level produces zero SDK calls.\n */\nexport const wildcardIgnored: Flow.StepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Standard Pinterest event rename via mapping.name. walkerOS \"page view\"\n * → Pinterest \"pagevisit\". The ONLY way to get Pinterest to recognize\n * a conversion event - the destination never auto-maps.\n */\nexport const pageViewRename: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.',\n in: getEvent('page view', { timestamp: 1700000102, id: 'ev-1700000102' }),\n mapping: { name: 'pagevisit' },\n out: [['pintrk', 'track', 'pagevisit', { event_id: 'ev-1700000102' }]],\n};\n\n/**\n * Search - walkerOS site search → Pinterest \"search\" with search_query.\n * Illustrates single-field mapping.data resolution.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Search',\n description:\n 'A site search fires Pinterest search with the search_query field resolved from event data.',\n in: getEvent('site search', {\n timestamp: 1700000103,\n id: 'ev-1700000103',\n data: { query: 'leather jacket' },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n search_query: 'data.query',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'search',\n {\n search_query: 'leather jacket',\n event_id: 'ev-1700000103',\n },\n ],\n ],\n};\n\n/**\n * Single-product viewcontent.\n */\nexport const productViewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view fires Pinterest viewcontent with value, currency, product_id, and product_name.',\n in: getEvent('product view', {\n timestamp: 1700000104,\n id: 'ev-1700000104',\n }),\n mapping: {\n name: 'viewcontent',\n data: {\n map: {\n value: 'data.price',\n currency: { key: 'data.currency', value: 'EUR' },\n product_id: 'data.id',\n product_name: 'data.color',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'viewcontent',\n {\n value: 420,\n currency: 'EUR',\n product_id: 'ers',\n product_name: 'black',\n event_id: 'ev-1700000104',\n },\n ],\n ],\n};\n\n/**\n * Add-to-cart with an inline line_items array.\n */\nexport const productAddToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.',\n in: getEvent('product add', {\n timestamp: 1700000105,\n id: 'ev-1700000105',\n }),\n mapping: {\n name: 'addtocart',\n data: {\n map: {\n value: 'data.price',\n order_quantity: { value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.color',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'addtocart',\n {\n value: 420,\n order_quantity: 1,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'black',\n product_price: 420,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000105',\n },\n ],\n ],\n};\n\n/**\n * Multi-product checkout - the canonical Pinterest ecommerce pattern.\n */\nexport const orderCompleteCheckout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.',\n in: getEvent('order complete', {\n timestamp: 1700000106,\n id: 'ev-1700000106',\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n value: 'data.total',\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) => {\n const v = value as { data?: { price?: unknown } };\n return typeof v?.data?.price === 'number';\n },\n map: {\n product_id: 'data.id',\n product_name: 'data.color',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'checkout',\n {\n value: 555,\n order_id: '0rd3r1d',\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'black',\n product_price: 420,\n product_quantity: 1,\n },\n {\n product_id: 'cc',\n product_price: 42,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000106',\n },\n ],\n ],\n};\n\n/**\n * Lead conversion with per-event enhanced matching update.\n */\nexport const userLoginLead: Flow.StepExample = {\n title: 'Lead with matching',\n description:\n 'A user login fires pintrk set for enhanced matching and then a lead conversion track call.',\n in: getEvent('user login', {\n timestamp: 1700000107,\n id: 'ev-1700000107',\n data: {\n id: 'usr_123',\n email: 'jane@example.com',\n },\n }),\n mapping: {\n name: 'lead',\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n data: {\n map: {\n lead_type: { value: 'login' },\n },\n },\n },\n out: [\n ['pintrk', 'set', { em: 'jane@example.com', external_id: 'usr_123' }],\n [\n 'pintrk',\n 'track',\n 'lead',\n {\n lead_type: 'login',\n event_id: 'ev-1700000107',\n },\n ],\n ],\n};\n\n/**\n * mapping.silent - processes side effects (identify set) but suppresses\n * the default pintrk('track', ...) call.\n */\nexport const identifyOnlySilent: Flow.StepExample = {\n title: 'Identify only',\n description:\n 'A user update fires pintrk set for enhanced matching without a track call via mapping silent.',\n in: getEvent('user update', {\n timestamp: 1700000108,\n id: 'ev-1700000108',\n data: {\n id: 'usr_456',\n email: 'new@example.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n },\n out: [['pintrk', 'set', { em: 'new@example.com', external_id: 'usr_456' }]],\n};\n\n/**\n * Consent revocation - walkerOS walker consent { marketing: false }.\n * The destination's on('consent') handler flips the runtime state flag\n * and stops calling pintrk('track', ...) for subsequent events.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n command: 'consent',\n in: { marketing: false } as WalkerOS.Consent,\n out: [],\n};\n\n/**\n * Consent grant - explicit opt-in.\n */\nexport const consentGrant: Flow.StepExample = {\n public: false,\n command: 'consent',\n in: { marketing: true } as WalkerOS.Consent,\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,MAAM,SAAS,oCAAoC,EACnD,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACtBD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;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,EACtB,KAAK,CAAC;AACR;","names":["z"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.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 { 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';\n\nexport const SettingsSchema = z\n .object({\n apiKey: z\n .string()\n .regex(/^\\d+$/, 'Must be a numeric Pinterest Tag ID')\n .min(6)\n .describe(\n 'Your Pinterest Tag ID (numeric string, e.g. \"2612345678901\"). Found in Pinterest Ads Manager under Conversions → Pinterest Tag. Passed to pintrk(\"load\", tagId).',\n ),\n pageview: z\n .boolean()\n .describe(\n 'Call pintrk(\"page\") once in init, as Pinterest\\'s base code does. Default true. Set false to leave the call out.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to enhanced matching fields: { em?: string, external_id?: string }. The Pinterest tag takes em plain (it hashes it with SHA-256 in the browser) or already hashed. Resolved on each event and sent with pintrk(\"set\", data) when it changes; init calls pintrk(\"load\", tagId) without it.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity override. Resolves to { em?, external_id? } and fires pintrk(\"set\", data) when the resolved value differs from the current state.',\n )\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, Pintrk } from '../types';\n\n/**\n * Example environment configurations for the Pinterest destination.\n *\n * These mock window.pintrk, allowing tests to run in a pure\n * Node environment without jsdom and without touching the real Pinterest\n * CDN. Tests replace env.window.pintrk with a jest.fn() spy.\n */\n\nconst noop = () => {};\n\nconst noopPintrk: Pintrk = Object.assign(noop, {\n queue: [],\n version: '3.0',\n});\n\n/**\n * Pre-init environment: pintrk is not yet on the window.\n * Used to validate the init path that creates the queue function.\n */\nexport const init: Env = {\n window: {\n pintrk: undefined,\n },\n};\n\n/**\n * Post-init environment: pintrk is available as a spy-able function.\n * Tests clone this and replace `pintrk` with a jest.fn() to record calls.\n */\nexport const push: Env = {\n window: {\n pintrk: noopPintrk,\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = ['call:window.pintrk'];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Output convention:\n * - Single SDK call: out = [['pintrk', 'track', 'checkout', { ... }]]\n * - Multiple SDK calls: out = [['pintrk', ...], ['pintrk', ...]]\n * - Zero SDK calls: out = []\n */\n\n/**\n * Default event forwarding - no rule. Without a mapping.name, the walkerOS\n * event name is forwarded as-is. Pinterest accepts it but won't match a\n * standard conversion event. event_id is auto-attached for deduplication.\n */\nexport const defaultForward: Flow.StepExample = {\n title: 'Default forward',\n description:\n 'Without a mapping the walker event name is forwarded as-is to pintrk track with an event_id for dedup.',\n in: getEvent('page view', { timestamp: 1700000100, id: 'ev-1700000100' }),\n mapping: undefined,\n out: [['pintrk', 'track', 'page view', { event_id: 'ev-1700000100' }]],\n};\n\n/**\n * Wildcard ignore pattern - the standard walkerOS way to suppress noisy\n * events. `mapping.ignore: true` at rule level produces zero SDK calls.\n */\nexport const wildcardIgnored: Flow.StepExample = {\n public: false,\n in: createEvent({ name: 'debug noise', timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Standard Pinterest event rename via mapping.name. walkerOS \"page view\"\n * → Pinterest \"pagevisit\". The ONLY way to get Pinterest to recognize\n * a conversion event - the destination never auto-maps.\n */\nexport const pageViewRename: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A mapping renames the walker event to the Pinterest standard pagevisit event for conversion tracking.',\n in: getEvent('page view', { timestamp: 1700000102, id: 'ev-1700000102' }),\n mapping: { name: 'pagevisit' },\n out: [['pintrk', 'track', 'pagevisit', { event_id: 'ev-1700000102' }]],\n};\n\n/**\n * Search - walkerOS search submit → Pinterest \"search\" with search_query.\n * Illustrates single-field mapping.data resolution.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Search',\n description:\n 'A search submit fires Pinterest search with the search_query field resolved from event data.',\n in: createEvent({\n name: 'search submit',\n timestamp: 1700000103,\n id: 'ev-1700000103',\n data: { term: 'leather jacket' },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n search_query: 'data.term',\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'search',\n {\n search_query: 'leather jacket',\n event_id: 'ev-1700000103',\n },\n ],\n ],\n};\n\n/**\n * Single-product viewcontent.\n */\nexport const productViewContent: Flow.StepExample = {\n title: 'View content',\n description:\n 'A product view fires Pinterest viewcontent with value, currency, and a single-item line_items array.',\n in: getEvent('product view', {\n timestamp: 1700000104,\n id: 'ev-1700000104',\n }),\n mapping: {\n name: 'viewcontent',\n data: {\n map: {\n value: 'data.price',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'viewcontent',\n {\n value: 420,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n },\n ],\n event_id: 'ev-1700000104',\n },\n ],\n ],\n};\n\n/**\n * Add-to-cart with an inline line_items array.\n */\nexport const productAddToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add fires Pinterest addtocart with value, currency, and a single-item line_items array.',\n in: getEvent('product add', {\n timestamp: 1700000105,\n id: 'ev-1700000105',\n }),\n mapping: {\n name: 'addtocart',\n data: {\n map: {\n value: 'data.price',\n order_quantity: { value: 1 },\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n set: [\n {\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'addtocart',\n {\n value: 420,\n order_quantity: 1,\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000105',\n },\n ],\n ],\n};\n\n/**\n * Multi-product checkout - the canonical Pinterest ecommerce pattern.\n */\nexport const orderCompleteCheckout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order fires Pinterest checkout with value, order_id, currency, and a nested line_items array.',\n in: getEvent('order complete', {\n timestamp: 1700000106,\n id: 'ev-1700000106',\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n value: 'data.value',\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n line_items: {\n loop: [\n 'nested',\n {\n condition: (value: unknown) =>\n typeof value === 'object' &&\n value !== null &&\n 'data' in value &&\n typeof value.data === 'object' &&\n value.data !== null &&\n 'price' in value.data &&\n typeof value.data.price === 'number',\n map: {\n product_id: 'data.id',\n product_name: 'data.name',\n product_price: 'data.price',\n product_quantity: { value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'pintrk',\n 'track',\n 'checkout',\n {\n value: 462,\n order_id: '0rd3r1d',\n currency: 'EUR',\n line_items: [\n {\n product_id: 'ers',\n product_name: 'Everyday Ruck Snack',\n product_price: 420,\n product_quantity: 1,\n },\n {\n product_id: 'cc',\n product_name: 'Cool Cap',\n product_price: 42,\n product_quantity: 1,\n },\n ],\n event_id: 'ev-1700000106',\n },\n ],\n ],\n};\n\n/**\n * Lead conversion with per-event enhanced matching update.\n */\nexport const userLoginLead: Flow.StepExample = {\n title: 'Lead with matching',\n description:\n 'A user login fires pintrk set for enhanced matching and then a lead conversion track call.',\n in: createEvent({\n name: 'user login',\n timestamp: 1700000107,\n id: 'ev-1700000107',\n data: {\n id: 'usr_123',\n email: 'jane@example.com',\n },\n }),\n mapping: {\n name: 'lead',\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n data: {\n map: {\n lead_type: { value: 'login' },\n },\n },\n },\n out: [\n ['pintrk', 'set', { em: 'jane@example.com', external_id: 'usr_123' }],\n [\n 'pintrk',\n 'track',\n 'lead',\n {\n lead_type: 'login',\n event_id: 'ev-1700000107',\n },\n ],\n ],\n};\n\n/**\n * mapping.silent - processes side effects (identify set) but suppresses\n * the default pintrk('track', ...) call.\n */\nexport const identifyOnlySilent: Flow.StepExample = {\n title: 'Identify only',\n description:\n 'A user update fires pintrk set for enhanced matching without a track call via mapping silent.',\n in: createEvent({\n name: 'user update',\n timestamp: 1700000108,\n id: 'ev-1700000108',\n data: {\n id: 'usr_456',\n email: 'new@example.com',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n em: 'data.email',\n external_id: 'data.id',\n },\n },\n },\n },\n out: [['pintrk', 'set', { em: 'new@example.com', external_id: 'usr_456' }]],\n};\n\n/**\n * Consent revocation - walkerOS walker consent { marketing: false }.\n * The destination's on('consent') handler flips the runtime state flag\n * and stops calling pintrk('track', ...) for subsequent events.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the destination stops sending track calls itself.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n\n/**\n * Consent grant - explicit opt-in.\n */\nexport const consentGrant: Flow.StepExample = {\n public: false,\n description:\n 'A grant of the required consent lets the destination send track calls again; Pinterest has no consent call to make.',\n command: 'consent',\n in: { marketing: true },\n out: [],\n};\n\n/** A silent rule sends no track call and no identity. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no pintrk track call.',\n in: createEvent({ name: 'page view', timestamp: 1700000109 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * The silent identify rule of identifyOnlySilent on an update without data:\n * no identity resolves and the rule suppresses the track, so nothing is\n * sent. A declared skip: an unmet mapping, not a failure.\n */\nexport const identifyOnlySilentWithoutData: Flow.StepExample = {\n public: false,\n description:\n 'A silent rule whose identify mapping finds no email or id sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: { name: 'user update', entity: 'user', action: 'update' },\n mapping: identifyOnlySilent.mapping,\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings the Pinterest Tag needs to deliver: the Tag ID. */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: '2612345678901' },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,MAAM,SAAS,oCAAoC,EACnD,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC,EACA,OAAO;;;ACxBV,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFDM,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,aAAqB,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;AAAA,IACJ,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,MACR,UAAU;AAAA,QACR,KAAK;AAAA,UACH,IAAI;AAAA,UACJ,aAAa;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,UAAU,OAAO,EAAE,IAAI,mBAAmB,aAAa,UAAU,CAAC,CAAC;AAC5E;AAOO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;AAKO,IAAM,eAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC;AACR;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,YAAY,EAAE,MAAM,aAAa,WAAW,WAAW,CAAC;AAAA,EAC5D,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAOO,IAAM,gCAAkD;AAAA,EAC7D,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,EAAE,MAAM,eAAe,QAAQ,QAAQ,QAAQ,SAAS;AAAA,EAC5D,SAAS,mBAAmB;AAAA,EAC5B,KAAK,CAAC;AACR;;;AChYO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,gBAAgB;AACtC;","names":["z"]}
|
|
@@ -85,12 +85,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Pre-init environment
|
|
88
|
+
* Pre-init environment: pintrk is not yet on the window.
|
|
89
89
|
* Used to validate the init path that creates the queue function.
|
|
90
90
|
*/
|
|
91
91
|
declare const init: Env;
|
|
92
92
|
/**
|
|
93
|
-
* Post-init environment
|
|
93
|
+
* Post-init environment: pintrk is available as a spy-able function.
|
|
94
94
|
* Tests clone this and replace `pintrk` with a jest.fn() to record calls.
|
|
95
95
|
*/
|
|
96
96
|
declare const push: Env;
|
|
@@ -128,7 +128,7 @@ declare const wildcardIgnored: Flow.StepExample;
|
|
|
128
128
|
*/
|
|
129
129
|
declare const pageViewRename: Flow.StepExample;
|
|
130
130
|
/**
|
|
131
|
-
* Search - walkerOS
|
|
131
|
+
* Search - walkerOS search submit → Pinterest "search" with search_query.
|
|
132
132
|
* Illustrates single-field mapping.data resolution.
|
|
133
133
|
*/
|
|
134
134
|
declare const siteSearch: Flow.StepExample;
|
|
@@ -163,20 +163,33 @@ declare const consentRevoke: Flow.StepExample;
|
|
|
163
163
|
* Consent grant - explicit opt-in.
|
|
164
164
|
*/
|
|
165
165
|
declare const consentGrant: Flow.StepExample;
|
|
166
|
+
/** A silent rule sends no track call and no identity. */
|
|
167
|
+
declare const silentRule: Flow.StepExample;
|
|
168
|
+
/**
|
|
169
|
+
* The silent identify rule of identifyOnlySilent on an update without data:
|
|
170
|
+
* no identity resolves and the rule suppresses the track, so nothing is
|
|
171
|
+
* sent. A declared skip: an unmet mapping, not a failure.
|
|
172
|
+
*/
|
|
173
|
+
declare const identifyOnlySilentWithoutData: Flow.StepExample;
|
|
166
174
|
|
|
167
175
|
declare const step_consentGrant: typeof consentGrant;
|
|
168
176
|
declare const step_consentRevoke: typeof consentRevoke;
|
|
169
177
|
declare const step_defaultForward: typeof defaultForward;
|
|
170
178
|
declare const step_identifyOnlySilent: typeof identifyOnlySilent;
|
|
179
|
+
declare const step_identifyOnlySilentWithoutData: typeof identifyOnlySilentWithoutData;
|
|
171
180
|
declare const step_orderCompleteCheckout: typeof orderCompleteCheckout;
|
|
172
181
|
declare const step_pageViewRename: typeof pageViewRename;
|
|
173
182
|
declare const step_productAddToCart: typeof productAddToCart;
|
|
174
183
|
declare const step_productViewContent: typeof productViewContent;
|
|
184
|
+
declare const step_silentRule: typeof silentRule;
|
|
175
185
|
declare const step_siteSearch: typeof siteSearch;
|
|
176
186
|
declare const step_userLoginLead: typeof userLoginLead;
|
|
177
187
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
178
188
|
declare namespace step {
|
|
179
|
-
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
189
|
+
export { step_consentGrant as consentGrant, step_consentRevoke as consentRevoke, step_defaultForward as defaultForward, step_identifyOnlySilent as identifyOnlySilent, step_identifyOnlySilentWithoutData as identifyOnlySilentWithoutData, step_orderCompleteCheckout as orderCompleteCheckout, step_pageViewRename as pageViewRename, step_productAddToCart as productAddToCart, step_productViewContent as productViewContent, step_silentRule as silentRule, step_siteSearch as siteSearch, step_userLoginLead as userLoginLead, step_wildcardIgnored as wildcardIgnored };
|
|
180
190
|
}
|
|
181
191
|
|
|
182
|
-
|
|
192
|
+
/** The settings the Pinterest Tag needs to deliver: the Tag ID. */
|
|
193
|
+
declare const minimal: Flow.MinimalExample;
|
|
194
|
+
|
|
195
|
+
export { env, minimal, step };
|