@walkeros/server-destination-criteo 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +8 -0
- package/dist/examples/index.mjs +8 -0
- package/dist/walkerOS.json +16 -8
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,i)=>{for(var r in i)t(e,r,{get:i[r],enumerable:!0})},n={};o(n,{examples:()=>y,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,i)=>{for(var r in i)t(e,r,{get:i[r],enumerable:!0})},n={};o(n,{examples:()=>y,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let d of r(o))a.call(e,d)||d===n||t(e,d,{get:()=>o[d],enumerable:!(s=i(o,d))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{CriteoEventNameSchema:()=>l,MappingSchema:()=>m,SettingsSchema:()=>c,mapping:()=>g,settings:()=>v});var d=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),c=p.z.object({partnerId:p.z.string().min(1).describe("Criteo Partner ID (numeric string, provided by Criteo)"),callerId:p.z.string().min(1).describe("Caller ID for user mapping (provided by Criteo)"),siteType:p.z.enum(["d","m","t"]).describe("Site type: d (desktop), m (mobile web), t (tablet)").optional(),country:p.z.string().length(2).describe("ISO 3166-1 alpha-2 country code").optional(),language:p.z.string().length(2).describe("2-letter language code").optional(),url:p.z.string().url().describe("Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)").optional(),user_data:p.z.record(p.z.string(),p.z.string()).describe("Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })").optional()}),m=require("@walkeros/core/dev").z.object({}),u=require("@walkeros/core/dev"),l=u.z.union([u.z.enum(["viewHome","viewPage","viewItem","viewList","addToCart","viewBasket","beginCheckout","trackTransaction","addPaymentInfo","login"]),u.z.string()]),v=(0,d.zodToSchema)(c),g=(0,d.zodToSchema)(m),y={};o(y,{env:()=>h,step:()=>k});var h={};o(h,{push:()=>_,simulation:()=>w});var _={sendServer:async()=>({ok:!0,data:"OK"})},w=["sendServer"],k={};o(k,{addToCart:()=>C,pageView:()=>T,purchase:()=>S,viewItem:()=>I});var b=require("@walkeros/core"),f="https://widget.criteo.com/m/event?version=s2s_v0",S={title:"Purchase",description:"A completed order is posted to the Criteo Events API as a trackTransaction event with items.",in:(0,b.getEvent)("order complete",{timestamp:17000009e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",name:"Widget Pro",price:124.99,quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com/checkout/complete",previous_id:"https://shop.example.com/cart"}}),mapping:{name:"trackTransaction",data:{map:{id:"data.id",item:{loop:["nested",{condition:e=>(0,b.isObject)(e)&&"product"===e.entity,map:{id:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}},out:[["sendServer",f,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"trackTransaction",timestamp:"2023-11-14T22:28:20.000Z",id:"ORD-300",item:[{id:"SKU-A1",price:124.99,quantity:2}]}],full_url:"https://shop.example.com/checkout/complete",previous_url:"https://shop.example.com/cart"})]]},C={title:"Add to cart",description:"A product add becomes a Criteo addToCart event with the item id, price, and quantity.",in:(0,b.getEvent)("product add",{timestamp:1700000901e3,data:{id:"SKU-B2",name:"Running Shoes",price:89.99},nested:[{entity:"product",data:{id:"SKU-B2",name:"Running Shoes",price:89.99,quantity:1}}],source:{type:"server",id:"https://shop.example.com/products/running-shoes",previous_id:""}}),mapping:{name:"addToCart",data:{map:{item:{loop:["nested",{condition:e=>(0,b.isObject)(e)&&"product"===e.entity,map:{id:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}},out:[["sendServer",f,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"addToCart",timestamp:"2023-11-14T22:28:21.000Z",item:[{id:"SKU-B2",price:89.99,quantity:1}]}],full_url:"https://shop.example.com/products/running-shoes"})]]},I={title:"View item",description:"A product view becomes a Criteo viewItem event with the viewed product id.",in:(0,b.getEvent)("product view",{timestamp:1700000902e3,data:{id:"SKU-C3",name:"Coffee Maker"},nested:[{entity:"product",data:{id:"SKU-C3"}}],source:{type:"server",id:"https://shop.example.com/products/coffee-maker",previous_id:""}}),mapping:{name:"viewItem",data:{map:{item:{loop:["nested",{condition:e=>(0,b.isObject)(e)&&"product"===e.entity,map:{id:"data.id"}}]}}}},out:[["sendServer",f,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"viewItem",timestamp:"2023-11-14T22:28:22.000Z",item:[{id:"SKU-C3"}]}],full_url:"https://shop.example.com/products/coffee-maker"})]]},T={title:"Page view",description:"A page view becomes a Criteo viewHome event used for home page impression tracking.",in:(0,b.getEvent)("page view",{timestamp:1700000903e3,source:{type:"server",id:"https://example.com/",previous_id:""}}),mapping:{name:"viewHome"},out:[["sendServer",f,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"viewHome",timestamp:"2023-11-14T22:28:23.000Z"}],full_url:"https://example.com/"})]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/primitives.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';\n\nexport const SettingsSchema = z.object({\n partnerId: z\n .string()\n .min(1)\n .describe('Criteo Partner ID (numeric string, provided by Criteo)'),\n callerId: z\n .string()\n .min(1)\n .describe('Caller ID for user mapping (provided by Criteo)'),\n siteType: z\n .enum(['d', 'm', 't'])\n .describe('Site type: d (desktop), m (mobile web), t (tablet)')\n .optional(),\n country: z\n .string()\n .length(2)\n .describe('ISO 3166-1 alpha-2 country code')\n .optional(),\n language: z.string().length(2).describe('2-letter language code').optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Criteo Events API Mapping Schema\n * Criteo has no event-level mapping configuration beyond name + data\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Criteo Events API event names.\n * https://guides.criteotilt.com/events-api/\n */\nexport const CriteoEventNameSchema = z.union([\n z.enum([\n 'viewHome',\n 'viewPage',\n 'viewItem',\n 'viewList',\n 'addToCart',\n 'viewBasket',\n 'beginCheckout',\n 'trackTransaction',\n 'addPaymentInfo',\n 'login',\n ]),\n z.string(), // Allow custom event names\n]);\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 Criteo Events API destination.\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => ({\n ok: true,\n data: 'OK',\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Criteo Events API pushes without making\n * actual HTTP requests to Criteo's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Criteo Events API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is the configured Criteo endpoint (default:\n * `https://widget.criteo.com/m/event?version=s2s_v0`) and `body` is the\n * JSON-stringified request payload.\n *\n * Test fixture pins `partnerId = 'PARTNER_ID'` and `callerId = 'CALLER_ID'`,\n * so every call targets the default URL above.\n *\n * Body is emitted with keys in the order the destination assembles them:\n * 1. version\n * 2. site_type\n * 3. account\n * 4. id (identity block)\n * 5. events (always a single-element array)\n * 6. full_url (only when event.source.id is set)\n * 7. previous_url (only when event.source.previous_id is set)\n */\nconst ENDPOINT = 'https://widget.criteo.com/m/event?version=s2s_v0';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-A1', name: 'Widget Pro', price: 124.99, quantity: 2 },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/checkout/complete',\n previous_id: 'https://shop.example.com/cart',\n },\n }),\n mapping: {\n name: 'trackTransaction',\n data: {\n map: {\n id: 'data.id',\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'trackTransaction',\n timestamp: '2023-11-14T22:28:20.000Z',\n id: 'ORD-300',\n item: [\n {\n id: 'SKU-A1',\n price: 124.99,\n quantity: 2,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/checkout/complete',\n previous_url: 'https://shop.example.com/cart',\n }),\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901000,\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n quantity: 1,\n },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/running-shoes',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'addToCart',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'addToCart',\n timestamp: '2023-11-14T22:28:21.000Z',\n item: [\n {\n id: 'SKU-B2',\n price: 89.99,\n quantity: 1,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/running-shoes',\n }),\n ],\n ],\n};\n\nexport const viewItem: Flow.StepExample = {\n in: getEvent('product view', {\n timestamp: 1700000902000,\n data: { id: 'SKU-C3', name: 'Coffee Maker' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-C3' },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/coffee-maker',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewItem',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewItem',\n timestamp: '2023-11-14T22:28:22.000Z',\n item: [\n {\n id: 'SKU-C3',\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/coffee-maker',\n }),\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000903000,\n source: {\n type: 'server',\n id: 'https://example.com/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewHome',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewHome',\n timestamp: '2023-11-14T22:28:23.000Z',\n },\n ],\n full_url: 'https://example.com/',\n }),\n ],\n ],\n};\n"],"mappings":";;;;;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sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,IAAI;AAAA,UACF,aAAa;AAAA,QACf;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,YACE,OAAO;AAAA,YACP,WAAW;AAAA,UACb;AAAA,QACF;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;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/mapping.ts","../src/schemas/primitives.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';\n\nexport const SettingsSchema = z.object({\n partnerId: z\n .string()\n .min(1)\n .describe('Criteo Partner ID (numeric string, provided by Criteo)'),\n callerId: z\n .string()\n .min(1)\n .describe('Caller ID for user mapping (provided by Criteo)'),\n siteType: z\n .enum(['d', 'm', 't'])\n .describe('Site type: d (desktop), m (mobile web), t (tablet)')\n .optional(),\n country: z\n .string()\n .length(2)\n .describe('ISO 3166-1 alpha-2 country code')\n .optional(),\n language: z.string().length(2).describe('2-letter language code').optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Criteo Events API Mapping Schema\n * Criteo has no event-level mapping configuration beyond name + data\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Criteo Events API event names.\n * https://guides.criteotilt.com/events-api/\n */\nexport const CriteoEventNameSchema = z.union([\n z.enum([\n 'viewHome',\n 'viewPage',\n 'viewItem',\n 'viewList',\n 'addToCart',\n 'viewBasket',\n 'beginCheckout',\n 'trackTransaction',\n 'addPaymentInfo',\n 'login',\n ]),\n z.string(), // Allow custom event names\n]);\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 Criteo Events API destination.\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => ({\n ok: true,\n data: 'OK',\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Criteo Events API pushes without making\n * actual HTTP requests to Criteo's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Criteo Events API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is the configured Criteo endpoint (default:\n * `https://widget.criteo.com/m/event?version=s2s_v0`) and `body` is the\n * JSON-stringified request payload.\n *\n * Test fixture pins `partnerId = 'PARTNER_ID'` and `callerId = 'CALLER_ID'`,\n * so every call targets the default URL above.\n *\n * Body is emitted with keys in the order the destination assembles them:\n * 1. version\n * 2. site_type\n * 3. account\n * 4. id (identity block)\n * 5. events (always a single-element array)\n * 6. full_url (only when event.source.id is set)\n * 7. previous_url (only when event.source.previous_id is set)\n */\nconst ENDPOINT = 'https://widget.criteo.com/m/event?version=s2s_v0';\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order is posted to the Criteo Events API as a trackTransaction event with items.',\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-A1', name: 'Widget Pro', price: 124.99, quantity: 2 },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/checkout/complete',\n previous_id: 'https://shop.example.com/cart',\n },\n }),\n mapping: {\n name: 'trackTransaction',\n data: {\n map: {\n id: 'data.id',\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'trackTransaction',\n timestamp: '2023-11-14T22:28:20.000Z',\n id: 'ORD-300',\n item: [\n {\n id: 'SKU-A1',\n price: 124.99,\n quantity: 2,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/checkout/complete',\n previous_url: 'https://shop.example.com/cart',\n }),\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add becomes a Criteo addToCart event with the item id, price, and quantity.',\n in: getEvent('product add', {\n timestamp: 1700000901000,\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n quantity: 1,\n },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/running-shoes',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'addToCart',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'addToCart',\n timestamp: '2023-11-14T22:28:21.000Z',\n item: [\n {\n id: 'SKU-B2',\n price: 89.99,\n quantity: 1,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/running-shoes',\n }),\n ],\n ],\n};\n\nexport const viewItem: Flow.StepExample = {\n title: 'View item',\n description:\n 'A product view becomes a Criteo viewItem event with the viewed product id.',\n in: getEvent('product view', {\n timestamp: 1700000902000,\n data: { id: 'SKU-C3', name: 'Coffee Maker' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-C3' },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/coffee-maker',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewItem',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewItem',\n timestamp: '2023-11-14T22:28:22.000Z',\n item: [\n {\n id: 'SKU-C3',\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/coffee-maker',\n }),\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view becomes a Criteo viewHome event used for home page impression tracking.',\n in: getEvent('page view', {\n timestamp: 1700000903000,\n source: {\n type: 'server',\n id: 'https://example.com/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewHome',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewHome',\n timestamp: '2023-11-14T22:28:23.000Z',\n },\n ],\n full_url: 'https://example.com/',\n }),\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,WAAW,aACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,wDAAwD;AAAA,EACpE,UAAU,aACP,OAAO,EACP,IAAI,CAAC,EACL,SAAS,iDAAiD;AAAA,EAC7D,UAAU,aACP,KAAK,CAAC,KAAK,KAAK,GAAG,CAAC,EACpB,SAAS,oDAAoD,EAC7D,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP,OAAO,CAAC,EACR,SAAS,iCAAiC,EAC1C,SAAS;AAAA,EACZ,UAAU,aAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,SAAS;AAAA,EAC3E,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AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,i)=>{for(var
|
|
1
|
+
var e=Object.defineProperty,t=(t,i)=>{for(var r in i)e(t,r,{get:i[r],enumerable:!0})},i={};t(i,{CriteoEventNameSchema:()=>p,MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>c,settings:()=>m});import{zodToSchema as r}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var o=a.object({partnerId:a.string().min(1).describe("Criteo Partner ID (numeric string, provided by Criteo)"),callerId:a.string().min(1).describe("Caller ID for user mapping (provided by Criteo)"),siteType:a.enum(["d","m","t"]).describe("Site type: d (desktop), m (mobile web), t (tablet)").optional(),country:a.string().length(2).describe("ISO 3166-1 alpha-2 country code").optional(),language:a.string().length(2).describe("2-letter language code").optional(),url:a.string().url().describe("Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)").optional(),user_data:a.record(a.string(),a.string()).describe("Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })").optional()});import{z as n}from"@walkeros/core/dev";var s=n.object({});import{z as d}from"@walkeros/core/dev";var p=d.union([d.enum(["viewHome","viewPage","viewItem","viewList","addToCart","viewBasket","beginCheckout","trackTransaction","addPaymentInfo","login"]),d.string()]),m=r(o),c=r(s),u={};t(u,{env:()=>v,step:()=>h});var v={};t(v,{push:()=>l,simulation:()=>g});var l={sendServer:async()=>({ok:!0,data:"OK"})},g=["sendServer"],h={};t(h,{addToCart:()=>f,pageView:()=>C,purchase:()=>k,viewItem:()=>S});import{getEvent as y,isObject as _}from"@walkeros/core";var w="https://widget.criteo.com/m/event?version=s2s_v0",k={title:"Purchase",description:"A completed order is posted to the Criteo Events API as a trackTransaction event with items.",in:y("order complete",{timestamp:17000009e5,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",name:"Widget Pro",price:124.99,quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com/checkout/complete",previous_id:"https://shop.example.com/cart"}}),mapping:{name:"trackTransaction",data:{map:{id:"data.id",item:{loop:["nested",{condition:e=>_(e)&&"product"===e.entity,map:{id:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}},out:[["sendServer",w,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"trackTransaction",timestamp:"2023-11-14T22:28:20.000Z",id:"ORD-300",item:[{id:"SKU-A1",price:124.99,quantity:2}]}],full_url:"https://shop.example.com/checkout/complete",previous_url:"https://shop.example.com/cart"})]]},f={title:"Add to cart",description:"A product add becomes a Criteo addToCart event with the item id, price, and quantity.",in:y("product add",{timestamp:1700000901e3,data:{id:"SKU-B2",name:"Running Shoes",price:89.99},nested:[{entity:"product",data:{id:"SKU-B2",name:"Running Shoes",price:89.99,quantity:1}}],source:{type:"server",id:"https://shop.example.com/products/running-shoes",previous_id:""}}),mapping:{name:"addToCart",data:{map:{item:{loop:["nested",{condition:e=>_(e)&&"product"===e.entity,map:{id:"data.id",price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}},out:[["sendServer",w,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"addToCart",timestamp:"2023-11-14T22:28:21.000Z",item:[{id:"SKU-B2",price:89.99,quantity:1}]}],full_url:"https://shop.example.com/products/running-shoes"})]]},S={title:"View item",description:"A product view becomes a Criteo viewItem event with the viewed product id.",in:y("product view",{timestamp:1700000902e3,data:{id:"SKU-C3",name:"Coffee Maker"},nested:[{entity:"product",data:{id:"SKU-C3"}}],source:{type:"server",id:"https://shop.example.com/products/coffee-maker",previous_id:""}}),mapping:{name:"viewItem",data:{map:{item:{loop:["nested",{condition:e=>_(e)&&"product"===e.entity,map:{id:"data.id"}}]}}}},out:[["sendServer",w,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"viewItem",timestamp:"2023-11-14T22:28:22.000Z",item:[{id:"SKU-C3"}]}],full_url:"https://shop.example.com/products/coffee-maker"})]]},C={title:"Page view",description:"A page view becomes a Criteo viewHome event used for home page impression tracking.",in:y("page view",{timestamp:1700000903e3,source:{type:"server",id:"https://example.com/",previous_id:""}}),mapping:{name:"viewHome"},out:[["sendServer",w,JSON.stringify({version:"walkeros_criteo_1.0.0",site_type:"d",account:"PARTNER_ID",id:{mapping_key:"CALLER_ID"},events:[{event:"viewHome",timestamp:"2023-11-14T22:28:23.000Z"}],full_url:"https://example.com/"})]]};export{u as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/primitives.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';\n\nexport const SettingsSchema = z.object({\n partnerId: z\n .string()\n .min(1)\n .describe('Criteo Partner ID (numeric string, provided by Criteo)'),\n callerId: z\n .string()\n .min(1)\n .describe('Caller ID for user mapping (provided by Criteo)'),\n siteType: z\n .enum(['d', 'm', 't'])\n .describe('Site type: d (desktop), m (mobile web), t (tablet)')\n .optional(),\n country: z\n .string()\n .length(2)\n .describe('ISO 3166-1 alpha-2 country code')\n .optional(),\n language: z.string().length(2).describe('2-letter language code').optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Criteo Events API Mapping Schema\n * Criteo has no event-level mapping configuration beyond name + data\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Criteo Events API event names.\n * https://guides.criteotilt.com/events-api/\n */\nexport const CriteoEventNameSchema = z.union([\n z.enum([\n 'viewHome',\n 'viewPage',\n 'viewItem',\n 'viewList',\n 'addToCart',\n 'viewBasket',\n 'beginCheckout',\n 'trackTransaction',\n 'addPaymentInfo',\n 'login',\n ]),\n z.string(), // Allow custom event names\n]);\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 Criteo Events API destination.\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => ({\n ok: true,\n data: 'OK',\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Criteo Events API pushes without making\n * actual HTTP requests to Criteo's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Criteo Events API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is the configured Criteo endpoint (default:\n * `https://widget.criteo.com/m/event?version=s2s_v0`) and `body` is the\n * JSON-stringified request payload.\n *\n * Test fixture pins `partnerId = 'PARTNER_ID'` and `callerId = 'CALLER_ID'`,\n * so every call targets the default URL above.\n *\n * Body is emitted with keys in the order the destination assembles them:\n * 1. version\n * 2. site_type\n * 3. account\n * 4. id (identity block)\n * 5. events (always a single-element array)\n * 6. full_url (only when event.source.id is set)\n * 7. previous_url (only when event.source.previous_id is set)\n */\nconst ENDPOINT = 'https://widget.criteo.com/m/event?version=s2s_v0';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-A1', name: 'Widget Pro', price: 124.99, quantity: 2 },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/checkout/complete',\n previous_id: 'https://shop.example.com/cart',\n },\n }),\n mapping: {\n name: 'trackTransaction',\n data: {\n map: {\n id: 'data.id',\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'trackTransaction',\n timestamp: '2023-11-14T22:28:20.000Z',\n id: 'ORD-300',\n item: [\n {\n id: 'SKU-A1',\n price: 124.99,\n quantity: 2,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/checkout/complete',\n previous_url: 'https://shop.example.com/cart',\n }),\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n in: getEvent('product add', {\n timestamp: 1700000901000,\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n quantity: 1,\n },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/running-shoes',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'addToCart',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'addToCart',\n timestamp: '2023-11-14T22:28:21.000Z',\n item: [\n {\n id: 'SKU-B2',\n price: 89.99,\n quantity: 1,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/running-shoes',\n }),\n ],\n ],\n};\n\nexport const viewItem: Flow.StepExample = {\n in: getEvent('product view', {\n timestamp: 1700000902000,\n data: { id: 'SKU-C3', name: 'Coffee Maker' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-C3' },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/coffee-maker',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewItem',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewItem',\n timestamp: '2023-11-14T22:28:22.000Z',\n item: [\n {\n id: 'SKU-C3',\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/coffee-maker',\n }),\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000903000,\n source: {\n type: 'server',\n id: 'https://example.com/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewHome',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewHome',\n timestamp: '2023-11-14T22:28:23.000Z',\n },\n ],\n full_url: 'https://example.com/',\n }),\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,WAAW,EACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,wDAAwD;AAAA,EACpE,UAAU,EACP,OAAO,EACP,IAAI,CAAC,EACL,SAAS,iDAAiD;AAAA,EAC7D,UAAU,EACP,KAAK,CAAC,KAAK,KAAK,GAAG,CAAC,EACpB,SAAS,oDAAoD,EAC7D,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,OAAO,CAAC,EACR,SAAS,iCAAiC,EAC1C,SAAS;AAAA,EACZ,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS,wBAAwB,EAAE,SAAS;AAAA,EAC3E,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,EACR,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AClCD,SAAS,KAAAA,UAAS;AAMX,IAAM,gBAAgBA,GAAE,OAAO,CAAC,CAAC;;;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;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,IAAI;AAAA,UACF,aAAa;AAAA,QACf;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,YACE,OAAO;AAAA,YACP,WAAW;AAAA,YACX,MAAM;AAAA,cACJ;AAAA,gBACE,IAAI;AAAA,cACN;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,IAAM,WAA6B;AAAA,EACxC,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,IAAI;AAAA,UACF,aAAa;AAAA,QACf;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,YACE,OAAO;AAAA,YACP,WAAW;AAAA,UACb;AAAA,QACF;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/schemas/primitives.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';\n\nexport const SettingsSchema = z.object({\n partnerId: z\n .string()\n .min(1)\n .describe('Criteo Partner ID (numeric string, provided by Criteo)'),\n callerId: z\n .string()\n .min(1)\n .describe('Caller ID for user mapping (provided by Criteo)'),\n siteType: z\n .enum(['d', 'm', 't'])\n .describe('Site type: d (desktop), m (mobile web), t (tablet)')\n .optional(),\n country: z\n .string()\n .length(2)\n .describe('ISO 3166-1 alpha-2 country code')\n .optional(),\n language: z.string().length(2).describe('2-letter language code').optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Events API endpoint (default https://widget.criteo.com/m/event?version=s2s_v0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping for identity fields (like { email: 'user.email', mapped_user_id: 'user.id' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Criteo Events API Mapping Schema\n * Criteo has no event-level mapping configuration beyond name + data\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Criteo Events API event names.\n * https://guides.criteotilt.com/events-api/\n */\nexport const CriteoEventNameSchema = z.union([\n z.enum([\n 'viewHome',\n 'viewPage',\n 'viewItem',\n 'viewList',\n 'addToCart',\n 'viewBasket',\n 'beginCheckout',\n 'trackTransaction',\n 'addPaymentInfo',\n 'login',\n ]),\n z.string(), // Allow custom event names\n]);\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 Criteo Events API destination.\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\ntype MockSendServer = (\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n) => Promise<SendResponse>;\n\nconst mockSendServer: MockSendServer = async () => ({\n ok: true,\n data: 'OK',\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Criteo Events API pushes without making\n * actual HTTP requests to Criteo's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Criteo Events API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is the configured Criteo endpoint (default:\n * `https://widget.criteo.com/m/event?version=s2s_v0`) and `body` is the\n * JSON-stringified request payload.\n *\n * Test fixture pins `partnerId = 'PARTNER_ID'` and `callerId = 'CALLER_ID'`,\n * so every call targets the default URL above.\n *\n * Body is emitted with keys in the order the destination assembles them:\n * 1. version\n * 2. site_type\n * 3. account\n * 4. id (identity block)\n * 5. events (always a single-element array)\n * 6. full_url (only when event.source.id is set)\n * 7. previous_url (only when event.source.previous_id is set)\n */\nconst ENDPOINT = 'https://widget.criteo.com/m/event?version=s2s_v0';\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order is posted to the Criteo Events API as a trackTransaction event with items.',\n in: getEvent('order complete', {\n timestamp: 1700000900000,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-A1', name: 'Widget Pro', price: 124.99, quantity: 2 },\n },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: {\n type: 'server',\n id: 'https://shop.example.com/checkout/complete',\n previous_id: 'https://shop.example.com/cart',\n },\n }),\n mapping: {\n name: 'trackTransaction',\n data: {\n map: {\n id: 'data.id',\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'trackTransaction',\n timestamp: '2023-11-14T22:28:20.000Z',\n id: 'ORD-300',\n item: [\n {\n id: 'SKU-A1',\n price: 124.99,\n quantity: 2,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/checkout/complete',\n previous_url: 'https://shop.example.com/cart',\n }),\n ],\n ],\n};\n\nexport const addToCart: Flow.StepExample = {\n title: 'Add to cart',\n description:\n 'A product add becomes a Criteo addToCart event with the item id, price, and quantity.',\n in: getEvent('product add', {\n timestamp: 1700000901000,\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n },\n nested: [\n {\n entity: 'product',\n data: {\n id: 'SKU-B2',\n name: 'Running Shoes',\n price: 89.99,\n quantity: 1,\n },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/running-shoes',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'addToCart',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'addToCart',\n timestamp: '2023-11-14T22:28:21.000Z',\n item: [\n {\n id: 'SKU-B2',\n price: 89.99,\n quantity: 1,\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/running-shoes',\n }),\n ],\n ],\n};\n\nexport const viewItem: Flow.StepExample = {\n title: 'View item',\n description:\n 'A product view becomes a Criteo viewItem event with the viewed product id.',\n in: getEvent('product view', {\n timestamp: 1700000902000,\n data: { id: 'SKU-C3', name: 'Coffee Maker' },\n nested: [\n {\n entity: 'product',\n data: { id: 'SKU-C3' },\n },\n ],\n source: {\n type: 'server',\n id: 'https://shop.example.com/products/coffee-maker',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewItem',\n data: {\n map: {\n item: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n },\n },\n ],\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewItem',\n timestamp: '2023-11-14T22:28:22.000Z',\n item: [\n {\n id: 'SKU-C3',\n },\n ],\n },\n ],\n full_url: 'https://shop.example.com/products/coffee-maker',\n }),\n ],\n ],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view becomes a Criteo viewHome event used for home page impression tracking.',\n in: getEvent('page view', {\n timestamp: 1700000903000,\n source: {\n type: 'server',\n id: 'https://example.com/',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'viewHome',\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n version: 'walkeros_criteo_1.0.0',\n site_type: 'd',\n account: 'PARTNER_ID',\n id: {\n mapping_key: 'CALLER_ID',\n },\n events: [\n {\n event: 'viewHome',\n timestamp: '2023-11-14T22:28:23.000Z',\n },\n ],\n full_url: 'https://example.com/',\n }),\n ],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,WAAW,EACR,OAAO,EACP,IAAI,CAAC,EACL,SAAS,wDAAwD;AAAA,EACpE,UAAU,EAC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A,EACF,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,IAAI;AAAA,UACF,aAAa;AAAA,QACf;AAAA,QACA,QAAQ;AAAA,UACN;AAAA,YACE,OAAO;AAAA,YACP,WAAW;AAAA,UACb;AAAA,QACF;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["z","z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -51,6 +51,8 @@ __export(step_exports, {
|
|
|
51
51
|
var import_core = require("@walkeros/core");
|
|
52
52
|
var ENDPOINT = "https://widget.criteo.com/m/event?version=s2s_v0";
|
|
53
53
|
var purchase = {
|
|
54
|
+
title: "Purchase",
|
|
55
|
+
description: "A completed order is posted to the Criteo Events API as a trackTransaction event with items.",
|
|
54
56
|
in: (0, import_core.getEvent)("order complete", {
|
|
55
57
|
timestamp: 17000009e5,
|
|
56
58
|
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
@@ -120,6 +122,8 @@ var purchase = {
|
|
|
120
122
|
]
|
|
121
123
|
};
|
|
122
124
|
var addToCart = {
|
|
125
|
+
title: "Add to cart",
|
|
126
|
+
description: "A product add becomes a Criteo addToCart event with the item id, price, and quantity.",
|
|
123
127
|
in: (0, import_core.getEvent)("product add", {
|
|
124
128
|
timestamp: 1700000901e3,
|
|
125
129
|
data: {
|
|
@@ -194,6 +198,8 @@ var addToCart = {
|
|
|
194
198
|
]
|
|
195
199
|
};
|
|
196
200
|
var viewItem = {
|
|
201
|
+
title: "View item",
|
|
202
|
+
description: "A product view becomes a Criteo viewItem event with the viewed product id.",
|
|
197
203
|
in: (0, import_core.getEvent)("product view", {
|
|
198
204
|
timestamp: 1700000902e3,
|
|
199
205
|
data: { id: "SKU-C3", name: "Coffee Maker" },
|
|
@@ -255,6 +261,8 @@ var viewItem = {
|
|
|
255
261
|
]
|
|
256
262
|
};
|
|
257
263
|
var pageView = {
|
|
264
|
+
title: "Page view",
|
|
265
|
+
description: "A page view becomes a Criteo viewHome event used for home page impression tracking.",
|
|
258
266
|
in: (0, import_core.getEvent)("page view", {
|
|
259
267
|
timestamp: 1700000903e3,
|
|
260
268
|
source: {
|
package/dist/examples/index.mjs
CHANGED
|
@@ -30,6 +30,8 @@ __export(step_exports, {
|
|
|
30
30
|
import { getEvent, isObject } from "@walkeros/core";
|
|
31
31
|
var ENDPOINT = "https://widget.criteo.com/m/event?version=s2s_v0";
|
|
32
32
|
var purchase = {
|
|
33
|
+
title: "Purchase",
|
|
34
|
+
description: "A completed order is posted to the Criteo Events API as a trackTransaction event with items.",
|
|
33
35
|
in: getEvent("order complete", {
|
|
34
36
|
timestamp: 17000009e5,
|
|
35
37
|
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
@@ -99,6 +101,8 @@ var purchase = {
|
|
|
99
101
|
]
|
|
100
102
|
};
|
|
101
103
|
var addToCart = {
|
|
104
|
+
title: "Add to cart",
|
|
105
|
+
description: "A product add becomes a Criteo addToCart event with the item id, price, and quantity.",
|
|
102
106
|
in: getEvent("product add", {
|
|
103
107
|
timestamp: 1700000901e3,
|
|
104
108
|
data: {
|
|
@@ -173,6 +177,8 @@ var addToCart = {
|
|
|
173
177
|
]
|
|
174
178
|
};
|
|
175
179
|
var viewItem = {
|
|
180
|
+
title: "View item",
|
|
181
|
+
description: "A product view becomes a Criteo viewItem event with the viewed product id.",
|
|
176
182
|
in: getEvent("product view", {
|
|
177
183
|
timestamp: 1700000902e3,
|
|
178
184
|
data: { id: "SKU-C3", name: "Coffee Maker" },
|
|
@@ -234,6 +240,8 @@ var viewItem = {
|
|
|
234
240
|
]
|
|
235
241
|
};
|
|
236
242
|
var pageView = {
|
|
243
|
+
title: "Page view",
|
|
244
|
+
description: "A page view becomes a Criteo viewHome event used for home page impression tracking.",
|
|
237
245
|
in: getEvent("page view", {
|
|
238
246
|
timestamp: 1700000903e3,
|
|
239
247
|
source: {
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-criteo",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -87,6 +87,8 @@
|
|
|
87
87
|
},
|
|
88
88
|
"step": {
|
|
89
89
|
"addToCart": {
|
|
90
|
+
"title": "Add to cart",
|
|
91
|
+
"description": "A product add becomes a Criteo addToCart event with the item id, price, and quantity.",
|
|
90
92
|
"in": {
|
|
91
93
|
"name": "product add",
|
|
92
94
|
"data": {
|
|
@@ -134,7 +136,7 @@
|
|
|
134
136
|
"group": "gr0up",
|
|
135
137
|
"count": 1,
|
|
136
138
|
"version": {
|
|
137
|
-
"source": "3.4.
|
|
139
|
+
"source": "3.4.1",
|
|
138
140
|
"tagging": 1
|
|
139
141
|
},
|
|
140
142
|
"source": {
|
|
@@ -152,7 +154,7 @@
|
|
|
152
154
|
"nested",
|
|
153
155
|
{
|
|
154
156
|
"condition": {
|
|
155
|
-
"$code": "e=>
|
|
157
|
+
"$code": "e=>_(e)&&\"product\"===e.entity"
|
|
156
158
|
},
|
|
157
159
|
"map": {
|
|
158
160
|
"id": "data.id",
|
|
@@ -177,6 +179,8 @@
|
|
|
177
179
|
]
|
|
178
180
|
},
|
|
179
181
|
"pageView": {
|
|
182
|
+
"title": "Page view",
|
|
183
|
+
"description": "A page view becomes a Criteo viewHome event used for home page impression tracking.",
|
|
180
184
|
"in": {
|
|
181
185
|
"name": "page view",
|
|
182
186
|
"data": {
|
|
@@ -231,7 +235,7 @@
|
|
|
231
235
|
"group": "gr0up",
|
|
232
236
|
"count": 1,
|
|
233
237
|
"version": {
|
|
234
|
-
"source": "3.4.
|
|
238
|
+
"source": "3.4.1",
|
|
235
239
|
"tagging": 1
|
|
236
240
|
},
|
|
237
241
|
"source": {
|
|
@@ -252,6 +256,8 @@
|
|
|
252
256
|
]
|
|
253
257
|
},
|
|
254
258
|
"purchase": {
|
|
259
|
+
"title": "Purchase",
|
|
260
|
+
"description": "A completed order is posted to the Criteo Events API as a trackTransaction event with items.",
|
|
255
261
|
"in": {
|
|
256
262
|
"name": "order complete",
|
|
257
263
|
"data": {
|
|
@@ -298,7 +304,7 @@
|
|
|
298
304
|
"group": "gr0up",
|
|
299
305
|
"count": 1,
|
|
300
306
|
"version": {
|
|
301
|
-
"source": "3.4.
|
|
307
|
+
"source": "3.4.1",
|
|
302
308
|
"tagging": 1
|
|
303
309
|
},
|
|
304
310
|
"source": {
|
|
@@ -317,7 +323,7 @@
|
|
|
317
323
|
"nested",
|
|
318
324
|
{
|
|
319
325
|
"condition": {
|
|
320
|
-
"$code": "e=>
|
|
326
|
+
"$code": "e=>_(e)&&\"product\"===e.entity"
|
|
321
327
|
},
|
|
322
328
|
"map": {
|
|
323
329
|
"id": "data.id",
|
|
@@ -342,6 +348,8 @@
|
|
|
342
348
|
]
|
|
343
349
|
},
|
|
344
350
|
"viewItem": {
|
|
351
|
+
"title": "View item",
|
|
352
|
+
"description": "A product view becomes a Criteo viewItem event with the viewed product id.",
|
|
345
353
|
"in": {
|
|
346
354
|
"name": "product view",
|
|
347
355
|
"data": {
|
|
@@ -385,7 +393,7 @@
|
|
|
385
393
|
"group": "gr0up",
|
|
386
394
|
"count": 1,
|
|
387
395
|
"version": {
|
|
388
|
-
"source": "3.4.
|
|
396
|
+
"source": "3.4.1",
|
|
389
397
|
"tagging": 1
|
|
390
398
|
},
|
|
391
399
|
"source": {
|
|
@@ -403,7 +411,7 @@
|
|
|
403
411
|
"nested",
|
|
404
412
|
{
|
|
405
413
|
"condition": {
|
|
406
|
-
"$code": "e=>
|
|
414
|
+
"$code": "e=>_(e)&&\"product\"===e.entity"
|
|
407
415
|
},
|
|
408
416
|
"map": {
|
|
409
417
|
"id": "data.id"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-criteo",
|
|
3
3
|
"description": "Criteo Events API server destination for walkerOS",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"update": "npx npm-check-updates -u && npm update"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@walkeros/core": "3.4.
|
|
38
|
-
"@walkeros/server-core": "3.4.
|
|
37
|
+
"@walkeros/core": "3.4.1",
|
|
38
|
+
"@walkeros/server-core": "3.4.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@walkeros/collector": "3.4.
|
|
41
|
+
"@walkeros/collector": "3.4.1"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|