@walkeros/server-destination-pinterest 3.4.2 → 4.0.0-next-1777463920154

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 CHANGED
@@ -1 +1 @@
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
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},s={};n(s,{examples:()=>b,schemas:()=>o}),module.exports=(e=s,((e,n,s,o)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let c of r(n))i.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:()=>_,SettingsSchema:()=>l,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()]),l=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()}),_=require("@walkeros/core/dev").z.object({}),v=(0,c.zodToSchema)(l),h=(0,c.zodToSchema)(_),b={};n(b,{env:()=>w,step:()=>y});var w={};n(w,{push:()=>f,simulation:()=>g});var f={sendServer:async function(e,t,a){return{ok:!0,data:{num_events_received:1,num_events_processed:1,events:[{status:"processed"}]}}}},g=["sendServer"],y={};n(y,{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",{id:"a1b2c3d4e5f60001",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:"browser",platform:"web",url:"https://shop.example.com"}}),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:"a1b2c3d4e5f60001",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",{id:"a1b2c3d4e5f60002",timestamp:1700000901,data:{id:"SKU-B2",name:"Cool Cap",price:"42.00",quantity:1},user:{id:"user-456"},source:{type:"browser",platform:"web",url:"https://shop.example.com/products"}}),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:"a1b2c3d4e5f60002",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",{id:"a1b2c3d4e5f60003",timestamp:1700000902,user:{id:"user-789"},source:{type:"browser",platform:"web",url:"https://www.example.com/docs/"}}),mapping:{name:"page_visit"},out:[["sendServer",S,JSON.stringify({data:[{event_name:"page_visit",event_id:"a1b2c3d4e5f60003",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",{id:"a1b2c3d4e5f60004",timestamp:1700000903,name:"site search",data:{query:"walkerOS destinations"},user:{id:"user-101"},source:{type:"browser",platform:"web",url:"https://www.example.com/search"}}),mapping:{name:"search",data:{map:{custom_data:{map:{search_string:"data.query"}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"search",event_id:"a1b2c3d4e5f60004",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",{id:"a1b2c3d4e5f60005",timestamp:1700000904,name:"user signup",data:{method:"email"},user:{id:"new-user-1",email:"new@example.com"},source:{type:"browser",platform:"web",url:"https://www.example.com/register"}}),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:"a1b2c3d4e5f60005",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 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;AA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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":["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 id: 'a1b2c3d4e5f60001',\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: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com',\n },\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: 'a1b2c3d4e5f60001',\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 id: 'a1b2c3d4e5f60002',\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: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/products',\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: 'a1b2c3d4e5f60002',\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 id: 'a1b2c3d4e5f60003',\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://www.example.com/docs/',\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: 'a1b2c3d4e5f60003',\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 id: 'a1b2c3d4e5f60004',\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://www.example.com/search',\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: 'a1b2c3d4e5f60004',\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 id: 'a1b2c3d4e5f60005',\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: 'browser',\n platform: 'web',\n url: 'https://www.example.com/register',\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: 'a1b2c3d4e5f60005',\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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AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,KAAK;AAAA,IACP;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,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":["import_dev","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,{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
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:()=>c,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()]),c=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 d}from"@walkeros/core/dev";var p=d.object({}),u=i(c),m=i(p),l={};t(l,{env:()=>_,step:()=>f});var _={};t(_,{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"],f={};t(f,{addToCart:()=>S,checkout:()=>k,pageVisit:()=>x,search:()=>A,signup:()=>P});import{getEvent as w,isObject as b}from"@walkeros/core";var g="https://api.pinterest.com/v5/ad_accounts/123456789/events",y={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:w("order complete",{id:"a1b2c3d4e5f60001",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:"browser",platform:"web",url:"https://shop.example.com"}}),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=>b(e)&&"product"===e.entity,map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",g,JSON.stringify({data:[{event_name:"checkout",event_id:"a1b2c3d4e5f60001",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"}]}),y]]},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:w("product add",{id:"a1b2c3d4e5f60002",timestamp:1700000901,data:{id:"SKU-B2",name:"Cool Cap",price:"42.00",quantity:1},user:{id:"user-456"},source:{type:"browser",platform:"web",url:"https://shop.example.com/products"}}),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",g,JSON.stringify({data:[{event_name:"add_to_cart",event_id:"a1b2c3d4e5f60002",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"}]}),y]]},x={title:"Page visit",description:"A page view is sent to Pinterest as a page_visit conversion with the source URL.",in:w("page view",{id:"a1b2c3d4e5f60003",timestamp:1700000902,user:{id:"user-789"},source:{type:"browser",platform:"web",url:"https://www.example.com/docs/"}}),mapping:{name:"page_visit"},out:[["sendServer",g,JSON.stringify({data:[{event_name:"page_visit",event_id:"a1b2c3d4e5f60003",event_time:1700001,action_source:"web",user_data:{},event_source_url:"https://www.example.com/docs/"}]}),y]]},A={title:"Search",description:"A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",in:w("entity action",{id:"a1b2c3d4e5f60004",timestamp:1700000903,name:"site search",data:{query:"walkerOS destinations"},user:{id:"user-101"},source:{type:"browser",platform:"web",url:"https://www.example.com/search"}}),mapping:{name:"search",data:{map:{custom_data:{map:{search_string:"data.query"}}}}},out:[["sendServer",g,JSON.stringify({data:[{event_name:"search",event_id:"a1b2c3d4e5f60004",event_time:1700001,action_source:"web",user_data:{},custom_data:{search_string:"walkerOS destinations"},event_source_url:"https://www.example.com/search"}]}),y]]},P={title:"Signup",description:"A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",in:w("entity action",{id:"a1b2c3d4e5f60005",timestamp:1700000904,name:"user signup",data:{method:"email"},user:{id:"new-user-1",email:"new@example.com"},source:{type:"browser",platform:"web",url:"https://www.example.com/register"}}),mapping:{name:"signup",data:{map:{user_data:{map:{em:{set:["user.email"]},external_id:{set:["user.id"]}}}}}},out:[["sendServer",g,JSON.stringify({data:[{event_name:"signup",event_id:"a1b2c3d4e5f60005",event_time:1700001,action_source:"web",user_data:{em:["f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"],external_id:["b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"]},event_source_url:"https://www.example.com/register"}]}),y]]};export{l 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 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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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AAA,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 id: 'a1b2c3d4e5f60001',\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: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com',\n },\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: 'a1b2c3d4e5f60001',\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 id: 'a1b2c3d4e5f60002',\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: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/products',\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: 'a1b2c3d4e5f60002',\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 id: 'a1b2c3d4e5f60003',\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://www.example.com/docs/',\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: 'a1b2c3d4e5f60003',\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 id: 'a1b2c3d4e5f60004',\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://www.example.com/search',\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: 'a1b2c3d4e5f60004',\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 id: 'a1b2c3d4e5f60005',\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: 'browser',\n platform: 'web',\n url: 'https://www.example.com/register',\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: 'a1b2c3d4e5f60005',\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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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AAA,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"]}
@@ -64,6 +64,7 @@ var checkout = {
64
64
  title: "Checkout",
65
65
  description: "A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",
66
66
  in: (0, import_core.getEvent)("order complete", {
67
+ id: "a1b2c3d4e5f60001",
67
68
  timestamp: 1700000900,
68
69
  data: { id: "ORD-300", total: 249.99, currency: "EUR" },
69
70
  nested: [
@@ -78,7 +79,11 @@ var checkout = {
78
79
  }
79
80
  ],
80
81
  user: { id: "user-123", device: "device-456" },
81
- source: { type: "server", id: "https://shop.example.com", previous_id: "" }
82
+ source: {
83
+ type: "browser",
84
+ platform: "web",
85
+ url: "https://shop.example.com"
86
+ }
82
87
  }),
83
88
  mapping: {
84
89
  name: "checkout",
@@ -121,7 +126,7 @@ var checkout = {
121
126
  data: [
122
127
  {
123
128
  event_name: "checkout",
124
- event_id: "1700000900-gr0up-1",
129
+ event_id: "a1b2c3d4e5f60001",
125
130
  event_time: 1700001,
126
131
  action_source: "web",
127
132
  user_data: {},
@@ -151,13 +156,14 @@ var addToCart = {
151
156
  title: "Add to cart",
152
157
  description: "A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",
153
158
  in: (0, import_core.getEvent)("product add", {
159
+ id: "a1b2c3d4e5f60002",
154
160
  timestamp: 1700000901,
155
161
  data: { id: "SKU-B2", name: "Cool Cap", price: "42.00", quantity: 1 },
156
162
  user: { id: "user-456" },
157
163
  source: {
158
- type: "server",
159
- id: "https://shop.example.com/products",
160
- previous_id: ""
164
+ type: "browser",
165
+ platform: "web",
166
+ url: "https://shop.example.com/products"
161
167
  }
162
168
  }),
163
169
  mapping: {
@@ -193,7 +199,7 @@ var addToCart = {
193
199
  data: [
194
200
  {
195
201
  event_name: "add_to_cart",
196
- event_id: "1700000901-gr0up-1",
202
+ event_id: "a1b2c3d4e5f60002",
197
203
  event_time: 1700001,
198
204
  action_source: "web",
199
205
  user_data: {},
@@ -221,12 +227,13 @@ var pageVisit = {
221
227
  title: "Page visit",
222
228
  description: "A page view is sent to Pinterest as a page_visit conversion with the source URL.",
223
229
  in: (0, import_core.getEvent)("page view", {
230
+ id: "a1b2c3d4e5f60003",
224
231
  timestamp: 1700000902,
225
232
  user: { id: "user-789" },
226
233
  source: {
227
- type: "server",
228
- id: "https://www.example.com/docs/",
229
- previous_id: ""
234
+ type: "browser",
235
+ platform: "web",
236
+ url: "https://www.example.com/docs/"
230
237
  }
231
238
  }),
232
239
  mapping: {
@@ -240,7 +247,7 @@ var pageVisit = {
240
247
  data: [
241
248
  {
242
249
  event_name: "page_visit",
243
- event_id: "1700000902-gr0up-1",
250
+ event_id: "a1b2c3d4e5f60003",
244
251
  event_time: 1700001,
245
252
  action_source: "web",
246
253
  user_data: {},
@@ -256,14 +263,15 @@ var search = {
256
263
  title: "Search",
257
264
  description: "A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",
258
265
  in: (0, import_core.getEvent)("entity action", {
266
+ id: "a1b2c3d4e5f60004",
259
267
  timestamp: 1700000903,
260
268
  name: "site search",
261
269
  data: { query: "walkerOS destinations" },
262
270
  user: { id: "user-101" },
263
271
  source: {
264
- type: "server",
265
- id: "https://www.example.com/search",
266
- previous_id: ""
272
+ type: "browser",
273
+ platform: "web",
274
+ url: "https://www.example.com/search"
267
275
  }
268
276
  }),
269
277
  mapping: {
@@ -286,7 +294,7 @@ var search = {
286
294
  data: [
287
295
  {
288
296
  event_name: "search",
289
- event_id: "1700000903-gr0up-1",
297
+ event_id: "a1b2c3d4e5f60004",
290
298
  event_time: 1700001,
291
299
  action_source: "web",
292
300
  user_data: {},
@@ -305,14 +313,15 @@ var signup = {
305
313
  title: "Signup",
306
314
  description: "A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",
307
315
  in: (0, import_core.getEvent)("entity action", {
316
+ id: "a1b2c3d4e5f60005",
308
317
  timestamp: 1700000904,
309
318
  name: "user signup",
310
319
  data: { method: "email" },
311
320
  user: { id: "new-user-1", email: "new@example.com" },
312
321
  source: {
313
- type: "server",
314
- id: "https://www.example.com/register",
315
- previous_id: ""
322
+ type: "browser",
323
+ platform: "web",
324
+ url: "https://www.example.com/register"
316
325
  }
317
326
  }),
318
327
  mapping: {
@@ -336,7 +345,7 @@ var signup = {
336
345
  data: [
337
346
  {
338
347
  event_name: "signup",
339
- event_id: "1700000904-gr0up-1",
348
+ event_id: "a1b2c3d4e5f60005",
340
349
  event_time: 1700001,
341
350
  action_source: "web",
342
351
  user_data: {
@@ -43,6 +43,7 @@ var checkout = {
43
43
  title: "Checkout",
44
44
  description: "A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.",
45
45
  in: getEvent("order complete", {
46
+ id: "a1b2c3d4e5f60001",
46
47
  timestamp: 1700000900,
47
48
  data: { id: "ORD-300", total: 249.99, currency: "EUR" },
48
49
  nested: [
@@ -57,7 +58,11 @@ var checkout = {
57
58
  }
58
59
  ],
59
60
  user: { id: "user-123", device: "device-456" },
60
- source: { type: "server", id: "https://shop.example.com", previous_id: "" }
61
+ source: {
62
+ type: "browser",
63
+ platform: "web",
64
+ url: "https://shop.example.com"
65
+ }
61
66
  }),
62
67
  mapping: {
63
68
  name: "checkout",
@@ -100,7 +105,7 @@ var checkout = {
100
105
  data: [
101
106
  {
102
107
  event_name: "checkout",
103
- event_id: "1700000900-gr0up-1",
108
+ event_id: "a1b2c3d4e5f60001",
104
109
  event_time: 1700001,
105
110
  action_source: "web",
106
111
  user_data: {},
@@ -130,13 +135,14 @@ var addToCart = {
130
135
  title: "Add to cart",
131
136
  description: "A product add is sent to Pinterest as an add_to_cart conversion with the added item details.",
132
137
  in: getEvent("product add", {
138
+ id: "a1b2c3d4e5f60002",
133
139
  timestamp: 1700000901,
134
140
  data: { id: "SKU-B2", name: "Cool Cap", price: "42.00", quantity: 1 },
135
141
  user: { id: "user-456" },
136
142
  source: {
137
- type: "server",
138
- id: "https://shop.example.com/products",
139
- previous_id: ""
143
+ type: "browser",
144
+ platform: "web",
145
+ url: "https://shop.example.com/products"
140
146
  }
141
147
  }),
142
148
  mapping: {
@@ -172,7 +178,7 @@ var addToCart = {
172
178
  data: [
173
179
  {
174
180
  event_name: "add_to_cart",
175
- event_id: "1700000901-gr0up-1",
181
+ event_id: "a1b2c3d4e5f60002",
176
182
  event_time: 1700001,
177
183
  action_source: "web",
178
184
  user_data: {},
@@ -200,12 +206,13 @@ var pageVisit = {
200
206
  title: "Page visit",
201
207
  description: "A page view is sent to Pinterest as a page_visit conversion with the source URL.",
202
208
  in: getEvent("page view", {
209
+ id: "a1b2c3d4e5f60003",
203
210
  timestamp: 1700000902,
204
211
  user: { id: "user-789" },
205
212
  source: {
206
- type: "server",
207
- id: "https://www.example.com/docs/",
208
- previous_id: ""
213
+ type: "browser",
214
+ platform: "web",
215
+ url: "https://www.example.com/docs/"
209
216
  }
210
217
  }),
211
218
  mapping: {
@@ -219,7 +226,7 @@ var pageVisit = {
219
226
  data: [
220
227
  {
221
228
  event_name: "page_visit",
222
- event_id: "1700000902-gr0up-1",
229
+ event_id: "a1b2c3d4e5f60003",
223
230
  event_time: 1700001,
224
231
  action_source: "web",
225
232
  user_data: {},
@@ -235,14 +242,15 @@ var search = {
235
242
  title: "Search",
236
243
  description: "A site search event is forwarded to Pinterest as a search conversion with the query in custom data.",
237
244
  in: getEvent("entity action", {
245
+ id: "a1b2c3d4e5f60004",
238
246
  timestamp: 1700000903,
239
247
  name: "site search",
240
248
  data: { query: "walkerOS destinations" },
241
249
  user: { id: "user-101" },
242
250
  source: {
243
- type: "server",
244
- id: "https://www.example.com/search",
245
- previous_id: ""
251
+ type: "browser",
252
+ platform: "web",
253
+ url: "https://www.example.com/search"
246
254
  }
247
255
  }),
248
256
  mapping: {
@@ -265,7 +273,7 @@ var search = {
265
273
  data: [
266
274
  {
267
275
  event_name: "search",
268
- event_id: "1700000903-gr0up-1",
276
+ event_id: "a1b2c3d4e5f60004",
269
277
  event_time: 1700001,
270
278
  action_source: "web",
271
279
  user_data: {},
@@ -284,14 +292,15 @@ var signup = {
284
292
  title: "Signup",
285
293
  description: "A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.",
286
294
  in: getEvent("entity action", {
295
+ id: "a1b2c3d4e5f60005",
287
296
  timestamp: 1700000904,
288
297
  name: "user signup",
289
298
  data: { method: "email" },
290
299
  user: { id: "new-user-1", email: "new@example.com" },
291
300
  source: {
292
- type: "server",
293
- id: "https://www.example.com/register",
294
- previous_id: ""
301
+ type: "browser",
302
+ platform: "web",
303
+ url: "https://www.example.com/register"
295
304
  }
296
305
  }),
297
306
  mapping: {
@@ -315,7 +324,7 @@ var signup = {
315
324
  data: [
316
325
  {
317
326
  event_name: "signup",
318
- event_id: "1700000904-gr0up-1",
327
+ event_id: "a1b2c3d4e5f60005",
319
328
  event_time: 1700001,
320
329
  action_source: "web",
321
330
  user_data: {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationPinterest:()=>types_exports,default:()=>index_default,destinationPinterest:()=>destinationPinterest}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core2=require("@walkeros/server-core"),import_core=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),keysToHash=["em","ph","fn","ln","db","ge","ct","st","zp","country","external_id","hashed_maids"];function shouldBeHashed(key,doNotHash=[]){return keysToHash.includes(key)&&!doNotHash.includes(key)}async function processValue(value,shouldHash){return shouldHash?(0,import_core.isArray)(value)?Promise.all(value.map(item=>(0,import_server_core.getHashServer)(String(item)))):(0,import_server_core.getHashServer)(String(value)):value}var push=async function(event,{config:config,data:data,env:env,logger:logger}){const{accessToken:accessToken,adAccountId:adAccountId,action_source:action_source="web",doNotHash:doNotHash,test:test,url:url="https://api.pinterest.com/v5/",user_data:user_data,partner_name:partner_name}=config.settings,eventData=(0,import_core2.isObject)(data)?data:{},configData=config.data?await(0,import_core2.getMappingValue)(event,config.data):{},userDataCustom=user_data?await(0,import_core2.getMappingValue)(event,{map:user_data}):{},userData={...(0,import_core2.isObject)(configData)&&(0,import_core2.isObject)(configData.user_data)?configData.user_data:{},...(0,import_core2.isObject)(userDataCustom)?userDataCustom:{},...(0,import_core2.isObject)(eventData.user_data)?eventData.user_data:{}},{user_data:_ud,custom_data:eventCustomData,...restEventData}=eventData,serverEvent={event_name:event.name,event_id:event.id,event_time:Math.round((event.timestamp||Date.now())/1e3),action_source:action_source,...restEventData,user_data:userData};(0,import_core2.isObject)(eventCustomData)&&(serverEvent.custom_data=eventCustomData),"web"===action_source&&(serverEvent.event_source_url=event.source.id),partner_name&&(serverEvent.partner_name=partner_name);const hashedServerEvent=await async function(value,doNotHash=[]){if(!(0,import_core.isObject)(value))return value;const isUserData="user_data"in value,target=isUserData?value.user_data:value,result=(await Promise.all(Object.entries(target).map(async([k,v])=>[k,await processValue(v,isUserData&&shouldBeHashed(k,doNotHash))]))).reduce((acc,[k,v])=>((0,import_core.isString)(k)&&(acc[k]=v),acc),{});return isUserData?{...value,user_data:result}:result}(serverEvent,doNotHash),body={data:[hashedServerEvent]},endpoint=`${url}ad_accounts/${adAccountId}/events${test?"?test=true":""}`;logger.debug("Calling Pinterest API",{endpoint:endpoint,method:"POST",eventName:serverEvent.event_name,eventId:serverEvent.event_id});const sendServerFn=(null==env?void 0:env.sendServer)||import_server_core2.sendServer,result=await sendServerFn(endpoint,JSON.stringify(body),{headers:{Authorization:`Bearer ${accessToken}`}});logger.debug("Pinterest API response",{ok:!(0,import_core2.isObject)(result)||result.ok}),(0,import_core2.isObject)(result)&&!1===result.ok&&logger.throw(`Pinterest API error: ${JSON.stringify(result)}`)},types_exports={},destinationPinterest={type:"pinterest",config:{},async init({config:partialConfig,logger:logger}){const config=function(partialConfig={},logger){const settings=partialConfig.settings||{},{accessToken:accessToken,adAccountId:adAccountId}=settings;accessToken||logger.throw("Config settings accessToken missing"),adAccountId||logger.throw("Config settings adAccountId missing");const settingsConfig={...settings,accessToken:accessToken,adAccountId:adAccountId};return{...partialConfig,settings:settingsConfig}}(partialConfig,logger);return config},push:async(event,context)=>await push(event,context)},index_default=destinationPinterest;//# sourceMappingURL=index.js.map
1
+ "use strict";var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationPinterest:()=>types_exports,default:()=>index_default,destinationPinterest:()=>destinationPinterest}),module.exports=(mod=index_exports,((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),mod));var import_core2=require("@walkeros/core"),import_server_core2=require("@walkeros/server-core"),import_core=require("@walkeros/core"),import_server_core=require("@walkeros/server-core"),keysToHash=["em","ph","fn","ln","db","ge","ct","st","zp","country","external_id","hashed_maids"];function shouldBeHashed(key,doNotHash=[]){return keysToHash.includes(key)&&!doNotHash.includes(key)}async function processValue(value,shouldHash){return shouldHash?(0,import_core.isArray)(value)?Promise.all(value.map(item=>(0,import_server_core.getHashServer)(String(item)))):(0,import_server_core.getHashServer)(String(value)):value}var push=async function(event,{config:config,data:data,env:env,logger:logger}){const{accessToken:accessToken,adAccountId:adAccountId,action_source:action_source="web",doNotHash:doNotHash,test:test,url:url="https://api.pinterest.com/v5/",user_data:user_data,partner_name:partner_name}=config.settings,eventData=(0,import_core2.isObject)(data)?data:{},configData=config.data?await(0,import_core2.getMappingValue)(event,config.data):{},userDataCustom=user_data?await(0,import_core2.getMappingValue)(event,{map:user_data}):{},userData={...(0,import_core2.isObject)(configData)&&(0,import_core2.isObject)(configData.user_data)?configData.user_data:{},...(0,import_core2.isObject)(userDataCustom)?userDataCustom:{},...(0,import_core2.isObject)(eventData.user_data)?eventData.user_data:{}},{user_data:_ud,custom_data:eventCustomData,...restEventData}=eventData,serverEvent={event_name:event.name,event_id:event.id,event_time:Math.round((event.timestamp||Date.now())/1e3),action_source:action_source,...restEventData,user_data:userData};(0,import_core2.isObject)(eventCustomData)&&(serverEvent.custom_data=eventCustomData),"web"===action_source&&event.source?.url&&(serverEvent.event_source_url=event.source.url),partner_name&&(serverEvent.partner_name=partner_name);const hashedServerEvent=await async function(value,doNotHash=[]){if(!(0,import_core.isObject)(value))return value;const isUserData="user_data"in value,target=isUserData?value.user_data:value,result=(await Promise.all(Object.entries(target).map(async([k,v])=>[k,await processValue(v,isUserData&&shouldBeHashed(k,doNotHash))]))).reduce((acc,[k,v])=>((0,import_core.isString)(k)&&(acc[k]=v),acc),{});return isUserData?{...value,user_data:result}:result}(serverEvent,doNotHash),body={data:[hashedServerEvent]},endpoint=`${url}ad_accounts/${adAccountId}/events${test?"?test=true":""}`;logger.debug("Calling Pinterest API",{endpoint:endpoint,method:"POST",eventName:serverEvent.event_name,eventId:serverEvent.event_id});const sendServerFn=env?.sendServer||import_server_core2.sendServer,result=await sendServerFn(endpoint,JSON.stringify(body),{headers:{Authorization:`Bearer ${accessToken}`}});logger.debug("Pinterest API response",{ok:!(0,import_core2.isObject)(result)||result.ok}),(0,import_core2.isObject)(result)&&!1===result.ok&&logger.throw(`Pinterest API error: ${JSON.stringify(result)}`)},types_exports={},destinationPinterest={type:"pinterest",config:{},async init({config:partialConfig,logger:logger}){const config=function(partialConfig={},logger){const settings=partialConfig.settings||{},{accessToken:accessToken,adAccountId:adAccountId}=settings;accessToken||logger.throw("Config settings accessToken missing"),adAccountId||logger.throw("Config settings adAccountId missing");const settingsConfig={...settings,accessToken:accessToken,adAccountId:adAccountId};return{...partialConfig,settings:settingsConfig}}(partialConfig,logger);return config},push:async(event,context)=>await push(event,context)},index_default=destinationPinterest;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/push.ts","../src/hash.ts","../src/types/index.ts"],"sourcesContent":["import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationPinterest from './types';\n\nexport const destinationPinterest: Destination = {\n type: 'pinterest',\n\n config: {},\n\n async init({ config: partialConfig, logger }) {\n const config = getConfig(partialConfig, logger);\n return config;\n },\n\n async push(event, context) {\n return await push(event, context);\n },\n};\n\nexport default destinationPinterest;\n","import type { Config, Settings, PartialConfig } from './types';\nimport type { Logger } from '@walkeros/core';\n\nexport function getConfig(\n partialConfig: PartialConfig = {},\n logger: Logger.Instance,\n): Config {\n const settings = (partialConfig.settings || {}) as Partial<Settings>;\n const { accessToken, adAccountId } = settings;\n\n if (!accessToken) logger.throw('Config settings accessToken missing');\n if (!adAccountId) logger.throw('Config settings adAccountId missing');\n\n const settingsConfig: Settings = {\n ...settings,\n accessToken,\n adAccountId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { ConversionEvent, PushFn, RequestBody, UserData } from './types';\nimport { getMappingValue, isObject } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\nimport { hashEvent } from './hash';\n\nexport const push: PushFn = async function (\n event,\n { config, data, env, logger },\n) {\n const {\n accessToken,\n adAccountId,\n action_source = 'web',\n doNotHash,\n test,\n url = 'https://api.pinterest.com/v5/',\n user_data,\n partner_name,\n } = config.settings!;\n\n const eventData = isObject(data) ? data : {};\n const configData = config.data\n ? await getMappingValue(event, config.data)\n : {};\n const userDataCustom = user_data\n ? await getMappingValue(event, { map: user_data })\n : {};\n\n // Merge user_data from config.data, settings.user_data, and event mapping\n const userData: UserData = {\n // Destination config\n ...(isObject(configData) && isObject(configData.user_data)\n ? configData.user_data\n : {}),\n // Custom user_data from settings\n ...(isObject(userDataCustom) ? userDataCustom : {}),\n // Event mapping\n ...(isObject(eventData.user_data) ? eventData.user_data : {}),\n };\n\n // Extract custom_data and user_data from eventData, leave the rest\n const {\n user_data: _ud,\n custom_data: eventCustomData,\n ...restEventData\n } = eventData;\n\n const serverEvent: ConversionEvent = {\n event_name: event.name,\n event_id: event.id,\n event_time: Math.round((event.timestamp || Date.now()) / 1000),\n action_source,\n ...restEventData,\n user_data: userData,\n };\n\n // Nest custom_data from mapping\n if (isObject(eventCustomData)) {\n serverEvent.custom_data = eventCustomData as ConversionEvent['custom_data'];\n }\n\n // Set event_source_url for web events\n if (action_source === 'web') {\n serverEvent.event_source_url = event.source.id;\n }\n\n // Add partner_name from settings\n if (partner_name) {\n serverEvent.partner_name = partner_name;\n }\n\n const hashedServerEvent = await hashEvent(serverEvent, doNotHash);\n\n const body: RequestBody = { data: [hashedServerEvent] };\n\n // Build endpoint URL\n const testParam = test ? '?test=true' : '';\n const endpoint = `${url}ad_accounts/${adAccountId}/events${testParam}`;\n\n logger.debug('Calling Pinterest API', {\n endpoint,\n method: 'POST',\n eventName: serverEvent.event_name,\n eventId: serverEvent.event_id,\n });\n\n const sendServerFn = env?.sendServer || sendServer;\n const result = await sendServerFn(endpoint, JSON.stringify(body), {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n logger.debug('Pinterest API response', {\n ok: isObject(result) ? result.ok : true,\n });\n\n if (isObject(result) && result.ok === false) {\n logger.throw(`Pinterest API error: ${JSON.stringify(result)}`);\n }\n};\n","import { WalkerOS } from '@walkeros/core';\nimport { isArray, isObject, isString } from '@walkeros/core';\nimport { getHashServer } from '@walkeros/server-core';\n\nconst keysToHash = [\n 'em',\n 'ph',\n 'fn',\n 'ln',\n 'db',\n 'ge',\n 'ct',\n 'st',\n 'zp',\n 'country',\n 'external_id',\n 'hashed_maids',\n];\n\nfunction shouldBeHashed(key: string, doNotHash: string[] = []): boolean {\n return keysToHash.includes(key) && !doNotHash.includes(key);\n}\n\ntype HashableValue = WalkerOS.AnyObject | unknown | unknown[];\n\nasync function processValue(\n value: unknown,\n shouldHash: boolean,\n): Promise<unknown> {\n if (!shouldHash) return value;\n if (isArray(value)) {\n return Promise.all(value.map((item) => getHashServer(String(item))));\n }\n return getHashServer(String(value));\n}\n\nexport async function hashEvent<T extends HashableValue>(\n value: T,\n doNotHash: string[] = [],\n): Promise<T> {\n if (!isObject(value)) return value;\n\n const isUserData = 'user_data' in value;\n const target = (isUserData ? value.user_data : value) as WalkerOS.AnyObject;\n\n const entries = await Promise.all(\n Object.entries(target).map(async ([k, v]) => [\n k,\n await processValue(v, isUserData && shouldBeHashed(k, doNotHash)),\n ]),\n );\n\n const result = entries.reduce((acc, [k, v]) => {\n if (isString(k)) acc[k] = v;\n return acc;\n }, {} as WalkerOS.AnyObject);\n\n return isUserData ? { ...value, user_data: result } : (result as T);\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n accessToken: string;\n adAccountId: string;\n action_source?: ActionSource;\n doNotHash?: string[];\n test?: boolean;\n url?: string;\n user_data?: WalkerOSMapping.Map;\n partner_name?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport interface Destination extends DestinationServer.Destination<Types> {\n init: DestinationServer.InitFn<Types>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Types>;\n\nexport type InitFn = DestinationServer.InitFn<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Types>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\n// Pinterest Conversions API types\n// https://developers.pinterest.com/docs/conversions/conversions/\n\nexport type ActionSource = 'app_android' | 'app_ios' | 'web' | 'offline';\n\nexport type EventName =\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 | string;\n\nexport interface ConversionEvent {\n // Required\n event_name: EventName;\n event_time: number;\n event_id: string;\n action_source: ActionSource;\n user_data: UserData;\n\n // Optional\n event_source_url?: string;\n opt_out?: boolean;\n partner_name?: string;\n app_id?: string;\n app_name?: string;\n app_version?: string;\n device_brand?: string;\n device_carrier?: string;\n device_model?: string;\n device_type?: string;\n os_version?: string;\n language?: string;\n wifi?: boolean;\n custom_data?: CustomData;\n}\n\nexport interface UserData {\n // Hashable fields (SHA-256, arrays)\n em?: string[];\n ph?: string[];\n fn?: string[];\n ln?: string[];\n db?: string[];\n ge?: string[];\n ct?: string[];\n st?: string[];\n zp?: string[];\n country?: string[];\n external_id?: string[];\n hashed_maids?: string[];\n\n // Pass-through fields (do NOT hash)\n client_ip_address?: string;\n client_user_agent?: string;\n click_id?: string;\n partner_id?: string;\n}\n\nexport interface CustomData {\n currency?: string;\n value?: string;\n content_ids?: string[];\n content_name?: string;\n content_category?: string;\n content_brand?: string;\n contents?: ContentItem[];\n num_items?: number;\n order_id?: string;\n search_string?: string;\n opt_out_type?: string;\n np?: string;\n predicted_ltv?: string;\n}\n\nexport interface ContentItem {\n id?: string;\n item_name?: string;\n item_category?: string;\n item_brand?: string;\n item_price?: string;\n quantity?: number;\n}\n\nexport interface RequestBody {\n data: ConversionEvent[];\n}\n\nexport interface ResponseBody {\n num_events_received: number;\n num_events_processed: number;\n events: Array<{\n status: string;\n error_message?: string;\n warning_message?: string;\n }>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,SAAS,UACd,gBAA+B,CAAC,GAChC,QACQ;AACR,QAAM,WAAY,cAAc,YAAY,CAAC;AAC7C,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AACpE,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AAEpE,QAAM,iBAA2B;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,eAAe,UAAU,eAAe;AACtD;;;ACnBA,IAAAA,eAA0C;AAC1C,IAAAC,sBAA2B;;;ACD3B,kBAA4C;AAC5C,yBAA8B;AAE9B,IAAM,aAAa;AAAA,EACjB;AAA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B,CAAC;AAED,QAAM,gBAAe,2BAAK,eAAc;AACxC,QAAM,SAAS,MAAM,aAAa,UAAU,KAAK,UAAU,IAAI,GAAG;AAAA,IAChE,SAAS,EAAE,eAAe,UAAU,WAAW,GAAG;AAAA,EACpD,CAAC;AAED,SAAO,MAAM,0BAA0B;AAAA,IACrC,QAAI,uBAAS,MAAM,IAAI,OAAO,KAAK;AAAA,EACrC,CAAC;AAED,UAAI,uBAAS,MAAM,KAAK,OAAO,OAAO,OAAO;AAC3C,WAAO,MAAM,wBAAwB,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,EAC/D;AACF;;;AElGA;;;AJOO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,eAAe,OAAO,GAAG;AAC5C,UAAM,SAAS,UAAU,eAAe,MAAM;AAC9C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,SAAS;AACzB,WAAO,MAAM,KAAK,OAAO,OAAO;AAAA,EAClC;AACF;AAEA,IAAO,gBAAQ;","names":["import_core","import_server_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/push.ts","../src/hash.ts","../src/types/index.ts"],"sourcesContent":["import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationPinterest from './types';\n\nexport const destinationPinterest: Destination = {\n type: 'pinterest',\n\n config: {},\n\n async init({ config: partialConfig, logger }) {\n const config = getConfig(partialConfig, logger);\n return config;\n },\n\n async push(event, context) {\n return await push(event, context);\n },\n};\n\nexport default destinationPinterest;\n","import type { Config, Settings, PartialConfig } from './types';\nimport type { Logger } from '@walkeros/core';\n\nexport function getConfig(\n partialConfig: PartialConfig = {},\n logger: Logger.Instance,\n): Config {\n const settings = (partialConfig.settings || {}) as Partial<Settings>;\n const { accessToken, adAccountId } = settings;\n\n if (!accessToken) logger.throw('Config settings accessToken missing');\n if (!adAccountId) logger.throw('Config settings adAccountId missing');\n\n const settingsConfig: Settings = {\n ...settings,\n accessToken,\n adAccountId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { ConversionEvent, PushFn, RequestBody, UserData } from './types';\nimport { getMappingValue, isObject } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\nimport { hashEvent } from './hash';\n\nexport const push: PushFn = async function (\n event,\n { config, data, env, logger },\n) {\n const {\n accessToken,\n adAccountId,\n action_source = 'web',\n doNotHash,\n test,\n url = 'https://api.pinterest.com/v5/',\n user_data,\n partner_name,\n } = config.settings!;\n\n const eventData = isObject(data) ? data : {};\n const configData = config.data\n ? await getMappingValue(event, config.data)\n : {};\n const userDataCustom = user_data\n ? await getMappingValue(event, { map: user_data })\n : {};\n\n // Merge user_data from config.data, settings.user_data, and event mapping\n const userData: UserData = {\n // Destination config\n ...(isObject(configData) && isObject(configData.user_data)\n ? configData.user_data\n : {}),\n // Custom user_data from settings\n ...(isObject(userDataCustom) ? userDataCustom : {}),\n // Event mapping\n ...(isObject(eventData.user_data) ? eventData.user_data : {}),\n };\n\n // Extract custom_data and user_data from eventData, leave the rest\n const {\n user_data: _ud,\n custom_data: eventCustomData,\n ...restEventData\n } = eventData;\n\n const serverEvent: ConversionEvent = {\n event_name: event.name,\n event_id: event.id,\n event_time: Math.round((event.timestamp || Date.now()) / 1000),\n action_source,\n ...restEventData,\n user_data: userData,\n };\n\n // Nest custom_data from mapping\n if (isObject(eventCustomData)) {\n serverEvent.custom_data = eventCustomData as ConversionEvent['custom_data'];\n }\n\n // Set event_source_url for web events\n if (action_source === 'web' && event.source?.url) {\n serverEvent.event_source_url = event.source.url;\n }\n\n // Add partner_name from settings\n if (partner_name) {\n serverEvent.partner_name = partner_name;\n }\n\n const hashedServerEvent = await hashEvent(serverEvent, doNotHash);\n\n const body: RequestBody = { data: [hashedServerEvent] };\n\n // Build endpoint URL\n const testParam = test ? '?test=true' : '';\n const endpoint = `${url}ad_accounts/${adAccountId}/events${testParam}`;\n\n logger.debug('Calling Pinterest API', {\n endpoint,\n method: 'POST',\n eventName: serverEvent.event_name,\n eventId: serverEvent.event_id,\n });\n\n const sendServerFn = env?.sendServer || sendServer;\n const result = await sendServerFn(endpoint, JSON.stringify(body), {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n logger.debug('Pinterest API response', {\n ok: isObject(result) ? result.ok : true,\n });\n\n if (isObject(result) && result.ok === false) {\n logger.throw(`Pinterest API error: ${JSON.stringify(result)}`);\n }\n};\n","import { WalkerOS } from '@walkeros/core';\nimport { isArray, isObject, isString } from '@walkeros/core';\nimport { getHashServer } from '@walkeros/server-core';\n\nconst keysToHash = [\n 'em',\n 'ph',\n 'fn',\n 'ln',\n 'db',\n 'ge',\n 'ct',\n 'st',\n 'zp',\n 'country',\n 'external_id',\n 'hashed_maids',\n];\n\nfunction shouldBeHashed(key: string, doNotHash: string[] = []): boolean {\n return keysToHash.includes(key) && !doNotHash.includes(key);\n}\n\ntype HashableValue = WalkerOS.AnyObject | unknown | unknown[];\n\nasync function processValue(\n value: unknown,\n shouldHash: boolean,\n): Promise<unknown> {\n if (!shouldHash) return value;\n if (isArray(value)) {\n return Promise.all(value.map((item) => getHashServer(String(item))));\n }\n return getHashServer(String(value));\n}\n\nexport async function hashEvent<T extends HashableValue>(\n value: T,\n doNotHash: string[] = [],\n): Promise<T> {\n if (!isObject(value)) return value;\n\n const isUserData = 'user_data' in value;\n const target = (isUserData ? value.user_data : value) as WalkerOS.AnyObject;\n\n const entries = await Promise.all(\n Object.entries(target).map(async ([k, v]) => [\n k,\n await processValue(v, isUserData && shouldBeHashed(k, doNotHash)),\n ]),\n );\n\n const result = entries.reduce((acc, [k, v]) => {\n if (isString(k)) acc[k] = v;\n return acc;\n }, {} as WalkerOS.AnyObject);\n\n return isUserData ? { ...value, user_data: result } : (result as T);\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n accessToken: string;\n adAccountId: string;\n action_source?: ActionSource;\n doNotHash?: string[];\n test?: boolean;\n url?: string;\n user_data?: WalkerOSMapping.Map;\n partner_name?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport interface Destination extends DestinationServer.Destination<Types> {\n init: DestinationServer.InitFn<Types>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Types>;\n\nexport type InitFn = DestinationServer.InitFn<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Types>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\n// Pinterest Conversions API types\n// https://developers.pinterest.com/docs/conversions/conversions/\n\nexport type ActionSource = 'app_android' | 'app_ios' | 'web' | 'offline';\n\nexport type EventName =\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 | string;\n\nexport interface ConversionEvent {\n // Required\n event_name: EventName;\n event_time: number;\n event_id: string;\n action_source: ActionSource;\n user_data: UserData;\n\n // Optional\n event_source_url?: string;\n opt_out?: boolean;\n partner_name?: string;\n app_id?: string;\n app_name?: string;\n app_version?: string;\n device_brand?: string;\n device_carrier?: string;\n device_model?: string;\n device_type?: string;\n os_version?: string;\n language?: string;\n wifi?: boolean;\n custom_data?: CustomData;\n}\n\nexport interface UserData {\n // Hashable fields (SHA-256, arrays)\n em?: string[];\n ph?: string[];\n fn?: string[];\n ln?: string[];\n db?: string[];\n ge?: string[];\n ct?: string[];\n st?: string[];\n zp?: string[];\n country?: string[];\n external_id?: string[];\n hashed_maids?: string[];\n\n // Pass-through fields (do NOT hash)\n client_ip_address?: string;\n client_user_agent?: string;\n click_id?: string;\n partner_id?: string;\n}\n\nexport interface CustomData {\n currency?: string;\n value?: string;\n content_ids?: string[];\n content_name?: string;\n content_category?: string;\n content_brand?: string;\n contents?: ContentItem[];\n num_items?: number;\n order_id?: string;\n search_string?: string;\n opt_out_type?: string;\n np?: string;\n predicted_ltv?: string;\n}\n\nexport interface ContentItem {\n id?: string;\n item_name?: string;\n item_category?: string;\n item_brand?: string;\n item_price?: string;\n quantity?: number;\n}\n\nexport interface RequestBody {\n data: ConversionEvent[];\n}\n\nexport interface ResponseBody {\n num_events_received: number;\n num_events_processed: number;\n events: Array<{\n status: string;\n error_message?: string;\n warning_message?: string;\n }>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,SAAS,UACd,gBAA+B,CAAC,GAChC,QACQ;AACR,QAAM,WAAY,cAAc,YAAY,CAAC;AAC7C,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AACpE,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AAEpE,QAAM,iBAA2B;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,eAAe,UAAU,eAAe;AACtD;;;ACnBA,IAAAA,eAA0C;AAC1C,IAAAC,sBAA2B;;;ACD3B,kBAA4C;AAC5C,yBAA8B;AAE9B,IAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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aAAa,UAAU,KAAK,UAAU,IAAI,GAAG;AAAA,IAChE,SAAS,EAAE,eAAe,UAAU,WAAW,GAAG;AAAA,EACpD,CAAC;AAED,SAAO,MAAM,0BAA0B;AAAA,IACrC,QAAI,uBAAS,MAAM,IAAI,OAAO,KAAK;AAAA,EACrC,CAAC;AAED,UAAI,uBAAS,MAAM,KAAK,OAAO,OAAO,OAAO;AAC3C,WAAO,MAAM,wBAAwB,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,EAC/D;AACF;;;AElGA;;;AJOO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,eAAe,OAAO,GAAG;AAC5C,UAAM,SAAS,UAAU,eAAe,MAAM;AAC9C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,SAAS;AACzB,WAAO,MAAM,KAAK,OAAO,OAAO;AAAA,EAClC;AACF;AAEA,IAAO,gBAAQ;","names":["import_core","import_server_core"]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{getMappingValue,isObject as isObject2}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";import{isArray,isObject,isString}from"@walkeros/core";import{getHashServer}from"@walkeros/server-core";var keysToHash=["em","ph","fn","ln","db","ge","ct","st","zp","country","external_id","hashed_maids"];function shouldBeHashed(key,doNotHash=[]){return keysToHash.includes(key)&&!doNotHash.includes(key)}async function processValue(value,shouldHash){return shouldHash?isArray(value)?Promise.all(value.map(item=>getHashServer(String(item)))):getHashServer(String(value)):value}var push=async function(event,{config:config,data:data,env:env,logger:logger}){const{accessToken:accessToken,adAccountId:adAccountId,action_source:action_source="web",doNotHash:doNotHash,test:test,url:url="https://api.pinterest.com/v5/",user_data:user_data,partner_name:partner_name}=config.settings,eventData=isObject2(data)?data:{},configData=config.data?await getMappingValue(event,config.data):{},userDataCustom=user_data?await getMappingValue(event,{map:user_data}):{},userData={...isObject2(configData)&&isObject2(configData.user_data)?configData.user_data:{},...isObject2(userDataCustom)?userDataCustom:{},...isObject2(eventData.user_data)?eventData.user_data:{}},{user_data:_ud,custom_data:eventCustomData,...restEventData}=eventData,serverEvent={event_name:event.name,event_id:event.id,event_time:Math.round((event.timestamp||Date.now())/1e3),action_source:action_source,...restEventData,user_data:userData};isObject2(eventCustomData)&&(serverEvent.custom_data=eventCustomData),"web"===action_source&&(serverEvent.event_source_url=event.source.id),partner_name&&(serverEvent.partner_name=partner_name);const hashedServerEvent=await async function(value,doNotHash=[]){if(!isObject(value))return value;const isUserData="user_data"in value,target=isUserData?value.user_data:value,result=(await Promise.all(Object.entries(target).map(async([k,v])=>[k,await processValue(v,isUserData&&shouldBeHashed(k,doNotHash))]))).reduce((acc,[k,v])=>(isString(k)&&(acc[k]=v),acc),{});return isUserData?{...value,user_data:result}:result}(serverEvent,doNotHash),body={data:[hashedServerEvent]},endpoint=`${url}ad_accounts/${adAccountId}/events${test?"?test=true":""}`;logger.debug("Calling Pinterest API",{endpoint:endpoint,method:"POST",eventName:serverEvent.event_name,eventId:serverEvent.event_id});const sendServerFn=(null==env?void 0:env.sendServer)||sendServer,result=await sendServerFn(endpoint,JSON.stringify(body),{headers:{Authorization:`Bearer ${accessToken}`}});logger.debug("Pinterest API response",{ok:!isObject2(result)||result.ok}),isObject2(result)&&!1===result.ok&&logger.throw(`Pinterest API error: ${JSON.stringify(result)}`)},types_exports={},destinationPinterest={type:"pinterest",config:{},async init({config:partialConfig,logger:logger}){const config=function(partialConfig={},logger){const settings=partialConfig.settings||{},{accessToken:accessToken,adAccountId:adAccountId}=settings;accessToken||logger.throw("Config settings accessToken missing"),adAccountId||logger.throw("Config settings adAccountId missing");const settingsConfig={...settings,accessToken:accessToken,adAccountId:adAccountId};return{...partialConfig,settings:settingsConfig}}(partialConfig,logger);return config},push:async(event,context)=>await push(event,context)},index_default=destinationPinterest;export{types_exports as DestinationPinterest,index_default as default,destinationPinterest};//# sourceMappingURL=index.mjs.map
1
+ import{getMappingValue,isObject as isObject2}from"@walkeros/core";import{sendServer}from"@walkeros/server-core";import{isArray,isObject,isString}from"@walkeros/core";import{getHashServer}from"@walkeros/server-core";var keysToHash=["em","ph","fn","ln","db","ge","ct","st","zp","country","external_id","hashed_maids"];function shouldBeHashed(key,doNotHash=[]){return keysToHash.includes(key)&&!doNotHash.includes(key)}async function processValue(value,shouldHash){return shouldHash?isArray(value)?Promise.all(value.map(item=>getHashServer(String(item)))):getHashServer(String(value)):value}var push=async function(event,{config:config,data:data,env:env,logger:logger}){const{accessToken:accessToken,adAccountId:adAccountId,action_source:action_source="web",doNotHash:doNotHash,test:test,url:url="https://api.pinterest.com/v5/",user_data:user_data,partner_name:partner_name}=config.settings,eventData=isObject2(data)?data:{},configData=config.data?await getMappingValue(event,config.data):{},userDataCustom=user_data?await getMappingValue(event,{map:user_data}):{},userData={...isObject2(configData)&&isObject2(configData.user_data)?configData.user_data:{},...isObject2(userDataCustom)?userDataCustom:{},...isObject2(eventData.user_data)?eventData.user_data:{}},{user_data:_ud,custom_data:eventCustomData,...restEventData}=eventData,serverEvent={event_name:event.name,event_id:event.id,event_time:Math.round((event.timestamp||Date.now())/1e3),action_source:action_source,...restEventData,user_data:userData};isObject2(eventCustomData)&&(serverEvent.custom_data=eventCustomData),"web"===action_source&&event.source?.url&&(serverEvent.event_source_url=event.source.url),partner_name&&(serverEvent.partner_name=partner_name);const hashedServerEvent=await async function(value,doNotHash=[]){if(!isObject(value))return value;const isUserData="user_data"in value,target=isUserData?value.user_data:value,result=(await Promise.all(Object.entries(target).map(async([k,v])=>[k,await processValue(v,isUserData&&shouldBeHashed(k,doNotHash))]))).reduce((acc,[k,v])=>(isString(k)&&(acc[k]=v),acc),{});return isUserData?{...value,user_data:result}:result}(serverEvent,doNotHash),body={data:[hashedServerEvent]},endpoint=`${url}ad_accounts/${adAccountId}/events${test?"?test=true":""}`;logger.debug("Calling Pinterest API",{endpoint:endpoint,method:"POST",eventName:serverEvent.event_name,eventId:serverEvent.event_id});const sendServerFn=env?.sendServer||sendServer,result=await sendServerFn(endpoint,JSON.stringify(body),{headers:{Authorization:`Bearer ${accessToken}`}});logger.debug("Pinterest API response",{ok:!isObject2(result)||result.ok}),isObject2(result)&&!1===result.ok&&logger.throw(`Pinterest API error: ${JSON.stringify(result)}`)},types_exports={},destinationPinterest={type:"pinterest",config:{},async init({config:partialConfig,logger:logger}){const config=function(partialConfig={},logger){const settings=partialConfig.settings||{},{accessToken:accessToken,adAccountId:adAccountId}=settings;accessToken||logger.throw("Config settings accessToken missing"),adAccountId||logger.throw("Config settings adAccountId missing");const settingsConfig={...settings,accessToken:accessToken,adAccountId:adAccountId};return{...partialConfig,settings:settingsConfig}}(partialConfig,logger);return config},push:async(event,context)=>await push(event,context)},index_default=destinationPinterest;export{types_exports as DestinationPinterest,index_default as default,destinationPinterest};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts","../src/push.ts","../src/hash.ts","../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { Config, Settings, PartialConfig } from './types';\nimport type { Logger } from '@walkeros/core';\n\nexport function getConfig(\n partialConfig: PartialConfig = {},\n logger: Logger.Instance,\n): Config {\n const settings = (partialConfig.settings || {}) as Partial<Settings>;\n const { accessToken, adAccountId } = settings;\n\n if (!accessToken) logger.throw('Config settings accessToken missing');\n if (!adAccountId) logger.throw('Config settings adAccountId missing');\n\n const settingsConfig: Settings = {\n ...settings,\n accessToken,\n adAccountId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { ConversionEvent, PushFn, RequestBody, UserData } from './types';\nimport { getMappingValue, isObject } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\nimport { hashEvent } from './hash';\n\nexport const push: PushFn = async function (\n event,\n { config, data, env, logger },\n) {\n const {\n accessToken,\n adAccountId,\n action_source = 'web',\n doNotHash,\n test,\n url = 'https://api.pinterest.com/v5/',\n user_data,\n partner_name,\n } = config.settings!;\n\n const eventData = isObject(data) ? data : {};\n const configData = config.data\n ? await getMappingValue(event, config.data)\n : {};\n const userDataCustom = user_data\n ? await getMappingValue(event, { map: user_data })\n : {};\n\n // Merge user_data from config.data, settings.user_data, and event mapping\n const userData: UserData = {\n // Destination config\n ...(isObject(configData) && isObject(configData.user_data)\n ? configData.user_data\n : {}),\n // Custom user_data from settings\n ...(isObject(userDataCustom) ? userDataCustom : {}),\n // Event mapping\n ...(isObject(eventData.user_data) ? eventData.user_data : {}),\n };\n\n // Extract custom_data and user_data from eventData, leave the rest\n const {\n user_data: _ud,\n custom_data: eventCustomData,\n ...restEventData\n } = eventData;\n\n const serverEvent: ConversionEvent = {\n event_name: event.name,\n event_id: event.id,\n event_time: Math.round((event.timestamp || Date.now()) / 1000),\n action_source,\n ...restEventData,\n user_data: userData,\n };\n\n // Nest custom_data from mapping\n if (isObject(eventCustomData)) {\n serverEvent.custom_data = eventCustomData as ConversionEvent['custom_data'];\n }\n\n // Set event_source_url for web events\n if (action_source === 'web') {\n serverEvent.event_source_url = event.source.id;\n }\n\n // Add partner_name from settings\n if (partner_name) {\n serverEvent.partner_name = partner_name;\n }\n\n const hashedServerEvent = await hashEvent(serverEvent, doNotHash);\n\n const body: RequestBody = { data: [hashedServerEvent] };\n\n // Build endpoint URL\n const testParam = test ? '?test=true' : '';\n const endpoint = `${url}ad_accounts/${adAccountId}/events${testParam}`;\n\n logger.debug('Calling Pinterest API', {\n endpoint,\n method: 'POST',\n eventName: serverEvent.event_name,\n eventId: serverEvent.event_id,\n });\n\n const sendServerFn = env?.sendServer || sendServer;\n const result = await sendServerFn(endpoint, JSON.stringify(body), {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n logger.debug('Pinterest API response', {\n ok: isObject(result) ? result.ok : true,\n });\n\n if (isObject(result) && result.ok === false) {\n logger.throw(`Pinterest API error: ${JSON.stringify(result)}`);\n }\n};\n","import { WalkerOS } from '@walkeros/core';\nimport { isArray, isObject, isString } from '@walkeros/core';\nimport { getHashServer } from '@walkeros/server-core';\n\nconst keysToHash = [\n 'em',\n 'ph',\n 'fn',\n 'ln',\n 'db',\n 'ge',\n 'ct',\n 'st',\n 'zp',\n 'country',\n 'external_id',\n 'hashed_maids',\n];\n\nfunction shouldBeHashed(key: string, doNotHash: string[] = []): boolean {\n return keysToHash.includes(key) && !doNotHash.includes(key);\n}\n\ntype HashableValue = WalkerOS.AnyObject | unknown | unknown[];\n\nasync function processValue(\n value: unknown,\n shouldHash: boolean,\n): Promise<unknown> {\n if (!shouldHash) return value;\n if (isArray(value)) {\n return Promise.all(value.map((item) => getHashServer(String(item))));\n }\n return getHashServer(String(value));\n}\n\nexport async function hashEvent<T extends HashableValue>(\n value: T,\n doNotHash: string[] = [],\n): Promise<T> {\n if (!isObject(value)) return value;\n\n const isUserData = 'user_data' in value;\n const target = (isUserData ? value.user_data : value) as WalkerOS.AnyObject;\n\n const entries = await Promise.all(\n Object.entries(target).map(async ([k, v]) => [\n k,\n await processValue(v, isUserData && shouldBeHashed(k, doNotHash)),\n ]),\n );\n\n const result = entries.reduce((acc, [k, v]) => {\n if (isString(k)) acc[k] = v;\n return acc;\n }, {} as WalkerOS.AnyObject);\n\n return isUserData ? { ...value, user_data: result } : (result as T);\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n accessToken: string;\n adAccountId: string;\n action_source?: ActionSource;\n doNotHash?: string[];\n test?: boolean;\n url?: string;\n user_data?: WalkerOSMapping.Map;\n partner_name?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport interface Destination extends DestinationServer.Destination<Types> {\n init: DestinationServer.InitFn<Types>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Types>;\n\nexport type InitFn = DestinationServer.InitFn<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Types>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\n// Pinterest Conversions API types\n// https://developers.pinterest.com/docs/conversions/conversions/\n\nexport type ActionSource = 'app_android' | 'app_ios' | 'web' | 'offline';\n\nexport type EventName =\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 | string;\n\nexport interface ConversionEvent {\n // Required\n event_name: EventName;\n event_time: number;\n event_id: string;\n action_source: ActionSource;\n user_data: UserData;\n\n // Optional\n event_source_url?: string;\n opt_out?: boolean;\n partner_name?: string;\n app_id?: string;\n app_name?: string;\n app_version?: string;\n device_brand?: string;\n device_carrier?: string;\n device_model?: string;\n device_type?: string;\n os_version?: string;\n language?: string;\n wifi?: boolean;\n custom_data?: CustomData;\n}\n\nexport interface UserData {\n // Hashable fields (SHA-256, arrays)\n em?: string[];\n ph?: string[];\n fn?: string[];\n ln?: string[];\n db?: string[];\n ge?: string[];\n ct?: string[];\n st?: string[];\n zp?: string[];\n country?: string[];\n external_id?: string[];\n hashed_maids?: string[];\n\n // Pass-through fields (do NOT hash)\n client_ip_address?: string;\n client_user_agent?: string;\n click_id?: string;\n partner_id?: string;\n}\n\nexport interface CustomData {\n currency?: string;\n value?: string;\n content_ids?: string[];\n content_name?: string;\n content_category?: string;\n content_brand?: string;\n contents?: ContentItem[];\n num_items?: number;\n order_id?: string;\n search_string?: string;\n opt_out_type?: string;\n np?: string;\n predicted_ltv?: string;\n}\n\nexport interface ContentItem {\n id?: string;\n item_name?: string;\n item_category?: string;\n item_brand?: string;\n item_price?: string;\n quantity?: number;\n}\n\nexport interface RequestBody {\n data: ConversionEvent[];\n}\n\nexport interface ResponseBody {\n num_events_received: number;\n num_events_processed: number;\n events: Array<{\n status: string;\n error_message?: string;\n warning_message?: string;\n }>;\n}\n","import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationPinterest from './types';\n\nexport const destinationPinterest: Destination = {\n type: 'pinterest',\n\n config: {},\n\n async init({ config: partialConfig, logger }) {\n const config = getConfig(partialConfig, logger);\n return config;\n },\n\n async push(event, context) {\n return await push(event, context);\n },\n};\n\nexport default destinationPinterest;\n"],"mappings":";AAGO,SAAS,UACd,gBAA+B,CAAC,GAChC,QACQ;AACR,QAAM,WAAY,cAAc,YAAY,CAAC;AAC7C,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AACpE,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AAEpE,QAAM,iBAA2B;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,eAAe,UAAU,eAAe;AACtD;;;ACnBA,SAAS,iBAAiB,YAAAA,iBAAgB;AAC1C,SAAS,kBAAkB;;;ACD3B,SAAS,SAAS,UAAU,gBAAgB;AAC5C,SAAS,qBAAqB;AAE9B,IAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,eAAe,KAAa,YAAsB,CAAC,GAAY;AACtE,SAAO,WAAW,SAAS,GAAG,KAAK,CAAC,UAAU,SAAS,GAAG;AAC5D;AAIA,eAAe,aACb,OACA,YACkB;AAClB,MA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S,MAAM,KAAK,OAAO,OAAO,OAAO;AAC3C,WAAO,MAAM,wBAAwB,KAAK,UAAU,MAAM,CAAC,EAAE;AAAA,EAC/D;AACF;;;AElGA;;;ACOO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,eAAe,OAAO,GAAG;AAC5C,UAAM,SAAS,UAAU,eAAe,MAAM;AAC9C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,SAAS;AACzB,WAAO,MAAM,KAAK,OAAO,OAAO;AAAA,EAClC;AACF;AAEA,IAAO,gBAAQ;","names":["isObject","isObject"]}
1
+ {"version":3,"sources":["../src/config.ts","../src/push.ts","../src/hash.ts","../src/types/index.ts","../src/index.ts"],"sourcesContent":["import type { Config, Settings, PartialConfig } from './types';\nimport type { Logger } from '@walkeros/core';\n\nexport function getConfig(\n partialConfig: PartialConfig = {},\n logger: Logger.Instance,\n): Config {\n const settings = (partialConfig.settings || {}) as Partial<Settings>;\n const { accessToken, adAccountId } = settings;\n\n if (!accessToken) logger.throw('Config settings accessToken missing');\n if (!adAccountId) logger.throw('Config settings adAccountId missing');\n\n const settingsConfig: Settings = {\n ...settings,\n accessToken,\n adAccountId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { ConversionEvent, PushFn, RequestBody, UserData } from './types';\nimport { getMappingValue, isObject } from '@walkeros/core';\nimport { sendServer } from '@walkeros/server-core';\nimport { hashEvent } from './hash';\n\nexport const push: PushFn = async function (\n event,\n { config, data, env, logger },\n) {\n const {\n accessToken,\n adAccountId,\n action_source = 'web',\n doNotHash,\n test,\n url = 'https://api.pinterest.com/v5/',\n user_data,\n partner_name,\n } = config.settings!;\n\n const eventData = isObject(data) ? data : {};\n const configData = config.data\n ? await getMappingValue(event, config.data)\n : {};\n const userDataCustom = user_data\n ? await getMappingValue(event, { map: user_data })\n : {};\n\n // Merge user_data from config.data, settings.user_data, and event mapping\n const userData: UserData = {\n // Destination config\n ...(isObject(configData) && isObject(configData.user_data)\n ? configData.user_data\n : {}),\n // Custom user_data from settings\n ...(isObject(userDataCustom) ? userDataCustom : {}),\n // Event mapping\n ...(isObject(eventData.user_data) ? eventData.user_data : {}),\n };\n\n // Extract custom_data and user_data from eventData, leave the rest\n const {\n user_data: _ud,\n custom_data: eventCustomData,\n ...restEventData\n } = eventData;\n\n const serverEvent: ConversionEvent = {\n event_name: event.name,\n event_id: event.id,\n event_time: Math.round((event.timestamp || Date.now()) / 1000),\n action_source,\n ...restEventData,\n user_data: userData,\n };\n\n // Nest custom_data from mapping\n if (isObject(eventCustomData)) {\n serverEvent.custom_data = eventCustomData as ConversionEvent['custom_data'];\n }\n\n // Set event_source_url for web events\n if (action_source === 'web' && event.source?.url) {\n serverEvent.event_source_url = event.source.url;\n }\n\n // Add partner_name from settings\n if (partner_name) {\n serverEvent.partner_name = partner_name;\n }\n\n const hashedServerEvent = await hashEvent(serverEvent, doNotHash);\n\n const body: RequestBody = { data: [hashedServerEvent] };\n\n // Build endpoint URL\n const testParam = test ? '?test=true' : '';\n const endpoint = `${url}ad_accounts/${adAccountId}/events${testParam}`;\n\n logger.debug('Calling Pinterest API', {\n endpoint,\n method: 'POST',\n eventName: serverEvent.event_name,\n eventId: serverEvent.event_id,\n });\n\n const sendServerFn = env?.sendServer || sendServer;\n const result = await sendServerFn(endpoint, JSON.stringify(body), {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n logger.debug('Pinterest API response', {\n ok: isObject(result) ? result.ok : true,\n });\n\n if (isObject(result) && result.ok === false) {\n logger.throw(`Pinterest API error: ${JSON.stringify(result)}`);\n }\n};\n","import { WalkerOS } from '@walkeros/core';\nimport { isArray, isObject, isString } from '@walkeros/core';\nimport { getHashServer } from '@walkeros/server-core';\n\nconst keysToHash = [\n 'em',\n 'ph',\n 'fn',\n 'ln',\n 'db',\n 'ge',\n 'ct',\n 'st',\n 'zp',\n 'country',\n 'external_id',\n 'hashed_maids',\n];\n\nfunction shouldBeHashed(key: string, doNotHash: string[] = []): boolean {\n return keysToHash.includes(key) && !doNotHash.includes(key);\n}\n\ntype HashableValue = WalkerOS.AnyObject | unknown | unknown[];\n\nasync function processValue(\n value: unknown,\n shouldHash: boolean,\n): Promise<unknown> {\n if (!shouldHash) return value;\n if (isArray(value)) {\n return Promise.all(value.map((item) => getHashServer(String(item))));\n }\n return getHashServer(String(value));\n}\n\nexport async function hashEvent<T extends HashableValue>(\n value: T,\n doNotHash: string[] = [],\n): Promise<T> {\n if (!isObject(value)) return value;\n\n const isUserData = 'user_data' in value;\n const target = (isUserData ? value.user_data : value) as WalkerOS.AnyObject;\n\n const entries = await Promise.all(\n Object.entries(target).map(async ([k, v]) => [\n k,\n await processValue(v, isUserData && shouldBeHashed(k, doNotHash)),\n ]),\n );\n\n const result = entries.reduce((acc, [k, v]) => {\n if (isString(k)) acc[k] = v;\n return acc;\n }, {} as WalkerOS.AnyObject);\n\n return isUserData ? { ...value, user_data: result } : (result as T);\n}\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationServer, sendServer } from '@walkeros/server-core';\n\nexport interface Settings {\n accessToken: string;\n adAccountId: string;\n action_source?: ActionSource;\n doNotHash?: string[];\n test?: boolean;\n url?: string;\n user_data?: WalkerOSMapping.Map;\n partner_name?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationServer.Env {\n sendServer?: typeof sendServer;\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport interface Destination extends DestinationServer.Destination<Types> {\n init: DestinationServer.InitFn<Types>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Types>;\n\nexport type InitFn = DestinationServer.InitFn<Types>;\nexport type PushFn = DestinationServer.PushFn<Types>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Types>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\n// Pinterest Conversions API types\n// https://developers.pinterest.com/docs/conversions/conversions/\n\nexport type ActionSource = 'app_android' | 'app_ios' | 'web' | 'offline';\n\nexport type EventName =\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 | string;\n\nexport interface ConversionEvent {\n // Required\n event_name: EventName;\n event_time: number;\n event_id: string;\n action_source: ActionSource;\n user_data: UserData;\n\n // Optional\n event_source_url?: string;\n opt_out?: boolean;\n partner_name?: string;\n app_id?: string;\n app_name?: string;\n app_version?: string;\n device_brand?: string;\n device_carrier?: string;\n device_model?: string;\n device_type?: string;\n os_version?: string;\n language?: string;\n wifi?: boolean;\n custom_data?: CustomData;\n}\n\nexport interface UserData {\n // Hashable fields (SHA-256, arrays)\n em?: string[];\n ph?: string[];\n fn?: string[];\n ln?: string[];\n db?: string[];\n ge?: string[];\n ct?: string[];\n st?: string[];\n zp?: string[];\n country?: string[];\n external_id?: string[];\n hashed_maids?: string[];\n\n // Pass-through fields (do NOT hash)\n client_ip_address?: string;\n client_user_agent?: string;\n click_id?: string;\n partner_id?: string;\n}\n\nexport interface CustomData {\n currency?: string;\n value?: string;\n content_ids?: string[];\n content_name?: string;\n content_category?: string;\n content_brand?: string;\n contents?: ContentItem[];\n num_items?: number;\n order_id?: string;\n search_string?: string;\n opt_out_type?: string;\n np?: string;\n predicted_ltv?: string;\n}\n\nexport interface ContentItem {\n id?: string;\n item_name?: string;\n item_category?: string;\n item_brand?: string;\n item_price?: string;\n quantity?: number;\n}\n\nexport interface RequestBody {\n data: ConversionEvent[];\n}\n\nexport interface ResponseBody {\n num_events_received: number;\n num_events_processed: number;\n events: Array<{\n status: string;\n error_message?: string;\n warning_message?: string;\n }>;\n}\n","import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationPinterest from './types';\n\nexport const destinationPinterest: Destination = {\n type: 'pinterest',\n\n config: {},\n\n async init({ config: partialConfig, logger }) {\n const config = getConfig(partialConfig, logger);\n return config;\n },\n\n async push(event, context) {\n return await push(event, context);\n },\n};\n\nexport default destinationPinterest;\n"],"mappings":";AAGO,SAAS,UACd,gBAA+B,CAAC,GAChC,QACQ;AACR,QAAM,WAAY,cAAc,YAAY,CAAC;AAC7C,QAAM,EAAE,aAAa,YAAY,IAAI;AAErC,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AACpE,MAAI,CAAC,YAAa,QAAO,MAAM,qCAAqC;AAEpE,QAAM,iBAA2B;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AAEA,SAAO,EAAE,GAAG,eAAe,UAAU,eAAe;AACtD;;;ACnBA,SAAS,iBAAiB,YAAAA,iBAAgB;AAC1C,SAAS,kBAAkB;;;ACD3B,SAAS,SAAS,UAAU,gBAAgB;AAC5C,SAAS,qBAAqB;AAE9B,IAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,eAAe,KAAa,YAAsB,CAAC,GAAY;AACtE,SAAO,WAAW,SAAS,GAAG,KAAK,CAAC,UAAU,SAAS,GAAG;AAC5D;AAIA,eAAe,aACb,OACA,YACkB;AAClB,MAAI,CAAC,WAAY,QAAO;AACxB,MAAI,QAAQ,KAAK,GAAG;AAClB,WAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,SAAS,cAAc,OAAO,IAA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;AACF;;;AElGA;;;ACOO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,eAAe,OAAO,GAAG;AAC5C,UAAM,SAAS,UAAU,eAAe,MAAM;AAC9C,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,SAAS;AACzB,WAAO,MAAM,KAAK,OAAO,OAAO;AAAA,EAClC;AACF;AAEA,IAAO,gBAAQ;","names":["isObject","isObject"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-pinterest",
4
- "version": "3.4.2",
4
+ "version": "4.0.0-next-1777463920154",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -120,22 +120,16 @@
120
120
  "consent": {
121
121
  "functional": true
122
122
  },
123
- "id": "1700000901-gr0up-1",
123
+ "id": "a1b2c3d4e5f60002",
124
124
  "trigger": "click",
125
125
  "entity": "product",
126
126
  "action": "add",
127
127
  "timestamp": 1700000901,
128
128
  "timing": 3.14,
129
- "group": "gr0up",
130
- "count": 1,
131
- "version": {
132
- "source": "3.4.2",
133
- "tagging": 1
134
- },
135
129
  "source": {
136
- "type": "server",
137
- "id": "https://shop.example.com/products",
138
- "previous_id": ""
130
+ "type": "browser",
131
+ "platform": "web",
132
+ "url": "https://shop.example.com/products"
139
133
  }
140
134
  },
141
135
  "mapping": {
@@ -172,7 +166,7 @@
172
166
  [
173
167
  "sendServer",
174
168
  "https://api.pinterest.com/v5/ad_accounts/123456789/events",
175
- "{\"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\"}]}",
169
+ "{\"data\":[{\"event_name\":\"add_to_cart\",\"event_id\":\"a1b2c3d4e5f60002\",\"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\"}]}",
176
170
  {
177
171
  "headers": {
178
172
  "Authorization": "Bearer s3cr3t"
@@ -221,22 +215,16 @@
221
215
  "consent": {
222
216
  "functional": true
223
217
  },
224
- "id": "1700000900-gr0up-1",
218
+ "id": "a1b2c3d4e5f60001",
225
219
  "trigger": "load",
226
220
  "entity": "order",
227
221
  "action": "complete",
228
222
  "timestamp": 1700000900,
229
223
  "timing": 3.14,
230
- "group": "gr0up",
231
- "count": 1,
232
- "version": {
233
- "source": "3.4.2",
234
- "tagging": 1
235
- },
236
224
  "source": {
237
- "type": "server",
238
- "id": "https://shop.example.com",
239
- "previous_id": ""
225
+ "type": "browser",
226
+ "platform": "web",
227
+ "url": "https://shop.example.com"
240
228
  }
241
229
  },
242
230
  "mapping": {
@@ -261,7 +249,7 @@
261
249
  "nested",
262
250
  {
263
251
  "condition": {
264
- "$code": "e=>w(e)&&\"product\"===e.entity"
252
+ "$code": "e=>b(e)&&\"product\"===e.entity"
265
253
  },
266
254
  "map": {
267
255
  "id": "data.id",
@@ -284,7 +272,7 @@
284
272
  [
285
273
  "sendServer",
286
274
  "https://api.pinterest.com/v5/ad_accounts/123456789/events",
287
- "{\"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\"}]}",
275
+ "{\"data\":[{\"event_name\":\"checkout\",\"event_id\":\"a1b2c3d4e5f60001\",\"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\"}]}",
288
276
  {
289
277
  "headers": {
290
278
  "Authorization": "Bearer s3cr3t"
@@ -326,35 +314,22 @@
326
314
  "entity": "child",
327
315
  "data": {
328
316
  "is": "subordinated"
329
- },
330
- "nested": [],
331
- "context": {
332
- "element": [
333
- "child",
334
- 0
335
- ]
336
317
  }
337
318
  }
338
319
  ],
339
320
  "consent": {
340
321
  "functional": true
341
322
  },
342
- "id": "1700000902-gr0up-1",
323
+ "id": "a1b2c3d4e5f60003",
343
324
  "trigger": "load",
344
325
  "entity": "page",
345
326
  "action": "view",
346
327
  "timestamp": 1700000902,
347
328
  "timing": 3.14,
348
- "group": "gr0up",
349
- "count": 1,
350
- "version": {
351
- "source": "3.4.2",
352
- "tagging": 1
353
- },
354
329
  "source": {
355
- "type": "server",
356
- "id": "https://www.example.com/docs/",
357
- "previous_id": ""
330
+ "type": "browser",
331
+ "platform": "web",
332
+ "url": "https://www.example.com/docs/"
358
333
  }
359
334
  },
360
335
  "mapping": {
@@ -364,7 +339,7 @@
364
339
  [
365
340
  "sendServer",
366
341
  "https://api.pinterest.com/v5/ad_accounts/123456789/events",
367
- "{\"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/\"}]}",
342
+ "{\"data\":[{\"event_name\":\"page_visit\",\"event_id\":\"a1b2c3d4e5f60003\",\"event_time\":1700001,\"action_source\":\"web\",\"user_data\":{},\"event_source_url\":\"https://www.example.com/docs/\"}]}",
368
343
  {
369
344
  "headers": {
370
345
  "Authorization": "Bearer s3cr3t"
@@ -401,35 +376,22 @@
401
376
  "entity": "child",
402
377
  "data": {
403
378
  "is": "subordinated"
404
- },
405
- "nested": [],
406
- "context": {
407
- "element": [
408
- "child",
409
- 0
410
- ]
411
379
  }
412
380
  }
413
381
  ],
414
382
  "consent": {
415
383
  "functional": true
416
384
  },
417
- "id": "1700000903-gr0up-1",
385
+ "id": "a1b2c3d4e5f60004",
418
386
  "trigger": "test",
419
387
  "entity": "entity",
420
388
  "action": "action",
421
389
  "timestamp": 1700000903,
422
390
  "timing": 3.14,
423
- "group": "gr0up",
424
- "count": 1,
425
- "version": {
426
- "source": "3.4.2",
427
- "tagging": 1
428
- },
429
391
  "source": {
430
- "type": "server",
431
- "id": "https://www.example.com/search",
432
- "previous_id": ""
392
+ "type": "browser",
393
+ "platform": "web",
394
+ "url": "https://www.example.com/search"
433
395
  }
434
396
  },
435
397
  "mapping": {
@@ -448,7 +410,7 @@
448
410
  [
449
411
  "sendServer",
450
412
  "https://api.pinterest.com/v5/ad_accounts/123456789/events",
451
- "{\"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\"}]}",
413
+ "{\"data\":[{\"event_name\":\"search\",\"event_id\":\"a1b2c3d4e5f60004\",\"event_time\":1700001,\"action_source\":\"web\",\"user_data\":{},\"custom_data\":{\"search_string\":\"walkerOS destinations\"},\"event_source_url\":\"https://www.example.com/search\"}]}",
452
414
  {
453
415
  "headers": {
454
416
  "Authorization": "Bearer s3cr3t"
@@ -486,35 +448,22 @@
486
448
  "entity": "child",
487
449
  "data": {
488
450
  "is": "subordinated"
489
- },
490
- "nested": [],
491
- "context": {
492
- "element": [
493
- "child",
494
- 0
495
- ]
496
451
  }
497
452
  }
498
453
  ],
499
454
  "consent": {
500
455
  "functional": true
501
456
  },
502
- "id": "1700000904-gr0up-1",
457
+ "id": "a1b2c3d4e5f60005",
503
458
  "trigger": "test",
504
459
  "entity": "entity",
505
460
  "action": "action",
506
461
  "timestamp": 1700000904,
507
462
  "timing": 3.14,
508
- "group": "gr0up",
509
- "count": 1,
510
- "version": {
511
- "source": "3.4.2",
512
- "tagging": 1
513
- },
514
463
  "source": {
515
- "type": "server",
516
- "id": "https://www.example.com/register",
517
- "previous_id": ""
464
+ "type": "browser",
465
+ "platform": "web",
466
+ "url": "https://www.example.com/register"
518
467
  }
519
468
  },
520
469
  "mapping": {
@@ -542,7 +491,7 @@
542
491
  [
543
492
  "sendServer",
544
493
  "https://api.pinterest.com/v5/ad_accounts/123456789/events",
545
- "{\"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\"}]}",
494
+ "{\"data\":[{\"event_name\":\"signup\",\"event_id\":\"a1b2c3d4e5f60005\",\"event_time\":1700001,\"action_source\":\"web\",\"user_data\":{\"em\":[\"f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716\"],\"external_id\":[\"b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde\"]},\"event_source_url\":\"https://www.example.com/register\"}]}",
546
495
  {
547
496
  "headers": {
548
497
  "Authorization": "Bearer s3cr3t"
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.2",
4
+ "version": "4.0.0-next-1777463920154",
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.2",
38
- "@walkeros/server-core": "3.4.2"
37
+ "@walkeros/core": "4.0.0-next-1777463920154",
38
+ "@walkeros/server-core": "4.0.0-next-1777463920154"
39
39
  },
40
40
  "devDependencies": {
41
- "@walkeros/collector": "3.4.2"
41
+ "@walkeros/collector": "4.0.0-next-1777463920154"
42
42
  },
43
43
  "repository": {
44
44
  "url": "git+https://github.com/elbwalker/walkerOS.git",