@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
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/examples/index.ts
|
|
21
|
+
var examples_exports = {};
|
|
22
|
+
__export(examples_exports, {
|
|
23
|
+
env: () => env_exports,
|
|
24
|
+
step: () => step_exports
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(examples_exports);
|
|
27
|
+
|
|
28
|
+
// src/examples/env.ts
|
|
29
|
+
var env_exports = {};
|
|
30
|
+
__export(env_exports, {
|
|
31
|
+
push: () => push,
|
|
32
|
+
simulation: () => simulation
|
|
33
|
+
});
|
|
34
|
+
var mockSendServer = async () => ({
|
|
35
|
+
ok: true,
|
|
36
|
+
data: {
|
|
37
|
+
status: "OK",
|
|
38
|
+
request_id: "mock-123"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var push = {
|
|
42
|
+
sendServer: mockSendServer
|
|
43
|
+
};
|
|
44
|
+
var simulation = ["sendServer"];
|
|
45
|
+
|
|
46
|
+
// src/examples/step.ts
|
|
47
|
+
var step_exports = {};
|
|
48
|
+
__export(step_exports, {
|
|
49
|
+
addToCart: () => addToCart,
|
|
50
|
+
lead: () => lead,
|
|
51
|
+
pageView: () => pageView,
|
|
52
|
+
purchase: () => purchase
|
|
53
|
+
});
|
|
54
|
+
var import_core = require("@walkeros/core");
|
|
55
|
+
var ENDPOINT = "https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t";
|
|
56
|
+
var purchase = {
|
|
57
|
+
in: (0, import_core.getEvent)("order complete", {
|
|
58
|
+
timestamp: 17000009e5,
|
|
59
|
+
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
60
|
+
nested: [
|
|
61
|
+
{
|
|
62
|
+
entity: "product",
|
|
63
|
+
data: { id: "SKU-A1", name: "Widget Pro", price: 124.99, quantity: 2 }
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
user: { id: "user-123", device: "device-456" },
|
|
67
|
+
source: {
|
|
68
|
+
type: "server",
|
|
69
|
+
id: "https://shop.example.com/checkout/complete",
|
|
70
|
+
previous_id: ""
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
mapping: {
|
|
74
|
+
name: "PURCHASE",
|
|
75
|
+
data: {
|
|
76
|
+
map: {
|
|
77
|
+
custom_data: {
|
|
78
|
+
map: {
|
|
79
|
+
value: "data.total",
|
|
80
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
81
|
+
transaction_id: "data.id",
|
|
82
|
+
contents: {
|
|
83
|
+
loop: [
|
|
84
|
+
"nested",
|
|
85
|
+
{
|
|
86
|
+
condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
|
|
87
|
+
map: {
|
|
88
|
+
id: "data.id",
|
|
89
|
+
item_price: "data.price",
|
|
90
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
user_data: {
|
|
98
|
+
map: {
|
|
99
|
+
external_id: "user.id"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
out: [
|
|
106
|
+
[
|
|
107
|
+
"sendServer",
|
|
108
|
+
ENDPOINT,
|
|
109
|
+
JSON.stringify({
|
|
110
|
+
data: [
|
|
111
|
+
{
|
|
112
|
+
event_name: "PURCHASE",
|
|
113
|
+
event_time: 1700000900,
|
|
114
|
+
action_source: "WEB",
|
|
115
|
+
event_id: "1700000900000-gr0up-1",
|
|
116
|
+
user_data: {
|
|
117
|
+
external_id: "fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8"
|
|
118
|
+
},
|
|
119
|
+
custom_data: {
|
|
120
|
+
value: 249.99,
|
|
121
|
+
currency: "EUR",
|
|
122
|
+
transaction_id: "ORD-300",
|
|
123
|
+
contents: [{ id: "SKU-A1", item_price: 124.99, quantity: 2 }]
|
|
124
|
+
},
|
|
125
|
+
event_source_url: "https://shop.example.com/checkout/complete"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
var addToCart = {
|
|
133
|
+
in: (0, import_core.getEvent)("product add", {
|
|
134
|
+
timestamp: 1700000901e3,
|
|
135
|
+
data: {
|
|
136
|
+
id: "SKU-B2",
|
|
137
|
+
name: "Running Shoes",
|
|
138
|
+
price: 89.99,
|
|
139
|
+
color: "blue"
|
|
140
|
+
},
|
|
141
|
+
nested: [
|
|
142
|
+
{
|
|
143
|
+
entity: "product",
|
|
144
|
+
data: {
|
|
145
|
+
id: "SKU-B2",
|
|
146
|
+
name: "Running Shoes",
|
|
147
|
+
price: 89.99,
|
|
148
|
+
quantity: 1
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
source: {
|
|
153
|
+
type: "server",
|
|
154
|
+
id: "https://shop.example.com/products/running-shoes",
|
|
155
|
+
previous_id: ""
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
mapping: {
|
|
159
|
+
name: "ADD_CART",
|
|
160
|
+
data: {
|
|
161
|
+
map: {
|
|
162
|
+
custom_data: {
|
|
163
|
+
map: {
|
|
164
|
+
value: "data.price",
|
|
165
|
+
currency: { value: "EUR" },
|
|
166
|
+
contents: {
|
|
167
|
+
loop: [
|
|
168
|
+
"nested",
|
|
169
|
+
{
|
|
170
|
+
condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
|
|
171
|
+
map: {
|
|
172
|
+
id: "data.id",
|
|
173
|
+
item_price: "data.price",
|
|
174
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
out: [
|
|
185
|
+
[
|
|
186
|
+
"sendServer",
|
|
187
|
+
ENDPOINT,
|
|
188
|
+
JSON.stringify({
|
|
189
|
+
data: [
|
|
190
|
+
{
|
|
191
|
+
event_name: "ADD_CART",
|
|
192
|
+
event_time: 1700000901,
|
|
193
|
+
action_source: "WEB",
|
|
194
|
+
event_id: "1700000901000-gr0up-1",
|
|
195
|
+
user_data: {},
|
|
196
|
+
custom_data: {
|
|
197
|
+
value: 89.99,
|
|
198
|
+
currency: "EUR",
|
|
199
|
+
contents: [{ id: "SKU-B2", item_price: 89.99, quantity: 1 }]
|
|
200
|
+
},
|
|
201
|
+
event_source_url: "https://shop.example.com/products/running-shoes"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
]
|
|
207
|
+
};
|
|
208
|
+
var pageView = {
|
|
209
|
+
in: (0, import_core.getEvent)("page view", {
|
|
210
|
+
timestamp: 1700000902e3,
|
|
211
|
+
source: {
|
|
212
|
+
type: "server",
|
|
213
|
+
id: "https://example.com/docs/",
|
|
214
|
+
previous_id: ""
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
217
|
+
mapping: void 0,
|
|
218
|
+
out: [
|
|
219
|
+
[
|
|
220
|
+
"sendServer",
|
|
221
|
+
ENDPOINT,
|
|
222
|
+
JSON.stringify({
|
|
223
|
+
data: [
|
|
224
|
+
{
|
|
225
|
+
event_name: "page view",
|
|
226
|
+
event_time: 1700000902,
|
|
227
|
+
action_source: "WEB",
|
|
228
|
+
event_id: "1700000902000-gr0up-1",
|
|
229
|
+
user_data: {},
|
|
230
|
+
custom_data: {},
|
|
231
|
+
event_source_url: "https://example.com/docs/"
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
var lead = {
|
|
239
|
+
in: (0, import_core.getEvent)("form submit", {
|
|
240
|
+
timestamp: 1700000903e3,
|
|
241
|
+
data: { type: "newsletter" },
|
|
242
|
+
user: { email: "user@example.com" },
|
|
243
|
+
source: {
|
|
244
|
+
type: "server",
|
|
245
|
+
id: "https://example.com/contact",
|
|
246
|
+
previous_id: ""
|
|
247
|
+
}
|
|
248
|
+
}),
|
|
249
|
+
mapping: {
|
|
250
|
+
name: "SIGN_UP",
|
|
251
|
+
data: {
|
|
252
|
+
map: {
|
|
253
|
+
user_data: {
|
|
254
|
+
map: {
|
|
255
|
+
em: "user.email"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
custom_data: {
|
|
259
|
+
map: {
|
|
260
|
+
sign_up_method: { value: "newsletter" }
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
out: [
|
|
267
|
+
[
|
|
268
|
+
"sendServer",
|
|
269
|
+
ENDPOINT,
|
|
270
|
+
JSON.stringify({
|
|
271
|
+
data: [
|
|
272
|
+
{
|
|
273
|
+
event_name: "SIGN_UP",
|
|
274
|
+
event_time: 1700000903,
|
|
275
|
+
action_source: "WEB",
|
|
276
|
+
event_id: "1700000903000-gr0up-1",
|
|
277
|
+
user_data: {
|
|
278
|
+
// sha256('user@example.com')
|
|
279
|
+
em: "b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514"
|
|
280
|
+
},
|
|
281
|
+
custom_data: {
|
|
282
|
+
sign_up_method: "newsletter"
|
|
283
|
+
},
|
|
284
|
+
event_source_url: "https://example.com/contact"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
]
|
|
290
|
+
};
|
|
291
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
292
|
+
0 && (module.exports = {
|
|
293
|
+
env,
|
|
294
|
+
step
|
|
295
|
+
});
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/examples/env.ts
|
|
8
|
+
var env_exports = {};
|
|
9
|
+
__export(env_exports, {
|
|
10
|
+
push: () => push,
|
|
11
|
+
simulation: () => simulation
|
|
12
|
+
});
|
|
13
|
+
var mockSendServer = async () => ({
|
|
14
|
+
ok: true,
|
|
15
|
+
data: {
|
|
16
|
+
status: "OK",
|
|
17
|
+
request_id: "mock-123"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var push = {
|
|
21
|
+
sendServer: mockSendServer
|
|
22
|
+
};
|
|
23
|
+
var simulation = ["sendServer"];
|
|
24
|
+
|
|
25
|
+
// src/examples/step.ts
|
|
26
|
+
var step_exports = {};
|
|
27
|
+
__export(step_exports, {
|
|
28
|
+
addToCart: () => addToCart,
|
|
29
|
+
lead: () => lead,
|
|
30
|
+
pageView: () => pageView,
|
|
31
|
+
purchase: () => purchase
|
|
32
|
+
});
|
|
33
|
+
import { getEvent, isObject } from "@walkeros/core";
|
|
34
|
+
var ENDPOINT = "https://tr.snapchat.com/v3/p1x3l1d/events?access_token=s3cr3t";
|
|
35
|
+
var purchase = {
|
|
36
|
+
in: getEvent("order complete", {
|
|
37
|
+
timestamp: 17000009e5,
|
|
38
|
+
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
39
|
+
nested: [
|
|
40
|
+
{
|
|
41
|
+
entity: "product",
|
|
42
|
+
data: { id: "SKU-A1", name: "Widget Pro", price: 124.99, quantity: 2 }
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
user: { id: "user-123", device: "device-456" },
|
|
46
|
+
source: {
|
|
47
|
+
type: "server",
|
|
48
|
+
id: "https://shop.example.com/checkout/complete",
|
|
49
|
+
previous_id: ""
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
mapping: {
|
|
53
|
+
name: "PURCHASE",
|
|
54
|
+
data: {
|
|
55
|
+
map: {
|
|
56
|
+
custom_data: {
|
|
57
|
+
map: {
|
|
58
|
+
value: "data.total",
|
|
59
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
60
|
+
transaction_id: "data.id",
|
|
61
|
+
contents: {
|
|
62
|
+
loop: [
|
|
63
|
+
"nested",
|
|
64
|
+
{
|
|
65
|
+
condition: (entity) => isObject(entity) && entity.entity === "product",
|
|
66
|
+
map: {
|
|
67
|
+
id: "data.id",
|
|
68
|
+
item_price: "data.price",
|
|
69
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
user_data: {
|
|
77
|
+
map: {
|
|
78
|
+
external_id: "user.id"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
out: [
|
|
85
|
+
[
|
|
86
|
+
"sendServer",
|
|
87
|
+
ENDPOINT,
|
|
88
|
+
JSON.stringify({
|
|
89
|
+
data: [
|
|
90
|
+
{
|
|
91
|
+
event_name: "PURCHASE",
|
|
92
|
+
event_time: 1700000900,
|
|
93
|
+
action_source: "WEB",
|
|
94
|
+
event_id: "1700000900000-gr0up-1",
|
|
95
|
+
user_data: {
|
|
96
|
+
external_id: "fcdec6df4d44dbc637c7c5b58efface52a7f8a88535423430255be0bb89bedd8"
|
|
97
|
+
},
|
|
98
|
+
custom_data: {
|
|
99
|
+
value: 249.99,
|
|
100
|
+
currency: "EUR",
|
|
101
|
+
transaction_id: "ORD-300",
|
|
102
|
+
contents: [{ id: "SKU-A1", item_price: 124.99, quantity: 2 }]
|
|
103
|
+
},
|
|
104
|
+
event_source_url: "https://shop.example.com/checkout/complete"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
var addToCart = {
|
|
112
|
+
in: getEvent("product add", {
|
|
113
|
+
timestamp: 1700000901e3,
|
|
114
|
+
data: {
|
|
115
|
+
id: "SKU-B2",
|
|
116
|
+
name: "Running Shoes",
|
|
117
|
+
price: 89.99,
|
|
118
|
+
color: "blue"
|
|
119
|
+
},
|
|
120
|
+
nested: [
|
|
121
|
+
{
|
|
122
|
+
entity: "product",
|
|
123
|
+
data: {
|
|
124
|
+
id: "SKU-B2",
|
|
125
|
+
name: "Running Shoes",
|
|
126
|
+
price: 89.99,
|
|
127
|
+
quantity: 1
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
source: {
|
|
132
|
+
type: "server",
|
|
133
|
+
id: "https://shop.example.com/products/running-shoes",
|
|
134
|
+
previous_id: ""
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
mapping: {
|
|
138
|
+
name: "ADD_CART",
|
|
139
|
+
data: {
|
|
140
|
+
map: {
|
|
141
|
+
custom_data: {
|
|
142
|
+
map: {
|
|
143
|
+
value: "data.price",
|
|
144
|
+
currency: { value: "EUR" },
|
|
145
|
+
contents: {
|
|
146
|
+
loop: [
|
|
147
|
+
"nested",
|
|
148
|
+
{
|
|
149
|
+
condition: (entity) => isObject(entity) && entity.entity === "product",
|
|
150
|
+
map: {
|
|
151
|
+
id: "data.id",
|
|
152
|
+
item_price: "data.price",
|
|
153
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
out: [
|
|
164
|
+
[
|
|
165
|
+
"sendServer",
|
|
166
|
+
ENDPOINT,
|
|
167
|
+
JSON.stringify({
|
|
168
|
+
data: [
|
|
169
|
+
{
|
|
170
|
+
event_name: "ADD_CART",
|
|
171
|
+
event_time: 1700000901,
|
|
172
|
+
action_source: "WEB",
|
|
173
|
+
event_id: "1700000901000-gr0up-1",
|
|
174
|
+
user_data: {},
|
|
175
|
+
custom_data: {
|
|
176
|
+
value: 89.99,
|
|
177
|
+
currency: "EUR",
|
|
178
|
+
contents: [{ id: "SKU-B2", item_price: 89.99, quantity: 1 }]
|
|
179
|
+
},
|
|
180
|
+
event_source_url: "https://shop.example.com/products/running-shoes"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
var pageView = {
|
|
188
|
+
in: getEvent("page view", {
|
|
189
|
+
timestamp: 1700000902e3,
|
|
190
|
+
source: {
|
|
191
|
+
type: "server",
|
|
192
|
+
id: "https://example.com/docs/",
|
|
193
|
+
previous_id: ""
|
|
194
|
+
}
|
|
195
|
+
}),
|
|
196
|
+
mapping: void 0,
|
|
197
|
+
out: [
|
|
198
|
+
[
|
|
199
|
+
"sendServer",
|
|
200
|
+
ENDPOINT,
|
|
201
|
+
JSON.stringify({
|
|
202
|
+
data: [
|
|
203
|
+
{
|
|
204
|
+
event_name: "page view",
|
|
205
|
+
event_time: 1700000902,
|
|
206
|
+
action_source: "WEB",
|
|
207
|
+
event_id: "1700000902000-gr0up-1",
|
|
208
|
+
user_data: {},
|
|
209
|
+
custom_data: {},
|
|
210
|
+
event_source_url: "https://example.com/docs/"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
]
|
|
216
|
+
};
|
|
217
|
+
var lead = {
|
|
218
|
+
in: getEvent("form submit", {
|
|
219
|
+
timestamp: 1700000903e3,
|
|
220
|
+
data: { type: "newsletter" },
|
|
221
|
+
user: { email: "user@example.com" },
|
|
222
|
+
source: {
|
|
223
|
+
type: "server",
|
|
224
|
+
id: "https://example.com/contact",
|
|
225
|
+
previous_id: ""
|
|
226
|
+
}
|
|
227
|
+
}),
|
|
228
|
+
mapping: {
|
|
229
|
+
name: "SIGN_UP",
|
|
230
|
+
data: {
|
|
231
|
+
map: {
|
|
232
|
+
user_data: {
|
|
233
|
+
map: {
|
|
234
|
+
em: "user.email"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
custom_data: {
|
|
238
|
+
map: {
|
|
239
|
+
sign_up_method: { value: "newsletter" }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
out: [
|
|
246
|
+
[
|
|
247
|
+
"sendServer",
|
|
248
|
+
ENDPOINT,
|
|
249
|
+
JSON.stringify({
|
|
250
|
+
data: [
|
|
251
|
+
{
|
|
252
|
+
event_name: "SIGN_UP",
|
|
253
|
+
event_time: 1700000903,
|
|
254
|
+
action_source: "WEB",
|
|
255
|
+
event_id: "1700000903000-gr0up-1",
|
|
256
|
+
user_data: {
|
|
257
|
+
// sha256('user@example.com')
|
|
258
|
+
em: "b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514"
|
|
259
|
+
},
|
|
260
|
+
custom_data: {
|
|
261
|
+
sign_up_method: "newsletter"
|
|
262
|
+
},
|
|
263
|
+
event_source_url: "https://example.com/contact"
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
]
|
|
269
|
+
};
|
|
270
|
+
export {
|
|
271
|
+
env_exports as env,
|
|
272
|
+
step_exports as step
|
|
273
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Mapping as Mapping$1, Destination as Destination$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationServer, sendServer } from '@walkeros/server-core';
|
|
3
|
+
|
|
4
|
+
interface Settings {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
pixelId: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
action_source?: ActionSource;
|
|
9
|
+
doNotHash?: string[];
|
|
10
|
+
user_data?: Mapping$1.Map;
|
|
11
|
+
testMode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type InitSettings = Partial<Settings>;
|
|
14
|
+
interface Mapping {
|
|
15
|
+
}
|
|
16
|
+
interface Env extends DestinationServer.Env {
|
|
17
|
+
sendServer?: typeof sendServer;
|
|
18
|
+
}
|
|
19
|
+
type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
|
|
20
|
+
interface Destination extends DestinationServer.Destination<Types> {
|
|
21
|
+
init: DestinationServer.InitFn<Types>;
|
|
22
|
+
}
|
|
23
|
+
type Config = {
|
|
24
|
+
settings: Settings;
|
|
25
|
+
} & DestinationServer.Config<Types>;
|
|
26
|
+
type InitFn = DestinationServer.InitFn<Types>;
|
|
27
|
+
type PushFn = DestinationServer.PushFn<Types>;
|
|
28
|
+
type PartialConfig = DestinationServer.PartialConfig<Types>;
|
|
29
|
+
type PushEvents = DestinationServer.PushEvents<Mapping>;
|
|
30
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
31
|
+
type Rules = Mapping$1.Rules<Rule>;
|
|
32
|
+
/**
|
|
33
|
+
* Snapchat Conversions API v3
|
|
34
|
+
* https://businesshelp.snapchat.com/s/article/conversions-api
|
|
35
|
+
*/
|
|
36
|
+
type ActionSource = 'WEB' | 'MOBILE_APP' | 'OFFLINE';
|
|
37
|
+
interface RequestBody {
|
|
38
|
+
data: SnapchatEvent[];
|
|
39
|
+
}
|
|
40
|
+
interface SnapchatEvent {
|
|
41
|
+
event_name: string;
|
|
42
|
+
event_time: number;
|
|
43
|
+
action_source: ActionSource;
|
|
44
|
+
event_source_url?: string;
|
|
45
|
+
event_id?: string;
|
|
46
|
+
user_data: UserData;
|
|
47
|
+
custom_data?: CustomData;
|
|
48
|
+
}
|
|
49
|
+
interface UserData {
|
|
50
|
+
/** Email, SHA-256 hashed, lowercase trimmed */
|
|
51
|
+
em?: string;
|
|
52
|
+
/** Phone number, SHA-256 hashed, E.164 digits */
|
|
53
|
+
ph?: string;
|
|
54
|
+
/** First name, SHA-256 hashed, lowercase */
|
|
55
|
+
fn?: string;
|
|
56
|
+
/** Last name, SHA-256 hashed, lowercase */
|
|
57
|
+
ln?: string;
|
|
58
|
+
/** Date of birth YYYYMMDD, SHA-256 hashed */
|
|
59
|
+
db?: string;
|
|
60
|
+
/** Gender (m/f), SHA-256 hashed */
|
|
61
|
+
ge?: string;
|
|
62
|
+
/** City, SHA-256 hashed, lowercase */
|
|
63
|
+
ct?: string;
|
|
64
|
+
/** State, SHA-256 hashed, lowercase */
|
|
65
|
+
st?: string;
|
|
66
|
+
/** Zip/postal code, SHA-256 hashed */
|
|
67
|
+
zp?: string;
|
|
68
|
+
/** Country code ISO 3166-1 alpha-2, SHA-256 hashed */
|
|
69
|
+
country?: string;
|
|
70
|
+
/** External/customer ID, SHA-256 hash recommended */
|
|
71
|
+
external_id?: string;
|
|
72
|
+
/** Snap cookie. Do NOT hash. */
|
|
73
|
+
sc_cookie1?: string;
|
|
74
|
+
/** Client IP address (IPv4 or IPv6). Do NOT hash. */
|
|
75
|
+
client_ip_address?: string;
|
|
76
|
+
/** Client user agent. Do NOT hash. */
|
|
77
|
+
client_user_agent?: string;
|
|
78
|
+
/** Snap click ID. Do NOT hash. */
|
|
79
|
+
sc_click_id?: string;
|
|
80
|
+
/** iOS IDFV. Do NOT hash. */
|
|
81
|
+
idfv?: string;
|
|
82
|
+
/** Mobile advertiser ID (IDFA/AAID). Do NOT hash. */
|
|
83
|
+
madid?: string;
|
|
84
|
+
}
|
|
85
|
+
interface CustomData {
|
|
86
|
+
value?: number;
|
|
87
|
+
currency?: string;
|
|
88
|
+
contents?: ContentItem[];
|
|
89
|
+
item_ids?: string[];
|
|
90
|
+
number_items?: number;
|
|
91
|
+
price?: number;
|
|
92
|
+
cart_total?: number;
|
|
93
|
+
search_string?: string;
|
|
94
|
+
item_category?: string;
|
|
95
|
+
brands?: string[];
|
|
96
|
+
description?: string;
|
|
97
|
+
transaction_id?: string;
|
|
98
|
+
payment_info_available?: number;
|
|
99
|
+
delivery_category?: string;
|
|
100
|
+
sign_up_method?: string;
|
|
101
|
+
level?: string;
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
interface ContentItem {
|
|
105
|
+
id?: string;
|
|
106
|
+
quantity?: number;
|
|
107
|
+
item_price?: number;
|
|
108
|
+
brand?: string;
|
|
109
|
+
}
|
|
110
|
+
interface ResponseBody {
|
|
111
|
+
status: string;
|
|
112
|
+
request_id?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Standard Snapchat event names (UPPERCASE).
|
|
116
|
+
* Custom events via CUSTOM_EVENT_1..5 or arbitrary strings.
|
|
117
|
+
*/
|
|
118
|
+
type StandardEventName = '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' | (string & {});
|
|
119
|
+
|
|
120
|
+
type index_ActionSource = ActionSource;
|
|
121
|
+
type index_Config = Config;
|
|
122
|
+
type index_ContentItem = ContentItem;
|
|
123
|
+
type index_CustomData = CustomData;
|
|
124
|
+
type index_Destination = Destination;
|
|
125
|
+
type index_Env = Env;
|
|
126
|
+
type index_InitFn = InitFn;
|
|
127
|
+
type index_InitSettings = InitSettings;
|
|
128
|
+
type index_Mapping = Mapping;
|
|
129
|
+
type index_PartialConfig = PartialConfig;
|
|
130
|
+
type index_PushEvents = PushEvents;
|
|
131
|
+
type index_PushFn = PushFn;
|
|
132
|
+
type index_RequestBody = RequestBody;
|
|
133
|
+
type index_ResponseBody = ResponseBody;
|
|
134
|
+
type index_Rule = Rule;
|
|
135
|
+
type index_Rules = Rules;
|
|
136
|
+
type index_Settings = Settings;
|
|
137
|
+
type index_SnapchatEvent = SnapchatEvent;
|
|
138
|
+
type index_StandardEventName = StandardEventName;
|
|
139
|
+
type index_Types = Types;
|
|
140
|
+
type index_UserData = UserData;
|
|
141
|
+
declare namespace index {
|
|
142
|
+
export type { index_ActionSource as ActionSource, index_Config as Config, index_ContentItem as ContentItem, index_CustomData as CustomData, index_Destination as Destination, index_Env as Env, index_InitFn as InitFn, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_RequestBody as RequestBody, index_ResponseBody as ResponseBody, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_SnapchatEvent as SnapchatEvent, index_StandardEventName as StandardEventName, index_Types as Types, index_UserData as UserData };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare const destinationSnapchat: Destination;
|
|
146
|
+
|
|
147
|
+
export { index as DestinationSnapchat, destinationSnapchat as default, destinationSnapchat };
|