@stack0/sdk 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extraction/index.d.mts +1 -1
- package/dist/extraction/index.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +752 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +746 -14
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +1261 -19
- package/dist/mail/index.d.ts +1261 -19
- package/dist/mail/index.js +752 -13
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/index.mjs +746 -14
- package/dist/mail/index.mjs.map +1 -1
- package/dist/screenshots/index.d.mts +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/{shared-types-B0PyC7cF.d.mts → shared-types-CjKSP5Xc.d.mts} +15 -1
- package/dist/{shared-types-B0PyC7cF.d.ts → shared-types-CjKSP5Xc.d.ts} +15 -1
- package/package.json +1 -1
package/dist/mail/index.js
CHANGED
|
@@ -77,14 +77,644 @@ var HttpClient = class {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
// src/mail/audiences.ts
|
|
81
|
+
var Audiences = class {
|
|
82
|
+
constructor(http) {
|
|
83
|
+
this.http = http;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* List all audiences
|
|
87
|
+
*/
|
|
88
|
+
async list(request = {}) {
|
|
89
|
+
const params = new URLSearchParams();
|
|
90
|
+
if (request.environment) params.set("environment", request.environment);
|
|
91
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
92
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
93
|
+
if (request.search) params.set("search", request.search);
|
|
94
|
+
const query = params.toString();
|
|
95
|
+
return this.http.get(`/mail/audiences${query ? `?${query}` : ""}`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get an audience by ID
|
|
99
|
+
*/
|
|
100
|
+
async get(id) {
|
|
101
|
+
return this.http.get(`/mail/audiences/${id}`);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create a new audience
|
|
105
|
+
*/
|
|
106
|
+
async create(request) {
|
|
107
|
+
return this.http.post("/mail/audiences", request);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Update an audience
|
|
111
|
+
*/
|
|
112
|
+
async update(request) {
|
|
113
|
+
const { id, ...data } = request;
|
|
114
|
+
return this.http.put(`/mail/audiences/${id}`, data);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete an audience
|
|
118
|
+
*/
|
|
119
|
+
async delete(id) {
|
|
120
|
+
return this.http.delete(`/mail/audiences/${id}`);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* List contacts in an audience
|
|
124
|
+
*/
|
|
125
|
+
async listContacts(request) {
|
|
126
|
+
const { id, ...params } = request;
|
|
127
|
+
const searchParams = new URLSearchParams();
|
|
128
|
+
if (params.environment) searchParams.set("environment", params.environment);
|
|
129
|
+
if (params.limit) searchParams.set("limit", params.limit.toString());
|
|
130
|
+
if (params.offset) searchParams.set("offset", params.offset.toString());
|
|
131
|
+
if (params.search) searchParams.set("search", params.search);
|
|
132
|
+
if (params.status) searchParams.set("status", params.status);
|
|
133
|
+
const query = searchParams.toString();
|
|
134
|
+
return this.http.get(`/mail/audiences/${id}/contacts${query ? `?${query}` : ""}`);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Add contacts to an audience
|
|
138
|
+
*/
|
|
139
|
+
async addContacts(request) {
|
|
140
|
+
const { id, contactIds } = request;
|
|
141
|
+
return this.http.post(`/mail/audiences/${id}/contacts`, { contactIds });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Remove contacts from an audience
|
|
145
|
+
*/
|
|
146
|
+
async removeContacts(request) {
|
|
147
|
+
const { id, contactIds } = request;
|
|
148
|
+
return this.http.deleteWithBody(`/mail/audiences/${id}/contacts`, {
|
|
149
|
+
contactIds
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/mail/campaigns.ts
|
|
155
|
+
var Campaigns = class {
|
|
156
|
+
constructor(http) {
|
|
157
|
+
this.http = http;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* List all campaigns
|
|
161
|
+
*/
|
|
162
|
+
async list(request = {}) {
|
|
163
|
+
const params = new URLSearchParams();
|
|
164
|
+
if (request.environment) params.set("environment", request.environment);
|
|
165
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
166
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
167
|
+
if (request.search) params.set("search", request.search);
|
|
168
|
+
if (request.status) params.set("status", request.status);
|
|
169
|
+
const query = params.toString();
|
|
170
|
+
return this.http.get(`/mail/campaigns${query ? `?${query}` : ""}`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get a campaign by ID
|
|
174
|
+
*/
|
|
175
|
+
async get(id) {
|
|
176
|
+
return this.http.get(`/mail/campaigns/${id}`);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a new campaign
|
|
180
|
+
*/
|
|
181
|
+
async create(request) {
|
|
182
|
+
return this.http.post("/mail/campaigns", request);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Update a campaign
|
|
186
|
+
*/
|
|
187
|
+
async update(request) {
|
|
188
|
+
const { id, ...data } = request;
|
|
189
|
+
return this.http.put(`/mail/campaigns/${id}`, data);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Delete a campaign
|
|
193
|
+
*/
|
|
194
|
+
async delete(id) {
|
|
195
|
+
return this.http.delete(`/mail/campaigns/${id}`);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Send a campaign
|
|
199
|
+
*/
|
|
200
|
+
async send(request) {
|
|
201
|
+
const { id, ...data } = request;
|
|
202
|
+
return this.http.post(`/mail/campaigns/${id}/send`, data);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Pause a sending campaign
|
|
206
|
+
*/
|
|
207
|
+
async pause(id) {
|
|
208
|
+
return this.http.post(`/mail/campaigns/${id}/pause`, {});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Cancel a campaign
|
|
212
|
+
*/
|
|
213
|
+
async cancel(id) {
|
|
214
|
+
return this.http.post(`/mail/campaigns/${id}/cancel`, {});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Duplicate a campaign
|
|
218
|
+
*/
|
|
219
|
+
async duplicate(id) {
|
|
220
|
+
return this.http.post(`/mail/campaigns/${id}/duplicate`, {});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get campaign statistics
|
|
224
|
+
*/
|
|
225
|
+
async getStats(id) {
|
|
226
|
+
return this.http.get(`/mail/campaigns/${id}/stats`);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// src/mail/contacts.ts
|
|
231
|
+
var Contacts = class {
|
|
232
|
+
constructor(http) {
|
|
233
|
+
this.http = http;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* List all contacts
|
|
237
|
+
*/
|
|
238
|
+
async list(request = {}) {
|
|
239
|
+
const params = new URLSearchParams();
|
|
240
|
+
if (request.environment) params.set("environment", request.environment);
|
|
241
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
242
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
243
|
+
if (request.search) params.set("search", request.search);
|
|
244
|
+
if (request.status) params.set("status", request.status);
|
|
245
|
+
const query = params.toString();
|
|
246
|
+
return this.http.get(`/mail/contacts${query ? `?${query}` : ""}`);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get a contact by ID
|
|
250
|
+
*/
|
|
251
|
+
async get(id) {
|
|
252
|
+
return this.http.get(`/mail/contacts/${id}`);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Create a new contact
|
|
256
|
+
*/
|
|
257
|
+
async create(request) {
|
|
258
|
+
return this.http.post("/mail/contacts", request);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Update a contact
|
|
262
|
+
*/
|
|
263
|
+
async update(request) {
|
|
264
|
+
const { id, ...data } = request;
|
|
265
|
+
return this.http.put(`/mail/contacts/${id}`, data);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Delete a contact
|
|
269
|
+
*/
|
|
270
|
+
async delete(id) {
|
|
271
|
+
return this.http.delete(`/mail/contacts/${id}`);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Import contacts in bulk
|
|
275
|
+
*/
|
|
276
|
+
async import(request) {
|
|
277
|
+
return this.http.post("/mail/contacts/import", request);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// src/mail/domains.ts
|
|
282
|
+
var Domains = class {
|
|
283
|
+
constructor(http) {
|
|
284
|
+
this.http = http;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* List all domains for the organization
|
|
288
|
+
*/
|
|
289
|
+
async list(request) {
|
|
290
|
+
const params = new URLSearchParams();
|
|
291
|
+
params.set("projectSlug", request.projectSlug);
|
|
292
|
+
if (request.environment) params.set("environment", request.environment);
|
|
293
|
+
return this.http.get(`/mail/domains?${params.toString()}`);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Add a new domain
|
|
297
|
+
*/
|
|
298
|
+
async add(request) {
|
|
299
|
+
return this.http.post("/mail/domains", request);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Get DNS records for a domain
|
|
303
|
+
*/
|
|
304
|
+
async getDnsRecords(domainId) {
|
|
305
|
+
return this.http.get(`/mail/domains/${domainId}/dns`);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Verify a domain
|
|
309
|
+
*/
|
|
310
|
+
async verify(domainId) {
|
|
311
|
+
return this.http.post(`/mail/domains/${domainId}/verify`, {});
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Delete a domain
|
|
315
|
+
*/
|
|
316
|
+
async delete(domainId) {
|
|
317
|
+
return this.http.delete(`/mail/domains/${domainId}`);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Set a domain as the default
|
|
321
|
+
*/
|
|
322
|
+
async setDefault(domainId) {
|
|
323
|
+
return this.http.post(`/mail/domains/${domainId}/default`, {});
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// src/mail/events.ts
|
|
328
|
+
var Events = class {
|
|
329
|
+
constructor(http) {
|
|
330
|
+
this.http = http;
|
|
331
|
+
}
|
|
332
|
+
// ============================================================================
|
|
333
|
+
// EVENT DEFINITIONS
|
|
334
|
+
// ============================================================================
|
|
335
|
+
/**
|
|
336
|
+
* List all event definitions
|
|
337
|
+
*/
|
|
338
|
+
async list(request = {}) {
|
|
339
|
+
const params = new URLSearchParams();
|
|
340
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
341
|
+
if (request.environment) params.set("environment", request.environment);
|
|
342
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
343
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
344
|
+
if (request.search) params.set("search", request.search);
|
|
345
|
+
const query = params.toString();
|
|
346
|
+
return this.http.get(`/mail/events${query ? `?${query}` : ""}`);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Get an event definition by ID
|
|
350
|
+
*/
|
|
351
|
+
async get(id) {
|
|
352
|
+
return this.http.get(`/mail/events/${id}`);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Create a new event definition
|
|
356
|
+
*/
|
|
357
|
+
async create(request) {
|
|
358
|
+
return this.http.post("/mail/events", request);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Update an event definition
|
|
362
|
+
*/
|
|
363
|
+
async update(request) {
|
|
364
|
+
const { id, ...data } = request;
|
|
365
|
+
return this.http.put(`/mail/events/${id}`, data);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Delete an event definition
|
|
369
|
+
*/
|
|
370
|
+
async delete(id) {
|
|
371
|
+
return this.http.delete(`/mail/events/${id}`);
|
|
372
|
+
}
|
|
373
|
+
// ============================================================================
|
|
374
|
+
// EVENT TRACKING
|
|
375
|
+
// ============================================================================
|
|
376
|
+
/**
|
|
377
|
+
* Track a single event
|
|
378
|
+
* This can trigger email sequences configured to listen for this event
|
|
379
|
+
*/
|
|
380
|
+
async track(request) {
|
|
381
|
+
return this.http.post("/mail/events/track", request);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Track multiple events in a batch (max 100)
|
|
385
|
+
*/
|
|
386
|
+
async trackBatch(request) {
|
|
387
|
+
return this.http.post("/mail/events/track/batch", request);
|
|
388
|
+
}
|
|
389
|
+
// ============================================================================
|
|
390
|
+
// EVENT OCCURRENCES
|
|
391
|
+
// ============================================================================
|
|
392
|
+
/**
|
|
393
|
+
* List event occurrences
|
|
394
|
+
*/
|
|
395
|
+
async listOccurrences(request = {}) {
|
|
396
|
+
const params = new URLSearchParams();
|
|
397
|
+
if (request.eventId) params.set("eventId", request.eventId);
|
|
398
|
+
if (request.contactId) params.set("contactId", request.contactId);
|
|
399
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
400
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
401
|
+
if (request.startDate) {
|
|
402
|
+
params.set("startDate", request.startDate instanceof Date ? request.startDate.toISOString() : request.startDate);
|
|
403
|
+
}
|
|
404
|
+
if (request.endDate) {
|
|
405
|
+
params.set("endDate", request.endDate instanceof Date ? request.endDate.toISOString() : request.endDate);
|
|
406
|
+
}
|
|
407
|
+
const query = params.toString();
|
|
408
|
+
return this.http.get(`/mail/events/occurrences${query ? `?${query}` : ""}`);
|
|
409
|
+
}
|
|
410
|
+
// ============================================================================
|
|
411
|
+
// ANALYTICS
|
|
412
|
+
// ============================================================================
|
|
413
|
+
/**
|
|
414
|
+
* Get analytics for an event
|
|
415
|
+
*/
|
|
416
|
+
async getAnalytics(id) {
|
|
417
|
+
return this.http.get(`/mail/events/analytics/${id}`);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// src/mail/sequences.ts
|
|
422
|
+
var Sequences = class {
|
|
423
|
+
constructor(http) {
|
|
424
|
+
this.http = http;
|
|
425
|
+
}
|
|
426
|
+
// ============================================================================
|
|
427
|
+
// SEQUENCE CRUD
|
|
428
|
+
// ============================================================================
|
|
429
|
+
/**
|
|
430
|
+
* List all sequences
|
|
431
|
+
*/
|
|
432
|
+
async list(request = {}) {
|
|
433
|
+
const params = new URLSearchParams();
|
|
434
|
+
if (request.environment) params.set("environment", request.environment);
|
|
435
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
436
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
437
|
+
if (request.search) params.set("search", request.search);
|
|
438
|
+
if (request.status) params.set("status", request.status);
|
|
439
|
+
if (request.triggerType) params.set("triggerType", request.triggerType);
|
|
440
|
+
const query = params.toString();
|
|
441
|
+
return this.http.get(`/mail/sequences${query ? `?${query}` : ""}`);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Get a sequence by ID with all nodes and connections
|
|
445
|
+
*/
|
|
446
|
+
async get(id) {
|
|
447
|
+
return this.http.get(`/mail/sequences/${id}`);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Create a new sequence
|
|
451
|
+
*/
|
|
452
|
+
async create(request) {
|
|
453
|
+
return this.http.post("/mail/sequences", request);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Update a sequence
|
|
457
|
+
*/
|
|
458
|
+
async update(request) {
|
|
459
|
+
const { id, ...data } = request;
|
|
460
|
+
return this.http.put(`/mail/sequences/${id}`, data);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Delete a sequence
|
|
464
|
+
*/
|
|
465
|
+
async delete(id) {
|
|
466
|
+
return this.http.delete(`/mail/sequences/${id}`);
|
|
467
|
+
}
|
|
468
|
+
// ============================================================================
|
|
469
|
+
// SEQUENCE LIFECYCLE
|
|
470
|
+
// ============================================================================
|
|
471
|
+
/**
|
|
472
|
+
* Publish (activate) a sequence
|
|
473
|
+
*/
|
|
474
|
+
async publish(id) {
|
|
475
|
+
return this.http.post(`/mail/sequences/${id}/publish`, {});
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Pause an active sequence
|
|
479
|
+
*/
|
|
480
|
+
async pause(id) {
|
|
481
|
+
return this.http.post(`/mail/sequences/${id}/pause`, {});
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Resume a paused sequence
|
|
485
|
+
*/
|
|
486
|
+
async resume(id) {
|
|
487
|
+
return this.http.post(`/mail/sequences/${id}/resume`, {});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Archive a sequence
|
|
491
|
+
*/
|
|
492
|
+
async archive(id) {
|
|
493
|
+
return this.http.post(`/mail/sequences/${id}/archive`, {});
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Duplicate a sequence
|
|
497
|
+
*/
|
|
498
|
+
async duplicate(id, name) {
|
|
499
|
+
return this.http.post(`/mail/sequences/${id}/duplicate`, { name });
|
|
500
|
+
}
|
|
501
|
+
// ============================================================================
|
|
502
|
+
// NODE MANAGEMENT
|
|
503
|
+
// ============================================================================
|
|
504
|
+
/**
|
|
505
|
+
* Create a new node in a sequence
|
|
506
|
+
*/
|
|
507
|
+
async createNode(request) {
|
|
508
|
+
const { id, ...data } = request;
|
|
509
|
+
return this.http.post(`/mail/sequences/${id}/nodes`, data);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Update a node
|
|
513
|
+
*/
|
|
514
|
+
async updateNode(request) {
|
|
515
|
+
const { id, nodeId, ...data } = request;
|
|
516
|
+
return this.http.put(`/mail/sequences/${id}/nodes/${nodeId}`, data);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Update node position (for visual editor)
|
|
520
|
+
*/
|
|
521
|
+
async updateNodePosition(request) {
|
|
522
|
+
const { id, nodeId, positionX, positionY } = request;
|
|
523
|
+
return this.http.put(`/mail/sequences/${id}/nodes/${nodeId}/position`, { positionX, positionY });
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Delete a node
|
|
527
|
+
*/
|
|
528
|
+
async deleteNode(sequenceId, nodeId) {
|
|
529
|
+
return this.http.delete(`/mail/sequences/${sequenceId}/nodes/${nodeId}`);
|
|
530
|
+
}
|
|
531
|
+
// ============================================================================
|
|
532
|
+
// NODE CONFIGURATIONS
|
|
533
|
+
// ============================================================================
|
|
534
|
+
/**
|
|
535
|
+
* Set email node content
|
|
536
|
+
*/
|
|
537
|
+
async setNodeEmail(sequenceId, request) {
|
|
538
|
+
const { nodeId, ...data } = request;
|
|
539
|
+
return this.http.put(`/mail/sequences/${sequenceId}/nodes/${nodeId}/email`, data);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Set timer node configuration
|
|
543
|
+
*/
|
|
544
|
+
async setNodeTimer(sequenceId, request) {
|
|
545
|
+
const { nodeId, ...data } = request;
|
|
546
|
+
return this.http.put(`/mail/sequences/${sequenceId}/nodes/${nodeId}/timer`, data);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Set filter node configuration
|
|
550
|
+
*/
|
|
551
|
+
async setNodeFilter(sequenceId, request) {
|
|
552
|
+
const { nodeId, ...data } = request;
|
|
553
|
+
return this.http.put(`/mail/sequences/${sequenceId}/nodes/${nodeId}/filter`, data);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Set branch node configuration
|
|
557
|
+
*/
|
|
558
|
+
async setNodeBranch(sequenceId, request) {
|
|
559
|
+
const { nodeId, ...data } = request;
|
|
560
|
+
return this.http.put(`/mail/sequences/${sequenceId}/nodes/${nodeId}/branch`, data);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Set experiment node configuration
|
|
564
|
+
*/
|
|
565
|
+
async setNodeExperiment(sequenceId, request) {
|
|
566
|
+
const { nodeId, ...data } = request;
|
|
567
|
+
return this.http.put(`/mail/sequences/${sequenceId}/nodes/${nodeId}/experiment`, data);
|
|
568
|
+
}
|
|
569
|
+
// ============================================================================
|
|
570
|
+
// CONNECTIONS
|
|
571
|
+
// ============================================================================
|
|
572
|
+
/**
|
|
573
|
+
* Create a connection between nodes
|
|
574
|
+
*/
|
|
575
|
+
async createConnection(request) {
|
|
576
|
+
const { id, ...data } = request;
|
|
577
|
+
return this.http.post(`/mail/sequences/${id}/connections`, data);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Delete a connection
|
|
581
|
+
*/
|
|
582
|
+
async deleteConnection(sequenceId, connectionId) {
|
|
583
|
+
return this.http.delete(`/mail/sequences/${sequenceId}/connections/${connectionId}`);
|
|
584
|
+
}
|
|
585
|
+
// ============================================================================
|
|
586
|
+
// SEQUENCE ENTRIES (CONTACTS IN SEQUENCE)
|
|
587
|
+
// ============================================================================
|
|
588
|
+
/**
|
|
589
|
+
* List contacts in a sequence
|
|
590
|
+
*/
|
|
591
|
+
async listEntries(request) {
|
|
592
|
+
const { id, ...params } = request;
|
|
593
|
+
const searchParams = new URLSearchParams();
|
|
594
|
+
if (params.limit) searchParams.set("limit", params.limit.toString());
|
|
595
|
+
if (params.offset) searchParams.set("offset", params.offset.toString());
|
|
596
|
+
if (params.status) searchParams.set("status", params.status);
|
|
597
|
+
const query = searchParams.toString();
|
|
598
|
+
return this.http.get(`/mail/sequences/${id}/entries${query ? `?${query}` : ""}`);
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Add a contact to a sequence
|
|
602
|
+
*/
|
|
603
|
+
async addContact(request) {
|
|
604
|
+
const { id, contactId } = request;
|
|
605
|
+
return this.http.post(`/mail/sequences/${id}/add-contact`, { contactId });
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Remove a contact from a sequence
|
|
609
|
+
*/
|
|
610
|
+
async removeContact(request) {
|
|
611
|
+
const { id, entryId, reason } = request;
|
|
612
|
+
return this.http.post(`/mail/sequences/${id}/remove-contact`, {
|
|
613
|
+
entryId,
|
|
614
|
+
reason
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
// ============================================================================
|
|
618
|
+
// ANALYTICS
|
|
619
|
+
// ============================================================================
|
|
620
|
+
/**
|
|
621
|
+
* Get sequence analytics
|
|
622
|
+
*/
|
|
623
|
+
async getAnalytics(id) {
|
|
624
|
+
return this.http.get(`/mail/sequences/${id}/analytics`);
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// src/mail/templates.ts
|
|
629
|
+
var Templates = class {
|
|
630
|
+
constructor(http) {
|
|
631
|
+
this.http = http;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* List all templates
|
|
635
|
+
*/
|
|
636
|
+
async list(request = {}) {
|
|
637
|
+
const params = new URLSearchParams();
|
|
638
|
+
if (request.environment) params.set("environment", request.environment);
|
|
639
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
640
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
641
|
+
if (request.isActive !== void 0) params.set("isActive", request.isActive.toString());
|
|
642
|
+
if (request.search) params.set("search", request.search);
|
|
643
|
+
const query = params.toString();
|
|
644
|
+
return this.http.get(`/mail/templates${query ? `?${query}` : ""}`);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Get a template by ID
|
|
648
|
+
*/
|
|
649
|
+
async get(id) {
|
|
650
|
+
return this.http.get(`/mail/templates/${id}`);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Get a template by slug
|
|
654
|
+
*/
|
|
655
|
+
async getBySlug(slug) {
|
|
656
|
+
return this.http.get(`/mail/templates/slug/${slug}`);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Create a new template
|
|
660
|
+
*/
|
|
661
|
+
async create(request) {
|
|
662
|
+
return this.http.post("/mail/templates", request);
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Update a template
|
|
666
|
+
*/
|
|
667
|
+
async update(request) {
|
|
668
|
+
const { id, ...data } = request;
|
|
669
|
+
return this.http.put(`/mail/templates/${id}`, data);
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Delete a template
|
|
673
|
+
*/
|
|
674
|
+
async delete(id) {
|
|
675
|
+
return this.http.delete(`/mail/templates/${id}`);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Preview a template with variables
|
|
679
|
+
*/
|
|
680
|
+
async preview(request) {
|
|
681
|
+
const { id, variables } = request;
|
|
682
|
+
return this.http.post(`/mail/templates/${id}/preview`, { variables });
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
|
|
80
686
|
// src/mail/client.ts
|
|
81
687
|
var Mail = class {
|
|
82
688
|
http;
|
|
689
|
+
/** Manage sending domains */
|
|
690
|
+
domains;
|
|
691
|
+
/** Manage email templates */
|
|
692
|
+
templates;
|
|
693
|
+
/** Manage contact audiences/lists */
|
|
694
|
+
audiences;
|
|
695
|
+
/** Manage contacts */
|
|
696
|
+
contacts;
|
|
697
|
+
/** Manage email campaigns */
|
|
698
|
+
campaigns;
|
|
699
|
+
/** Manage automated email sequences */
|
|
700
|
+
sequences;
|
|
701
|
+
/** Track and manage custom events */
|
|
702
|
+
events;
|
|
83
703
|
constructor(config) {
|
|
84
704
|
this.http = new HttpClient(config);
|
|
705
|
+
this.domains = new Domains(this.http);
|
|
706
|
+
this.templates = new Templates(this.http);
|
|
707
|
+
this.audiences = new Audiences(this.http);
|
|
708
|
+
this.contacts = new Contacts(this.http);
|
|
709
|
+
this.campaigns = new Campaigns(this.http);
|
|
710
|
+
this.sequences = new Sequences(this.http);
|
|
711
|
+
this.events = new Events(this.http);
|
|
85
712
|
}
|
|
713
|
+
// ============================================================================
|
|
714
|
+
// TRANSACTIONAL EMAILS
|
|
715
|
+
// ============================================================================
|
|
86
716
|
/**
|
|
87
|
-
* Send
|
|
717
|
+
* Send a single email
|
|
88
718
|
*
|
|
89
719
|
* @example
|
|
90
720
|
* ```typescript
|
|
@@ -97,11 +727,40 @@ var Mail = class {
|
|
|
97
727
|
* ```
|
|
98
728
|
*/
|
|
99
729
|
async send(request) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
730
|
+
return this.http.post("/mail/send", request);
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Send multiple emails in a batch (up to 100)
|
|
734
|
+
* Each email can have different content and recipients
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* ```typescript
|
|
738
|
+
* const result = await mail.sendBatch({
|
|
739
|
+
* emails: [
|
|
740
|
+
* { from: 'noreply@example.com', to: 'user1@example.com', subject: 'Hello', html: '<p>Hi User 1</p>' },
|
|
741
|
+
* { from: 'noreply@example.com', to: 'user2@example.com', subject: 'Hello', html: '<p>Hi User 2</p>' },
|
|
742
|
+
* ]
|
|
743
|
+
* });
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
async sendBatch(request) {
|
|
747
|
+
return this.http.post("/mail/send/batch", request);
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Send a broadcast email (same content to multiple recipients, up to 1000)
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```typescript
|
|
754
|
+
* const result = await mail.sendBroadcast({
|
|
755
|
+
* from: 'noreply@example.com',
|
|
756
|
+
* to: ['user1@example.com', 'user2@example.com', 'user3@example.com'],
|
|
757
|
+
* subject: 'Newsletter',
|
|
758
|
+
* html: '<p>Our latest updates...</p>',
|
|
759
|
+
* });
|
|
760
|
+
* ```
|
|
761
|
+
*/
|
|
762
|
+
async sendBroadcast(request) {
|
|
763
|
+
return this.http.post("/mail/send/broadcast", request);
|
|
105
764
|
}
|
|
106
765
|
/**
|
|
107
766
|
* Get email details by ID
|
|
@@ -113,17 +772,97 @@ var Mail = class {
|
|
|
113
772
|
* ```
|
|
114
773
|
*/
|
|
115
774
|
async get(id) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
775
|
+
return this.http.get(`/mail/${id}`);
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* List emails with optional filters
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```typescript
|
|
782
|
+
* const result = await mail.list({
|
|
783
|
+
* status: 'delivered',
|
|
784
|
+
* limit: 50,
|
|
785
|
+
* });
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
async list(request = {}) {
|
|
789
|
+
const params = new URLSearchParams();
|
|
790
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
791
|
+
if (request.environment) params.set("environment", request.environment);
|
|
792
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
793
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
794
|
+
if (request.status) params.set("status", request.status);
|
|
795
|
+
if (request.from) params.set("from", request.from);
|
|
796
|
+
if (request.to) params.set("to", request.to);
|
|
797
|
+
if (request.subject) params.set("subject", request.subject);
|
|
798
|
+
if (request.tag) params.set("tag", request.tag);
|
|
799
|
+
if (request.startDate) {
|
|
800
|
+
params.set("startDate", request.startDate instanceof Date ? request.startDate.toISOString() : request.startDate);
|
|
801
|
+
}
|
|
802
|
+
if (request.endDate) {
|
|
803
|
+
params.set("endDate", request.endDate instanceof Date ? request.endDate.toISOString() : request.endDate);
|
|
122
804
|
}
|
|
123
|
-
|
|
805
|
+
if (request.sortBy) params.set("sortBy", request.sortBy);
|
|
806
|
+
if (request.sortOrder) params.set("sortOrder", request.sortOrder);
|
|
807
|
+
const query = params.toString();
|
|
808
|
+
return this.http.get(`/mail${query ? `?${query}` : ""}`);
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Resend a previously sent email
|
|
812
|
+
*/
|
|
813
|
+
async resend(id) {
|
|
814
|
+
return this.http.post(`/mail/${id}/resend`, {});
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Cancel a scheduled email
|
|
818
|
+
*/
|
|
819
|
+
async cancel(id) {
|
|
820
|
+
return this.http.post(`/mail/${id}/cancel`, {});
|
|
821
|
+
}
|
|
822
|
+
// ============================================================================
|
|
823
|
+
// ANALYTICS
|
|
824
|
+
// ============================================================================
|
|
825
|
+
/**
|
|
826
|
+
* Get overall email analytics
|
|
827
|
+
*/
|
|
828
|
+
async getAnalytics() {
|
|
829
|
+
return this.http.get("/mail/analytics");
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Get time series analytics (daily breakdown)
|
|
833
|
+
*/
|
|
834
|
+
async getTimeSeriesAnalytics(request = {}) {
|
|
835
|
+
const params = new URLSearchParams();
|
|
836
|
+
if (request.days) params.set("days", request.days.toString());
|
|
837
|
+
const query = params.toString();
|
|
838
|
+
return this.http.get(`/mail/analytics/timeseries${query ? `?${query}` : ""}`);
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get hourly analytics
|
|
842
|
+
*/
|
|
843
|
+
async getHourlyAnalytics() {
|
|
844
|
+
return this.http.get("/mail/analytics/hourly");
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* List unique senders with their statistics
|
|
848
|
+
*/
|
|
849
|
+
async listSenders(request = {}) {
|
|
850
|
+
const params = new URLSearchParams();
|
|
851
|
+
if (request.projectSlug) params.set("projectSlug", request.projectSlug);
|
|
852
|
+
if (request.environment) params.set("environment", request.environment);
|
|
853
|
+
if (request.search) params.set("search", request.search);
|
|
854
|
+
const query = params.toString();
|
|
855
|
+
return this.http.get(`/mail/senders${query ? `?${query}` : ""}`);
|
|
124
856
|
}
|
|
125
857
|
};
|
|
126
858
|
|
|
859
|
+
exports.Audiences = Audiences;
|
|
860
|
+
exports.Campaigns = Campaigns;
|
|
861
|
+
exports.Contacts = Contacts;
|
|
862
|
+
exports.Domains = Domains;
|
|
863
|
+
exports.Events = Events;
|
|
127
864
|
exports.Mail = Mail;
|
|
865
|
+
exports.Sequences = Sequences;
|
|
866
|
+
exports.Templates = Templates;
|
|
128
867
|
//# sourceMappingURL=index.js.map
|
|
129
868
|
//# sourceMappingURL=index.js.map
|