@walkeros/server-destination-snapchat 3.4.0-next-1776749829492
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 +21 -0
- package/README.md +162 -0
- package/dist/dev.d.mts +120 -0
- package/dist/dev.d.ts +120 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +36 -0
- package/dist/examples/index.d.ts +36 -0
- package/dist/examples/index.js +295 -0
- package/dist/examples/index.mjs +273 -0
- package/dist/index.d.mts +147 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/walkerOS.json +449 -0
- package/package.json +76 -0
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,162 @@
|
|
|
1
|
+
# @walkeros/server-destination-snapchat
|
|
2
|
+
|
|
3
|
+
Server-side Snapchat Conversions API destination for walkerOS. Sends conversion
|
|
4
|
+
events directly to Snapchat's Conversions API v3 via HTTP POST for reliable
|
|
5
|
+
server-to-server tracking.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @walkeros/server-destination-snapchat
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"destinations": {
|
|
18
|
+
"snapchat": {
|
|
19
|
+
"package": "@walkeros/server-destination-snapchat",
|
|
20
|
+
"config": {
|
|
21
|
+
"settings": {
|
|
22
|
+
"pixelId": "YOUR_PIXEL_ID",
|
|
23
|
+
"accessToken": "YOUR_ACCESS_TOKEN"
|
|
24
|
+
},
|
|
25
|
+
"mapping": {
|
|
26
|
+
"order": {
|
|
27
|
+
"complete": {
|
|
28
|
+
"name": "PURCHASE",
|
|
29
|
+
"data": {
|
|
30
|
+
"map": {
|
|
31
|
+
"custom_data": {
|
|
32
|
+
"map": {
|
|
33
|
+
"value": "data.total",
|
|
34
|
+
"currency": "data.currency",
|
|
35
|
+
"transaction_id": "data.id"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Settings
|
|
50
|
+
|
|
51
|
+
| Setting | Type | Required | Default | Description |
|
|
52
|
+
| --------------- | -------- | -------- | ----------------------------- | ----------------------------------------------------------- |
|
|
53
|
+
| `accessToken` | string | Yes | -- | Long-lived CAPI token from Snapchat Ads Manager |
|
|
54
|
+
| `pixelId` | string | Yes | -- | Snap Pixel ID |
|
|
55
|
+
| `url` | string | No | `https://tr.snapchat.com/v3/` | Custom Conversions API base URL |
|
|
56
|
+
| `action_source` | string | No | `WEB` | One of `WEB`, `MOBILE_APP`, `OFFLINE` |
|
|
57
|
+
| `doNotHash` | string[] | No | `[]` | User data fields to skip SHA-256 hashing |
|
|
58
|
+
| `user_data` | object | No | -- | Default user data mapping (e.g. `{ em: 'user.email' }`) |
|
|
59
|
+
| `testMode` | boolean | No | `false` | Send to `/events/validate` for testing instead of `/events` |
|
|
60
|
+
|
|
61
|
+
## Event Mapping
|
|
62
|
+
|
|
63
|
+
| walkerOS Event | Snapchat Standard Event (UPPERCASE) |
|
|
64
|
+
| ------------------ | ----------------------------------- |
|
|
65
|
+
| `page view` | `PAGE_VIEW` |
|
|
66
|
+
| `product view` | `VIEW_CONTENT` |
|
|
67
|
+
| `product add` | `ADD_CART` |
|
|
68
|
+
| `wishlist add` | `ADD_TO_WISHLIST` |
|
|
69
|
+
| `checkout start` | `START_CHECKOUT` |
|
|
70
|
+
| `checkout payment` | `ADD_BILLING` |
|
|
71
|
+
| `order complete` | `PURCHASE` |
|
|
72
|
+
| `form submit` | `SIGN_UP` |
|
|
73
|
+
| `search submit` | `SEARCH` |
|
|
74
|
+
| `subscribe submit` | `SUBSCRIBE` |
|
|
75
|
+
| `user login` | `LOGIN` |
|
|
76
|
+
|
|
77
|
+
Set the Snapchat event name via the rule's `name` field. Use UPPERCASE for
|
|
78
|
+
standard events; custom event names may use `CUSTOM_EVENT_1..5` or any string.
|
|
79
|
+
|
|
80
|
+
## User Data & Hashing
|
|
81
|
+
|
|
82
|
+
The following 11 identity fields are automatically SHA-256 hashed before
|
|
83
|
+
sending. They match Meta's CAPI semantics:
|
|
84
|
+
|
|
85
|
+
| Field | Hashed | Description |
|
|
86
|
+
| ------------- | ------ | -------------------------------------------- |
|
|
87
|
+
| `em` | Yes | Email (lowercased, trimmed) |
|
|
88
|
+
| `ph` | Yes | Phone number (E.164 digits) |
|
|
89
|
+
| `fn` | Yes | First name (lowercase) |
|
|
90
|
+
| `ln` | Yes | Last name (lowercase) |
|
|
91
|
+
| `db` | Yes | Date of birth (YYYYMMDD) |
|
|
92
|
+
| `ge` | Yes | Gender (`m`, `f`) |
|
|
93
|
+
| `ct` | Yes | City (lowercase) |
|
|
94
|
+
| `st` | Yes | State (lowercase) |
|
|
95
|
+
| `zp` | Yes | Zip or postal code |
|
|
96
|
+
| `country` | Yes | Country code (ISO 3166-1 alpha-2, lowercase) |
|
|
97
|
+
| `external_id` | Yes | External/customer identifier |
|
|
98
|
+
|
|
99
|
+
These user data fields are **never** hashed and pass through as-is:
|
|
100
|
+
|
|
101
|
+
| Field | Hashed | Description |
|
|
102
|
+
| ------------------- | ------ | ---------------------------------- |
|
|
103
|
+
| `sc_cookie1` | No | Snap Pixel cookie |
|
|
104
|
+
| `client_ip_address` | No | Client IP address (IPv4 or IPv6) |
|
|
105
|
+
| `client_user_agent` | No | Browser user agent string |
|
|
106
|
+
| `sc_click_id` | No | Snap click ID |
|
|
107
|
+
| `idfv` | No | iOS IDFV |
|
|
108
|
+
| `madid` | No | Mobile advertiser ID (IDFA / AAID) |
|
|
109
|
+
|
|
110
|
+
Use the `doNotHash` setting to skip hashing for pre-hashed values.
|
|
111
|
+
|
|
112
|
+
## custom_data Structure
|
|
113
|
+
|
|
114
|
+
Properties must be nested under `custom_data` (unlike Meta's CAPI which puts
|
|
115
|
+
them flat on the event root). Map them via `data.map.custom_data.map`:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"data": {
|
|
120
|
+
"map": {
|
|
121
|
+
"custom_data": {
|
|
122
|
+
"map": {
|
|
123
|
+
"value": "data.total",
|
|
124
|
+
"currency": "data.currency",
|
|
125
|
+
"transaction_id": "data.id",
|
|
126
|
+
"contents": {
|
|
127
|
+
"loop": [
|
|
128
|
+
"nested",
|
|
129
|
+
{
|
|
130
|
+
"map": {
|
|
131
|
+
"id": "data.id",
|
|
132
|
+
"item_price": "data.price",
|
|
133
|
+
"quantity": { "key": "data.quantity", "value": 1 }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Deduplication
|
|
146
|
+
|
|
147
|
+
The destination uses `event.id` as Snapchat's `event_id`. When using both the
|
|
148
|
+
Snap Pixel client-side and this server destination, Snapchat deduplicates
|
|
149
|
+
matching events across channels within a 48h window by `event_id` +
|
|
150
|
+
`event_name`.
|
|
151
|
+
|
|
152
|
+
## Test Mode
|
|
153
|
+
|
|
154
|
+
Set `"testMode": true` in settings to send events to Snapchat's
|
|
155
|
+
`/events/validate` endpoint instead of `/events`. Snapchat returns detailed
|
|
156
|
+
validation feedback without counting the event toward ads delivery. Switch off
|
|
157
|
+
before going live.
|
|
158
|
+
|
|
159
|
+
## Links
|
|
160
|
+
|
|
161
|
+
- [Snapchat Conversions API Documentation](https://businesshelp.snapchat.com/s/article/conversions-api)
|
|
162
|
+
- [walkerOS Documentation](https://www.walkeros.io)
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
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 Snapchat Conversions API event names (UPPERCASE).
|
|
8
|
+
* https://businesshelp.snapchat.com/s/article/capi-parameters
|
|
9
|
+
*/
|
|
10
|
+
declare const StandardEventNameSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
11
|
+
PAGE_VIEW: "PAGE_VIEW";
|
|
12
|
+
VIEW_CONTENT: "VIEW_CONTENT";
|
|
13
|
+
ADD_CART: "ADD_CART";
|
|
14
|
+
ADD_TO_WISHLIST: "ADD_TO_WISHLIST";
|
|
15
|
+
START_CHECKOUT: "START_CHECKOUT";
|
|
16
|
+
ADD_BILLING: "ADD_BILLING";
|
|
17
|
+
PURCHASE: "PURCHASE";
|
|
18
|
+
SIGN_UP: "SIGN_UP";
|
|
19
|
+
SEARCH: "SEARCH";
|
|
20
|
+
SAVE: "SAVE";
|
|
21
|
+
SUBSCRIBE: "SUBSCRIBE";
|
|
22
|
+
COMPLETE_TUTORIAL: "COMPLETE_TUTORIAL";
|
|
23
|
+
START_TRIAL: "START_TRIAL";
|
|
24
|
+
AD_CLICK: "AD_CLICK";
|
|
25
|
+
AD_VIEW: "AD_VIEW";
|
|
26
|
+
APP_OPEN: "APP_OPEN";
|
|
27
|
+
LEVEL_COMPLETE: "LEVEL_COMPLETE";
|
|
28
|
+
INVITE: "INVITE";
|
|
29
|
+
LOGIN: "LOGIN";
|
|
30
|
+
SHARE: "SHARE";
|
|
31
|
+
RESERVE: "RESERVE";
|
|
32
|
+
ACHIEVEMENT_UNLOCKED: "ACHIEVEMENT_UNLOCKED";
|
|
33
|
+
SPENT_CREDITS: "SPENT_CREDITS";
|
|
34
|
+
RATE: "RATE";
|
|
35
|
+
LIST_VIEW: "LIST_VIEW";
|
|
36
|
+
CUSTOM_EVENT_1: "CUSTOM_EVENT_1";
|
|
37
|
+
CUSTOM_EVENT_2: "CUSTOM_EVENT_2";
|
|
38
|
+
CUSTOM_EVENT_3: "CUSTOM_EVENT_3";
|
|
39
|
+
CUSTOM_EVENT_4: "CUSTOM_EVENT_4";
|
|
40
|
+
CUSTOM_EVENT_5: "CUSTOM_EVENT_5";
|
|
41
|
+
}>, z.ZodString]>;
|
|
42
|
+
|
|
43
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
44
|
+
accessToken: z.ZodString;
|
|
45
|
+
pixelId: z.ZodString;
|
|
46
|
+
url: z.ZodOptional<z.ZodString>;
|
|
47
|
+
action_source: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
WEB: "WEB";
|
|
49
|
+
MOBILE_APP: "MOBILE_APP";
|
|
50
|
+
OFFLINE: "OFFLINE";
|
|
51
|
+
}>>;
|
|
52
|
+
doNotHash: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
user_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
54
|
+
testMode: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Snapchat Conversions API Mapping Schema
|
|
60
|
+
* Snapchat CAPI has no event-level mapping configuration
|
|
61
|
+
*/
|
|
62
|
+
declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
|
|
63
|
+
/**
|
|
64
|
+
* Type inference from MappingSchema
|
|
65
|
+
*/
|
|
66
|
+
type Mapping = z.infer<typeof MappingSchema>;
|
|
67
|
+
|
|
68
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
69
|
+
declare const mapping: _walkeros_core_dev.JSONSchema;
|
|
70
|
+
|
|
71
|
+
type index$1_Mapping = Mapping;
|
|
72
|
+
declare const index$1_MappingSchema: typeof MappingSchema;
|
|
73
|
+
type index$1_Settings = Settings;
|
|
74
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
75
|
+
declare const index$1_StandardEventNameSchema: typeof StandardEventNameSchema;
|
|
76
|
+
declare const index$1_mapping: typeof mapping;
|
|
77
|
+
declare const index$1_settings: typeof settings;
|
|
78
|
+
declare namespace index$1 {
|
|
79
|
+
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 };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface Env extends DestinationServer.Env {
|
|
83
|
+
sendServer?: typeof sendServer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Standard mock environment for push operations.
|
|
88
|
+
*
|
|
89
|
+
* Use this for testing Snapchat Conversions API events without making
|
|
90
|
+
* actual HTTP requests to Snapchat's servers.
|
|
91
|
+
*/
|
|
92
|
+
declare const push: Env;
|
|
93
|
+
declare const simulation: string[];
|
|
94
|
+
|
|
95
|
+
declare const env_push: typeof push;
|
|
96
|
+
declare const env_simulation: typeof simulation;
|
|
97
|
+
declare namespace env {
|
|
98
|
+
export { env_push as push, env_simulation as simulation };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare const purchase: Flow.StepExample;
|
|
102
|
+
declare const addToCart: Flow.StepExample;
|
|
103
|
+
declare const pageView: Flow.StepExample;
|
|
104
|
+
declare const lead: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_addToCart: typeof addToCart;
|
|
107
|
+
declare const step_lead: typeof lead;
|
|
108
|
+
declare const step_pageView: typeof pageView;
|
|
109
|
+
declare const step_purchase: typeof purchase;
|
|
110
|
+
declare namespace step {
|
|
111
|
+
export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare const index_env: typeof env;
|
|
115
|
+
declare const index_step: typeof step;
|
|
116
|
+
declare namespace index {
|
|
117
|
+
export { index_env as env, index_step as step };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
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 Snapchat Conversions API event names (UPPERCASE).
|
|
8
|
+
* https://businesshelp.snapchat.com/s/article/capi-parameters
|
|
9
|
+
*/
|
|
10
|
+
declare const StandardEventNameSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
11
|
+
PAGE_VIEW: "PAGE_VIEW";
|
|
12
|
+
VIEW_CONTENT: "VIEW_CONTENT";
|
|
13
|
+
ADD_CART: "ADD_CART";
|
|
14
|
+
ADD_TO_WISHLIST: "ADD_TO_WISHLIST";
|
|
15
|
+
START_CHECKOUT: "START_CHECKOUT";
|
|
16
|
+
ADD_BILLING: "ADD_BILLING";
|
|
17
|
+
PURCHASE: "PURCHASE";
|
|
18
|
+
SIGN_UP: "SIGN_UP";
|
|
19
|
+
SEARCH: "SEARCH";
|
|
20
|
+
SAVE: "SAVE";
|
|
21
|
+
SUBSCRIBE: "SUBSCRIBE";
|
|
22
|
+
COMPLETE_TUTORIAL: "COMPLETE_TUTORIAL";
|
|
23
|
+
START_TRIAL: "START_TRIAL";
|
|
24
|
+
AD_CLICK: "AD_CLICK";
|
|
25
|
+
AD_VIEW: "AD_VIEW";
|
|
26
|
+
APP_OPEN: "APP_OPEN";
|
|
27
|
+
LEVEL_COMPLETE: "LEVEL_COMPLETE";
|
|
28
|
+
INVITE: "INVITE";
|
|
29
|
+
LOGIN: "LOGIN";
|
|
30
|
+
SHARE: "SHARE";
|
|
31
|
+
RESERVE: "RESERVE";
|
|
32
|
+
ACHIEVEMENT_UNLOCKED: "ACHIEVEMENT_UNLOCKED";
|
|
33
|
+
SPENT_CREDITS: "SPENT_CREDITS";
|
|
34
|
+
RATE: "RATE";
|
|
35
|
+
LIST_VIEW: "LIST_VIEW";
|
|
36
|
+
CUSTOM_EVENT_1: "CUSTOM_EVENT_1";
|
|
37
|
+
CUSTOM_EVENT_2: "CUSTOM_EVENT_2";
|
|
38
|
+
CUSTOM_EVENT_3: "CUSTOM_EVENT_3";
|
|
39
|
+
CUSTOM_EVENT_4: "CUSTOM_EVENT_4";
|
|
40
|
+
CUSTOM_EVENT_5: "CUSTOM_EVENT_5";
|
|
41
|
+
}>, z.ZodString]>;
|
|
42
|
+
|
|
43
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
44
|
+
accessToken: z.ZodString;
|
|
45
|
+
pixelId: z.ZodString;
|
|
46
|
+
url: z.ZodOptional<z.ZodString>;
|
|
47
|
+
action_source: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
WEB: "WEB";
|
|
49
|
+
MOBILE_APP: "MOBILE_APP";
|
|
50
|
+
OFFLINE: "OFFLINE";
|
|
51
|
+
}>>;
|
|
52
|
+
doNotHash: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
user_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
54
|
+
testMode: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Snapchat Conversions API Mapping Schema
|
|
60
|
+
* Snapchat CAPI has no event-level mapping configuration
|
|
61
|
+
*/
|
|
62
|
+
declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
|
|
63
|
+
/**
|
|
64
|
+
* Type inference from MappingSchema
|
|
65
|
+
*/
|
|
66
|
+
type Mapping = z.infer<typeof MappingSchema>;
|
|
67
|
+
|
|
68
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
69
|
+
declare const mapping: _walkeros_core_dev.JSONSchema;
|
|
70
|
+
|
|
71
|
+
type index$1_Mapping = Mapping;
|
|
72
|
+
declare const index$1_MappingSchema: typeof MappingSchema;
|
|
73
|
+
type index$1_Settings = Settings;
|
|
74
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
75
|
+
declare const index$1_StandardEventNameSchema: typeof StandardEventNameSchema;
|
|
76
|
+
declare const index$1_mapping: typeof mapping;
|
|
77
|
+
declare const index$1_settings: typeof settings;
|
|
78
|
+
declare namespace index$1 {
|
|
79
|
+
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 };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface Env extends DestinationServer.Env {
|
|
83
|
+
sendServer?: typeof sendServer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Standard mock environment for push operations.
|
|
88
|
+
*
|
|
89
|
+
* Use this for testing Snapchat Conversions API events without making
|
|
90
|
+
* actual HTTP requests to Snapchat's servers.
|
|
91
|
+
*/
|
|
92
|
+
declare const push: Env;
|
|
93
|
+
declare const simulation: string[];
|
|
94
|
+
|
|
95
|
+
declare const env_push: typeof push;
|
|
96
|
+
declare const env_simulation: typeof simulation;
|
|
97
|
+
declare namespace env {
|
|
98
|
+
export { env_push as push, env_simulation as simulation };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare const purchase: Flow.StepExample;
|
|
102
|
+
declare const addToCart: Flow.StepExample;
|
|
103
|
+
declare const pageView: Flow.StepExample;
|
|
104
|
+
declare const lead: Flow.StepExample;
|
|
105
|
+
|
|
106
|
+
declare const step_addToCart: typeof addToCart;
|
|
107
|
+
declare const step_lead: typeof lead;
|
|
108
|
+
declare const step_pageView: typeof pageView;
|
|
109
|
+
declare const step_purchase: typeof purchase;
|
|
110
|
+
declare namespace step {
|
|
111
|
+
export { step_addToCart as addToCart, step_lead as lead, step_pageView as pageView, step_purchase as purchase };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare const index_env: typeof env;
|
|
115
|
+
declare const index_step: typeof step;
|
|
116
|
+
declare namespace index {
|
|
117
|
+
export { index_env as env, index_step as step };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
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,s=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},i={};s(i,{examples:()=>E,schemas:()=>o}),module.exports=(e=i,((e,s,i,o)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let c of r(s))n.call(e,c)||c===i||t(e,c,{get:()=>s[c],enumerable:!(o=a(s,c))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};s(o,{MappingSchema:()=>p,SettingsSchema:()=>u,StandardEventNameSchema:()=>_,mapping:()=>v,settings:()=>l});var c=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),u=d.z.object({accessToken:d.z.string().min(1).describe("Long-lived Conversions API access token from Snapchat Ads Manager"),pixelId:d.z.string().min(1).describe("Snap Pixel ID"),url:d.z.string().url().describe("Custom Conversions API base URL (default https://tr.snapchat.com/v3/)").optional(),action_source:d.z.enum(["WEB","MOBILE_APP","OFFLINE"]).describe("Event action source (default WEB)").optional(),doNotHash:d.z.array(d.z.string()).describe("User data fields to skip hashing (like ['em', 'ph'])").optional(),user_data:d.z.record(d.z.string(),d.z.string()).describe("Mapping for user data fields (like { em: 'user.email' })").optional(),testMode:d.z.boolean().describe("When true, sends events to /events/validate instead of /events for testing").optional()}),p=require("@walkeros/core/dev").z.object({}),m=require("@walkeros/core/dev"),_=m.z.union([m.z.enum(["PAGE_VIEW","VIEW_CONTENT","ADD_CART","ADD_TO_WISHLIST","START_CHECKOUT","ADD_BILLING","PURCHASE","SIGN_UP","SEARCH","SAVE","SUBSCRIBE","COMPLETE_TUTORIAL","START_TRIAL","AD_CLICK","AD_VIEW","APP_OPEN","LEVEL_COMPLETE","INVITE","LOGIN","SHARE","RESERVE","ACHIEVEMENT_UNLOCKED","SPENT_CREDITS","RATE","LIST_VIEW","CUSTOM_EVENT_1","CUSTOM_EVENT_2","CUSTOM_EVENT_3","CUSTOM_EVENT_4","CUSTOM_EVENT_5"]),m.z.string()]),l=(0,c.zodToSchema)(u),v=(0,c.zodToSchema)(p),E={};s(E,{env:()=>S,step:()=>y});var S={};s(S,{push:()=>g,simulation:()=>h});var g={sendServer:async()=>({ok:!0,data:{status:"OK",request_id:"mock-123"}})},h=["sendServer"],y={};s(y,{addToCart:()=>O,lead:()=>C,pageView:()=>A,purchase:()=>f});var T=require("@walkeros/core"),b="https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t",f={in:(0,T.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:"PURCHASE",data:{map:{custom_data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},transaction_id:"data.id",contents:{loop:["nested",{condition:e=>(0,T.isObject)(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}},user_data:{map:{external_id:"user.id"}}}}},out:[["sendServer",b,JSON.stringify({data:[{event_name:"PURCHASE",event_time:1700000900,action_source:"WEB",event_id:"1700000900000-gr0up-1",user_data:{external_id:"fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8"},custom_data:{value:249.99,currency:"EUR",transaction_id:"ORD-300",contents:[{id:"SKU-A1",item_price:124.99,quantity:2}]},event_source_url:"https://shop.example.com/checkout/complete"}]})]]},O={in:(0,T.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:"ADD_CART",data:{map:{custom_data:{map:{value:"data.price",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>(0,T.isObject)(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",b,JSON.stringify({data:[{event_name:"ADD_CART",event_time:1700000901,action_source:"WEB",event_id:"1700000901000-gr0up-1",user_data:{},custom_data:{value:89.99,currency:"EUR",contents:[{id:"SKU-B2",item_price:89.99,quantity:1}]},event_source_url:"https://shop.example.com/products/running-shoes"}]})]]},A={in:(0,T.getEvent)("page view",{timestamp:1700000902e3,source:{type:"server",id:"https://example.com/docs/",previous_id:""}}),mapping:void 0,out:[["sendServer",b,JSON.stringify({data:[{event_name:"page view",event_time:1700000902,action_source:"WEB",event_id:"1700000902000-gr0up-1",user_data:{},custom_data:{},event_source_url:"https://example.com/docs/"}]})]]},C={in:(0,T.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:"SIGN_UP",data:{map:{user_data:{map:{em:"user.email"}},custom_data:{map:{sign_up_method:{value:"newsletter"}}}}}},out:[["sendServer",b,JSON.stringify({data:[{event_name:"SIGN_UP",event_time:1700000903,action_source:"WEB",event_id:"1700000903000-gr0up-1",user_data:{em:"b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514"},custom_data:{sign_up_method:"newsletter"},event_source_url:"https://example.com/contact"}]})]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -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 accessToken: z\n .string()\n .min(1)\n .describe(\n 'Long-lived Conversions API access token from Snapchat Ads Manager',\n ),\n pixelId: z.string().min(1).describe('Snap Pixel ID'),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Conversions API base URL (default https://tr.snapchat.com/v3/)',\n )\n .optional(),\n action_source: z\n .enum(['WEB', 'MOBILE_APP', 'OFFLINE'])\n .describe('Event action source (default WEB)')\n .optional(),\n doNotHash: z\n .array(z.string())\n .describe(\"User data fields to skip hashing (like ['em', 'ph'])\")\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\"Mapping for user data fields (like { em: 'user.email' })\")\n .optional(),\n testMode: z\n .boolean()\n .describe(\n 'When true, sends events to /events/validate instead of /events for testing',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Snapchat Conversions API Mapping Schema\n * Snapchat CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Snapchat Conversions API event names (UPPERCASE).\n * https://businesshelp.snapchat.com/s/article/capi-parameters\n */\nexport const StandardEventNameSchema = z.union([\n z.enum([\n 'PAGE_VIEW',\n 'VIEW_CONTENT',\n 'ADD_CART',\n 'ADD_TO_WISHLIST',\n 'START_CHECKOUT',\n 'ADD_BILLING',\n 'PURCHASE',\n 'SIGN_UP',\n 'SEARCH',\n 'SAVE',\n 'SUBSCRIBE',\n 'COMPLETE_TUTORIAL',\n 'START_TRIAL',\n 'AD_CLICK',\n 'AD_VIEW',\n 'APP_OPEN',\n 'LEVEL_COMPLETE',\n 'INVITE',\n 'LOGIN',\n 'SHARE',\n 'RESERVE',\n 'ACHIEVEMENT_UNLOCKED',\n 'SPENT_CREDITS',\n 'RATE',\n 'LIST_VIEW',\n 'CUSTOM_EVENT_1',\n 'CUSTOM_EVENT_2',\n 'CUSTOM_EVENT_3',\n 'CUSTOM_EVENT_4',\n 'CUSTOM_EVENT_5',\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 Snapchat Conversions 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: {\n status: 'OK',\n request_id: 'mock-123',\n },\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Snapchat Conversions API events without making\n * actual HTTP requests to Snapchat'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 * Snapchat Conversions API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is `${settings.url}${settings.pixelId}/${path}?access_token=${settings.accessToken}`\n * with `path` = `events` (or `events/validate` when `testMode` is set),\n * and `body` is the JSON-stringified `{ data: [snapchatEvent] }` payload.\n *\n * The test fixture pins `accessToken = 's3cr3t'` and `pixelId = 'p1x3l1d'`,\n * so every endpoint resolves to:\n * https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t\n *\n * Body fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * 1. event_name\n * 2. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 3. action_source (default 'WEB')\n * 4. event_id\n * 5. user_data (hashed per Snapchat's PII requirements)\n * 6. custom_data (mapped event data, excluding user_data/custom_data keys)\n * 7. event_source_url (appended last when action_source === 'WEB')\n */\nconst ENDPOINT =\n 'https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t';\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: 'PURCHASE',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n transaction_id: 'data.id',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n user_data: {\n map: {\n external_id: 'user.id',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'PURCHASE',\n event_time: 1700000900,\n action_source: 'WEB',\n event_id: '1700000900000-gr0up-1',\n user_data: {\n external_id:\n 'fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8',\n },\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n transaction_id: 'ORD-300',\n contents: [{ id: 'SKU-A1', item_price: 124.99, quantity: 2 }],\n },\n event_source_url: 'https://shop.example.com/checkout/complete',\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: 'ADD_CART',\n data: {\n map: {\n custom_data: {\n map: {\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 id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'ADD_CART',\n event_time: 1700000901,\n action_source: 'WEB',\n event_id: '1700000901000-gr0up-1',\n user_data: {},\n custom_data: {\n value: 89.99,\n currency: 'EUR',\n contents: [{ id: 'SKU-B2', item_price: 89.99, quantity: 1 }],\n },\n event_source_url: 'https://shop.example.com/products/running-shoes',\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 [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page view',\n event_time: 1700000902,\n action_source: 'WEB',\n event_id: '1700000902000-gr0up-1',\n user_data: {},\n custom_data: {},\n event_source_url: 'https://example.com/docs/',\n },\n ],\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: 'SIGN_UP',\n data: {\n map: {\n user_data: {\n map: {\n em: 'user.email',\n },\n },\n custom_data: {\n map: {\n sign_up_method: { value: 'newsletter' },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'SIGN_UP',\n event_time: 1700000903,\n action_source: 'WEB',\n event_id: '1700000903000-gr0up-1',\n user_data: {\n // sha256('user@example.com')\n em: 'b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514',\n },\n custom_data: {\n sign_up_method: 'newsletter',\n },\n event_source_url: 'https://example.com/contact',\n },\n ],\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,aAAa,aACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,eAAe;AAAA,EACnD,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,aACZ,KAAK,CAAC,OAAO,cAAc,SAAS,CAAC,EACrC,SAAS,mCAAmC,EAC5C,SAAS;AAAA,EACZ,WAAW,aACR,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,sDAAsD,EAC/D,SAAS;AAAA,EACZ,WAAW,aACR,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B,SAAS,0DAA0D,EACnE,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC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,YACV,WAAW;AAAA;AAAA,cAET,IAAI;AAAA,YACN;AAAA,YACA,aAAa;AAAA,cACX,gBAAgB;AAAA,YAClB;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;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:()=>o,SettingsSchema:()=>n,StandardEventNameSchema:()=>c,mapping:()=>m,settings:()=>p});import{zodToSchema as r}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var n=s.object({accessToken:s.string().min(1).describe("Long-lived Conversions API access token from Snapchat Ads Manager"),pixelId:s.string().min(1).describe("Snap Pixel ID"),url:s.string().url().describe("Custom Conversions API base URL (default https://tr.snapchat.com/v3/)").optional(),action_source:s.enum(["WEB","MOBILE_APP","OFFLINE"]).describe("Event action source (default WEB)").optional(),doNotHash:s.array(s.string()).describe("User data fields to skip hashing (like ['em', 'ph'])").optional(),user_data:s.record(s.string(),s.string()).describe("Mapping for user data fields (like { em: 'user.email' })").optional(),testMode:s.boolean().describe("When true, sends events to /events/validate instead of /events for testing").optional()});import{z as i}from"@walkeros/core/dev";var o=i.object({});import{z as d}from"@walkeros/core/dev";var c=d.union([d.enum(["PAGE_VIEW","VIEW_CONTENT","ADD_CART","ADD_TO_WISHLIST","START_CHECKOUT","ADD_BILLING","PURCHASE","SIGN_UP","SEARCH","SAVE","SUBSCRIBE","COMPLETE_TUTORIAL","START_TRIAL","AD_CLICK","AD_VIEW","APP_OPEN","LEVEL_COMPLETE","INVITE","LOGIN","SHARE","RESERVE","ACHIEVEMENT_UNLOCKED","SPENT_CREDITS","RATE","LIST_VIEW","CUSTOM_EVENT_1","CUSTOM_EVENT_2","CUSTOM_EVENT_3","CUSTOM_EVENT_4","CUSTOM_EVENT_5"]),d.string()]),p=r(n),m=r(o),u={};t(u,{env:()=>_,step:()=>E});var _={};t(_,{push:()=>v,simulation:()=>l});var v={sendServer:async()=>({ok:!0,data:{status:"OK",request_id:"mock-123"}})},l=["sendServer"],E={};t(E,{addToCart:()=>y,lead:()=>A,pageView:()=>f,purchase:()=>T});import{getEvent as S,isObject as g}from"@walkeros/core";var h="https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t",T={in:S("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:"PURCHASE",data:{map:{custom_data:{map:{value:"data.total",currency:{key:"data.currency",value:"EUR"},transaction_id:"data.id",contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}},user_data:{map:{external_id:"user.id"}}}}},out:[["sendServer",h,JSON.stringify({data:[{event_name:"PURCHASE",event_time:1700000900,action_source:"WEB",event_id:"1700000900000-gr0up-1",user_data:{external_id:"fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8"},custom_data:{value:249.99,currency:"EUR",transaction_id:"ORD-300",contents:[{id:"SKU-A1",item_price:124.99,quantity:2}]},event_source_url:"https://shop.example.com/checkout/complete"}]})]]},y={in:S("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:"ADD_CART",data:{map:{custom_data:{map:{value:"data.price",currency:{value:"EUR"},contents:{loop:["nested",{condition:e=>g(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]}}}}}},out:[["sendServer",h,JSON.stringify({data:[{event_name:"ADD_CART",event_time:1700000901,action_source:"WEB",event_id:"1700000901000-gr0up-1",user_data:{},custom_data:{value:89.99,currency:"EUR",contents:[{id:"SKU-B2",item_price:89.99,quantity:1}]},event_source_url:"https://shop.example.com/products/running-shoes"}]})]]},f={in:S("page view",{timestamp:1700000902e3,source:{type:"server",id:"https://example.com/docs/",previous_id:""}}),mapping:void 0,out:[["sendServer",h,JSON.stringify({data:[{event_name:"page view",event_time:1700000902,action_source:"WEB",event_id:"1700000902000-gr0up-1",user_data:{},custom_data:{},event_source_url:"https://example.com/docs/"}]})]]},A={in:S("form submit",{timestamp:1700000903e3,data:{type:"newsletter"},user:{email:"user@example.com"},source:{type:"server",id:"https://example.com/contact",previous_id:""}}),mapping:{name:"SIGN_UP",data:{map:{user_data:{map:{em:"user.email"}},custom_data:{map:{sign_up_method:{value:"newsletter"}}}}}},out:[["sendServer",h,JSON.stringify({data:[{event_name:"SIGN_UP",event_time:1700000903,action_source:"WEB",event_id:"1700000903000-gr0up-1",user_data:{em:"b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514"},custom_data:{sign_up_method:"newsletter"},event_source_url:"https://example.com/contact"}]})]]};export{u as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
ADDED
|
@@ -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 accessToken: z\n .string()\n .min(1)\n .describe(\n 'Long-lived Conversions API access token from Snapchat Ads Manager',\n ),\n pixelId: z.string().min(1).describe('Snap Pixel ID'),\n url: z\n .string()\n .url()\n .describe(\n 'Custom Conversions API base URL (default https://tr.snapchat.com/v3/)',\n )\n .optional(),\n action_source: z\n .enum(['WEB', 'MOBILE_APP', 'OFFLINE'])\n .describe('Event action source (default WEB)')\n .optional(),\n doNotHash: z\n .array(z.string())\n .describe(\"User data fields to skip hashing (like ['em', 'ph'])\")\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\"Mapping for user data fields (like { em: 'user.email' })\")\n .optional(),\n testMode: z\n .boolean()\n .describe(\n 'When true, sends events to /events/validate instead of /events for testing',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Snapchat Conversions API Mapping Schema\n * Snapchat CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Standard Snapchat Conversions API event names (UPPERCASE).\n * https://businesshelp.snapchat.com/s/article/capi-parameters\n */\nexport const StandardEventNameSchema = z.union([\n z.enum([\n 'PAGE_VIEW',\n 'VIEW_CONTENT',\n 'ADD_CART',\n 'ADD_TO_WISHLIST',\n 'START_CHECKOUT',\n 'ADD_BILLING',\n 'PURCHASE',\n 'SIGN_UP',\n 'SEARCH',\n 'SAVE',\n 'SUBSCRIBE',\n 'COMPLETE_TUTORIAL',\n 'START_TRIAL',\n 'AD_CLICK',\n 'AD_VIEW',\n 'APP_OPEN',\n 'LEVEL_COMPLETE',\n 'INVITE',\n 'LOGIN',\n 'SHARE',\n 'RESERVE',\n 'ACHIEVEMENT_UNLOCKED',\n 'SPENT_CREDITS',\n 'RATE',\n 'LIST_VIEW',\n 'CUSTOM_EVENT_1',\n 'CUSTOM_EVENT_2',\n 'CUSTOM_EVENT_3',\n 'CUSTOM_EVENT_4',\n 'CUSTOM_EVENT_5',\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 Snapchat Conversions 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: {\n status: 'OK',\n request_id: 'mock-123',\n },\n});\n\n/**\n * Standard mock environment for push operations.\n *\n * Use this for testing Snapchat Conversions API events without making\n * actual HTTP requests to Snapchat'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 * Snapchat Conversions API step examples.\n *\n * At push time, the destination calls `env.sendServer(url, body)` where\n * `url` is `${settings.url}${settings.pixelId}/${path}?access_token=${settings.accessToken}`\n * with `path` = `events` (or `events/validate` when `testMode` is set),\n * and `body` is the JSON-stringified `{ data: [snapchatEvent] }` payload.\n *\n * The test fixture pins `accessToken = 's3cr3t'` and `pixelId = 'p1x3l1d'`,\n * so every endpoint resolves to:\n * https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t\n *\n * Body fields are emitted in the order the destination constructs them\n * (insertion order matters for `JSON.stringify` string equality):\n * 1. event_name\n * 2. event_time (unix seconds; `Math.round(event.timestamp / 1000)`)\n * 3. action_source (default 'WEB')\n * 4. event_id\n * 5. user_data (hashed per Snapchat's PII requirements)\n * 6. custom_data (mapped event data, excluding user_data/custom_data keys)\n * 7. event_source_url (appended last when action_source === 'WEB')\n */\nconst ENDPOINT =\n 'https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t';\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: 'PURCHASE',\n data: {\n map: {\n custom_data: {\n map: {\n value: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n transaction_id: 'data.id',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n user_data: {\n map: {\n external_id: 'user.id',\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'PURCHASE',\n event_time: 1700000900,\n action_source: 'WEB',\n event_id: '1700000900000-gr0up-1',\n user_data: {\n external_id:\n 'fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8',\n },\n custom_data: {\n value: 249.99,\n currency: 'EUR',\n transaction_id: 'ORD-300',\n contents: [{ id: 'SKU-A1', item_price: 124.99, quantity: 2 }],\n },\n event_source_url: 'https://shop.example.com/checkout/complete',\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: 'ADD_CART',\n data: {\n map: {\n custom_data: {\n map: {\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 id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'ADD_CART',\n event_time: 1700000901,\n action_source: 'WEB',\n event_id: '1700000901000-gr0up-1',\n user_data: {},\n custom_data: {\n value: 89.99,\n currency: 'EUR',\n contents: [{ id: 'SKU-B2', item_price: 89.99, quantity: 1 }],\n },\n event_source_url: 'https://shop.example.com/products/running-shoes',\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 [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'page view',\n event_time: 1700000902,\n action_source: 'WEB',\n event_id: '1700000902000-gr0up-1',\n user_data: {},\n custom_data: {},\n event_source_url: 'https://example.com/docs/',\n },\n ],\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: 'SIGN_UP',\n data: {\n map: {\n user_data: {\n map: {\n em: 'user.email',\n },\n },\n custom_data: {\n map: {\n sign_up_method: { value: 'newsletter' },\n },\n },\n },\n },\n },\n out: [\n [\n 'sendServer',\n ENDPOINT,\n JSON.stringify({\n data: [\n {\n event_name: 'SIGN_UP',\n event_time: 1700000903,\n action_source: 'WEB',\n event_id: '1700000903000-gr0up-1',\n user_data: {\n // sha256('user@example.com')\n em: 'b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514',\n },\n custom_data: {\n sign_up_method: 'newsletter',\n },\n event_source_url: 'https://example.com/contact',\n },\n ],\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,aAAa,EACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,eAAe;AAAA,EACnD,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,EACZ,KAAK,CAAC,OAAO,cAAc,SAAS,CAAC,EACrC,SAAS,mCAAmC,EAC5C,SAAS;AAAA,EACZ,WAAW,EACR,MAAM,EAAE,OAAO,CAAC,EAChB,SAAS,sDAAsD,EAC/D,SAAS;AAAA,EACZ,WAAW,EACR,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,0DAA0D,EACnE,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACnCD,SAAS,KAAAA,UAAS;AAMX,IAAM,gBAAgBA,GAAE,OAAO,CAAC,CAAC;;;ACNxC,SAAS,KAAAC,UAAS;AAMX,IAAM,0BAA0BA,GAAE,MAAM;AAAA,EAC7CA,GAAE,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,IAC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U;AAAA,QACb,MAAM;AAAA,UACJ;AAAA,YACE,YAAY;AAAA,YACZ,YAAY;AAAA,YACZ,eAAe;AAAA,YACf,UAAU;AAAA,YACV,WAAW,CAAC;AAAA,YACZ,aAAa,CAAC;AAAA,YACd,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;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,IAAI;AAAA,UACN;AAAA,QACF;AAAA,QACA,aAAa;AAAA,UACX,KAAK;AAAA,YACH,gBAAgB,EAAE,OAAO,aAAa;AAAA,UACxC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,UACJ;AAAA,YACE,YAAY;AAAA,YACZ,YAAY;AAAA,YACZ,eAAe;AAAA,YACf,UAAU;AAAA,YACV,WAAW;AAAA;AAAA,cAET,IAAI;AAAA,YACN;AAAA,YACA,aAAa;AAAA,cACX,gBAAgB;AAAA,YAClB;AAAA,YACA,kBAAkB;AAAA,UACpB;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;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 Snapchat Conversions API events without making
|
|
12
|
+
* actual HTTP requests to Snapchat'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 Snapchat Conversions API events without making
|
|
12
|
+
* actual HTTP requests to Snapchat'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 };
|