@walkeros/server-destination-reddit 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/README.md +137 -0
- package/dist/dev.d.mts +115 -0
- package/dist/dev.d.ts +115 -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 +40 -0
- package/dist/examples/index.d.ts +40 -0
- package/dist/examples/index.js +401 -0
- package/dist/examples/index.mjs +379 -0
- package/dist/index.d.mts +123 -0
- package/dist/index.d.ts +123 -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 +621 -0
- package/package.json +75 -0
|
@@ -0,0 +1,401 @@
|
|
|
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
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
data: {
|
|
38
|
+
success: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
var push = {
|
|
43
|
+
sendServer: mockSendServer
|
|
44
|
+
};
|
|
45
|
+
var simulation = ["sendServer"];
|
|
46
|
+
|
|
47
|
+
// src/examples/step.ts
|
|
48
|
+
var step_exports = {};
|
|
49
|
+
__export(step_exports, {
|
|
50
|
+
addToCart: () => addToCart,
|
|
51
|
+
lead: () => lead,
|
|
52
|
+
pageVisit: () => pageVisit,
|
|
53
|
+
purchase: () => purchase,
|
|
54
|
+
search: () => search,
|
|
55
|
+
signUp: () => signUp
|
|
56
|
+
});
|
|
57
|
+
var import_core = require("@walkeros/core");
|
|
58
|
+
var ENDPOINT = "https://ads-api.reddit.com/api/v2.0/conversions/events/a2_abcdef123456";
|
|
59
|
+
var OPTIONS = {
|
|
60
|
+
headers: { Authorization: "Bearer s3cr3t" }
|
|
61
|
+
};
|
|
62
|
+
var purchase = {
|
|
63
|
+
in: (0, import_core.getEvent)("order complete", {
|
|
64
|
+
timestamp: 1700000900,
|
|
65
|
+
data: { id: "ORD-300", total: 249.99, currency: "EUR" },
|
|
66
|
+
nested: [
|
|
67
|
+
{
|
|
68
|
+
entity: "product",
|
|
69
|
+
data: {
|
|
70
|
+
id: "SKU-A1",
|
|
71
|
+
name: "Everyday Ruck Snack",
|
|
72
|
+
category: "bags",
|
|
73
|
+
price: "129.99",
|
|
74
|
+
quantity: 2
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
user: { id: "user-123", device: "device-456" },
|
|
79
|
+
source: { type: "server", id: "https://shop.example.com", previous_id: "" }
|
|
80
|
+
}),
|
|
81
|
+
mapping: {
|
|
82
|
+
name: "Purchase",
|
|
83
|
+
data: {
|
|
84
|
+
map: {
|
|
85
|
+
event_metadata: {
|
|
86
|
+
map: {
|
|
87
|
+
value_decimal: "data.total",
|
|
88
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
89
|
+
item_count: {
|
|
90
|
+
fn: (event) => event.nested.filter(
|
|
91
|
+
(item) => item.entity === "product"
|
|
92
|
+
).length
|
|
93
|
+
},
|
|
94
|
+
products: {
|
|
95
|
+
loop: [
|
|
96
|
+
"nested",
|
|
97
|
+
{
|
|
98
|
+
condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
|
|
99
|
+
map: {
|
|
100
|
+
id: "data.id",
|
|
101
|
+
name: "data.name",
|
|
102
|
+
category: { key: "data.category", value: "uncategorized" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
out: [
|
|
113
|
+
[
|
|
114
|
+
"sendServer",
|
|
115
|
+
ENDPOINT,
|
|
116
|
+
JSON.stringify({
|
|
117
|
+
data: {
|
|
118
|
+
events: [
|
|
119
|
+
{
|
|
120
|
+
event_at: "1970-01-20T16:13:20.900Z",
|
|
121
|
+
event_at_ms: 1700000900,
|
|
122
|
+
event_type: { tracking_type: "Purchase" },
|
|
123
|
+
user: {},
|
|
124
|
+
event_metadata: {
|
|
125
|
+
conversion_id: "1700000900-gr0up-1",
|
|
126
|
+
value_decimal: 249.99,
|
|
127
|
+
currency: "EUR",
|
|
128
|
+
item_count: 1,
|
|
129
|
+
products: [
|
|
130
|
+
{
|
|
131
|
+
id: "SKU-A1",
|
|
132
|
+
name: "Everyday Ruck Snack",
|
|
133
|
+
category: "bags"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
OPTIONS
|
|
142
|
+
]
|
|
143
|
+
]
|
|
144
|
+
};
|
|
145
|
+
var addToCart = {
|
|
146
|
+
in: (0, import_core.getEvent)("product add", {
|
|
147
|
+
timestamp: 1700000901,
|
|
148
|
+
data: {
|
|
149
|
+
id: "SKU-B2",
|
|
150
|
+
name: "Cool Cap",
|
|
151
|
+
category: "hats",
|
|
152
|
+
price: "42.00",
|
|
153
|
+
quantity: 1
|
|
154
|
+
},
|
|
155
|
+
user: { id: "user-456" },
|
|
156
|
+
source: {
|
|
157
|
+
type: "server",
|
|
158
|
+
id: "https://shop.example.com/products",
|
|
159
|
+
previous_id: ""
|
|
160
|
+
}
|
|
161
|
+
}),
|
|
162
|
+
mapping: {
|
|
163
|
+
name: "AddToCart",
|
|
164
|
+
data: {
|
|
165
|
+
map: {
|
|
166
|
+
event_metadata: {
|
|
167
|
+
map: {
|
|
168
|
+
value_decimal: "data.price",
|
|
169
|
+
currency: { value: "EUR" },
|
|
170
|
+
item_count: { value: 1 },
|
|
171
|
+
products: {
|
|
172
|
+
set: [
|
|
173
|
+
{
|
|
174
|
+
map: {
|
|
175
|
+
id: "data.id",
|
|
176
|
+
name: "data.name",
|
|
177
|
+
category: { key: "data.category", value: "uncategorized" }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
out: [
|
|
188
|
+
[
|
|
189
|
+
"sendServer",
|
|
190
|
+
ENDPOINT,
|
|
191
|
+
JSON.stringify({
|
|
192
|
+
data: {
|
|
193
|
+
events: [
|
|
194
|
+
{
|
|
195
|
+
event_at: "1970-01-20T16:13:20.901Z",
|
|
196
|
+
event_at_ms: 1700000901,
|
|
197
|
+
event_type: { tracking_type: "AddToCart" },
|
|
198
|
+
user: {},
|
|
199
|
+
event_metadata: {
|
|
200
|
+
conversion_id: "1700000901-gr0up-1",
|
|
201
|
+
value_decimal: "42.00",
|
|
202
|
+
currency: "EUR",
|
|
203
|
+
item_count: 1,
|
|
204
|
+
products: [
|
|
205
|
+
{ id: "SKU-B2", name: "Cool Cap", category: "hats" }
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
OPTIONS
|
|
213
|
+
]
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
var pageVisit = {
|
|
217
|
+
in: (0, import_core.getEvent)("page view", {
|
|
218
|
+
timestamp: 1700000902,
|
|
219
|
+
user: { id: "user-789" },
|
|
220
|
+
source: {
|
|
221
|
+
type: "server",
|
|
222
|
+
id: "https://www.example.com/docs/",
|
|
223
|
+
previous_id: ""
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
mapping: {
|
|
227
|
+
name: "PageVisit"
|
|
228
|
+
},
|
|
229
|
+
out: [
|
|
230
|
+
[
|
|
231
|
+
"sendServer",
|
|
232
|
+
ENDPOINT,
|
|
233
|
+
JSON.stringify({
|
|
234
|
+
data: {
|
|
235
|
+
events: [
|
|
236
|
+
{
|
|
237
|
+
event_at: "1970-01-20T16:13:20.902Z",
|
|
238
|
+
event_at_ms: 1700000902,
|
|
239
|
+
event_type: { tracking_type: "PageVisit" },
|
|
240
|
+
user: {},
|
|
241
|
+
event_metadata: { conversion_id: "1700000902-gr0up-1" }
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
}),
|
|
246
|
+
OPTIONS
|
|
247
|
+
]
|
|
248
|
+
]
|
|
249
|
+
};
|
|
250
|
+
var lead = {
|
|
251
|
+
in: (0, import_core.getEvent)("form submit", {
|
|
252
|
+
timestamp: 1700000903,
|
|
253
|
+
data: { form: "contact" },
|
|
254
|
+
user: { id: "user-lead-1", email: "lead@example.com" },
|
|
255
|
+
source: {
|
|
256
|
+
type: "server",
|
|
257
|
+
id: "https://www.example.com/contact",
|
|
258
|
+
previous_id: ""
|
|
259
|
+
}
|
|
260
|
+
}),
|
|
261
|
+
mapping: {
|
|
262
|
+
name: "Lead",
|
|
263
|
+
data: {
|
|
264
|
+
map: {
|
|
265
|
+
user: {
|
|
266
|
+
map: {
|
|
267
|
+
email: "user.email",
|
|
268
|
+
external_id: "user.id"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
out: [
|
|
275
|
+
[
|
|
276
|
+
"sendServer",
|
|
277
|
+
ENDPOINT,
|
|
278
|
+
JSON.stringify({
|
|
279
|
+
data: {
|
|
280
|
+
events: [
|
|
281
|
+
{
|
|
282
|
+
event_at: "1970-01-20T16:13:20.903Z",
|
|
283
|
+
event_at_ms: 1700000903,
|
|
284
|
+
event_type: { tracking_type: "Lead" },
|
|
285
|
+
user: {
|
|
286
|
+
// sha256('lead@example.com')
|
|
287
|
+
email: "9fbdefe2837a03c9225be80e741f316f4d174d1732b719b6abb6477efc1ae9d2",
|
|
288
|
+
// sha256('user-lead-1')
|
|
289
|
+
external_id: "ee818eebb052cf288ffeeb2e09ee35c9946e1a7f53a959cb3ef06d5d4adb78e8"
|
|
290
|
+
},
|
|
291
|
+
event_metadata: { conversion_id: "1700000903-gr0up-1" }
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
}),
|
|
296
|
+
OPTIONS
|
|
297
|
+
]
|
|
298
|
+
]
|
|
299
|
+
};
|
|
300
|
+
var signUp = {
|
|
301
|
+
in: (0, import_core.getEvent)("user signup", {
|
|
302
|
+
timestamp: 1700000904,
|
|
303
|
+
data: { method: "email" },
|
|
304
|
+
user: { id: "new-user-1", email: "new@example.com" },
|
|
305
|
+
source: {
|
|
306
|
+
type: "server",
|
|
307
|
+
id: "https://www.example.com/register",
|
|
308
|
+
previous_id: ""
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
mapping: {
|
|
312
|
+
name: "SignUp",
|
|
313
|
+
data: {
|
|
314
|
+
map: {
|
|
315
|
+
user: {
|
|
316
|
+
map: {
|
|
317
|
+
email: "user.email",
|
|
318
|
+
external_id: "user.id"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
out: [
|
|
325
|
+
[
|
|
326
|
+
"sendServer",
|
|
327
|
+
ENDPOINT,
|
|
328
|
+
JSON.stringify({
|
|
329
|
+
data: {
|
|
330
|
+
events: [
|
|
331
|
+
{
|
|
332
|
+
event_at: "1970-01-20T16:13:20.904Z",
|
|
333
|
+
event_at_ms: 1700000904,
|
|
334
|
+
event_type: { tracking_type: "SignUp" },
|
|
335
|
+
user: {
|
|
336
|
+
// sha256('new@example.com')
|
|
337
|
+
email: "f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716",
|
|
338
|
+
// sha256('new-user-1')
|
|
339
|
+
external_id: "b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde"
|
|
340
|
+
},
|
|
341
|
+
event_metadata: { conversion_id: "1700000904-gr0up-1" }
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
}),
|
|
346
|
+
OPTIONS
|
|
347
|
+
]
|
|
348
|
+
]
|
|
349
|
+
};
|
|
350
|
+
var search = {
|
|
351
|
+
in: (0, import_core.getEvent)("site search", {
|
|
352
|
+
timestamp: 1700000905,
|
|
353
|
+
data: { query: "walkerOS destinations" },
|
|
354
|
+
user: { id: "user-101" },
|
|
355
|
+
source: {
|
|
356
|
+
type: "server",
|
|
357
|
+
id: "https://www.example.com/search",
|
|
358
|
+
previous_id: ""
|
|
359
|
+
}
|
|
360
|
+
}),
|
|
361
|
+
mapping: {
|
|
362
|
+
name: "Search",
|
|
363
|
+
data: {
|
|
364
|
+
map: {
|
|
365
|
+
event_metadata: {
|
|
366
|
+
map: {
|
|
367
|
+
item_count: { value: 1 }
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
out: [
|
|
374
|
+
[
|
|
375
|
+
"sendServer",
|
|
376
|
+
ENDPOINT,
|
|
377
|
+
JSON.stringify({
|
|
378
|
+
data: {
|
|
379
|
+
events: [
|
|
380
|
+
{
|
|
381
|
+
event_at: "1970-01-20T16:13:20.905Z",
|
|
382
|
+
event_at_ms: 1700000905,
|
|
383
|
+
event_type: { tracking_type: "Search" },
|
|
384
|
+
user: {},
|
|
385
|
+
event_metadata: {
|
|
386
|
+
conversion_id: "1700000905-gr0up-1",
|
|
387
|
+
item_count: 1
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
}),
|
|
393
|
+
OPTIONS
|
|
394
|
+
]
|
|
395
|
+
]
|
|
396
|
+
};
|
|
397
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
398
|
+
0 && (module.exports = {
|
|
399
|
+
env,
|
|
400
|
+
step
|
|
401
|
+
});
|