@walkeros/server-destination-pinterest 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +132 -95
- package/dist/examples/index.mjs +132 -95
- package/dist/walkerOS.json +47 -99
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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:()=>
|
|
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:()=>h,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:()=>l,SettingsSchema:()=>_,mapping:()=>g,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)(_),g=(0,c.zodToSchema)(l),h={};n(h,{env:()=>y,step:()=>b});var y={};n(y,{push:()=>f,simulation:()=>w});var f={sendServer:async function(e,t,a){return{ok:!0,data:{num_events_received:1,num_events_processed:1,events:[{status:"processed"}]}}}},w=["sendServer"],b={};n(b,{addToCart:()=>O,checkout:()=>x,pageVisit:()=>q,search:()=>E,signup:()=>A});var k=require("@walkeros/core"),S="https://api.pinterest.com/v5/ad_accounts/123456789/events",z={headers:{Authorization:"Bearer s3cr3t"}},x={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]]},O={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]]},q={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]]},E={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]]},A={in:(0,k.getEvent)("entity action",{timestamp:1700000904,name:"user signup",data:{method:"email"},user:{id:"new-user-1",email:"new@example.com"},source:{type:"server",id:"https://www.example.com/register",previous_id:""}}),mapping:{name:"signup",data:{map:{user_data:{map:{em:{set:["user.email"]},external_id:{set:["user.id"]}}}}}},out:[["sendServer",S,JSON.stringify({data:[{event_name:"signup",event_id:"1700000904-gr0up-1",event_time:1700001,action_source:"web",user_data:{em:["f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"],external_id:["b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"]},event_source_url:"https://www.example.com/register"}]}),z]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const checkout: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'checkout',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'web',\n user_data: {\n external_id: ['user-123'],\n },\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 },\n ],\n },\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'add_to_cart',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://shop.example.com/products',\n action_source: 'web',\n user_data: {\n external_id: ['user-456'],\n },\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 },\n ],\n },\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: {\n data: [\n {\n event_name: 'page_visit',\n event_time: 1700000902,\n event_id: '1700000902-gr0up-1',\n event_source_url: 'https://www.example.com/docs/',\n action_source: 'web',\n user_data: {\n external_id: ['user-789'],\n },\n },\n ],\n },\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'search',\n event_time: 1700000903,\n event_id: '1700000903-gr0up-1',\n event_source_url: 'https://www.example.com/search',\n action_source: 'web',\n user_data: {\n external_id: ['user-101'],\n },\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n },\n ],\n },\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'signup',\n event_time: 1700000904,\n event_id: '1700000904-gr0up-1',\n event_source_url: 'https://www.example.com/register',\n action_source: 'web',\n user_data: {\n em: ['new@example.com'],\n external_id: ['new-user-1'],\n },\n },\n ],\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,aAAE,OAAO;AAAA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;AAAA,UACT,aAAa,CAAC,UAAU;AAAA,QAC1B;AAAA,QACA,aAAa;AAAA,UACX,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,SAA2B;AAAA,EACtC,QAAI,sBAAS,iBAAiB;AAAA,IAC5B,WAAW;AAAA,IACX,MAAM;AAAA,IACN,MAAM,EAAE,QAAQ,QAAQ;AAAA,IACxB,MAAM,EAAE,IAAI,cAAc,OAAO,kBAAkB;AAAA,IACnD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,IACf;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,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,WAAW;AAAA,UACT,IAAI,CAAC,iBAAiB;AAAA,UACtB,aAAa,CAAC,YAAY;AAAA,QAC5B;AAAA,MACF;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 in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAA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F;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 r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{ActionSourceSchema:()=>s,EventNameSchema:()=>o,MappingSchema:()=>p,SettingsSchema:()=>
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{ActionSourceSchema:()=>s,EventNameSchema:()=>o,MappingSchema:()=>p,SettingsSchema:()=>d,mapping:()=>m,settings:()=>u});import{zodToSchema as r}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var s=n.enum(["app_android","app_ios","web","offline"]),o=n.union([n.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"]),n.string()]),d=i.object({accessToken:i.string().min(1).describe("Pinterest conversion access token for Bearer authentication (like pina_ABC123...)"),adAccountId:i.string().regex(/^[0-9]+$/,"Ad account ID must contain only digits").describe("Pinterest ad account ID from Ads Manager (like 123456789)"),action_source:s.describe("Source of the event (web, app_android, app_ios, offline) (like web)").optional(),doNotHash:i.array(i.string()).describe("Array of user_data fields that should not be hashed (like ['external_id'])").optional(),test:i.boolean().describe("Enable test mode by appending ?test=true to the API URL (like true)").optional(),url:i.string().url().describe("Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)").optional(),user_data:i.record(i.string(),i.string()).describe("Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })").optional(),partner_name:i.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=r(d),m=r(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:()=>R});import{getEvent as y,isObject as f}from"@walkeros/core";var w="https://api.pinterest.com/v5/ad_accounts/123456789/events",b={headers:{Authorization:"Bearer s3cr3t"}},k={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=>f(e)&&"product"===e.entity,map:{id:"data.id",item_name:"data.name",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",w,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={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",w,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={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",w,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={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",w,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]]},R={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",w,JSON.stringify({data:[{event_name:"signup",event_id:"1700000904-gr0up-1",event_time:1700001,action_source:"web",user_data:{em:["f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"],external_id:["b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"]},event_source_url:"https://www.example.com/register"}]}),b]]};export{_ as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Pinterest conversion access token for Bearer authentication (like pina_ABC123...)',\n ),\n adAccountId: z\n .string()\n .regex(/^[0-9]+$/, 'Ad account ID must contain only digits')\n .describe('Pinterest ad account ID from Ads Manager (like 123456789)'),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (web, app_android, app_ios, offline) (like web)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['external_id'])\",\n )\n .optional(),\n test: z\n .boolean()\n .describe(\n 'Enable test mode by appending ?test=true to the API URL (like true)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Pinterest Conversions API endpoint (like https://api.pinterest.com/v5/)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { em: 'user.email', ph: 'user.phone' })\",\n )\n .optional(),\n partner_name: z\n .string()\n .describe('Third-party partner name for attribution (like ss-walkeros)')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.pinterest.com/docs/conversions/conversions/\n */\nexport const ActionSourceSchema = z.enum([\n 'app_android',\n 'app_ios',\n 'web',\n 'offline',\n]);\n\n/**\n * Event Name\n * Standard Pinterest CAPI event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'add_payment_info',\n 'add_to_cart',\n 'add_to_wishlist',\n 'app_install',\n 'app_open',\n 'checkout',\n 'contact',\n 'custom',\n 'customize_product',\n 'find_location',\n 'initiate_checkout',\n 'lead',\n 'page_visit',\n 'schedule',\n 'search',\n 'signup',\n 'start_trial',\n 'submit_application',\n 'subscribe',\n 'view_category',\n 'view_content',\n 'watch_video',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Pinterest Conversions API Mapping Schema\n * Pinterest CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Pinterest Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Pinterest API response\n return {\n ok: true,\n data: {\n num_events_received: 1,\n num_events_processed: 1,\n events: [{ status: 'processed' }],\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Pinterest Conversions API events without making\n * actual HTTP requests to Pinterest's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const checkout: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'checkout',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'web',\n user_data: {\n external_id: ['user-123'],\n },\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 },\n ],\n },\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'add_to_cart',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://shop.example.com/products',\n action_source: 'web',\n user_data: {\n external_id: ['user-456'],\n },\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 },\n ],\n },\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: {\n data: [\n {\n event_name: 'page_visit',\n event_time: 1700000902,\n event_id: '1700000902-gr0up-1',\n event_source_url: 'https://www.example.com/docs/',\n action_source: 'web',\n user_data: {\n external_id: ['user-789'],\n },\n },\n ],\n },\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'search',\n event_time: 1700000903,\n event_id: '1700000903-gr0up-1',\n event_source_url: 'https://www.example.com/search',\n action_source: 'web',\n user_data: {\n external_id: ['user-101'],\n },\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n },\n ],\n },\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'signup',\n event_time: 1700000904,\n event_id: '1700000904-gr0up-1',\n event_source_url: 'https://www.example.com/register',\n action_source: 'web',\n user_data: {\n em: ['new@example.com'],\n external_id: ['new-user-1'],\n },\n },\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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,EAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,aAAaA,GACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,aAAaA,GACV,OAAO,EACP,MAAM,YAAY,wCAAwC,EAC1D,SAAS,2DAA2D;AAAA,EACvE,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EAC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AAQ;AAAA,IACxB,MAAM,EAAE,IAAI,cAAc,OAAO,kBAAkB;AAAA,IACnD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,IACf;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,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,WAAW;AAAA,UACT,IAAI,CAAC,iBAAiB;AAAA,UACtB,aAAa,CAAC,YAAY;AAAA,QAC5B;AAAA,MACF;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 in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-A1',\n name: 'Everyday Ruck Snack',\n price: '129.99',\n quantity: 2,\n },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'checkout',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'checkout',\n event_id: '1700000900-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n num_items: 1,\n contents: [\n {\n id: 'SKU-A1',\n item_name: 'Everyday Ruck Snack',\n item_price: '129.99',\n quantity: 2,\n },\n ],\n },\n event_source_url: 'https://shop.example.com',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901,\n data: { id: 'SKU-B2', name: 'Cool Cap', price: '42.00', quantity: 1 },\n user: { id: 'user-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/products',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'add_to_cart',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n set: [\n {\n map: {\n id: 'data.id',\n item_name: 'data.name',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'add_to_cart',\n event_id: '1700000901-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n value: '42.00',\n currency: 'EUR',\n contents: [\n {\n id: 'SKU-B2',\n item_name: 'Cool Cap',\n item_price: '42.00',\n quantity: 1,\n },\n ],\n },\n event_source_url: 'https://shop.example.com/products',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const pageVisit: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902,\n user: { id: 'user-789' },\n source: {\n type: 'server',\n id: 'https://www.example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'page_visit',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page_visit',\n event_id: '1700000902-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n event_source_url: 'https://www.example.com/docs/',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const search: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000903,\n name: 'site search',\n data: { query: 'walkerOS destinations' },\n user: { id: 'user-101' },\n source: {\n type: 'server',\n id: 'https://www.example.com/search',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'search',\n data: {\n map: {\n custom_data: {\n map: {\n search_string: 'data.query',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'search',\n event_id: '1700000903-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {},\n custom_data: {\n search_string: 'walkerOS destinations',\n },\n event_source_url: 'https://www.example.com/search',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n\nexport const signup: Flow.StepExample = {\n in: getEvent('entity action', {\n timestamp: 1700000904,\n name: 'user signup',\n data: { method: 'email' },\n user: { id: 'new-user-1', email: 'new@example.com' },\n source: {\n type: 'server',\n id: 'https://www.example.com/register',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'signup',\n data: {\n map: {\n user_data: {\n map: {\n em: { set: ['user.email'] },\n external_id: { set: ['user.id'] },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'signup',\n event_id: '1700000904-gr0up-1',\n event_time: 1700001,\n action_source: 'web',\n user_data: {\n // sha256('new@example.com')\n em: [\n 'f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716',\n ],\n // sha256('new-user-1')\n external_id: [\n 'b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde',\n ],\n },\n event_source_url: 'https://www.example.com/register',\n },\n ],\n }),\n OPTIONS,\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,EAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,aAAaA,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AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -56,6 +56,10 @@ __export(step_exports, {
|
|
|
56
56
|
signup: () => signup
|
|
57
57
|
});
|
|
58
58
|
var import_core = require("@walkeros/core");
|
|
59
|
+
var ENDPOINT = "https://api.pinterest.com/v5/ad_accounts/123456789/events";
|
|
60
|
+
var OPTIONS = {
|
|
61
|
+
headers: { Authorization: "Bearer s3cr3t" }
|
|
62
|
+
};
|
|
59
63
|
var checkout = {
|
|
60
64
|
in: (0, import_core.getEvent)("order complete", {
|
|
61
65
|
timestamp: 1700000900,
|
|
@@ -107,34 +111,39 @@ var checkout = {
|
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
},
|
|
110
|
-
out:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
out: [
|
|
115
|
+
[
|
|
116
|
+
"sendServer",
|
|
117
|
+
ENDPOINT,
|
|
118
|
+
JSON.stringify({
|
|
119
|
+
data: [
|
|
120
|
+
{
|
|
121
|
+
event_name: "checkout",
|
|
122
|
+
event_id: "1700000900-gr0up-1",
|
|
123
|
+
event_time: 1700001,
|
|
124
|
+
action_source: "web",
|
|
125
|
+
user_data: {},
|
|
126
|
+
custom_data: {
|
|
127
|
+
value: 249.99,
|
|
128
|
+
currency: "EUR",
|
|
129
|
+
order_id: "ORD-300",
|
|
130
|
+
num_items: 1,
|
|
131
|
+
contents: [
|
|
132
|
+
{
|
|
133
|
+
id: "SKU-A1",
|
|
134
|
+
item_name: "Everyday Ruck Snack",
|
|
135
|
+
item_price: "129.99",
|
|
136
|
+
quantity: 2
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
event_source_url: "https://shop.example.com"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
OPTIONS
|
|
136
145
|
]
|
|
137
|
-
|
|
146
|
+
]
|
|
138
147
|
};
|
|
139
148
|
var addToCart = {
|
|
140
149
|
in: (0, import_core.getEvent)("product add", {
|
|
@@ -172,32 +181,37 @@ var addToCart = {
|
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
183
|
},
|
|
175
|
-
out:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
184
|
+
out: [
|
|
185
|
+
[
|
|
186
|
+
"sendServer",
|
|
187
|
+
ENDPOINT,
|
|
188
|
+
JSON.stringify({
|
|
189
|
+
data: [
|
|
190
|
+
{
|
|
191
|
+
event_name: "add_to_cart",
|
|
192
|
+
event_id: "1700000901-gr0up-1",
|
|
193
|
+
event_time: 1700001,
|
|
194
|
+
action_source: "web",
|
|
195
|
+
user_data: {},
|
|
196
|
+
custom_data: {
|
|
197
|
+
value: "42.00",
|
|
198
|
+
currency: "EUR",
|
|
199
|
+
contents: [
|
|
200
|
+
{
|
|
201
|
+
id: "SKU-B2",
|
|
202
|
+
item_name: "Cool Cap",
|
|
203
|
+
item_price: "42.00",
|
|
204
|
+
quantity: 1
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
event_source_url: "https://shop.example.com/products"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
OPTIONS
|
|
199
213
|
]
|
|
200
|
-
|
|
214
|
+
]
|
|
201
215
|
};
|
|
202
216
|
var pageVisit = {
|
|
203
217
|
in: (0, import_core.getEvent)("page view", {
|
|
@@ -212,20 +226,25 @@ var pageVisit = {
|
|
|
212
226
|
mapping: {
|
|
213
227
|
name: "page_visit"
|
|
214
228
|
},
|
|
215
|
-
out:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
out: [
|
|
230
|
+
[
|
|
231
|
+
"sendServer",
|
|
232
|
+
ENDPOINT,
|
|
233
|
+
JSON.stringify({
|
|
234
|
+
data: [
|
|
235
|
+
{
|
|
236
|
+
event_name: "page_visit",
|
|
237
|
+
event_id: "1700000902-gr0up-1",
|
|
238
|
+
event_time: 1700001,
|
|
239
|
+
action_source: "web",
|
|
240
|
+
user_data: {},
|
|
241
|
+
event_source_url: "https://www.example.com/docs/"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}),
|
|
245
|
+
OPTIONS
|
|
227
246
|
]
|
|
228
|
-
|
|
247
|
+
]
|
|
229
248
|
};
|
|
230
249
|
var search = {
|
|
231
250
|
in: (0, import_core.getEvent)("entity action", {
|
|
@@ -251,23 +270,28 @@ var search = {
|
|
|
251
270
|
}
|
|
252
271
|
}
|
|
253
272
|
},
|
|
254
|
-
out:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
out: [
|
|
274
|
+
[
|
|
275
|
+
"sendServer",
|
|
276
|
+
ENDPOINT,
|
|
277
|
+
JSON.stringify({
|
|
278
|
+
data: [
|
|
279
|
+
{
|
|
280
|
+
event_name: "search",
|
|
281
|
+
event_id: "1700000903-gr0up-1",
|
|
282
|
+
event_time: 1700001,
|
|
283
|
+
action_source: "web",
|
|
284
|
+
user_data: {},
|
|
285
|
+
custom_data: {
|
|
286
|
+
search_string: "walkerOS destinations"
|
|
287
|
+
},
|
|
288
|
+
event_source_url: "https://www.example.com/search"
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
}),
|
|
292
|
+
OPTIONS
|
|
269
293
|
]
|
|
270
|
-
|
|
294
|
+
]
|
|
271
295
|
};
|
|
272
296
|
var signup = {
|
|
273
297
|
in: (0, import_core.getEvent)("entity action", {
|
|
@@ -294,21 +318,34 @@ var signup = {
|
|
|
294
318
|
}
|
|
295
319
|
}
|
|
296
320
|
},
|
|
297
|
-
out:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
321
|
+
out: [
|
|
322
|
+
[
|
|
323
|
+
"sendServer",
|
|
324
|
+
ENDPOINT,
|
|
325
|
+
JSON.stringify({
|
|
326
|
+
data: [
|
|
327
|
+
{
|
|
328
|
+
event_name: "signup",
|
|
329
|
+
event_id: "1700000904-gr0up-1",
|
|
330
|
+
event_time: 1700001,
|
|
331
|
+
action_source: "web",
|
|
332
|
+
user_data: {
|
|
333
|
+
// sha256('new@example.com')
|
|
334
|
+
em: [
|
|
335
|
+
"f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"
|
|
336
|
+
],
|
|
337
|
+
// sha256('new-user-1')
|
|
338
|
+
external_id: [
|
|
339
|
+
"b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
event_source_url: "https://www.example.com/register"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
}),
|
|
346
|
+
OPTIONS
|
|
310
347
|
]
|
|
311
|
-
|
|
348
|
+
]
|
|
312
349
|
};
|
|
313
350
|
// Annotate the CommonJS export names for ESM import in node:
|
|
314
351
|
0 && (module.exports = {
|
package/dist/examples/index.mjs
CHANGED
|
@@ -35,6 +35,10 @@ __export(step_exports, {
|
|
|
35
35
|
signup: () => signup
|
|
36
36
|
});
|
|
37
37
|
import { getEvent, isObject } from "@walkeros/core";
|
|
38
|
+
var ENDPOINT = "https://api.pinterest.com/v5/ad_accounts/123456789/events";
|
|
39
|
+
var OPTIONS = {
|
|
40
|
+
headers: { Authorization: "Bearer s3cr3t" }
|
|
41
|
+
};
|
|
38
42
|
var checkout = {
|
|
39
43
|
in: getEvent("order complete", {
|
|
40
44
|
timestamp: 1700000900,
|
|
@@ -86,34 +90,39 @@ var checkout = {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
},
|
|
89
|
-
out:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
out: [
|
|
94
|
+
[
|
|
95
|
+
"sendServer",
|
|
96
|
+
ENDPOINT,
|
|
97
|
+
JSON.stringify({
|
|
98
|
+
data: [
|
|
99
|
+
{
|
|
100
|
+
event_name: "checkout",
|
|
101
|
+
event_id: "1700000900-gr0up-1",
|
|
102
|
+
event_time: 1700001,
|
|
103
|
+
action_source: "web",
|
|
104
|
+
user_data: {},
|
|
105
|
+
custom_data: {
|
|
106
|
+
value: 249.99,
|
|
107
|
+
currency: "EUR",
|
|
108
|
+
order_id: "ORD-300",
|
|
109
|
+
num_items: 1,
|
|
110
|
+
contents: [
|
|
111
|
+
{
|
|
112
|
+
id: "SKU-A1",
|
|
113
|
+
item_name: "Everyday Ruck Snack",
|
|
114
|
+
item_price: "129.99",
|
|
115
|
+
quantity: 2
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
event_source_url: "https://shop.example.com"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
OPTIONS
|
|
115
124
|
]
|
|
116
|
-
|
|
125
|
+
]
|
|
117
126
|
};
|
|
118
127
|
var addToCart = {
|
|
119
128
|
in: getEvent("product add", {
|
|
@@ -151,32 +160,37 @@ var addToCart = {
|
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
},
|
|
154
|
-
out:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
163
|
+
out: [
|
|
164
|
+
[
|
|
165
|
+
"sendServer",
|
|
166
|
+
ENDPOINT,
|
|
167
|
+
JSON.stringify({
|
|
168
|
+
data: [
|
|
169
|
+
{
|
|
170
|
+
event_name: "add_to_cart",
|
|
171
|
+
event_id: "1700000901-gr0up-1",
|
|
172
|
+
event_time: 1700001,
|
|
173
|
+
action_source: "web",
|
|
174
|
+
user_data: {},
|
|
175
|
+
custom_data: {
|
|
176
|
+
value: "42.00",
|
|
177
|
+
currency: "EUR",
|
|
178
|
+
contents: [
|
|
179
|
+
{
|
|
180
|
+
id: "SKU-B2",
|
|
181
|
+
item_name: "Cool Cap",
|
|
182
|
+
item_price: "42.00",
|
|
183
|
+
quantity: 1
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
event_source_url: "https://shop.example.com/products"
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}),
|
|
191
|
+
OPTIONS
|
|
178
192
|
]
|
|
179
|
-
|
|
193
|
+
]
|
|
180
194
|
};
|
|
181
195
|
var pageVisit = {
|
|
182
196
|
in: getEvent("page view", {
|
|
@@ -191,20 +205,25 @@ var pageVisit = {
|
|
|
191
205
|
mapping: {
|
|
192
206
|
name: "page_visit"
|
|
193
207
|
},
|
|
194
|
-
out:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
208
|
+
out: [
|
|
209
|
+
[
|
|
210
|
+
"sendServer",
|
|
211
|
+
ENDPOINT,
|
|
212
|
+
JSON.stringify({
|
|
213
|
+
data: [
|
|
214
|
+
{
|
|
215
|
+
event_name: "page_visit",
|
|
216
|
+
event_id: "1700000902-gr0up-1",
|
|
217
|
+
event_time: 1700001,
|
|
218
|
+
action_source: "web",
|
|
219
|
+
user_data: {},
|
|
220
|
+
event_source_url: "https://www.example.com/docs/"
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
OPTIONS
|
|
206
225
|
]
|
|
207
|
-
|
|
226
|
+
]
|
|
208
227
|
};
|
|
209
228
|
var search = {
|
|
210
229
|
in: getEvent("entity action", {
|
|
@@ -230,23 +249,28 @@ var search = {
|
|
|
230
249
|
}
|
|
231
250
|
}
|
|
232
251
|
},
|
|
233
|
-
out:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
252
|
+
out: [
|
|
253
|
+
[
|
|
254
|
+
"sendServer",
|
|
255
|
+
ENDPOINT,
|
|
256
|
+
JSON.stringify({
|
|
257
|
+
data: [
|
|
258
|
+
{
|
|
259
|
+
event_name: "search",
|
|
260
|
+
event_id: "1700000903-gr0up-1",
|
|
261
|
+
event_time: 1700001,
|
|
262
|
+
action_source: "web",
|
|
263
|
+
user_data: {},
|
|
264
|
+
custom_data: {
|
|
265
|
+
search_string: "walkerOS destinations"
|
|
266
|
+
},
|
|
267
|
+
event_source_url: "https://www.example.com/search"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}),
|
|
271
|
+
OPTIONS
|
|
248
272
|
]
|
|
249
|
-
|
|
273
|
+
]
|
|
250
274
|
};
|
|
251
275
|
var signup = {
|
|
252
276
|
in: getEvent("entity action", {
|
|
@@ -273,21 +297,34 @@ var signup = {
|
|
|
273
297
|
}
|
|
274
298
|
}
|
|
275
299
|
},
|
|
276
|
-
out:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
300
|
+
out: [
|
|
301
|
+
[
|
|
302
|
+
"sendServer",
|
|
303
|
+
ENDPOINT,
|
|
304
|
+
JSON.stringify({
|
|
305
|
+
data: [
|
|
306
|
+
{
|
|
307
|
+
event_name: "signup",
|
|
308
|
+
event_id: "1700000904-gr0up-1",
|
|
309
|
+
event_time: 1700001,
|
|
310
|
+
action_source: "web",
|
|
311
|
+
user_data: {
|
|
312
|
+
// sha256('new@example.com')
|
|
313
|
+
em: [
|
|
314
|
+
"f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716"
|
|
315
|
+
],
|
|
316
|
+
// sha256('new-user-1')
|
|
317
|
+
external_id: [
|
|
318
|
+
"b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
event_source_url: "https://www.example.com/register"
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}),
|
|
325
|
+
OPTIONS
|
|
289
326
|
]
|
|
290
|
-
|
|
327
|
+
]
|
|
291
328
|
};
|
|
292
329
|
export {
|
|
293
330
|
env_exports as env,
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-pinterest",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"group": "gr0up",
|
|
128
128
|
"count": 1,
|
|
129
129
|
"version": {
|
|
130
|
-
"source": "3.
|
|
130
|
+
"source": "3.4.0",
|
|
131
131
|
"tagging": 1
|
|
132
132
|
},
|
|
133
133
|
"source": {
|
|
@@ -166,34 +166,18 @@
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
|
-
"out":
|
|
170
|
-
|
|
169
|
+
"out": [
|
|
170
|
+
[
|
|
171
|
+
"sendServer",
|
|
172
|
+
"https://api.pinterest.com/v5/ad_accounts/123456789/events",
|
|
173
|
+
"{\"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\"}]}",
|
|
171
174
|
{
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
"event_id": "1700000901-gr0up-1",
|
|
175
|
-
"event_source_url": "https://shop.example.com/products",
|
|
176
|
-
"action_source": "web",
|
|
177
|
-
"user_data": {
|
|
178
|
-
"external_id": [
|
|
179
|
-
"user-456"
|
|
180
|
-
]
|
|
181
|
-
},
|
|
182
|
-
"custom_data": {
|
|
183
|
-
"value": "42.00",
|
|
184
|
-
"currency": "EUR",
|
|
185
|
-
"contents": [
|
|
186
|
-
{
|
|
187
|
-
"id": "SKU-B2",
|
|
188
|
-
"item_name": "Cool Cap",
|
|
189
|
-
"item_price": "42.00",
|
|
190
|
-
"quantity": 1
|
|
191
|
-
}
|
|
192
|
-
]
|
|
175
|
+
"headers": {
|
|
176
|
+
"Authorization": "Bearer s3cr3t"
|
|
193
177
|
}
|
|
194
178
|
}
|
|
195
179
|
]
|
|
196
|
-
|
|
180
|
+
]
|
|
197
181
|
},
|
|
198
182
|
"checkout": {
|
|
199
183
|
"in": {
|
|
@@ -242,7 +226,7 @@
|
|
|
242
226
|
"group": "gr0up",
|
|
243
227
|
"count": 1,
|
|
244
228
|
"version": {
|
|
245
|
-
"source": "3.
|
|
229
|
+
"source": "3.4.0",
|
|
246
230
|
"tagging": 1
|
|
247
231
|
},
|
|
248
232
|
"source": {
|
|
@@ -273,7 +257,7 @@
|
|
|
273
257
|
"nested",
|
|
274
258
|
{
|
|
275
259
|
"condition": {
|
|
276
|
-
"$code": "e=>
|
|
260
|
+
"$code": "e=>f(e)&&\"product\"===e.entity"
|
|
277
261
|
},
|
|
278
262
|
"map": {
|
|
279
263
|
"id": "data.id",
|
|
@@ -292,36 +276,18 @@
|
|
|
292
276
|
}
|
|
293
277
|
}
|
|
294
278
|
},
|
|
295
|
-
"out":
|
|
296
|
-
|
|
279
|
+
"out": [
|
|
280
|
+
[
|
|
281
|
+
"sendServer",
|
|
282
|
+
"https://api.pinterest.com/v5/ad_accounts/123456789/events",
|
|
283
|
+
"{\"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\"}]}",
|
|
297
284
|
{
|
|
298
|
-
"
|
|
299
|
-
|
|
300
|
-
"event_id": "1700000900-gr0up-1",
|
|
301
|
-
"event_source_url": "https://shop.example.com",
|
|
302
|
-
"action_source": "web",
|
|
303
|
-
"user_data": {
|
|
304
|
-
"external_id": [
|
|
305
|
-
"user-123"
|
|
306
|
-
]
|
|
307
|
-
},
|
|
308
|
-
"custom_data": {
|
|
309
|
-
"value": 249.99,
|
|
310
|
-
"currency": "EUR",
|
|
311
|
-
"order_id": "ORD-300",
|
|
312
|
-
"num_items": 1,
|
|
313
|
-
"contents": [
|
|
314
|
-
{
|
|
315
|
-
"id": "SKU-A1",
|
|
316
|
-
"item_name": "Everyday Ruck Snack",
|
|
317
|
-
"item_price": "129.99",
|
|
318
|
-
"quantity": 2
|
|
319
|
-
}
|
|
320
|
-
]
|
|
285
|
+
"headers": {
|
|
286
|
+
"Authorization": "Bearer s3cr3t"
|
|
321
287
|
}
|
|
322
288
|
}
|
|
323
289
|
]
|
|
324
|
-
|
|
290
|
+
]
|
|
325
291
|
},
|
|
326
292
|
"pageVisit": {
|
|
327
293
|
"in": {
|
|
@@ -376,7 +342,7 @@
|
|
|
376
342
|
"group": "gr0up",
|
|
377
343
|
"count": 1,
|
|
378
344
|
"version": {
|
|
379
|
-
"source": "3.
|
|
345
|
+
"source": "3.4.0",
|
|
380
346
|
"tagging": 1
|
|
381
347
|
},
|
|
382
348
|
"source": {
|
|
@@ -388,22 +354,18 @@
|
|
|
388
354
|
"mapping": {
|
|
389
355
|
"name": "page_visit"
|
|
390
356
|
},
|
|
391
|
-
"out":
|
|
392
|
-
|
|
357
|
+
"out": [
|
|
358
|
+
[
|
|
359
|
+
"sendServer",
|
|
360
|
+
"https://api.pinterest.com/v5/ad_accounts/123456789/events",
|
|
361
|
+
"{\"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/\"}]}",
|
|
393
362
|
{
|
|
394
|
-
"
|
|
395
|
-
|
|
396
|
-
"event_id": "1700000902-gr0up-1",
|
|
397
|
-
"event_source_url": "https://www.example.com/docs/",
|
|
398
|
-
"action_source": "web",
|
|
399
|
-
"user_data": {
|
|
400
|
-
"external_id": [
|
|
401
|
-
"user-789"
|
|
402
|
-
]
|
|
363
|
+
"headers": {
|
|
364
|
+
"Authorization": "Bearer s3cr3t"
|
|
403
365
|
}
|
|
404
366
|
}
|
|
405
367
|
]
|
|
406
|
-
|
|
368
|
+
]
|
|
407
369
|
},
|
|
408
370
|
"search": {
|
|
409
371
|
"in": {
|
|
@@ -453,7 +415,7 @@
|
|
|
453
415
|
"group": "gr0up",
|
|
454
416
|
"count": 1,
|
|
455
417
|
"version": {
|
|
456
|
-
"source": "3.
|
|
418
|
+
"source": "3.4.0",
|
|
457
419
|
"tagging": 1
|
|
458
420
|
},
|
|
459
421
|
"source": {
|
|
@@ -474,25 +436,18 @@
|
|
|
474
436
|
}
|
|
475
437
|
}
|
|
476
438
|
},
|
|
477
|
-
"out":
|
|
478
|
-
|
|
439
|
+
"out": [
|
|
440
|
+
[
|
|
441
|
+
"sendServer",
|
|
442
|
+
"https://api.pinterest.com/v5/ad_accounts/123456789/events",
|
|
443
|
+
"{\"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\"}]}",
|
|
479
444
|
{
|
|
480
|
-
"
|
|
481
|
-
|
|
482
|
-
"event_id": "1700000903-gr0up-1",
|
|
483
|
-
"event_source_url": "https://www.example.com/search",
|
|
484
|
-
"action_source": "web",
|
|
485
|
-
"user_data": {
|
|
486
|
-
"external_id": [
|
|
487
|
-
"user-101"
|
|
488
|
-
]
|
|
489
|
-
},
|
|
490
|
-
"custom_data": {
|
|
491
|
-
"search_string": "walkerOS destinations"
|
|
445
|
+
"headers": {
|
|
446
|
+
"Authorization": "Bearer s3cr3t"
|
|
492
447
|
}
|
|
493
448
|
}
|
|
494
449
|
]
|
|
495
|
-
|
|
450
|
+
]
|
|
496
451
|
},
|
|
497
452
|
"signup": {
|
|
498
453
|
"in": {
|
|
@@ -543,7 +498,7 @@
|
|
|
543
498
|
"group": "gr0up",
|
|
544
499
|
"count": 1,
|
|
545
500
|
"version": {
|
|
546
|
-
"source": "3.
|
|
501
|
+
"source": "3.4.0",
|
|
547
502
|
"tagging": 1
|
|
548
503
|
},
|
|
549
504
|
"source": {
|
|
@@ -573,25 +528,18 @@
|
|
|
573
528
|
}
|
|
574
529
|
}
|
|
575
530
|
},
|
|
576
|
-
"out":
|
|
577
|
-
|
|
531
|
+
"out": [
|
|
532
|
+
[
|
|
533
|
+
"sendServer",
|
|
534
|
+
"https://api.pinterest.com/v5/ad_accounts/123456789/events",
|
|
535
|
+
"{\"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\"}]}",
|
|
578
536
|
{
|
|
579
|
-
"
|
|
580
|
-
|
|
581
|
-
"event_id": "1700000904-gr0up-1",
|
|
582
|
-
"event_source_url": "https://www.example.com/register",
|
|
583
|
-
"action_source": "web",
|
|
584
|
-
"user_data": {
|
|
585
|
-
"em": [
|
|
586
|
-
"new@example.com"
|
|
587
|
-
],
|
|
588
|
-
"external_id": [
|
|
589
|
-
"new-user-1"
|
|
590
|
-
]
|
|
537
|
+
"headers": {
|
|
538
|
+
"Authorization": "Bearer s3cr3t"
|
|
591
539
|
}
|
|
592
540
|
}
|
|
593
541
|
]
|
|
594
|
-
|
|
542
|
+
]
|
|
595
543
|
}
|
|
596
544
|
}
|
|
597
545
|
}
|
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
|
+
"version": "3.4.0",
|
|
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.
|
|
38
|
-
"@walkeros/server-core": "3.
|
|
37
|
+
"@walkeros/core": "3.4.0",
|
|
38
|
+
"@walkeros/server-core": "3.4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@walkeros/collector": "3.
|
|
41
|
+
"@walkeros/collector": "3.4.0"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|