@walkeros/server-destination-tiktok 3.3.0-next-1776098542393

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @walkeros/server-destination-tiktok
2
+
3
+ Server-side TikTok Events API destination for walkerOS. Sends conversion events
4
+ directly to TikTok's Events API via HTTP POST for reliable server-to-server
5
+ tracking.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @walkeros/server-destination-tiktok
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```json
16
+ {
17
+ "destinations": {
18
+ "tiktok": {
19
+ "package": "@walkeros/server-destination-tiktok",
20
+ "config": {
21
+ "settings": {
22
+ "pixelCode": "YOUR_PIXEL_CODE",
23
+ "accessToken": "YOUR_ACCESS_TOKEN"
24
+ },
25
+ "mapping": {
26
+ "order": {
27
+ "complete": {
28
+ "name": "CompletePayment",
29
+ "data": {
30
+ "map": {
31
+ "value": "data.total",
32
+ "currency": "data.currency",
33
+ "order_id": "data.id"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## Settings
46
+
47
+ | Setting | Type | Required | Default | Description |
48
+ | ----------------- | -------- | -------- | ------------------------------------------------------------ | --------------------------------------- |
49
+ | `pixelCode` | string | Yes | -- | TikTok Pixel Code from Events Manager |
50
+ | `accessToken` | string | Yes | -- | Events API access token |
51
+ | `url` | string | No | `https://business-api.tiktok.com/open_api/v1.3/event/track/` | Custom endpoint URL |
52
+ | `test_event_code` | string | No | -- | Test event code for debugging |
53
+ | `doNotHash` | string[] | No | `[]` | User data fields to skip SHA256 hashing |
54
+ | `user_data` | object | No | -- | Default user data mapping |
55
+ | `partner_name` | string | No | `walkerOS` | Partner name for TikTok attribution |
56
+
57
+ ## Event Mapping
58
+
59
+ | walkerOS Event | TikTok Standard Event |
60
+ | ------------------ | ---------------------- |
61
+ | `product view` | `ViewContent` |
62
+ | `product add` | `AddToCart` |
63
+ | `checkout start` | `InitiateCheckout` |
64
+ | `checkout payment` | `AddPaymentInfo` |
65
+ | `order complete` | `CompletePayment` |
66
+ | `form submit` | `SubmitForm` |
67
+ | `user register` | `CompleteRegistration` |
68
+ | `search submit` | `Search` |
69
+ | `contact submit` | `Contact` |
70
+
71
+ ## User Data & Hashing
72
+
73
+ The following fields are automatically SHA256-hashed before sending:
74
+
75
+ | Field | Hashed | Description |
76
+ | -------------- | ------ | ----------------------------------- |
77
+ | `email` | Yes | Email address (lowercased, trimmed) |
78
+ | `phone_number` | Yes | Phone in E.164 format |
79
+ | `external_id` | Yes | Custom user identifier |
80
+ | `ttp` | No | TikTok `_ttp` cookie value |
81
+ | `ttclid` | No | TikTok click ID |
82
+ | `locale` | No | Client locale |
83
+
84
+ Use the `doNotHash` setting to skip hashing for pre-hashed values.
85
+
86
+ ## Deduplication
87
+
88
+ The destination uses `event.id` as TikTok's `event_id`. When using both the web
89
+ pixel (`@walkeros/web-destination-tiktok`) and this server destination, TikTok
90
+ deduplicates events by matching `event_id` + `event` name across both channels.
91
+
92
+ ## Links
93
+
94
+ - [TikTok Events API Documentation](https://business-api.tiktok.com/portal/docs?id=1771100865818625)
95
+ - [walkerOS Documentation](https://www.walkeros.io)
package/dist/dev.d.mts ADDED
@@ -0,0 +1,100 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { DestinationServer, sendServer } from '@walkeros/server-core';
4
+ import { Flow } from '@walkeros/core';
5
+
6
+ /**
7
+ * Standard TikTok Event Names
8
+ * https://business-api.tiktok.com/portal/docs?id=1771100865818625
9
+ */
10
+ declare const StandardEventNameSchema: z.ZodUnion<readonly [z.ZodEnum<{
11
+ ViewContent: "ViewContent";
12
+ ClickButton: "ClickButton";
13
+ Search: "Search";
14
+ AddToWishlist: "AddToWishlist";
15
+ AddToCart: "AddToCart";
16
+ InitiateCheckout: "InitiateCheckout";
17
+ AddPaymentInfo: "AddPaymentInfo";
18
+ CompletePayment: "CompletePayment";
19
+ PlaceAnOrder: "PlaceAnOrder";
20
+ Contact: "Contact";
21
+ Download: "Download";
22
+ SubmitForm: "SubmitForm";
23
+ CompleteRegistration: "CompleteRegistration";
24
+ Subscribe: "Subscribe";
25
+ }>, z.ZodString]>;
26
+
27
+ declare const SettingsSchema: z.ZodObject<{
28
+ pixelCode: z.ZodString;
29
+ accessToken: z.ZodString;
30
+ url: z.ZodOptional<z.ZodString>;
31
+ test_event_code: z.ZodOptional<z.ZodString>;
32
+ doNotHash: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ user_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ partner_name: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ type Settings = z.infer<typeof SettingsSchema>;
37
+
38
+ /**
39
+ * TikTok Events API Mapping Schema
40
+ * TikTok Events API has no event-level mapping configuration
41
+ */
42
+ declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
43
+ /**
44
+ * Type inference from MappingSchema
45
+ */
46
+ type Mapping = z.infer<typeof MappingSchema>;
47
+
48
+ declare const settings: _walkeros_core_dev.JSONSchema;
49
+ declare const mapping: _walkeros_core_dev.JSONSchema;
50
+
51
+ type index$1_Mapping = Mapping;
52
+ declare const index$1_MappingSchema: typeof MappingSchema;
53
+ type index$1_Settings = Settings;
54
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
55
+ declare const index$1_StandardEventNameSchema: typeof StandardEventNameSchema;
56
+ declare const index$1_mapping: typeof mapping;
57
+ declare const index$1_settings: typeof settings;
58
+ declare namespace index$1 {
59
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_StandardEventNameSchema as StandardEventNameSchema, index$1_mapping as mapping, index$1_settings as settings };
60
+ }
61
+
62
+ interface Env extends DestinationServer.Env {
63
+ sendServer?: typeof sendServer;
64
+ }
65
+
66
+ /**
67
+ * Standard mock environment for push operations
68
+ *
69
+ * Use this for testing TikTok Events API events without making
70
+ * actual HTTP requests to TikTok's servers.
71
+ */
72
+ declare const push: Env;
73
+ declare const simulation: string[];
74
+
75
+ declare const env_push: typeof push;
76
+ declare const env_simulation: typeof simulation;
77
+ declare namespace env {
78
+ export { env_push as push, env_simulation as simulation };
79
+ }
80
+
81
+ declare const purchase: Flow.StepExample;
82
+ declare const addToCart: Flow.StepExample;
83
+ declare const pageView: Flow.StepExample;
84
+ declare const lead: Flow.StepExample;
85
+
86
+ declare const step_addToCart: typeof addToCart;
87
+ declare const step_lead: typeof lead;
88
+ declare const step_pageView: typeof pageView;
89
+ declare const step_purchase: typeof purchase;
90
+ declare namespace step {
91
+ export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
92
+ }
93
+
94
+ declare const index_env: typeof env;
95
+ declare const index_step: typeof step;
96
+ declare namespace index {
97
+ export { index_env as env, index_step as step };
98
+ }
99
+
100
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { DestinationServer, sendServer } from '@walkeros/server-core';
4
+ import { Flow } from '@walkeros/core';
5
+
6
+ /**
7
+ * Standard TikTok Event Names
8
+ * https://business-api.tiktok.com/portal/docs?id=1771100865818625
9
+ */
10
+ declare const StandardEventNameSchema: z.ZodUnion<readonly [z.ZodEnum<{
11
+ ViewContent: "ViewContent";
12
+ ClickButton: "ClickButton";
13
+ Search: "Search";
14
+ AddToWishlist: "AddToWishlist";
15
+ AddToCart: "AddToCart";
16
+ InitiateCheckout: "InitiateCheckout";
17
+ AddPaymentInfo: "AddPaymentInfo";
18
+ CompletePayment: "CompletePayment";
19
+ PlaceAnOrder: "PlaceAnOrder";
20
+ Contact: "Contact";
21
+ Download: "Download";
22
+ SubmitForm: "SubmitForm";
23
+ CompleteRegistration: "CompleteRegistration";
24
+ Subscribe: "Subscribe";
25
+ }>, z.ZodString]>;
26
+
27
+ declare const SettingsSchema: z.ZodObject<{
28
+ pixelCode: z.ZodString;
29
+ accessToken: z.ZodString;
30
+ url: z.ZodOptional<z.ZodString>;
31
+ test_event_code: z.ZodOptional<z.ZodString>;
32
+ doNotHash: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ user_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
34
+ partner_name: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ type Settings = z.infer<typeof SettingsSchema>;
37
+
38
+ /**
39
+ * TikTok Events API Mapping Schema
40
+ * TikTok Events API has no event-level mapping configuration
41
+ */
42
+ declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
43
+ /**
44
+ * Type inference from MappingSchema
45
+ */
46
+ type Mapping = z.infer<typeof MappingSchema>;
47
+
48
+ declare const settings: _walkeros_core_dev.JSONSchema;
49
+ declare const mapping: _walkeros_core_dev.JSONSchema;
50
+
51
+ type index$1_Mapping = Mapping;
52
+ declare const index$1_MappingSchema: typeof MappingSchema;
53
+ type index$1_Settings = Settings;
54
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
55
+ declare const index$1_StandardEventNameSchema: typeof StandardEventNameSchema;
56
+ declare const index$1_mapping: typeof mapping;
57
+ declare const index$1_settings: typeof settings;
58
+ declare namespace index$1 {
59
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_StandardEventNameSchema as StandardEventNameSchema, index$1_mapping as mapping, index$1_settings as settings };
60
+ }
61
+
62
+ interface Env extends DestinationServer.Env {
63
+ sendServer?: typeof sendServer;
64
+ }
65
+
66
+ /**
67
+ * Standard mock environment for push operations
68
+ *
69
+ * Use this for testing TikTok Events API events without making
70
+ * actual HTTP requests to TikTok's servers.
71
+ */
72
+ declare const push: Env;
73
+ declare const simulation: string[];
74
+
75
+ declare const env_push: typeof push;
76
+ declare const env_simulation: typeof simulation;
77
+ declare namespace env {
78
+ export { env_push as push, env_simulation as simulation };
79
+ }
80
+
81
+ declare const purchase: Flow.StepExample;
82
+ declare const addToCart: Flow.StepExample;
83
+ declare const pageView: Flow.StepExample;
84
+ declare const lead: Flow.StepExample;
85
+
86
+ declare const step_addToCart: typeof addToCart;
87
+ declare const step_lead: typeof lead;
88
+ declare const step_pageView: typeof pageView;
89
+ declare const step_purchase: typeof purchase;
90
+ declare namespace step {
91
+ export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
92
+ }
93
+
94
+ declare const index_env: typeof env;
95
+ declare const index_step: typeof step;
96
+ declare namespace index {
97
+ export { index_env as env, index_step as step };
98
+ }
99
+
100
+ export { index as examples, index$1 as schemas };
package/dist/dev.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},i={};o(i,{examples:()=>_,schemas:()=>p}),module.exports=(e=i,((e,o,i,p)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let s of r(o))n.call(e,s)||s===i||t(e,s,{get:()=>o[s],enumerable:!(p=a(o,s))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var p={};o(p,{MappingSchema:()=>m,SettingsSchema:()=>c,StandardEventNameSchema:()=>l,mapping:()=>g,settings:()=>v});var s=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),c=d.z.object({pixelCode:d.z.string().min(1).describe("TikTok Pixel Code from Events Manager (like C0ABCDEF12345)"),accessToken:d.z.string().min(1).describe("Events API access token from TikTok Events Manager"),url:d.z.string().url().describe("Custom Events API endpoint URL").optional(),test_event_code:d.z.string().describe("Test event code for debugging in TikTok Events Manager (like TEST12345)").optional(),doNotHash:d.z.array(d.z.string()).describe("User data fields to skip hashing (like ['email', 'phone_number'])").optional(),user_data:d.z.record(d.z.string(),d.z.string()).describe("Mapping for user data fields (like { email: 'user.email' })").optional(),partner_name:d.z.string().describe("Partner name for TikTok attribution").optional()}),m=require("@walkeros/core/dev").z.object({}),u=require("@walkeros/core/dev"),l=u.z.union([u.z.enum(["ViewContent","ClickButton","Search","AddToWishlist","AddToCart","InitiateCheckout","AddPaymentInfo","CompletePayment","PlaceAnOrder","Contact","Download","SubmitForm","CompleteRegistration","Subscribe"]),u.z.string()]),v=(0,s.zodToSchema)(c),g=(0,s.zodToSchema)(m),_={};o(_,{env:()=>y,step:()=>b});var y={};o(y,{push:()=>h,simulation:()=>k});var h={sendServer:async function(e,t,a){return{ok:!0,data:{code:0,message:"OK"}}}},k=["sendServer"],b={};o(b,{addToCart:()=>x,lead:()=>C,pageView:()=>T,purchase:()=>E});var S=require("@walkeros/core"),E={in:(0,S.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:""}}),mapping:{name:"CompletePayment",data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},order_id:"data.id",content_type:{value:"product"},contents:{loop:["nested",{condition:e=>(0,S.isObject)(e)&&"product"===e.entity,map:{content_id:"data.id",content_name:"data.name",quantity:{key:"data.quantity",value:1},price:"data.price"}}]},user_data:{map:{external_id:"user.id"}}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"CompletePayment",event_id:"1700000900000-gr0up-1",timestamp:"2023-11-14T22:28:20.000Z",context:{user:{external_id:"user-123"},page:{url:"https://shop.example.com/checkout/complete"}},properties:{value:249.99,currency:"EUR",order_id:"ORD-300",content_type:"product",contents:[{content_id:"SKU-A1",content_name:"Widget Pro",quantity:2,price:124.99}]}}]}},x={in:(0,S.getEvent)("product add",{timestamp:1700000901e3,data:{id:"SKU-B2",name:"Running Shoes",price:89.99,color:"blue"},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:{content_type:{value:"product"},value:"data.price",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,S.isObject)(e)&&"product"===e.entity,map:{content_id:"data.id",content_name:"data.name",quantity:{key:"data.quantity",value:1},price:"data.price"}}]}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"AddToCart",event_id:"1700000901000-gr0up-1",timestamp:"2023-11-14T22:28:21.000Z",context:{page:{url:"https://shop.example.com/products/running-shoes"}},properties:{content_type:"product",value:89.99,currency:"EUR",contents:[{content_id:"SKU-B2",content_name:"Running Shoes",quantity:1,price:89.99}]}}]}},T={in:(0,S.getEvent)("page view",{timestamp:1700000902e3,source:{type:"server",id:"https://example.com/docs/",previous_id:""}}),mapping:void 0,out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"page view",event_id:"1700000902000-gr0up-1",timestamp:"2023-11-14T22:28:22.000Z",context:{page:{url:"https://example.com/docs/"}},properties:{}}]}},C={in:(0,S.getEvent)("form submit",{timestamp:1700000903e3,data:{type:"newsletter"},user:{email:"user@example.com"},source:{type:"server",id:"https://example.com/contact",previous_id:""}}),mapping:{name:"SubmitForm",data:{map:{user_data:{map:{email:"user.email"}}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"SubmitForm",event_id:"1700000903000-gr0up-1",timestamp:"2023-11-14T22:28:23.000Z",context:{user:{email:"user@example.com"},page:{url:"https://example.com/contact"}},properties:{}}]}};//# sourceMappingURL=dev.js.map
@@ -0,0 +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 pixelCode: z\n .string()\n .min(1)\n .describe('TikTok Pixel Code from Events Manager (like C0ABCDEF12345)'),\n accessToken: z\n .string()\n .min(1)\n .describe('Events API access token from TikTok Events Manager'),\n url: z.string().url().describe('Custom Events API endpoint URL').optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging in TikTok Events Manager (like TEST12345)',\n )\n .optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"User data fields to skip hashing (like ['email', 'phone_number'])\",\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\"Mapping for user data fields (like { email: 'user.email' })\")\n .optional(),\n partner_name: z\n .string()\n .describe('Partner name for TikTok attribution')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * TikTok Events API Mapping Schema\n * TikTok Events API 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","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard TikTok Event Names\n * https://business-api.tiktok.com/portal/docs?id=1771100865818625\n */\nexport const StandardEventNameSchema = z.union([\n z.enum([\n 'ViewContent',\n 'ClickButton',\n 'Search',\n 'AddToWishlist',\n 'AddToCart',\n 'InitiateCheckout',\n 'AddPaymentInfo',\n 'CompletePayment',\n 'PlaceAnOrder',\n 'Contact',\n 'Download',\n 'SubmitForm',\n 'CompleteRegistration',\n 'Subscribe',\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 TikTok Events 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 TikTok API response\n return {\n ok: true,\n data: {\n code: 0,\n message: 'OK',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing TikTok Events API events without making\n * actual HTTP requests to TikTok'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\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: '',\n },\n }),\n mapping: {\n name: 'CompletePayment',\n data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n content_type: { value: 'product' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n content_id: 'data.id',\n content_name: 'data.name',\n quantity: { key: 'data.quantity', value: 1 },\n price: 'data.price',\n },\n },\n ],\n },\n user_data: {\n map: {\n external_id: 'user.id',\n },\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'CompletePayment',\n event_id: '1700000900000-gr0up-1',\n timestamp: '2023-11-14T22:28:20.000Z',\n context: {\n user: {\n external_id: 'user-123',\n },\n page: {\n url: 'https://shop.example.com/checkout/complete',\n },\n },\n properties: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n content_type: 'product',\n contents: [\n {\n content_id: 'SKU-A1',\n content_name: 'Widget Pro',\n quantity: 2,\n price: 124.99,\n },\n ],\n },\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 color: 'blue',\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 content_type: { value: 'product' },\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n content_id: 'data.id',\n content_name: 'data.name',\n quantity: { key: 'data.quantity', value: 1 },\n price: 'data.price',\n },\n },\n ],\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'AddToCart',\n event_id: '1700000901000-gr0up-1',\n timestamp: '2023-11-14T22:28:21.000Z',\n context: {\n page: {\n url: 'https://shop.example.com/products/running-shoes',\n },\n },\n properties: {\n content_type: 'product',\n value: 89.99,\n currency: 'EUR',\n contents: [\n {\n content_id: 'SKU-B2',\n content_name: 'Running Shoes',\n quantity: 1,\n price: 89.99,\n },\n ],\n },\n },\n ],\n },\n};\n\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902000,\n source: {\n type: 'server',\n id: 'https://example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: undefined,\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'page view',\n event_id: '1700000902000-gr0up-1',\n timestamp: '2023-11-14T22:28:22.000Z',\n context: {\n page: {\n url: 'https://example.com/docs/',\n },\n },\n properties: {},\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000903000,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: {\n type: 'server',\n id: 'https://example.com/contact',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'SubmitForm',\n data: {\n map: {\n user_data: {\n map: {\n email: 'user.email',\n },\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'SubmitForm',\n event_id: '1700000903000-gr0up-1',\n timestamp: '2023-11-14T22:28:23.000Z',\n context: {\n user: {\n email: 'user@example.com',\n },\n page: {\n url: 'https://example.com/contact',\n },\n },\n properties: {},\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,4DAA4D;AAAA,EACxE,aAAa,aACV,OAAO,EACP,IAAI,CAAC,EACL,SAAS,oDAAoD;AAAA,EAChE,KAAK,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS,gCAAgC,EAAE,SAAS;AAAA,EAC1E,iBAAiB,aACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,aACR,MAAM,aAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,aACR,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,cAAc,aACX,OAAO,EACP,SAAS,qCAAqC,EAC9C,SAAS;AACd,CAAC;;;AChCD,IAAAC,cAAkB;AAMX,IAAM,gBAAgB,cAAE,OAAO,CAAC,CAAC;;;ACNxC,IAAAC,cAAkB;AAMX,IAAM,0BAA0B,cAAE,MAAM;AAAA,EAC7C,cAAE,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,EACF,CAAC;AAAA,E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C;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,OAAyB;AAAA,EACpC,QAAI,sBAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,aAAa;AAAA,IAC3B,MAAM,EAAE,OAAO,mBAAmB;AAAA,IAClC,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,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,UACP,MAAM;AAAA,YACJ,OAAO;AAAA,UACT;AAAA,UACA,MAAM;AAAA,YACJ,KAAK;AAAA,UACP;AAAA,QACF;AAAA,QACA,YAAY,CAAC;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
package/dist/dev.mjs ADDED
@@ -0,0 +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,{MappingSchema:()=>p,SettingsSchema:()=>o,StandardEventNameSchema:()=>s,mapping:()=>m,settings:()=>c});import{zodToSchema as r}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.object({pixelCode:n.string().min(1).describe("TikTok Pixel Code from Events Manager (like C0ABCDEF12345)"),accessToken:n.string().min(1).describe("Events API access token from TikTok Events Manager"),url:n.string().url().describe("Custom Events API endpoint URL").optional(),test_event_code:n.string().describe("Test event code for debugging in TikTok Events Manager (like TEST12345)").optional(),doNotHash:n.array(n.string()).describe("User data fields to skip hashing (like ['email', 'phone_number'])").optional(),user_data:n.record(n.string(),n.string()).describe("Mapping for user data fields (like { email: 'user.email' })").optional(),partner_name:n.string().describe("Partner name for TikTok attribution").optional()});import{z as i}from"@walkeros/core/dev";var p=i.object({});import{z as d}from"@walkeros/core/dev";var s=d.union([d.enum(["ViewContent","ClickButton","Search","AddToWishlist","AddToCart","InitiateCheckout","AddPaymentInfo","CompletePayment","PlaceAnOrder","Contact","Download","SubmitForm","CompleteRegistration","Subscribe"]),d.string()]),c=r(o),m=r(p),u={};t(u,{env:()=>l,step:()=>_});var l={};t(l,{push:()=>v,simulation:()=>g});var v={sendServer:async function(e,t,a){return{ok:!0,data:{code:0,message:"OK"}}}},g=["sendServer"],_={};t(_,{addToCart:()=>S,lead:()=>b,pageView:()=>x,purchase:()=>k});import{getEvent as y,isObject as h}from"@walkeros/core";var k={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:""}}),mapping:{name:"CompletePayment",data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},order_id:"data.id",content_type:{value:"product"},contents:{loop:["nested",{condition:e=>h(e)&&"product"===e.entity,map:{content_id:"data.id",content_name:"data.name",quantity:{key:"data.quantity",value:1},price:"data.price"}}]},user_data:{map:{external_id:"user.id"}}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"CompletePayment",event_id:"1700000900000-gr0up-1",timestamp:"2023-11-14T22:28:20.000Z",context:{user:{external_id:"user-123"},page:{url:"https://shop.example.com/checkout/complete"}},properties:{value:249.99,currency:"EUR",order_id:"ORD-300",content_type:"product",contents:[{content_id:"SKU-A1",content_name:"Widget Pro",quantity:2,price:124.99}]}}]}},S={in:y("product add",{timestamp:1700000901e3,data:{id:"SKU-B2",name:"Running Shoes",price:89.99,color:"blue"},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:{content_type:{value:"product"},value:"data.price",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>h(e)&&"product"===e.entity,map:{content_id:"data.id",content_name:"data.name",quantity:{key:"data.quantity",value:1},price:"data.price"}}]}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"AddToCart",event_id:"1700000901000-gr0up-1",timestamp:"2023-11-14T22:28:21.000Z",context:{page:{url:"https://shop.example.com/products/running-shoes"}},properties:{content_type:"product",value:89.99,currency:"EUR",contents:[{content_id:"SKU-B2",content_name:"Running Shoes",quantity:1,price:89.99}]}}]}},x={in:y("page view",{timestamp:1700000902e3,source:{type:"server",id:"https://example.com/docs/",previous_id:""}}),mapping:void 0,out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"page view",event_id:"1700000902000-gr0up-1",timestamp:"2023-11-14T22:28:22.000Z",context:{page:{url:"https://example.com/docs/"}},properties:{}}]}},b={in:y("form submit",{timestamp:1700000903e3,data:{type:"newsletter"},user:{email:"user@example.com"},source:{type:"server",id:"https://example.com/contact",previous_id:""}}),mapping:{name:"SubmitForm",data:{map:{user_data:{map:{email:"user.email"}}}}},out:{pixel_code:"PIXEL_CODE",partner_name:"walkerOS",data:[{event:"SubmitForm",event_id:"1700000903000-gr0up-1",timestamp:"2023-11-14T22:28:23.000Z",context:{user:{email:"user@example.com"},page:{url:"https://example.com/contact"}},properties:{}}]}};export{u as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
@@ -0,0 +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 pixelCode: z\n .string()\n .min(1)\n .describe('TikTok Pixel Code from Events Manager (like C0ABCDEF12345)'),\n accessToken: z\n .string()\n .min(1)\n .describe('Events API access token from TikTok Events Manager'),\n url: z.string().url().describe('Custom Events API endpoint URL').optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging in TikTok Events Manager (like TEST12345)',\n )\n .optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"User data fields to skip hashing (like ['email', 'phone_number'])\",\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\"Mapping for user data fields (like { email: 'user.email' })\")\n .optional(),\n partner_name: z\n .string()\n .describe('Partner name for TikTok attribution')\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * TikTok Events API Mapping Schema\n * TikTok Events API 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","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard TikTok Event Names\n * https://business-api.tiktok.com/portal/docs?id=1771100865818625\n */\nexport const StandardEventNameSchema = z.union([\n z.enum([\n 'ViewContent',\n 'ClickButton',\n 'Search',\n 'AddToWishlist',\n 'AddToCart',\n 'InitiateCheckout',\n 'AddPaymentInfo',\n 'CompletePayment',\n 'PlaceAnOrder',\n 'Contact',\n 'Download',\n 'SubmitForm',\n 'CompleteRegistration',\n 'Subscribe',\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 TikTok Events 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 TikTok API response\n return {\n ok: true,\n data: {\n code: 0,\n message: 'OK',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing TikTok Events API events without making\n * actual HTTP requests to TikTok'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\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: '',\n },\n }),\n mapping: {\n name: 'CompletePayment',\n data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n order_id: 'data.id',\n content_type: { value: 'product' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n content_id: 'data.id',\n content_name: 'data.name',\n quantity: { key: 'data.quantity', value: 1 },\n price: 'data.price',\n },\n },\n ],\n },\n user_data: {\n map: {\n external_id: 'user.id',\n },\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'CompletePayment',\n event_id: '1700000900000-gr0up-1',\n timestamp: '2023-11-14T22:28:20.000Z',\n context: {\n user: {\n external_id: 'user-123',\n },\n page: {\n url: 'https://shop.example.com/checkout/complete',\n },\n },\n properties: {\n value: 249.99,\n currency: 'EUR',\n order_id: 'ORD-300',\n content_type: 'product',\n contents: [\n {\n content_id: 'SKU-A1',\n content_name: 'Widget Pro',\n quantity: 2,\n price: 124.99,\n },\n ],\n },\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 color: 'blue',\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 content_type: { value: 'product' },\n value: 'data.price',\n currency: { value: 'EUR' },\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n content_id: 'data.id',\n content_name: 'data.name',\n quantity: { key: 'data.quantity', value: 1 },\n price: 'data.price',\n },\n },\n ],\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'AddToCart',\n event_id: '1700000901000-gr0up-1',\n timestamp: '2023-11-14T22:28:21.000Z',\n context: {\n page: {\n url: 'https://shop.example.com/products/running-shoes',\n },\n },\n properties: {\n content_type: 'product',\n value: 89.99,\n currency: 'EUR',\n contents: [\n {\n content_id: 'SKU-B2',\n content_name: 'Running Shoes',\n quantity: 1,\n price: 89.99,\n },\n ],\n },\n },\n ],\n },\n};\n\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', {\n timestamp: 1700000902000,\n source: {\n type: 'server',\n id: 'https://example.com/docs/',\n previous_id: '',\n },\n }),\n mapping: undefined,\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'page view',\n event_id: '1700000902000-gr0up-1',\n timestamp: '2023-11-14T22:28:22.000Z',\n context: {\n page: {\n url: 'https://example.com/docs/',\n },\n },\n properties: {},\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000903000,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: {\n type: 'server',\n id: 'https://example.com/contact',\n previous_id: '',\n },\n }),\n mapping: {\n name: 'SubmitForm',\n data: {\n map: {\n user_data: {\n map: {\n email: 'user.email',\n },\n },\n },\n },\n },\n out: {\n pixel_code: 'PIXEL_CODE',\n partner_name: 'walkerOS',\n data: [\n {\n event: 'SubmitForm',\n event_id: '1700000903000-gr0up-1',\n timestamp: '2023-11-14T22:28:23.000Z',\n context: {\n user: {\n email: 'user@example.com',\n },\n page: {\n url: 'https://example.com/contact',\n },\n },\n properties: {},\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,4DAA4D;AAAA,EACxE,aAAa,EACV,OAAO,EACP,IAAI,CAAC,EACL,SAAS,oDAAoD;AAAA,EAChE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,gCAAgC,EAAE,SAAS;AAAA,EAC1E,iBAAiB,EACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,EACR,MAAM,EAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,EACR,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,6DAA6D,EACtE,SAAS;AAAA,EACZ,cAAc,EACX,OAAO,EACP,SAAS,qCAAqC,EAC9C,SA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AAAA,IACxB,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,UACP,MAAM;AAAA,YACJ,KAAK;AAAA,UACP;AAAA,QACF;AAAA,QACA,YAAY,CAAC;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,OAAyB;AAAA,EACpC,IAAI,SAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,aAAa;AAAA,IAC3B,MAAM,EAAE,OAAO,mBAAmB;AAAA,IAClC,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,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,QACX,SAAS;AAAA,UACP,MAAM;AAAA,YACJ,OAAO;AAAA,UACT;AAAA,UACA,MAAM;AAAA,YACJ,KAAK;AAAA,UACP;AAAA,QACF;AAAA,QACA,YAAY,CAAC;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z"]}
@@ -0,0 +1,36 @@
1
+ import { DestinationServer, sendServer } from '@walkeros/server-core';
2
+ import { Flow } from '@walkeros/core';
3
+
4
+ interface Env extends DestinationServer.Env {
5
+ sendServer?: typeof sendServer;
6
+ }
7
+
8
+ /**
9
+ * Standard mock environment for push operations
10
+ *
11
+ * Use this for testing TikTok Events API events without making
12
+ * actual HTTP requests to TikTok's servers.
13
+ */
14
+ declare const push: Env;
15
+ declare const simulation: string[];
16
+
17
+ declare const env_push: typeof push;
18
+ declare const env_simulation: typeof simulation;
19
+ declare namespace env {
20
+ export { env_push as push, env_simulation as simulation };
21
+ }
22
+
23
+ declare const purchase: Flow.StepExample;
24
+ declare const addToCart: Flow.StepExample;
25
+ declare const pageView: Flow.StepExample;
26
+ declare const lead: Flow.StepExample;
27
+
28
+ declare const step_addToCart: typeof addToCart;
29
+ declare const step_lead: typeof lead;
30
+ declare const step_pageView: typeof pageView;
31
+ declare const step_purchase: typeof purchase;
32
+ declare namespace step {
33
+ export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
34
+ }
35
+
36
+ export { env, step };
@@ -0,0 +1,36 @@
1
+ import { DestinationServer, sendServer } from '@walkeros/server-core';
2
+ import { Flow } from '@walkeros/core';
3
+
4
+ interface Env extends DestinationServer.Env {
5
+ sendServer?: typeof sendServer;
6
+ }
7
+
8
+ /**
9
+ * Standard mock environment for push operations
10
+ *
11
+ * Use this for testing TikTok Events API events without making
12
+ * actual HTTP requests to TikTok's servers.
13
+ */
14
+ declare const push: Env;
15
+ declare const simulation: string[];
16
+
17
+ declare const env_push: typeof push;
18
+ declare const env_simulation: typeof simulation;
19
+ declare namespace env {
20
+ export { env_push as push, env_simulation as simulation };
21
+ }
22
+
23
+ declare const purchase: Flow.StepExample;
24
+ declare const addToCart: Flow.StepExample;
25
+ declare const pageView: Flow.StepExample;
26
+ declare const lead: Flow.StepExample;
27
+
28
+ declare const step_addToCart: typeof addToCart;
29
+ declare const step_lead: typeof lead;
30
+ declare const step_pageView: typeof pageView;
31
+ declare const step_purchase: typeof purchase;
32
+ declare namespace step {
33
+ export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
34
+ }
35
+
36
+ export { env, step };