@walkeros/server-destination-pinterest 3.4.0 → 3.4.1
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/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.js +10 -0
- package/dist/examples/index.mjs +10 -0
- package/dist/walkerOS.json +17 -7
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},s={};n(s,{examples:()=>g,schemas:()=>o}),module.exports=(e=s,((e,n,s,o)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let c of i(n))r.call(e,c)||c===s||t(e,c,{get:()=>n[c],enumerable:!(o=a(n,c))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};n(o,{ActionSourceSchema:()=>p,EventNameSchema:()=>m,MappingSchema:()=>l,SettingsSchema:()=>_,mapping:()=>h,settings:()=>v});var c=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=u.z.enum(["app_android","app_ios","web","offline"]),m=u.z.union([u.z.enum(["add_payment_info","add_to_cart","add_to_wishlist","app_install","app_open","checkout","contact","custom","customize_product","find_location","initiate_checkout","lead","page_visit","schedule","search","signup","start_trial","submit_application","subscribe","view_category","view_content","watch_video"]),u.z.string()]),_=d.z.object({accessToken:d.z.string().min(1).describe("Pinterest conversion access token for Bearer authentication (like pina_ABC123...)"),adAccountId:d.z.string().regex(/^[0-9]+$/,"Ad account ID must contain only digits").describe("Pinterest ad account ID from Ads Manager (like 123456789)"),action_source:p.describe("Source of the event (web, app_android, app_ios, offline) (like web)").optional(),doNotHash:d.z.array(d.z.string()).describe("Array of user_data fields that should not be hashed (like ['external_id'])").optional(),test:d.z.boolean().describe("Enable test mode by appending ?test=true to the API URL (like true)").optional(),url:d.z.string().url().describe("Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)").optional(),user_data:d.z.record(d.z.string(),d.z.string()).describe("Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })").optional(),partner_name:d.z.string().describe("Third-party partner name for attribution (like ss-walkeros)").optional()}),l=require("@walkeros/core/dev").z.object({}),v=(0,c.zodToSchema)(_),h=(0,c.zodToSchema)(l),g={};n(g,{env:()=>y,step:()=>b});var y={};n(y,{push:()=>w,simulation:()=>f});var w={sendServer:async function(e,t,a){return{ok:!0,data:{num_events_received:1,num_events_processed:1,events:[{status:"processed"}]}}}},f=["sendServer"],b={};n(b,{addToCart:()=>A,checkout:()=>x,pageVisit:()=>O,search:()=>q,signup:()=>P});var k=require("@walkeros/core"),S="https://api.pinterest.com/v5/ad_accounts/123456789/events",z={headers:{Authorization:"Bearer s3cr3t"}},x={title:"Checkout",description:"A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",in:(0,k.getEvent)("order complete",{timestamp:1700000900,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",name:"Everyday Ruck Snack",price:"129.99",quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"checkout",data:{map:{custom_data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},order_id:"data.id",num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length},contents:{loop:["nested",{condition:e=>(0,k.isObject)(e)&&"product"===e.entity,map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"checkout",event_id:"1700000900-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{value:249.99,currency:"EUR",order_id:"ORD-300",num_items:1,contents:[{id:"SKU-A1",item_name:"Everyday Ruck Snack",item_price:"129.99",quantity:2}]},event_source_url:"https://shop.example.com"}]}),z]]},A={title:"Add to cart",description:"A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",in:(0,k.getEvent)("product add",{timestamp:1700000901,data:{id:"SKU-B2",name:"Cool Cap",price:"42.00",quantity:1},user:{id:"user-456"},source:{type:"server",id:"https://shop.example.com/products",previous_id:""}}),mapping:{name:"add_to_cart",data:{map:{custom_data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"add_to_cart",event_id:"1700000901-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{value:"42.00",currency:"EUR",contents:[{id:"SKU-B2",item_name:"Cool Cap",item_price:"42.00",quantity:1}]},event_source_url:"https://shop.example.com/products"}]}),z]]},O={title:"Page visit",description:"A page view is sent to Pinterest as a page_visit conversion with the source URL.",in:(0,k.getEvent)("page view",{timestamp:1700000902,user:{id:"user-789"},source:{type:"server",id:"https://www.example.com/docs/",previous_id:""}}),mapping:{name:"page_visit"},out:[["sendServer",S,JSON.stringify({data:[{event_name:"page_visit",event_id:"1700000902-gr0up-1",event_time:1700001,action_source:"web",user_data:{},event_source_url:"https://www.example.com/docs/"}]}),z]]},q={title:"Search",description:"A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",in:(0,k.getEvent)("entity action",{timestamp:1700000903,name:"site search",data:{query:"walkerOS destinations"},user:{id:"user-101"},source:{type:"server",id:"https://www.example.com/search",previous_id:""}}),mapping:{name:"search",data:{map:{custom_data:{map:{search_string:"data.query"}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"search",event_id:"1700000903-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{search_string:"walkerOS destinations"},event_source_url:"https://www.example.com/search"}]}),z]]},P={title:"Signup",description:"A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",in:(0,k.getEvent)("entity action",{timestamp:1700000904,name:"user signup",data:{method:"email"},user:{id:"new-user-1",email:"new@example.com"},source:{type:"server",id:"https://www.example.com/register",previous_id:""}}),mapping:{name:"signup",data:{map:{user_data:{map:{em:{set:["user.email"]},external_id:{set:["user.id"]}}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"signup",event_id:"1700000904-gr0up-1",event_time:1700001,action_source:"web",user_data:{em:["f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"],external_id:["b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"]},event_source_url:"https://www.example.com/register"}]}),z]]};//# 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 { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Pinterest Conversions API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(body), { headers })` where\n * `endpoint = ${settings.url}ad_accounts/${settings.adAccountId}/events`\n * and `body = { data: [hashedServerEvent] }`.\n *\n * Test fixture pins `accessToken = 's3cr3t'` and `adAccountId = '123456789'`,\n * so every endpoint resolves to:\n * https://api.pinterest.com/v5/ad_accounts/123456789/events\n *\n * Body is emitted with keys in insertion order from push.ts:\n * 1. event_name\n * 2. event_id\n * 3. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 4. action_source (default 'web')\n * 5. ...restEventData (from mapping.data, excluding user_data/custom_data)\n * 6. user_data (hashed per Pinterest's PII requirements)\n * 7. custom_data (only when mapping sets custom_data)\n * 8. event_source_url (appended when action_source === 'web')\n *\n * The `options` argument carries the Authorization header.\n */\nconst ENDPOINT = 'https://api.pinterest.com/v5/ad_accounts/123456789/events';\nconst OPTIONS = {\n headers: { Authorization: 'Bearer s3cr3t' },\n};\n\nexport const checkout: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,aAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiB,cAAE,OAAO;AAAA,EACrC,aAAa,cACV,OAAO,EACP,IAAI,CAAC,EACL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F,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
|
|
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 { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Pinterest Conversions API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(body), { headers })` where\n * `endpoint = ${settings.url}ad_accounts/${settings.adAccountId}/events`\n * and `body = { data: [hashedServerEvent] }`.\n *\n * Test fixture pins `accessToken = 's3cr3t'` and `adAccountId = '123456789'`,\n * so every endpoint resolves to:\n * https://api.pinterest.com/v5/ad_accounts/123456789/events\n *\n * Body is emitted with keys in insertion order from push.ts:\n * 1. event_name\n * 2. event_id\n * 3. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 4. action_source (default 'web')\n * 5. ...restEventData (from mapping.data, excluding user_data/custom_data)\n * 6. user_data (hashed per Pinterest's PII requirements)\n * 7. custom_data (only when mapping sets custom_data)\n * 8. event_source_url (appended when action_source === 'web')\n *\n * The `options` argument carries the Authorization header.\n */\nconst ENDPOINT = 'https://api.pinterest.com/v5/ad_accounts/123456789/events';\nconst OPTIONS = {\n headers: { Authorization: 'Bearer s3cr3t' },\n};\n\nexport const checkout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.',\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add is sent to Pinterest as an add_to_cart conversion with the added item details.',\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A page view is sent to Pinterest as a page_visit conversion with the source URL.',\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n title: 'Search',\n description:\n 'A site search event is forwarded to Pinterest as a search conversion with the query in custom data.',\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n title: 'Signup',\n description:\n 'A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.',\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,aAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiB,cAAE,OAAO;AAAA,EACrC,aAAa,cACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,aAAa,cACV,OAAO,EACP,MAAM,YAAY,wCAAwC,EAC1D,SAAS,2DAA2D;AAAA,EACvE,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EACX,WAAW,cACR,MAAM,cAAE,OAAO,C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ACF;AACF;","names":["import_dev","import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{ActionSourceSchema:()=>n,EventNameSchema:()=>o,MappingSchema:()=>p,SettingsSchema:()=>d,mapping:()=>m,settings:()=>u});import{zodToSchema as i}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var n=s.enum(["app_android","app_ios","web","offline"]),o=s.union([s.enum(["add_payment_info","add_to_cart","add_to_wishlist","app_install","app_open","checkout","contact","custom","customize_product","find_location","initiate_checkout","lead","page_visit","schedule","search","signup","start_trial","submit_application","subscribe","view_category","view_content","watch_video"]),s.string()]),d=r.object({accessToken:r.string().min(1).describe("Pinterest conversion access token for Bearer authentication (like pina_ABC123...)"),adAccountId:r.string().regex(/^[0-9]+$/,"Ad account ID must contain only digits").describe("Pinterest ad account ID from Ads Manager (like 123456789)"),action_source:n.describe("Source of the event (web, app_android, app_ios, offline) (like web)").optional(),doNotHash:r.array(r.string()).describe("Array of user_data fields that should not be hashed (like ['external_id'])").optional(),test:r.boolean().describe("Enable test mode by appending ?test=true to the API URL (like true)").optional(),url:r.string().url().describe("Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)").optional(),user_data:r.record(r.string(),r.string()).describe("Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })").optional(),partner_name:r.string().describe("Third-party partner name for attribution (like ss-walkeros)").optional()});import{z as c}from"@walkeros/core/dev";var p=c.object({}),u=i(d),m=i(p),_={};t(_,{env:()=>l,step:()=>g});var l={};t(l,{push:()=>v,simulation:()=>h});var v={sendServer:async function(e,t,a){return{ok:!0,data:{num_events_received:1,num_events_processed:1,events:[{status:"processed"}]}}}},h=["sendServer"],g={};t(g,{addToCart:()=>S,checkout:()=>k,pageVisit:()=>x,search:()=>A,signup:()=>P});import{getEvent as y,isObject as w}from"@walkeros/core";var f="https://api.pinterest.com/v5/ad_accounts/123456789/events",b={headers:{Authorization:"Bearer s3cr3t"}},k={title:"Checkout",description:"A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",in:y("order complete",{timestamp:1700000900,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",name:"Everyday Ruck Snack",price:"129.99",quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"checkout",data:{map:{custom_data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},order_id:"data.id",num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length},contents:{loop:["nested",{condition:e=>w(e)&&"product"===e.entity,map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",f,JSON.stringify({data:[{event_name:"checkout",event_id:"1700000900-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{value:249.99,currency:"EUR",order_id:"ORD-300",num_items:1,contents:[{id:"SKU-A1",item_name:"Everyday Ruck Snack",item_price:"129.99",quantity:2}]},event_source_url:"https://shop.example.com"}]}),b]]},S={title:"Add to cart",description:"A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",in:y("product add",{timestamp:1700000901,data:{id:"SKU-B2",name:"Cool Cap",price:"42.00",quantity:1},user:{id:"user-456"},source:{type:"server",id:"https://shop.example.com/products",previous_id:""}}),mapping:{name:"add_to_cart",data:{map:{custom_data:{map:{value:"data.price",currency:{value:"EUR"},contents:{set:[{map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",f,JSON.stringify({data:[{event_name:"add_to_cart",event_id:"1700000901-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{value:"42.00",currency:"EUR",contents:[{id:"SKU-B2",item_name:"Cool Cap",item_price:"42.00",quantity:1}]},event_source_url:"https://shop.example.com/products"}]}),b]]},x={title:"Page visit",description:"A page view is sent to Pinterest as a page_visit conversion with the source URL.",in:y("page view",{timestamp:1700000902,user:{id:"user-789"},source:{type:"server",id:"https://www.example.com/docs/",previous_id:""}}),mapping:{name:"page_visit"},out:[["sendServer",f,JSON.stringify({data:[{event_name:"page_visit",event_id:"1700000902-gr0up-1",event_time:1700001,action_source:"web",user_data:{},event_source_url:"https://www.example.com/docs/"}]}),b]]},A={title:"Search",description:"A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",in:y("entity action",{timestamp:1700000903,name:"site search",data:{query:"walkerOS destinations"},user:{id:"user-101"},source:{type:"server",id:"https://www.example.com/search",previous_id:""}}),mapping:{name:"search",data:{map:{custom_data:{map:{search_string:"data.query"}}}}},out:[["sendServer",f,JSON.stringify({data:[{event_name:"search",event_id:"1700000903-gr0up-1",event_time:1700001,action_source:"web",user_data:{},custom_data:{search_string:"walkerOS destinations"},event_source_url:"https://www.example.com/search"}]}),b]]},P={title:"Signup",description:"A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",in:y("entity action",{timestamp:1700000904,name:"user signup",data:{method:"email"},user:{id:"new-user-1",email:"new@example.com"},source:{type:"server",id:"https://www.example.com/register",previous_id:""}}),mapping:{name:"signup",data:{map:{user_data:{map:{em:{set:["user.email"]},external_id:{set:["user.id"]}}}}}},out:[["sendServer",f,JSON.stringify({data:[{event_name:"signup",event_id:"1700000904-gr0up-1",event_time:1700001,action_source:"web",user_data:{em:["f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"],external_id:["b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"]},event_source_url:"https://www.example.com/register"}]}),b]]};export{_ 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/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 { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Pinterest Conversions API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(body), { headers })` where\n * `endpoint = ${settings.url}ad_accounts/${settings.adAccountId}/events`\n * and `body = { data: [hashedServerEvent] }`.\n *\n * Test fixture pins `accessToken = 's3cr3t'` and `adAccountId = '123456789'`,\n * so every endpoint resolves to:\n * https://api.pinterest.com/v5/ad_accounts/123456789/events\n *\n * Body is emitted with keys in insertion order from push.ts:\n * 1. event_name\n * 2. event_id\n * 3. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 4. action_source (default 'web')\n * 5. ...restEventData (from mapping.data, excluding user_data/custom_data)\n * 6. user_data (hashed per Pinterest's PII requirements)\n * 7. custom_data (only when mapping sets custom_data)\n * 8. event_source_url (appended when action_source === 'web')\n *\n * The `options` argument carries the Authorization header.\n */\nconst ENDPOINT = 'https://api.pinterest.com/v5/ad_accounts/123456789/events';\nconst OPTIONS = {\n headers: { Authorization: 'Bearer s3cr3t' },\n};\n\nexport const checkout: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,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,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,WAAW;AAAA,UACT,KAAK;AAAA,YACH,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE;AAAA,YAC1B,aAAa,EAAE,KAAK,CAAC,SAAS,EAAE;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,UACJ;AAAA,YACE,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,eAAe;AAAA,YACf,WAAW;AAAA;AAAA,cAET,IAAI;AAAA,gBACF;AAAA,cACF;AAAA;AAAA,cAEA,aAAa;AAAA,gBACX;AAAA,cACF;AAAA,YACF;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
|
|
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 { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Pinterest Conversions API step examples.\n *\n * At push time, the destination calls\n * `env.sendServer(endpoint, JSON.stringify(body), { headers })` where\n * `endpoint = ${settings.url}ad_accounts/${settings.adAccountId}/events`\n * and `body = { data: [hashedServerEvent] }`.\n *\n * Test fixture pins `accessToken = 's3cr3t'` and `adAccountId = '123456789'`,\n * so every endpoint resolves to:\n * https://api.pinterest.com/v5/ad_accounts/123456789/events\n *\n * Body is emitted with keys in insertion order from push.ts:\n * 1. event_name\n * 2. event_id\n * 3. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 4. action_source (default 'web')\n * 5. ...restEventData (from mapping.data, excluding user_data/custom_data)\n * 6. user_data (hashed per Pinterest's PII requirements)\n * 7. custom_data (only when mapping sets custom_data)\n * 8. event_source_url (appended when action_source === 'web')\n *\n * The `options` argument carries the Authorization header.\n */\nconst ENDPOINT = 'https://api.pinterest.com/v5/ad_accounts/123456789/events';\nconst OPTIONS = {\n headers: { Authorization: 'Bearer s3cr3t' },\n};\n\nexport const checkout: Flow.StepExample = {\n title: 'Checkout',\n description:\n 'A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.',\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add is sent to Pinterest as an add_to_cart conversion with the added item details.',\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n title: 'Page visit',\n description:\n 'A page view is sent to Pinterest as a page_visit conversion with the source URL.',\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n title: 'Search',\n description:\n 'A site search event is forwarded to Pinterest as a search conversion with the query in custom data.',\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n title: 'Signup',\n description:\n 'A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.',\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAOX,IAAM,qBAAqB,EAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,EAAE,MAAM;AAAA,EACrC,EAAE,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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AAY,EAAE;AAAA,YAC1B,aAAa,EAAE,KAAK,CAAC,SAAS,EAAE;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,UACJ;AAAA,YACE,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,eAAe;AAAA,YACf,WAAW;AAAA;AAAA,cAET,IAAI;AAAA,gBACF;AAAA,cACF;AAAA;AAAA,cAEA,aAAa;AAAA,gBACX;AAAA,cACF;AAAA,YACF;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -61,6 +61,8 @@ var OPTIONS = {
|
|
|
61
61
|
headers: { Authorization: "Bearer s3cr3t" }
|
|
62
62
|
};
|
|
63
63
|
var checkout = {
|
|
64
|
+
title: "Checkout",
|
|
65
|
+
description: "A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",
|
|
64
66
|
in: (0, import_core.getEvent)("order complete", {
|
|
65
67
|
timestamp: 1700000900,
|
|
66
68
|
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
@@ -146,6 +148,8 @@ var checkout = {
|
|
|
146
148
|
]
|
|
147
149
|
};
|
|
148
150
|
var addToCart = {
|
|
151
|
+
title: "Add to cart",
|
|
152
|
+
description: "A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",
|
|
149
153
|
in: (0, import_core.getEvent)("product add", {
|
|
150
154
|
timestamp: 1700000901,
|
|
151
155
|
data: { id: "SKU-B2", name: "Cool Cap", price: "42.00", quantity: 1 },
|
|
@@ -214,6 +218,8 @@ var addToCart = {
|
|
|
214
218
|
]
|
|
215
219
|
};
|
|
216
220
|
var pageVisit = {
|
|
221
|
+
title: "Page visit",
|
|
222
|
+
description: "A page view is sent to Pinterest as a page_visit conversion with the source URL.",
|
|
217
223
|
in: (0, import_core.getEvent)("page view", {
|
|
218
224
|
timestamp: 1700000902,
|
|
219
225
|
user: { id: "user-789" },
|
|
@@ -247,6 +253,8 @@ var pageVisit = {
|
|
|
247
253
|
]
|
|
248
254
|
};
|
|
249
255
|
var search = {
|
|
256
|
+
title: "Search",
|
|
257
|
+
description: "A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",
|
|
250
258
|
in: (0, import_core.getEvent)("entity action", {
|
|
251
259
|
timestamp: 1700000903,
|
|
252
260
|
name: "site search",
|
|
@@ -294,6 +302,8 @@ var search = {
|
|
|
294
302
|
]
|
|
295
303
|
};
|
|
296
304
|
var signup = {
|
|
305
|
+
title: "Signup",
|
|
306
|
+
description: "A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",
|
|
297
307
|
in: (0, import_core.getEvent)("entity action", {
|
|
298
308
|
timestamp: 1700000904,
|
|
299
309
|
name: "user signup",
|
package/dist/examples/index.mjs
CHANGED
|
@@ -40,6 +40,8 @@ var OPTIONS = {
|
|
|
40
40
|
headers: { Authorization: "Bearer s3cr3t" }
|
|
41
41
|
};
|
|
42
42
|
var checkout = {
|
|
43
|
+
title: "Checkout",
|
|
44
|
+
description: "A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",
|
|
43
45
|
in: getEvent("order complete", {
|
|
44
46
|
timestamp: 1700000900,
|
|
45
47
|
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
@@ -125,6 +127,8 @@ var checkout = {
|
|
|
125
127
|
]
|
|
126
128
|
};
|
|
127
129
|
var addToCart = {
|
|
130
|
+
title: "Add to cart",
|
|
131
|
+
description: "A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",
|
|
128
132
|
in: getEvent("product add", {
|
|
129
133
|
timestamp: 1700000901,
|
|
130
134
|
data: { id: "SKU-B2", name: "Cool Cap", price: "42.00", quantity: 1 },
|
|
@@ -193,6 +197,8 @@ var addToCart = {
|
|
|
193
197
|
]
|
|
194
198
|
};
|
|
195
199
|
var pageVisit = {
|
|
200
|
+
title: "Page visit",
|
|
201
|
+
description: "A page view is sent to Pinterest as a page_visit conversion with the source URL.",
|
|
196
202
|
in: getEvent("page view", {
|
|
197
203
|
timestamp: 1700000902,
|
|
198
204
|
user: { id: "user-789" },
|
|
@@ -226,6 +232,8 @@ var pageVisit = {
|
|
|
226
232
|
]
|
|
227
233
|
};
|
|
228
234
|
var search = {
|
|
235
|
+
title: "Search",
|
|
236
|
+
description: "A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",
|
|
229
237
|
in: getEvent("entity action", {
|
|
230
238
|
timestamp: 1700000903,
|
|
231
239
|
name: "site search",
|
|
@@ -273,6 +281,8 @@ var search = {
|
|
|
273
281
|
]
|
|
274
282
|
};
|
|
275
283
|
var signup = {
|
|
284
|
+
title: "Signup",
|
|
285
|
+
description: "A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",
|
|
276
286
|
in: getEvent("entity action", {
|
|
277
287
|
timestamp: 1700000904,
|
|
278
288
|
name: "user signup",
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-pinterest",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -91,6 +91,8 @@
|
|
|
91
91
|
},
|
|
92
92
|
"step": {
|
|
93
93
|
"addToCart": {
|
|
94
|
+
"title": "Add to cart",
|
|
95
|
+
"description": "A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",
|
|
94
96
|
"in": {
|
|
95
97
|
"name": "product add",
|
|
96
98
|
"data": {
|
|
@@ -127,7 +129,7 @@
|
|
|
127
129
|
"group": "gr0up",
|
|
128
130
|
"count": 1,
|
|
129
131
|
"version": {
|
|
130
|
-
"source": "3.4.
|
|
132
|
+
"source": "3.4.1",
|
|
131
133
|
"tagging": 1
|
|
132
134
|
},
|
|
133
135
|
"source": {
|
|
@@ -180,6 +182,8 @@
|
|
|
180
182
|
]
|
|
181
183
|
},
|
|
182
184
|
"checkout": {
|
|
185
|
+
"title": "Checkout",
|
|
186
|
+
"description": "A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",
|
|
183
187
|
"in": {
|
|
184
188
|
"name": "order complete",
|
|
185
189
|
"data": {
|
|
@@ -226,7 +230,7 @@
|
|
|
226
230
|
"group": "gr0up",
|
|
227
231
|
"count": 1,
|
|
228
232
|
"version": {
|
|
229
|
-
"source": "3.4.
|
|
233
|
+
"source": "3.4.1",
|
|
230
234
|
"tagging": 1
|
|
231
235
|
},
|
|
232
236
|
"source": {
|
|
@@ -257,7 +261,7 @@
|
|
|
257
261
|
"nested",
|
|
258
262
|
{
|
|
259
263
|
"condition": {
|
|
260
|
-
"$code": "e=>
|
|
264
|
+
"$code": "e=>w(e)&&\"product\"===e.entity"
|
|
261
265
|
},
|
|
262
266
|
"map": {
|
|
263
267
|
"id": "data.id",
|
|
@@ -290,6 +294,8 @@
|
|
|
290
294
|
]
|
|
291
295
|
},
|
|
292
296
|
"pageVisit": {
|
|
297
|
+
"title": "Page visit",
|
|
298
|
+
"description": "A page view is sent to Pinterest as a page_visit conversion with the source URL.",
|
|
293
299
|
"in": {
|
|
294
300
|
"name": "page view",
|
|
295
301
|
"data": {
|
|
@@ -342,7 +348,7 @@
|
|
|
342
348
|
"group": "gr0up",
|
|
343
349
|
"count": 1,
|
|
344
350
|
"version": {
|
|
345
|
-
"source": "3.4.
|
|
351
|
+
"source": "3.4.1",
|
|
346
352
|
"tagging": 1
|
|
347
353
|
},
|
|
348
354
|
"source": {
|
|
@@ -368,6 +374,8 @@
|
|
|
368
374
|
]
|
|
369
375
|
},
|
|
370
376
|
"search": {
|
|
377
|
+
"title": "Search",
|
|
378
|
+
"description": "A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",
|
|
371
379
|
"in": {
|
|
372
380
|
"name": "entity action",
|
|
373
381
|
"data": {
|
|
@@ -415,7 +423,7 @@
|
|
|
415
423
|
"group": "gr0up",
|
|
416
424
|
"count": 1,
|
|
417
425
|
"version": {
|
|
418
|
-
"source": "3.4.
|
|
426
|
+
"source": "3.4.1",
|
|
419
427
|
"tagging": 1
|
|
420
428
|
},
|
|
421
429
|
"source": {
|
|
@@ -450,6 +458,8 @@
|
|
|
450
458
|
]
|
|
451
459
|
},
|
|
452
460
|
"signup": {
|
|
461
|
+
"title": "Signup",
|
|
462
|
+
"description": "A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",
|
|
453
463
|
"in": {
|
|
454
464
|
"name": "entity action",
|
|
455
465
|
"data": {
|
|
@@ -498,7 +508,7 @@
|
|
|
498
508
|
"group": "gr0up",
|
|
499
509
|
"count": 1,
|
|
500
510
|
"version": {
|
|
501
|
-
"source": "3.4.
|
|
511
|
+
"source": "3.4.1",
|
|
502
512
|
"tagging": 1
|
|
503
513
|
},
|
|
504
514
|
"source": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-pinterest",
|
|
3
3
|
"description": "Pinterest server destination for walkerOS",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"update": "npx npm-check-updates -u && npm update"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@walkeros/core": "3.4.
|
|
38
|
-
"@walkeros/server-core": "3.4.
|
|
37
|
+
"@walkeros/core": "3.4.1",
|
|
38
|
+
"@walkeros/server-core": "3.4.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@walkeros/collector": "3.4.
|
|
41
|
+
"@walkeros/collector": "3.4.1"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|