sendlit 0.6.0 → 0.8.0
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 +38 -1
- package/dist/index.d.mts +1831 -553
- package/dist/index.d.ts +1831 -553
- package/dist/index.js +638 -213
- package/dist/index.mjs +638 -214
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -167,17 +167,28 @@ headers("created_at", [
|
|
|
167
167
|
"created",
|
|
168
168
|
"created_date",
|
|
169
169
|
"date_added",
|
|
170
|
-
"subscribed_at",
|
|
171
|
-
"subscribe_date",
|
|
172
|
-
"subscription_date",
|
|
173
170
|
"signup_date",
|
|
174
171
|
"sign_up_date",
|
|
172
|
+
"joined_at"
|
|
173
|
+
]);
|
|
174
|
+
headers("opted_in_at", [
|
|
175
|
+
"opted_in_at",
|
|
175
176
|
"optin_time",
|
|
177
|
+
"opt_in_time",
|
|
178
|
+
"opt_in_date",
|
|
176
179
|
"confirm_time",
|
|
177
|
-
"
|
|
180
|
+
"subscribed_at",
|
|
181
|
+
"subscribe_date",
|
|
182
|
+
"subscription_date",
|
|
183
|
+
"consent_date"
|
|
178
184
|
]);
|
|
179
185
|
headers("tag_from_value", ["tier", "plan", "subscription_tier"]);
|
|
180
|
-
headers("ignore", [
|
|
186
|
+
headers("ignore", [
|
|
187
|
+
"suppression_reason",
|
|
188
|
+
"consent_channel",
|
|
189
|
+
"consent_source",
|
|
190
|
+
"consent_wording"
|
|
191
|
+
]);
|
|
181
192
|
function statuses(result, values) {
|
|
182
193
|
for (const value of values)
|
|
183
194
|
result;
|
|
@@ -230,6 +241,162 @@ statuses({ skip: "pending_confirmation" }, [
|
|
|
230
241
|
"awaiting_confirmation",
|
|
231
242
|
"not_confirmed"
|
|
232
243
|
]);
|
|
244
|
+
var postalAddressSchema = zod.z.object({
|
|
245
|
+
line1: zod.z.string().trim().min(1).max(200).describe("Street address"),
|
|
246
|
+
line2: zod.z.string().trim().max(200).optional().describe("Apartment, suite, building and so on"),
|
|
247
|
+
city: zod.z.string().trim().max(100).optional(),
|
|
248
|
+
region: zod.z.string().trim().max(100).optional().describe("State, province or region"),
|
|
249
|
+
postalCode: zod.z.string().trim().max(20).optional(),
|
|
250
|
+
country: zod.z.string().regex(/^[A-Z]{2}$/).describe("ISO 3166-1 alpha-2 country code, uppercase (for example `GB`)")
|
|
251
|
+
});
|
|
252
|
+
var generalSettingsSchema = zod.z.object({
|
|
253
|
+
/** The physical postal address shown in marketing email footers; required
|
|
254
|
+
* for broadcasts and sequences. `null` until it is set. */
|
|
255
|
+
postalAddress: postalAddressSchema.nullable(),
|
|
256
|
+
updatedAt: zod.z.string().nullable().optional()
|
|
257
|
+
});
|
|
258
|
+
var updateGeneralSettingsBodySchema = zod.z.object({
|
|
259
|
+
/** Omit to keep the address; `null` clears it. */
|
|
260
|
+
postalAddress: postalAddressSchema.nullable().optional()
|
|
261
|
+
});
|
|
262
|
+
var trackingDomainStatuses = ["pending", "verified", "failed"];
|
|
263
|
+
var trackingDomainSchema = zod.z.object({
|
|
264
|
+
domain: zod.z.string().nullable(),
|
|
265
|
+
/** `pending` until the CNAME and HTTPS work; `failed` after the domain
|
|
266
|
+
* stopped working, when links fall back to SendLit's own host. */
|
|
267
|
+
status: zod.z.enum(trackingDomainStatuses).nullable(),
|
|
268
|
+
/** The host the domain's CNAME record must point to. */
|
|
269
|
+
cnameTarget: zod.z.string(),
|
|
270
|
+
/** Why the last check failed: `cname_missing`, `cname_mismatch`,
|
|
271
|
+
* `unreachable` (no HTTPS answer yet) or `dns_error`. */
|
|
272
|
+
error: zod.z.string().nullable(),
|
|
273
|
+
verifiedAt: zod.z.string().nullable(),
|
|
274
|
+
checkedAt: zod.z.string().nullable()
|
|
275
|
+
});
|
|
276
|
+
var updateTrackingDomainBodySchema = zod.z.object({
|
|
277
|
+
/** A subdomain such as `track.example.com`; `null` removes it. */
|
|
278
|
+
domain: zod.z.string().max(253).nullable()
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// ../api-contract/src/schemas/teams.ts
|
|
282
|
+
var teamSchema = zod.z.object({
|
|
283
|
+
teamId: zod.z.string(),
|
|
284
|
+
/** Public organization identifier. Present when an end user lists the
|
|
285
|
+
* teams they belong to, so the dashboard can keep workspace selection
|
|
286
|
+
* scoped to one organization. */
|
|
287
|
+
organizationId: zod.z.string().optional(),
|
|
288
|
+
organizationName: zod.z.string().optional(),
|
|
289
|
+
name: zod.z.string(),
|
|
290
|
+
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
291
|
+
externalId: zod.z.string().nullable().optional(),
|
|
292
|
+
createdAt: zod.z.string().nullable().optional(),
|
|
293
|
+
updatedAt: zod.z.string().nullable().optional(),
|
|
294
|
+
/** True when the calling human is already a `team_members` row. Always
|
|
295
|
+
* false for organization API keys. Omitted on non-list team payloads. */
|
|
296
|
+
viewerIsMember: zod.z.boolean().optional()
|
|
297
|
+
});
|
|
298
|
+
var apiKeySchema = zod.z.object({
|
|
299
|
+
keyId: zod.z.string(),
|
|
300
|
+
keyPrefix: zod.z.string(),
|
|
301
|
+
name: zod.z.string(),
|
|
302
|
+
expiresAt: zod.z.string().nullable().optional(),
|
|
303
|
+
lastUsedAt: zod.z.string().nullable().optional(),
|
|
304
|
+
revokedAt: zod.z.string().nullable().optional(),
|
|
305
|
+
createdAt: zod.z.string().nullable().optional()
|
|
306
|
+
});
|
|
307
|
+
var createdApiKeySchema = apiKeySchema.extend({
|
|
308
|
+
key: zod.z.string()
|
|
309
|
+
});
|
|
310
|
+
var createTeamBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
311
|
+
var renameTeamBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
312
|
+
var createApiKeyBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
313
|
+
var provisionTeamBodySchema = zod.z.object({
|
|
314
|
+
externalId: zod.z.string().min(1),
|
|
315
|
+
name: zod.z.string().min(1),
|
|
316
|
+
sender: zod.z.object({
|
|
317
|
+
fromName: zod.z.string().min(1).optional(),
|
|
318
|
+
replyTo: zod.z.string().email().optional()
|
|
319
|
+
}).optional(),
|
|
320
|
+
postalAddress: postalAddressSchema.optional(),
|
|
321
|
+
delivery: zod.z.object({
|
|
322
|
+
useOrganizationDefault: zod.z.boolean().optional(),
|
|
323
|
+
teamEspEnabled: zod.z.boolean().optional(),
|
|
324
|
+
teamCanChangeDefault: zod.z.boolean().optional()
|
|
325
|
+
}).optional(),
|
|
326
|
+
quota: zod.z.object({
|
|
327
|
+
dailyLimit: zod.z.number().int().positive().nullable().optional(),
|
|
328
|
+
monthlyLimit: zod.z.number().int().positive().nullable().optional()
|
|
329
|
+
}).optional()
|
|
330
|
+
});
|
|
331
|
+
var provisionedTeamBaseSchema = zod.z.object({
|
|
332
|
+
teamId: zod.z.string(),
|
|
333
|
+
externalId: zod.z.string(),
|
|
334
|
+
name: zod.z.string(),
|
|
335
|
+
deliverySource: zod.z.object({ type: zod.z.literal("organization") })
|
|
336
|
+
});
|
|
337
|
+
var provisionTeamResponseSchema = zod.z.discriminatedUnion("created", [
|
|
338
|
+
provisionedTeamBaseSchema.extend({
|
|
339
|
+
created: zod.z.literal(true),
|
|
340
|
+
apiKey: zod.z.string()
|
|
341
|
+
}),
|
|
342
|
+
provisionedTeamBaseSchema.extend({
|
|
343
|
+
created: zod.z.literal(false),
|
|
344
|
+
apiKey: zod.z.null()
|
|
345
|
+
})
|
|
346
|
+
]);
|
|
347
|
+
var teamHealthSchema = zod.z.object({
|
|
348
|
+
status: zod.z.enum(["normal", "warned", "marketing_paused", "all_paused"]),
|
|
349
|
+
reason: zod.z.string().nullable(),
|
|
350
|
+
scope: zod.z.enum(["team", "shared_mailbox"]).nullable(),
|
|
351
|
+
last7Days: zod.z.object({
|
|
352
|
+
sent: zod.z.number().int().nonnegative(),
|
|
353
|
+
bounced: zod.z.number().int().nonnegative(),
|
|
354
|
+
complained: zod.z.number().int().nonnegative()
|
|
355
|
+
})
|
|
356
|
+
});
|
|
357
|
+
var provisionedTeamSchema = provisionedTeamBaseSchema.extend({
|
|
358
|
+
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
359
|
+
postalAddress: postalAddressSchema.nullable(),
|
|
360
|
+
teamEspEnabled: zod.z.boolean(),
|
|
361
|
+
teamCanChangeDefault: zod.z.boolean(),
|
|
362
|
+
createdAt: zod.z.string().nullable(),
|
|
363
|
+
updatedAt: zod.z.string().nullable(),
|
|
364
|
+
health: teamHealthSchema
|
|
365
|
+
});
|
|
366
|
+
var updateProvisionedTeamBodySchema = zod.z.object({
|
|
367
|
+
name: zod.z.string().min(1).optional(),
|
|
368
|
+
sender: zod.z.object({
|
|
369
|
+
fromName: zod.z.string().min(1).nullable().optional(),
|
|
370
|
+
replyTo: zod.z.string().email().nullable().optional()
|
|
371
|
+
}).optional(),
|
|
372
|
+
postalAddress: postalAddressSchema.nullable().optional(),
|
|
373
|
+
delivery: zod.z.object({
|
|
374
|
+
teamEspEnabled: zod.z.boolean().optional(),
|
|
375
|
+
teamCanChangeDefault: zod.z.boolean().optional()
|
|
376
|
+
}).optional(),
|
|
377
|
+
quota: zod.z.object({
|
|
378
|
+
dailyLimit: zod.z.number().int().nonnegative().nullable().optional(),
|
|
379
|
+
monthlyLimit: zod.z.number().int().nonnegative().nullable().optional()
|
|
380
|
+
}).optional()
|
|
381
|
+
}).refine((body) => Object.keys(body).length > 0, {
|
|
382
|
+
message: "At least one field is required"
|
|
383
|
+
});
|
|
384
|
+
var usageWindowSchema = zod.z.object({
|
|
385
|
+
limit: zod.z.number().int().nullable(),
|
|
386
|
+
accepted: zod.z.number().int().nonnegative(),
|
|
387
|
+
reserved: zod.z.number().int().nonnegative(),
|
|
388
|
+
remaining: zod.z.number().int().nullable(),
|
|
389
|
+
resetsAt: zod.z.string()
|
|
390
|
+
});
|
|
391
|
+
var teamQuotaUsageSchema = zod.z.object({
|
|
392
|
+
day: usageWindowSchema,
|
|
393
|
+
month: usageWindowSchema
|
|
394
|
+
});
|
|
395
|
+
var provisionedTeamUsageSchema = teamQuotaUsageSchema.extend({
|
|
396
|
+
health: teamHealthSchema
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// ../api-contract/src/schemas/organizations.ts
|
|
233
400
|
var organizationRoleSchema = zod.z.enum(["owner", "admin", "member"]);
|
|
234
401
|
var organizationSchema = zod.z.object({
|
|
235
402
|
organizationId: zod.z.string(),
|
|
@@ -314,14 +481,18 @@ var organizationMailCountsSchema = zod.z.object({
|
|
|
314
481
|
sent: zod.z.number().int().nonnegative(),
|
|
315
482
|
queued: zod.z.number().int().nonnegative(),
|
|
316
483
|
failed: zod.z.number().int().nonnegative(),
|
|
317
|
-
bounced: zod.z.number().int().nonnegative()
|
|
484
|
+
bounced: zod.z.number().int().nonnegative(),
|
|
485
|
+
complained: zod.z.number().int().nonnegative()
|
|
318
486
|
});
|
|
319
487
|
var organizationMailActivityTeamSchema = zod.z.object({
|
|
320
488
|
teamId: zod.z.string(),
|
|
321
489
|
name: zod.z.string(),
|
|
322
490
|
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
323
491
|
externalId: zod.z.string().nullable(),
|
|
324
|
-
mail: organizationMailCountsSchema
|
|
492
|
+
mail: organizationMailCountsSchema,
|
|
493
|
+
health: teamHealthSchema,
|
|
494
|
+
/** Shared-mailbox quota; null when the team has no active grant. */
|
|
495
|
+
quota: teamQuotaUsageSchema.nullable()
|
|
325
496
|
});
|
|
326
497
|
var organizationMailActivitySchema = zod.z.object({
|
|
327
498
|
rangeDays: zod.z.union([zod.z.literal(1), zod.z.literal(3), zod.z.literal(7), zod.z.literal(30)]),
|
|
@@ -672,6 +843,81 @@ function paginated(item) {
|
|
|
672
843
|
function itemsList(item) {
|
|
673
844
|
return zod.z.object({ items: zod.z.array(item) });
|
|
674
845
|
}
|
|
846
|
+
var consentActions = ["opt_in", "opt_out", "suppressed"];
|
|
847
|
+
var consentChannels = [
|
|
848
|
+
/** A signup form: the hosted page, an embedded form, or `forms.submit`. */
|
|
849
|
+
"form",
|
|
850
|
+
/** A contact import (CSV in the dashboard, or `contacts.import`). */
|
|
851
|
+
"import",
|
|
852
|
+
/** The REST API with an API key or OAuth token. */
|
|
853
|
+
"api",
|
|
854
|
+
/** An MCP tool. */
|
|
855
|
+
"mcp",
|
|
856
|
+
/** A team member in the SendLit dashboard. */
|
|
857
|
+
"dashboard",
|
|
858
|
+
/** The unsubscribe link in an email. */
|
|
859
|
+
"unsubscribe_link",
|
|
860
|
+
/** A mailbox provider's one-click unsubscribe (RFC 8058 List-Unsubscribe). */
|
|
861
|
+
"list_unsubscribe",
|
|
862
|
+
/** A suppression: hard bounce, spam complaint, provider or manual. */
|
|
863
|
+
"suppression",
|
|
864
|
+
/** The contact existed before SendLit kept consent records. */
|
|
865
|
+
"pre_tracking"
|
|
866
|
+
];
|
|
867
|
+
var consentActorTypes = ["contact", "member", "api_key", "system"];
|
|
868
|
+
var consentSource = zod.z.string().trim().regex(
|
|
869
|
+
/^[a-z0-9][a-z0-9_.:-]{0,63}$/,
|
|
870
|
+
"Lowercase letters, digits and _ . : - (up to 64 characters)"
|
|
871
|
+
);
|
|
872
|
+
var consentInputSchema = zod.z.object({
|
|
873
|
+
source: consentSource.optional().describe(
|
|
874
|
+
"Your own name for where consent was collected, e.g. `storefront_signup`, `checkout`, `admin_import`. Lowercase letters, digits and _ . : -."
|
|
875
|
+
),
|
|
876
|
+
wording: zod.z.string().trim().min(1).max(2e3).optional().describe("The exact text the person agreed to, e.g. the checkbox label"),
|
|
877
|
+
consentedAt: zod.z.string().datetime({ offset: true }).refine((value) => Date.parse(value) <= Date.now() + 5 * 6e4, {
|
|
878
|
+
message: "Can't be in the future"
|
|
879
|
+
}).optional().describe(
|
|
880
|
+
"When the person gave consent, if earlier than this call (ISO 8601). Kept as a claimed time next to the time SendLit recorded it."
|
|
881
|
+
),
|
|
882
|
+
actor: zod.z.enum(["contact", "app"]).optional().describe(
|
|
883
|
+
"Who made the change: `contact` when the person did it themself (ticked the box, clicked unsubscribe in your app), `app` when your app or its admin did (default)."
|
|
884
|
+
),
|
|
885
|
+
externalActorId: zod.z.string().trim().min(1).max(200).optional().describe("Your own id for whoever made the change, e.g. your admin's user id"),
|
|
886
|
+
ipAddress: zod.z.string().trim().ip().optional().describe("IP address of the person giving consent, if your app saw it"),
|
|
887
|
+
userAgent: zod.z.string().trim().min(1).max(512).optional().describe("Browser user agent of the person giving consent")
|
|
888
|
+
});
|
|
889
|
+
var consentEventSchema = zod.z.object({
|
|
890
|
+
consentEventId: zod.z.string(),
|
|
891
|
+
action: zod.z.enum(consentActions).describe(
|
|
892
|
+
"`opt_in`, `opt_out`, or `suppressed` (mail stopped by a bounce or suppression without the person opting out)"
|
|
893
|
+
),
|
|
894
|
+
channel: zod.z.enum(consentChannels).describe("How the change reached SendLit"),
|
|
895
|
+
source: zod.z.string().nullable().describe(
|
|
896
|
+
"Where consent was collected, as the client app named it, or the suppression reason for `suppression` events"
|
|
897
|
+
),
|
|
898
|
+
wording: zod.z.string().nullable().describe("The exact text the person agreed to"),
|
|
899
|
+
recordedAt: zod.z.string().describe("When SendLit recorded the change"),
|
|
900
|
+
consentedAt: zod.z.string().nullable().describe(
|
|
901
|
+
"When the change happened according to the caller or the imported file, if earlier than recordedAt. A claim, not verified by SendLit."
|
|
902
|
+
),
|
|
903
|
+
actorType: zod.z.enum(consentActorTypes).describe(
|
|
904
|
+
"`contact` (the person themself), `member` (a team member), `api_key` (an app using an API key) or `system`"
|
|
905
|
+
),
|
|
906
|
+
actorUserId: zod.z.string().nullable().describe("The team member, for `member`"),
|
|
907
|
+
apiKeyId: zod.z.string().nullable().describe("The API key the change came through"),
|
|
908
|
+
externalActorId: zod.z.string().nullable().describe("The client app's own id for whoever made the change"),
|
|
909
|
+
ipAddress: zod.z.string().nullable(),
|
|
910
|
+
userAgent: zod.z.string().nullable(),
|
|
911
|
+
formId: zod.z.string().nullable().describe("The signup form, for `form` events"),
|
|
912
|
+
doubleOptIn: zod.z.boolean().nullable().describe("For `form` opt-ins: whether the person confirmed by email"),
|
|
913
|
+
importId: zod.z.string().nullable().describe("The import, for `import` events"),
|
|
914
|
+
importConfirmed: zod.z.boolean().nullable().describe(
|
|
915
|
+
"For `import` opt-ins: the importer confirmed these people agreed to receive marketing email"
|
|
916
|
+
)
|
|
917
|
+
});
|
|
918
|
+
var consentHistorySchema = zod.z.object({
|
|
919
|
+
items: zod.z.array(consentEventSchema).describe("Newest first")
|
|
920
|
+
});
|
|
675
921
|
var customFieldScalarSchema = zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]);
|
|
676
922
|
var customFieldValueSchema = zod.z.union([
|
|
677
923
|
customFieldScalarSchema,
|
|
@@ -735,6 +981,12 @@ var organizationDeliveryPolicySchema = zod.z.object({
|
|
|
735
981
|
aggregateMonthlyLimit: nullableLimit,
|
|
736
982
|
teamEspEnabledByDefault: zod.z.boolean(),
|
|
737
983
|
teamCanChangeDefault: zod.z.boolean(),
|
|
984
|
+
/** Whether teams on a shared ESP must send from their own verified
|
|
985
|
+
* domain: `off` (default), for `marketing` only, or for `all` mail. */
|
|
986
|
+
requireTeamSendingDomain: zod.z.enum(["off", "marketing", "all"]),
|
|
987
|
+
/** Monthly cap on each team's marketing through a shared ESP while it
|
|
988
|
+
* still uses the shared From domain; `null` for none. */
|
|
989
|
+
sharedDomainMonthlyLimit: nullableLimit,
|
|
738
990
|
updatedAt: zod.z.string()
|
|
739
991
|
});
|
|
740
992
|
var updateOrganizationDeliveryPolicyBodySchema = zod.z.object({
|
|
@@ -745,7 +997,9 @@ var updateOrganizationDeliveryPolicyBodySchema = zod.z.object({
|
|
|
745
997
|
aggregateDailyLimit: nullableLimit.optional(),
|
|
746
998
|
aggregateMonthlyLimit: nullableLimit.optional(),
|
|
747
999
|
teamEspEnabledByDefault: zod.z.boolean().optional(),
|
|
748
|
-
teamCanChangeDefault: zod.z.boolean().optional()
|
|
1000
|
+
teamCanChangeDefault: zod.z.boolean().optional(),
|
|
1001
|
+
requireTeamSendingDomain: zod.z.enum(["off", "marketing", "all"]).optional(),
|
|
1002
|
+
sharedDomainMonthlyLimit: nullableLimit.optional()
|
|
749
1003
|
}).refine((value) => Object.keys(value).length > 0, {
|
|
750
1004
|
message: "At least one field is required"
|
|
751
1005
|
});
|
|
@@ -759,6 +1013,15 @@ var espGrantSchema = zod.z.object({
|
|
|
759
1013
|
replyTo: zod.z.string().nullable(),
|
|
760
1014
|
dailyLimit: nullableLimit,
|
|
761
1015
|
monthlyLimit: nullableLimit,
|
|
1016
|
+
/** The team's own From address on this mailbox, when it has one. */
|
|
1017
|
+
fromEmail: zod.z.string().nullable(),
|
|
1018
|
+
/** The team's own sending domain, when it has one (see
|
|
1019
|
+
* `/teams/:teamId/sending-domain`). */
|
|
1020
|
+
sendingDomain: zod.z.object({
|
|
1021
|
+
domain: zod.z.string(),
|
|
1022
|
+
status: zod.z.enum(["pending", "verified", "failing"]),
|
|
1023
|
+
inUse: zod.z.boolean()
|
|
1024
|
+
}).nullable(),
|
|
762
1025
|
createdAt: zod.z.string(),
|
|
763
1026
|
updatedAt: zod.z.string()
|
|
764
1027
|
});
|
|
@@ -824,6 +1087,35 @@ var sendingOptionSchema = zod.z.discriminatedUnion("type", [
|
|
|
824
1087
|
countsAgainstQuota: zod.z.literal(false)
|
|
825
1088
|
})
|
|
826
1089
|
]);
|
|
1090
|
+
var teamSendingDomainRecordSchema = zod.z.object({
|
|
1091
|
+
type: zod.z.enum(["CNAME", "TXT"]),
|
|
1092
|
+
name: zod.z.string(),
|
|
1093
|
+
value: zod.z.string(),
|
|
1094
|
+
purpose: zod.z.enum(["dkim", "dmarc"]),
|
|
1095
|
+
/** Whether the last check found it in place. */
|
|
1096
|
+
present: zod.z.boolean().optional()
|
|
1097
|
+
});
|
|
1098
|
+
var teamSendingDomainSchema = zod.z.object({
|
|
1099
|
+
domain: zod.z.string(),
|
|
1100
|
+
fromEmail: zod.z.string().nullable(),
|
|
1101
|
+
/** `pending` until DKIM and DMARC first pass, `verified` once they have,
|
|
1102
|
+
* `failing` when they stopped passing after that. */
|
|
1103
|
+
status: zod.z.enum(["pending", "verified", "failing"]),
|
|
1104
|
+
dkim: zod.z.enum(["pending", "verified", "failed"]),
|
|
1105
|
+
dmarc: zod.z.enum(["pass", "missing"]),
|
|
1106
|
+
/** Whether the team's mail goes out from this domain right now. */
|
|
1107
|
+
inUse: zod.z.boolean(),
|
|
1108
|
+
records: zod.z.array(teamSendingDomainRecordSchema),
|
|
1109
|
+
verifiedAt: zod.z.string().nullable(),
|
|
1110
|
+
failingSince: zod.z.string().nullable(),
|
|
1111
|
+
/** When the team's marketing pauses if the domain keeps failing. */
|
|
1112
|
+
graceEndsAt: zod.z.string().nullable(),
|
|
1113
|
+
lastCheckedAt: zod.z.string().nullable()
|
|
1114
|
+
});
|
|
1115
|
+
var setTeamSendingDomainBodySchema = zod.z.object({
|
|
1116
|
+
/** The team's From address; its domain is registered with the shared ESP. */
|
|
1117
|
+
fromEmail: zod.z.string().email()
|
|
1118
|
+
});
|
|
827
1119
|
var EVENT_NAME_MAX_LENGTH = 128;
|
|
828
1120
|
var EVENT_PROPERTIES_MAX_BYTES = 32 * 1024;
|
|
829
1121
|
var EVENT_PROPERTIES_MAX_KEYS = 100;
|
|
@@ -1379,13 +1671,19 @@ var createContactBodySchema = zod.z.object({
|
|
|
1379
1671
|
email: zod.z.string().email(),
|
|
1380
1672
|
name: zod.z.string().optional(),
|
|
1381
1673
|
tags: zod.z.array(zod.z.string()).optional(),
|
|
1382
|
-
customFields: customFieldsSchema.optional()
|
|
1674
|
+
customFields: customFieldsSchema.optional(),
|
|
1675
|
+
consent: consentInputSchema.optional().describe(
|
|
1676
|
+
"How the person opted in. Recorded in the contact's consent history when this call creates the contact."
|
|
1677
|
+
)
|
|
1383
1678
|
});
|
|
1384
1679
|
var updateContactBodySchema = zod.z.object({
|
|
1385
1680
|
name: zod.z.string().optional(),
|
|
1386
1681
|
subscribed: zod.z.boolean().optional(),
|
|
1387
1682
|
tags: zod.z.array(zod.z.string()).optional(),
|
|
1388
|
-
customFields: customFieldsSchema.optional()
|
|
1683
|
+
customFields: customFieldsSchema.optional(),
|
|
1684
|
+
consent: consentInputSchema.optional().describe(
|
|
1685
|
+
"How the person opted in or out. Recorded in the consent history when `subscribed` changes, or with `subscribed` set to re-record an unchanged choice (for example a fresh opt-in at checkout)."
|
|
1686
|
+
)
|
|
1389
1687
|
});
|
|
1390
1688
|
var listContactsQuerySchema = zod.z.object({
|
|
1391
1689
|
q: zod.z.string().optional().describe("Search term matched against email or name"),
|
|
@@ -1398,8 +1696,8 @@ var listContactsQuerySchema = zod.z.object({
|
|
|
1398
1696
|
excludeFilter: zod.z.string().optional().describe(
|
|
1399
1697
|
"Serialized ContactFilterWithAggregator JSON; contacts matching it are left out"
|
|
1400
1698
|
),
|
|
1401
|
-
offset: zod.z.coerce.number().int().min(1).optional(),
|
|
1402
|
-
rowsPerPage: zod.z.coerce.number().int().min(1).optional()
|
|
1699
|
+
offset: zod.z.coerce.number().int().min(1).optional().describe("Page number, 1-indexed (default: 1)"),
|
|
1700
|
+
rowsPerPage: zod.z.coerce.number().int().min(1).optional().describe("Contacts per page (default: 10)")
|
|
1403
1701
|
});
|
|
1404
1702
|
zod.z.object({
|
|
1405
1703
|
sequenceId: zod.z.string(),
|
|
@@ -1423,6 +1721,9 @@ var importContactRowSchema = zod.z.object({
|
|
|
1423
1721
|
"The source platform's status, e.g. beehiiv's Active/Paused/Inactive/Pending or Mailchimp's subscribed/unsubscribed/cleaned. Empty means subscribed."
|
|
1424
1722
|
),
|
|
1425
1723
|
createdAt: zod.z.string().optional().describe("Original signup date; kept as the contact's createdAt"),
|
|
1724
|
+
optedInAt: zod.z.string().optional().describe(
|
|
1725
|
+
"When the person opted in on the source platform (e.g. Mailchimp's OPTIN_TIME, a subscribed_at column). Kept in the consent history as a claimed time, marked as imported."
|
|
1726
|
+
),
|
|
1426
1727
|
customFields: customFieldsSchema.optional(),
|
|
1427
1728
|
/** Echoed back in `skipped` so callers can point at the CSV line. */
|
|
1428
1729
|
row: zod.z.number().int().optional()
|
|
@@ -1435,9 +1736,16 @@ var importContactsBodySchema = zod.z.object({
|
|
|
1435
1736
|
),
|
|
1436
1737
|
source: zod.z.string().max(200).optional().describe(
|
|
1437
1738
|
"Where the rows came from, e.g. the CSV file name; kept in the audit log"
|
|
1739
|
+
),
|
|
1740
|
+
consentConfirmed: zod.z.boolean().optional().describe(
|
|
1741
|
+
"Required (true) when any row would be imported subscribed: you confirm that these people agreed to receive marketing email from you. Stored on each imported contact's consent record. Without it the import fails with 400 `consent_confirmation_required`."
|
|
1742
|
+
),
|
|
1743
|
+
consent: consentInputSchema.pick({ source: true, wording: true }).optional().describe(
|
|
1744
|
+
"Where and with what wording the imported people opted in, if known; stored on each imported opt-in"
|
|
1438
1745
|
)
|
|
1439
1746
|
});
|
|
1440
1747
|
var importContactsResultSchema = zod.z.object({
|
|
1748
|
+
importId: zod.z.string().describe("Identifies this import in the imported contacts' consent history"),
|
|
1441
1749
|
created: zod.z.number().int(),
|
|
1442
1750
|
updated: zod.z.number().int(),
|
|
1443
1751
|
unchanged: zod.z.number().int(),
|
|
@@ -1533,6 +1841,9 @@ var espConfigSchema = zod.z.object({
|
|
|
1533
1841
|
secure: zod.z.boolean(),
|
|
1534
1842
|
username: zod.z.string().nullable().optional(),
|
|
1535
1843
|
hasPassword: zod.z.boolean(),
|
|
1844
|
+
/** Organization ESPs: whether a provider API credential is stored, which
|
|
1845
|
+
* lets teams register their own sending domains (SES only for now). */
|
|
1846
|
+
hasManagementCredentials: zod.z.boolean().optional(),
|
|
1536
1847
|
fromName: zod.z.string().nullable().optional(),
|
|
1537
1848
|
fromEmail: zod.z.string().nullable().optional(),
|
|
1538
1849
|
replyTo: zod.z.string().nullable().optional(),
|
|
@@ -1640,6 +1951,12 @@ var domainAuthenticationQuerySchema = zod.z.object({
|
|
|
1640
1951
|
"DKIM selector to check (for Amazon SES, one Easy DKIM token). A selector that passes is saved on the ESP and used by later checks that omit it."
|
|
1641
1952
|
)
|
|
1642
1953
|
});
|
|
1954
|
+
var espManagementCredentialsBodySchema = zod.z.object({
|
|
1955
|
+
accessKeyId: zod.z.string().min(1),
|
|
1956
|
+
secretAccessKey: zod.z.string().min(1),
|
|
1957
|
+
/** Defaults to the region in the SMTP host. */
|
|
1958
|
+
region: zod.z.string().min(1).optional()
|
|
1959
|
+
});
|
|
1643
1960
|
var feedbackConnectionStatus = [
|
|
1644
1961
|
"pending",
|
|
1645
1962
|
"healthy",
|
|
@@ -1714,6 +2031,50 @@ var createSignupFormBodySchema = zod.z.object({
|
|
|
1714
2031
|
redirectUrl: zod.z.string().url().refine((value) => /^https?:\/\//i.test(value), "Must be an http(s) URL").nullable().optional().describe("Where to send people after they submit the hosted or embedded form")
|
|
1715
2032
|
});
|
|
1716
2033
|
var updateSignupFormBodySchema = createSignupFormBodySchema.partial();
|
|
2034
|
+
var SIGNUP_CONFIRMATION_TOKEN_PLACEHOLDER = "{{token}}";
|
|
2035
|
+
var SIGNUP_CONFIRMATION_URL_PLACEHOLDER = "{{confirmUrl}}";
|
|
2036
|
+
var containsConfirmUrl = (value) => value.includes(SIGNUP_CONFIRMATION_URL_PLACEHOLDER);
|
|
2037
|
+
var signupConfirmationOptionsSchema = zod.z.object({
|
|
2038
|
+
url: zod.z.string().url().max(2e3).refine((value) => /^https?:\/\//i.test(value), "Must be an http(s) URL").refine(
|
|
2039
|
+
(value) => value.includes(SIGNUP_CONFIRMATION_TOKEN_PLACEHOLDER),
|
|
2040
|
+
"Must contain {{token}}"
|
|
2041
|
+
).optional().describe(
|
|
2042
|
+
"Where the emailed link points instead of SendLit's confirmation page. `{{token}}` is replaced with the confirmation token; the page there confirms it with POST /forms/{formId}/confirmations."
|
|
2043
|
+
),
|
|
2044
|
+
email: zod.z.object({
|
|
2045
|
+
subject: zod.z.string().trim().min(1).max(200),
|
|
2046
|
+
html: zod.z.string().min(1).max(1e5).refine(containsConfirmUrl, "Must contain {{confirmUrl}}"),
|
|
2047
|
+
text: zod.z.string().min(1).max(5e4).refine(containsConfirmUrl, "Must contain {{confirmUrl}}")
|
|
2048
|
+
}).optional().describe(
|
|
2049
|
+
"The confirmation email to send instead of SendLit's own. `{{confirmUrl}}` is replaced with the confirmation link in both bodies."
|
|
2050
|
+
)
|
|
2051
|
+
});
|
|
2052
|
+
var submitSignupFormBodySchema = zod.z.object({
|
|
2053
|
+
email: zod.z.string().trim().min(1).max(254),
|
|
2054
|
+
name: zod.z.string().trim().max(200).optional(),
|
|
2055
|
+
clientIp: zod.z.string().trim().min(1).max(64).optional().describe(
|
|
2056
|
+
"IP address of the person signing up. Per-IP rate limits apply to it; without it they apply to the calling server."
|
|
2057
|
+
),
|
|
2058
|
+
confirmation: signupConfirmationOptionsSchema.optional().describe("Double opt-in only: your own confirmation link and email"),
|
|
2059
|
+
consent: consentInputSchema.pick({ source: true, wording: true, userAgent: true }).optional().describe(
|
|
2060
|
+
"Recorded in the person's consent history: your name for the signup place, the exact text they agreed to, and their browser user agent. `clientIp` is recorded as their IP address."
|
|
2061
|
+
)
|
|
2062
|
+
});
|
|
2063
|
+
var signupFormSubmissionSchema = zod.z.object({
|
|
2064
|
+
status: zod.z.enum(["confirmation_sent", "subscribed"]).describe(
|
|
2065
|
+
"`confirmation_sent` for double opt-in forms, `subscribed` for single opt-in. The same for every address, accepted or quietly dropped."
|
|
2066
|
+
)
|
|
2067
|
+
});
|
|
2068
|
+
var confirmSignupBodySchema = zod.z.object({
|
|
2069
|
+
token: zod.z.string().trim().min(1).max(200),
|
|
2070
|
+
clientIp: zod.z.string().trim().ip().optional().describe("IP address of the person confirming; kept in their consent history"),
|
|
2071
|
+
userAgent: zod.z.string().trim().min(1).max(512).optional().describe(
|
|
2072
|
+
"Browser user agent of the person confirming; kept in their consent history"
|
|
2073
|
+
)
|
|
2074
|
+
});
|
|
2075
|
+
var signupConfirmationSchema = zod.z.object({
|
|
2076
|
+
status: zod.z.literal("confirmed").describe("The person is subscribed. Confirming again is harmless.")
|
|
2077
|
+
});
|
|
1717
2078
|
var mediaSchema = zod.z.object({
|
|
1718
2079
|
mediaId: zod.z.string(),
|
|
1719
2080
|
url: zod.z.string(),
|
|
@@ -1851,42 +2212,6 @@ var updateSegmentBodySchema = zod.z.object({
|
|
|
1851
2212
|
name: zod.z.string().min(1).optional(),
|
|
1852
2213
|
filter: contactFilterSchema.optional()
|
|
1853
2214
|
});
|
|
1854
|
-
var postalAddressSchema = zod.z.object({
|
|
1855
|
-
line1: zod.z.string().trim().min(1).max(200).describe("Street address"),
|
|
1856
|
-
line2: zod.z.string().trim().max(200).optional().describe("Apartment, suite, building and so on"),
|
|
1857
|
-
city: zod.z.string().trim().max(100).optional(),
|
|
1858
|
-
region: zod.z.string().trim().max(100).optional().describe("State, province or region"),
|
|
1859
|
-
postalCode: zod.z.string().trim().max(20).optional(),
|
|
1860
|
-
country: zod.z.string().regex(/^[A-Z]{2}$/).describe("ISO 3166-1 alpha-2 country code, uppercase (for example `GB`)")
|
|
1861
|
-
});
|
|
1862
|
-
var generalSettingsSchema = zod.z.object({
|
|
1863
|
-
/** The physical postal address shown in marketing email footers; required
|
|
1864
|
-
* for broadcasts and sequences. `null` until it is set. */
|
|
1865
|
-
postalAddress: postalAddressSchema.nullable(),
|
|
1866
|
-
updatedAt: zod.z.string().nullable().optional()
|
|
1867
|
-
});
|
|
1868
|
-
var updateGeneralSettingsBodySchema = zod.z.object({
|
|
1869
|
-
/** Omit to keep the address; `null` clears it. */
|
|
1870
|
-
postalAddress: postalAddressSchema.nullable().optional()
|
|
1871
|
-
});
|
|
1872
|
-
var trackingDomainStatuses = ["pending", "verified", "failed"];
|
|
1873
|
-
var trackingDomainSchema = zod.z.object({
|
|
1874
|
-
domain: zod.z.string().nullable(),
|
|
1875
|
-
/** `pending` until the CNAME and HTTPS work; `failed` after the domain
|
|
1876
|
-
* stopped working, when links fall back to SendLit's own host. */
|
|
1877
|
-
status: zod.z.enum(trackingDomainStatuses).nullable(),
|
|
1878
|
-
/** The host the domain's CNAME record must point to. */
|
|
1879
|
-
cnameTarget: zod.z.string(),
|
|
1880
|
-
/** Why the last check failed: `cname_missing`, `cname_mismatch`,
|
|
1881
|
-
* `unreachable` (no HTTPS answer yet) or `dns_error`. */
|
|
1882
|
-
error: zod.z.string().nullable(),
|
|
1883
|
-
verifiedAt: zod.z.string().nullable(),
|
|
1884
|
-
checkedAt: zod.z.string().nullable()
|
|
1885
|
-
});
|
|
1886
|
-
var updateTrackingDomainBodySchema = zod.z.object({
|
|
1887
|
-
/** A subdomain such as `track.example.com`; `null` removes it. */
|
|
1888
|
-
domain: zod.z.string().max(253).nullable()
|
|
1889
|
-
});
|
|
1890
2215
|
var tagSummarySchema = zod.z.object({
|
|
1891
2216
|
tag: zod.z.string(),
|
|
1892
2217
|
contactCount: zod.z.number().int()
|
|
@@ -1928,108 +2253,6 @@ var deleteTagResultSchema = zod.z.object({
|
|
|
1928
2253
|
contactsUpdated: zod.z.number().int(),
|
|
1929
2254
|
references: tagReferencesSchema
|
|
1930
2255
|
});
|
|
1931
|
-
var teamSchema = zod.z.object({
|
|
1932
|
-
teamId: zod.z.string(),
|
|
1933
|
-
/** Public organization identifier. Present when an end user lists the
|
|
1934
|
-
* teams they belong to, so the dashboard can keep workspace selection
|
|
1935
|
-
* scoped to one organization. */
|
|
1936
|
-
organizationId: zod.z.string().optional(),
|
|
1937
|
-
organizationName: zod.z.string().optional(),
|
|
1938
|
-
name: zod.z.string(),
|
|
1939
|
-
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
1940
|
-
externalId: zod.z.string().nullable().optional(),
|
|
1941
|
-
createdAt: zod.z.string().nullable().optional(),
|
|
1942
|
-
updatedAt: zod.z.string().nullable().optional(),
|
|
1943
|
-
/** True when the calling human is already a `team_members` row. Always
|
|
1944
|
-
* false for organization API keys. Omitted on non-list team payloads. */
|
|
1945
|
-
viewerIsMember: zod.z.boolean().optional()
|
|
1946
|
-
});
|
|
1947
|
-
var apiKeySchema = zod.z.object({
|
|
1948
|
-
keyId: zod.z.string(),
|
|
1949
|
-
keyPrefix: zod.z.string(),
|
|
1950
|
-
name: zod.z.string(),
|
|
1951
|
-
expiresAt: zod.z.string().nullable().optional(),
|
|
1952
|
-
lastUsedAt: zod.z.string().nullable().optional(),
|
|
1953
|
-
revokedAt: zod.z.string().nullable().optional(),
|
|
1954
|
-
createdAt: zod.z.string().nullable().optional()
|
|
1955
|
-
});
|
|
1956
|
-
var createdApiKeySchema = apiKeySchema.extend({
|
|
1957
|
-
key: zod.z.string()
|
|
1958
|
-
});
|
|
1959
|
-
var createTeamBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
1960
|
-
var renameTeamBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
1961
|
-
var createApiKeyBodySchema = zod.z.object({ name: zod.z.string().min(1) });
|
|
1962
|
-
var provisionTeamBodySchema = zod.z.object({
|
|
1963
|
-
externalId: zod.z.string().min(1),
|
|
1964
|
-
name: zod.z.string().min(1),
|
|
1965
|
-
sender: zod.z.object({
|
|
1966
|
-
fromName: zod.z.string().min(1).optional(),
|
|
1967
|
-
replyTo: zod.z.string().email().optional()
|
|
1968
|
-
}).optional(),
|
|
1969
|
-
postalAddress: postalAddressSchema.optional(),
|
|
1970
|
-
delivery: zod.z.object({
|
|
1971
|
-
useOrganizationDefault: zod.z.boolean().optional(),
|
|
1972
|
-
teamEspEnabled: zod.z.boolean().optional(),
|
|
1973
|
-
teamCanChangeDefault: zod.z.boolean().optional()
|
|
1974
|
-
}).optional(),
|
|
1975
|
-
quota: zod.z.object({
|
|
1976
|
-
dailyLimit: zod.z.number().int().positive().nullable().optional(),
|
|
1977
|
-
monthlyLimit: zod.z.number().int().positive().nullable().optional()
|
|
1978
|
-
}).optional()
|
|
1979
|
-
});
|
|
1980
|
-
var provisionedTeamBaseSchema = zod.z.object({
|
|
1981
|
-
teamId: zod.z.string(),
|
|
1982
|
-
externalId: zod.z.string(),
|
|
1983
|
-
name: zod.z.string(),
|
|
1984
|
-
deliverySource: zod.z.object({ type: zod.z.literal("organization") })
|
|
1985
|
-
});
|
|
1986
|
-
var provisionTeamResponseSchema = zod.z.discriminatedUnion("created", [
|
|
1987
|
-
provisionedTeamBaseSchema.extend({
|
|
1988
|
-
created: zod.z.literal(true),
|
|
1989
|
-
apiKey: zod.z.string()
|
|
1990
|
-
}),
|
|
1991
|
-
provisionedTeamBaseSchema.extend({
|
|
1992
|
-
created: zod.z.literal(false),
|
|
1993
|
-
apiKey: zod.z.null()
|
|
1994
|
-
})
|
|
1995
|
-
]);
|
|
1996
|
-
var provisionedTeamSchema = provisionedTeamBaseSchema.extend({
|
|
1997
|
-
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
1998
|
-
postalAddress: postalAddressSchema.nullable(),
|
|
1999
|
-
teamEspEnabled: zod.z.boolean(),
|
|
2000
|
-
teamCanChangeDefault: zod.z.boolean(),
|
|
2001
|
-
createdAt: zod.z.string().nullable(),
|
|
2002
|
-
updatedAt: zod.z.string().nullable()
|
|
2003
|
-
});
|
|
2004
|
-
var updateProvisionedTeamBodySchema = zod.z.object({
|
|
2005
|
-
name: zod.z.string().min(1).optional(),
|
|
2006
|
-
sender: zod.z.object({
|
|
2007
|
-
fromName: zod.z.string().min(1).nullable().optional(),
|
|
2008
|
-
replyTo: zod.z.string().email().nullable().optional()
|
|
2009
|
-
}).optional(),
|
|
2010
|
-
postalAddress: postalAddressSchema.nullable().optional(),
|
|
2011
|
-
delivery: zod.z.object({
|
|
2012
|
-
teamEspEnabled: zod.z.boolean().optional(),
|
|
2013
|
-
teamCanChangeDefault: zod.z.boolean().optional()
|
|
2014
|
-
}).optional(),
|
|
2015
|
-
quota: zod.z.object({
|
|
2016
|
-
dailyLimit: zod.z.number().int().nonnegative().nullable().optional(),
|
|
2017
|
-
monthlyLimit: zod.z.number().int().nonnegative().nullable().optional()
|
|
2018
|
-
}).optional()
|
|
2019
|
-
}).refine((body) => Object.keys(body).length > 0, {
|
|
2020
|
-
message: "At least one field is required"
|
|
2021
|
-
});
|
|
2022
|
-
var usageWindowSchema = zod.z.object({
|
|
2023
|
-
limit: zod.z.number().int().nullable(),
|
|
2024
|
-
accepted: zod.z.number().int().nonnegative(),
|
|
2025
|
-
reserved: zod.z.number().int().nonnegative(),
|
|
2026
|
-
remaining: zod.z.number().int().nullable(),
|
|
2027
|
-
resetsAt: zod.z.string()
|
|
2028
|
-
});
|
|
2029
|
-
var provisionedTeamUsageSchema = zod.z.object({
|
|
2030
|
-
day: usageWindowSchema,
|
|
2031
|
-
month: usageWindowSchema
|
|
2032
|
-
});
|
|
2033
2256
|
var templatePurposes = ["marketing", "transactional"];
|
|
2034
2257
|
var templatePurposeSchema = zod.z.enum(templatePurposes).describe(
|
|
2035
2258
|
"Immutable sending purpose. Marketing templates require a final managed footer; transactional templates are footer-free and are valid for POST /emails."
|
|
@@ -2286,7 +2509,7 @@ var contactsContract = c.router(
|
|
|
2286
2509
|
400: errorSchema
|
|
2287
2510
|
},
|
|
2288
2511
|
summary: "Import contacts",
|
|
2289
|
-
description: "Creates or updates up to 1000 contacts per request, matched by email. A status can only get stricter (subscribed < unsubscribed < bounced < complained): an import never re-subscribes an unsubscribed or suppressed contact, and bounced or complained rows are imported unsubscribed and added to the suppression list. Paused contacts stay subscribed with the `paused` tag. Tags and custom fields are merged into existing contacts, and an earlier createdAt replaces a later one. Imports don't trigger sequences. Subscribed contacts over the plan's limit are skipped with `plan_limit_reached`."
|
|
2512
|
+
description: "Creates or updates up to 1000 contacts per request, matched by email. A status can only get stricter (subscribed < unsubscribed < bounced < complained): an import never re-subscribes an unsubscribed or suppressed contact, and bounced or complained rows are imported unsubscribed and added to the suppression list. Paused contacts stay subscribed with the `paused` tag. Tags and custom fields are merged into existing contacts, and an earlier createdAt replaces a later one. Imports don't trigger sequences. Subscribed contacts over the plan's limit are skipped with `plan_limit_reached`. When any row would be imported subscribed, `consentConfirmed: true` is required (400 `consent_confirmation_required` otherwise): you confirm these people agreed to receive marketing email from you. Each imported contact gets a consent event with the returned `importId`, the confirmation, who imported, and the row's `optedInAt` as a claimed time."
|
|
2290
2513
|
},
|
|
2291
2514
|
export: {
|
|
2292
2515
|
method: "GET",
|
|
@@ -2298,7 +2521,7 @@ var contactsContract = c.router(
|
|
|
2298
2521
|
404: errorSchema
|
|
2299
2522
|
},
|
|
2300
2523
|
summary: "Export contacts as CSV",
|
|
2301
|
-
description: "Returns every contact, or those matching segmentId and/or filter, as CSV: email, name, status (subscribed, unsubscribed, bounced or complained), tags, created_at, suppression_reason, then one column per custom field."
|
|
2524
|
+
description: "Returns every contact, or those matching segmentId and/or filter, as CSV: email, name, status (subscribed, unsubscribed, bounced or complained), tags, created_at, suppression_reason, the latest opt-in's opted_in_at, consent_channel, consent_source and consent_wording, then one column per custom field."
|
|
2302
2525
|
},
|
|
2303
2526
|
previewBulkDelete: {
|
|
2304
2527
|
method: "POST",
|
|
@@ -2382,11 +2605,19 @@ var contactsContract = c.router(
|
|
|
2382
2605
|
summary: "List the custom events received for a contact",
|
|
2383
2606
|
description: "Newest first by occurredAt. `enrolledSequences` lists the sequences each event started."
|
|
2384
2607
|
},
|
|
2608
|
+
consent: {
|
|
2609
|
+
method: "GET",
|
|
2610
|
+
path: "/contacts/:contactId/consent",
|
|
2611
|
+
responses: { 200: consentHistorySchema, 404: errorSchema },
|
|
2612
|
+
summary: "List a contact's consent history",
|
|
2613
|
+
description: "Every opt-in, opt-out and suppression recorded for the contact, newest first: how it reached SendLit (`channel`), where it was collected (`source`), the wording the person agreed to, who made it, and for forms and imports the IP address, user agent, double opt-in and import confirmation. Contacts that existed before consent records start with one `pre_tracking` event holding their state at that time. The history is deleted with the contact."
|
|
2614
|
+
},
|
|
2385
2615
|
remove: {
|
|
2386
2616
|
method: "DELETE",
|
|
2387
2617
|
path: "/contacts/:contactId",
|
|
2388
2618
|
responses: { 204: c.noBody() },
|
|
2389
|
-
summary: "Delete a contact"
|
|
2619
|
+
summary: "Delete a contact",
|
|
2620
|
+
description: "Deletes the contact with its consent history, custom field values, events and delivery records."
|
|
2390
2621
|
}
|
|
2391
2622
|
},
|
|
2392
2623
|
{ metadata: { tag: "Contacts" } }
|
|
@@ -3321,7 +3552,8 @@ var provisioningContract = c.router(
|
|
|
3321
3552
|
403: errorSchema,
|
|
3322
3553
|
404: errorSchema
|
|
3323
3554
|
},
|
|
3324
|
-
summary: "Get a provisioned team within the authenticated organization"
|
|
3555
|
+
summary: "Get a provisioned team within the authenticated organization",
|
|
3556
|
+
description: "`health` is the team's sending status: `normal`, `warned`, `marketing_paused` or `all_paused`, with the `reason` code and whether it comes from the team's own reputation or the shared mailbox (`scope`). `last7Days` counts the emails the ESP accepted in the last 7 days and how many bounced or were marked as spam."
|
|
3325
3557
|
},
|
|
3326
3558
|
updateTeam: {
|
|
3327
3559
|
method: "PATCH",
|
|
@@ -3378,6 +3610,39 @@ var provisioningContract = c.router(
|
|
|
3378
3610
|
responses: { 204: c.noBody(), 403: errorSchema, 404: errorSchema },
|
|
3379
3611
|
summary: "Archive a provisioned team"
|
|
3380
3612
|
},
|
|
3613
|
+
getTeamSendingDomain: {
|
|
3614
|
+
method: "GET",
|
|
3615
|
+
path: "/provisioning/teams/:teamId/sending-domain",
|
|
3616
|
+
responses: {
|
|
3617
|
+
200: teamSendingDomainSchema.nullable(),
|
|
3618
|
+
403: errorSchema,
|
|
3619
|
+
404: errorSchema,
|
|
3620
|
+
422: errorSchema
|
|
3621
|
+
},
|
|
3622
|
+
summary: "Check a provisioned team's own sending domain",
|
|
3623
|
+
description: "Re-checks the domain with the shared ESP and DNS, at most every 30 seconds (calls in between return the last check). Requires `teams:read`. `null` when the team has none."
|
|
3624
|
+
},
|
|
3625
|
+
setTeamSendingDomain: {
|
|
3626
|
+
method: "PUT",
|
|
3627
|
+
path: "/provisioning/teams/:teamId/sending-domain",
|
|
3628
|
+
body: setTeamSendingDomainBodySchema,
|
|
3629
|
+
responses: {
|
|
3630
|
+
200: teamSendingDomainSchema,
|
|
3631
|
+
400: errorSchema,
|
|
3632
|
+
403: errorSchema,
|
|
3633
|
+
404: errorSchema,
|
|
3634
|
+
409: errorSchema,
|
|
3635
|
+
422: errorSchema
|
|
3636
|
+
},
|
|
3637
|
+
summary: "Set a provisioned team's own From address and register its domain",
|
|
3638
|
+
description: "Requires `teams:manage`. Returns the DNS records the team must publish (Amazon SES Easy DKIM CNAMEs and a DMARC TXT record). Errors as for the organization route."
|
|
3639
|
+
},
|
|
3640
|
+
removeTeamSendingDomain: {
|
|
3641
|
+
method: "DELETE",
|
|
3642
|
+
path: "/provisioning/teams/:teamId/sending-domain",
|
|
3643
|
+
responses: { 204: c.noBody(), 403: errorSchema, 404: errorSchema },
|
|
3644
|
+
summary: "Stop using a provisioned team's own sending domain"
|
|
3645
|
+
},
|
|
3381
3646
|
getTeamUsage: {
|
|
3382
3647
|
method: "GET",
|
|
3383
3648
|
path: "/provisioning/teams/:teamId/usage",
|
|
@@ -3386,7 +3651,8 @@ var provisioningContract = c.router(
|
|
|
3386
3651
|
403: errorSchema,
|
|
3387
3652
|
404: errorSchema
|
|
3388
3653
|
},
|
|
3389
|
-
summary: "Get organization-delivery quota usage for a provisioned team"
|
|
3654
|
+
summary: "Get organization-delivery quota usage for a provisioned team",
|
|
3655
|
+
description: "Returns the team's day and month quota on the shared mailbox, plus its `health` (see Get a provisioned team)."
|
|
3390
3656
|
}
|
|
3391
3657
|
},
|
|
3392
3658
|
{ metadata: { tag: "Teams" } }
|
|
@@ -3700,6 +3966,31 @@ var organizationsContract = c.router(
|
|
|
3700
3966
|
summary: "Delete an eligible never-activated organization ESP",
|
|
3701
3967
|
description: "Only a never-activated draft with no history is deleted. 409 explains a blocked delete: `esp_retire_instead` (it has been activated; retire it instead), `esp_has_delivery_history`, or `delivery_source_in_use`."
|
|
3702
3968
|
},
|
|
3969
|
+
setEspManagementCredentials: {
|
|
3970
|
+
method: "PUT",
|
|
3971
|
+
path: "/organizations/:organizationId/esps/:espId/management-credentials",
|
|
3972
|
+
body: espManagementCredentialsBodySchema,
|
|
3973
|
+
responses: {
|
|
3974
|
+
200: espConfigSchema,
|
|
3975
|
+
403: errorSchema,
|
|
3976
|
+
404: errorSchema,
|
|
3977
|
+
422: errorSchema
|
|
3978
|
+
},
|
|
3979
|
+
summary: "Store a shared ESP's provider API credential",
|
|
3980
|
+
description: "Lets teams register their own sending domains on this mailbox. Amazon SES only for now (422 `provider_domain_unsupported` otherwise). The credential is encrypted at rest and never returned; the ESP shows `hasManagementCredentials`."
|
|
3981
|
+
},
|
|
3982
|
+
removeEspManagementCredentials: {
|
|
3983
|
+
method: "DELETE",
|
|
3984
|
+
path: "/organizations/:organizationId/esps/:espId/management-credentials",
|
|
3985
|
+
responses: {
|
|
3986
|
+
200: espConfigSchema,
|
|
3987
|
+
403: errorSchema,
|
|
3988
|
+
404: errorSchema,
|
|
3989
|
+
409: errorSchema
|
|
3990
|
+
},
|
|
3991
|
+
summary: "Remove a shared ESP's provider API credential",
|
|
3992
|
+
description: "409 `esp_management_credentials_in_use` while teams' own sending domains are registered through the mailbox: remove those first."
|
|
3993
|
+
},
|
|
3703
3994
|
getEspFeedback: {
|
|
3704
3995
|
method: "GET",
|
|
3705
3996
|
path: "/organizations/:organizationId/esps/:espId/feedback",
|
|
@@ -3799,8 +4090,8 @@ var organizationsContract = c.router(
|
|
|
3799
4090
|
403: errorSchema,
|
|
3800
4091
|
404: errorSchema
|
|
3801
4092
|
},
|
|
3802
|
-
summary: "Get organization
|
|
3803
|
-
description: "Returns per-team and organization-total
|
|
4093
|
+
summary: "Get organization mail activity and team health",
|
|
4094
|
+
description: "Returns per-team and organization-total mail counts (`sent`, `queued`, `failed`, `bounced`, `complained`) from the outbound ledger, covering broadcasts, sequences and transactional email, for a window of 1, 3, 7, or 30 days (default 7). Includes teams with zero activity. Each team also carries its `health` (sending status with reason and scope, plus 7-day sent, bounced and complained counts, whatever the window) and its shared-mailbox `quota` (null without an active grant). No recipients, subjects, or email bodies."
|
|
3804
4095
|
},
|
|
3805
4096
|
enterTeam: {
|
|
3806
4097
|
method: "POST",
|
|
@@ -3860,6 +4151,40 @@ var organizationsContract = c.router(
|
|
|
3860
4151
|
},
|
|
3861
4152
|
summary: "Transition a team's organization ESP grant; revoking detaches safe campaigns"
|
|
3862
4153
|
},
|
|
4154
|
+
getTeamSendingDomain: {
|
|
4155
|
+
method: "GET",
|
|
4156
|
+
path: "/organizations/:organizationId/teams/:teamId/sending-domain",
|
|
4157
|
+
responses: {
|
|
4158
|
+
200: teamSendingDomainSchema.nullable(),
|
|
4159
|
+
403: errorSchema,
|
|
4160
|
+
404: errorSchema,
|
|
4161
|
+
422: errorSchema
|
|
4162
|
+
},
|
|
4163
|
+
summary: "Check a team's own sending domain",
|
|
4164
|
+
description: "Re-checks the domain with the shared ESP and DNS (at most every 30 seconds; calls in between return the last check) and returns its status and the DNS records to publish. `null` when the team has none. The team sends from it once the ESP has verified DKIM and a DMARC record is published."
|
|
4165
|
+
},
|
|
4166
|
+
setTeamSendingDomain: {
|
|
4167
|
+
method: "PUT",
|
|
4168
|
+
path: "/organizations/:organizationId/teams/:teamId/sending-domain",
|
|
4169
|
+
body: setTeamSendingDomainBodySchema,
|
|
4170
|
+
responses: {
|
|
4171
|
+
200: teamSendingDomainSchema,
|
|
4172
|
+
400: errorSchema,
|
|
4173
|
+
403: errorSchema,
|
|
4174
|
+
404: errorSchema,
|
|
4175
|
+
409: errorSchema,
|
|
4176
|
+
422: errorSchema
|
|
4177
|
+
},
|
|
4178
|
+
summary: "Set a team's own From address and register its domain",
|
|
4179
|
+
description: "Registers the From address's domain with the team's shared ESP (Amazon SES for now) and returns the DNS records to publish. Replacing a different domain removes the old one. 422 `esp_management_credentials_required` when the shared ESP has no API credential, `provider_domain_unsupported` for other providers, `organization_delivery_disabled` without an active grant. 409 `domain_in_use` when another team, the organization or the shared mailbox's own From address uses the domain, and `domain_exists_at_provider` when the ESP account already has the domain (SendLit never takes over an identity it did not create). 422 `esp_provider_error` when the provider's API refuses or fails."
|
|
4180
|
+
},
|
|
4181
|
+
removeTeamSendingDomain: {
|
|
4182
|
+
method: "DELETE",
|
|
4183
|
+
path: "/organizations/:organizationId/teams/:teamId/sending-domain",
|
|
4184
|
+
responses: { 204: c.noBody(), 403: errorSchema, 404: errorSchema },
|
|
4185
|
+
summary: "Stop using a team's own sending domain",
|
|
4186
|
+
description: "Removes the domain from the shared ESP. The team goes back to the shared From domain, which the organization's `requireTeamSendingDomain` policy may refuse."
|
|
4187
|
+
},
|
|
3863
4188
|
listSendingDomains: {
|
|
3864
4189
|
method: "GET",
|
|
3865
4190
|
path: "/organizations/:organizationId/sending-domains",
|
|
@@ -4070,6 +4395,34 @@ var formsContract = c.router(
|
|
|
4070
4395
|
path: "/forms/:formId",
|
|
4071
4396
|
responses: { 204: c.noBody(), 404: errorSchema },
|
|
4072
4397
|
summary: "Delete a signup form"
|
|
4398
|
+
},
|
|
4399
|
+
submit: {
|
|
4400
|
+
method: "POST",
|
|
4401
|
+
path: "/forms/:formId/submissions",
|
|
4402
|
+
body: submitSignupFormBodySchema,
|
|
4403
|
+
responses: {
|
|
4404
|
+
200: signupFormSubmissionSchema,
|
|
4405
|
+
400: errorSchema,
|
|
4406
|
+
404: errorSchema,
|
|
4407
|
+
429: errorSchema,
|
|
4408
|
+
503: signupFormSenderErrorSchema.extend({
|
|
4409
|
+
error: zod.z.literal("form_unavailable")
|
|
4410
|
+
})
|
|
4411
|
+
},
|
|
4412
|
+
summary: "Submit a signup to a form",
|
|
4413
|
+
description: "Signs someone up through the form from your own server, for a signup page you host yourself. It works like a submission to the form's public URL: double opt-in forms email the confirmation link and subscribe only once it's clicked, single opt-in never resubscribes someone who unsubscribed, and suppressed or disposable addresses are dropped quietly. A double opt-in form doesn't email someone who is already subscribed. Pass `clientIp` so the per-IP rate limit applies to the person, not your server. For double opt-in, `confirmation` replaces the email and points its link at your own page (for example to match your site's language); that page confirms the token with POST /forms/{formId}/confirmations. Fails with 400 `invalid_email`, 429 `too_many_requests`, or 503 `form_unavailable` when the team can't send the confirmation email."
|
|
4414
|
+
},
|
|
4415
|
+
confirm: {
|
|
4416
|
+
method: "POST",
|
|
4417
|
+
path: "/forms/:formId/confirmations",
|
|
4418
|
+
body: confirmSignupBodySchema,
|
|
4419
|
+
responses: {
|
|
4420
|
+
200: signupConfirmationSchema,
|
|
4421
|
+
400: errorSchema,
|
|
4422
|
+
404: errorSchema
|
|
4423
|
+
},
|
|
4424
|
+
summary: "Confirm a double opt-in signup",
|
|
4425
|
+
description: "Confirms a signup from the token in its confirmation link, for a confirmation page you host yourself (see `confirmation.url` on submit). Subscribes the person with the form's tags; confirming again is harmless. Only call it when the person presses a button on your page: link scanners open emailed links too. Fails with 400 `invalid_token` when the token is unknown, expired, or belongs to another form."
|
|
4073
4426
|
}
|
|
4074
4427
|
},
|
|
4075
4428
|
{ metadata: { tag: "Contacts" } }
|
|
@@ -4407,6 +4760,22 @@ var Contacts = class {
|
|
|
4407
4760
|
params: { contactId: assertId(contactId, "contactId") }
|
|
4408
4761
|
});
|
|
4409
4762
|
}
|
|
4763
|
+
/** The contact's consent history, newest first: every opt-in, opt-out
|
|
4764
|
+
* and suppression with its channel, source, wording, actor, and for forms
|
|
4765
|
+
* and imports the IP address, user agent, double opt-in and import
|
|
4766
|
+
* confirmation. Keep it as proof of consent. */
|
|
4767
|
+
async consent(contactId) {
|
|
4768
|
+
const { items } = await this.http.request(routes.consent, {
|
|
4769
|
+
params: { contactId: assertId(contactId, "contactId") }
|
|
4770
|
+
});
|
|
4771
|
+
return items;
|
|
4772
|
+
}
|
|
4773
|
+
/** Imports up to 1000 contacts, matched by email. Importing anyone as
|
|
4774
|
+
* subscribed requires `consentConfirmed: true`: you confirm they agreed
|
|
4775
|
+
* to receive marketing email from you. */
|
|
4776
|
+
async import(input) {
|
|
4777
|
+
return this.http.request(routes.import, { body: input });
|
|
4778
|
+
}
|
|
4410
4779
|
/** Custom events received for this contact, newest first, with the
|
|
4411
4780
|
* sequences each one started. */
|
|
4412
4781
|
async events(contactId, query = {}) {
|
|
@@ -4525,19 +4894,73 @@ var Events = class {
|
|
|
4525
4894
|
}
|
|
4526
4895
|
};
|
|
4527
4896
|
|
|
4897
|
+
// src/resources/forms.ts
|
|
4898
|
+
var routes5 = contract.forms;
|
|
4899
|
+
var Forms = class {
|
|
4900
|
+
constructor(http) {
|
|
4901
|
+
this.http = http;
|
|
4902
|
+
}
|
|
4903
|
+
async list() {
|
|
4904
|
+
return this.http.request(routes5.list);
|
|
4905
|
+
}
|
|
4906
|
+
/** Double opt-in (the default) needs a sending mailbox: without one this
|
|
4907
|
+
* fails with 422 `confirmation_sender_unavailable`. */
|
|
4908
|
+
async create(input) {
|
|
4909
|
+
return this.http.request(routes5.create, { body: input });
|
|
4910
|
+
}
|
|
4911
|
+
async get(formId) {
|
|
4912
|
+
return this.http.request(routes5.get, {
|
|
4913
|
+
params: { formId: assertId(formId, "formId") }
|
|
4914
|
+
});
|
|
4915
|
+
}
|
|
4916
|
+
async update(formId, input) {
|
|
4917
|
+
return this.http.request(routes5.update, {
|
|
4918
|
+
params: { formId: assertId(formId, "formId") },
|
|
4919
|
+
body: input
|
|
4920
|
+
});
|
|
4921
|
+
}
|
|
4922
|
+
async remove(formId) {
|
|
4923
|
+
await this.http.request(routes5.remove, {
|
|
4924
|
+
params: { formId: assertId(formId, "formId") }
|
|
4925
|
+
});
|
|
4926
|
+
}
|
|
4927
|
+
/**
|
|
4928
|
+
* Signs someone up through the form from your server. A double opt-in
|
|
4929
|
+
* form emails them a confirmation link; pass `clientIp` so the per-IP
|
|
4930
|
+
* rate limit applies to them rather than to your server.
|
|
4931
|
+
*/
|
|
4932
|
+
async submit(formId, input) {
|
|
4933
|
+
return this.http.request(routes5.submit, {
|
|
4934
|
+
params: { formId: assertId(formId, "formId") },
|
|
4935
|
+
body: input
|
|
4936
|
+
});
|
|
4937
|
+
}
|
|
4938
|
+
/**
|
|
4939
|
+
* Confirms a double opt-in signup from the token in its link, for a
|
|
4940
|
+
* confirmation page you host (`confirmation.url` on `submit`). Call it only
|
|
4941
|
+
* when the person presses a button there: link scanners open links too.
|
|
4942
|
+
*/
|
|
4943
|
+
async confirm(formId, token) {
|
|
4944
|
+
return this.http.request(routes5.confirm, {
|
|
4945
|
+
params: { formId: assertId(formId, "formId") },
|
|
4946
|
+
body: { token }
|
|
4947
|
+
});
|
|
4948
|
+
}
|
|
4949
|
+
};
|
|
4950
|
+
|
|
4528
4951
|
// src/resources/overview.ts
|
|
4529
|
-
var
|
|
4952
|
+
var routes6 = contract.overview;
|
|
4530
4953
|
var OverviewResource = class {
|
|
4531
4954
|
constructor(http) {
|
|
4532
4955
|
this.http = http;
|
|
4533
4956
|
}
|
|
4534
4957
|
async get(query = {}) {
|
|
4535
|
-
return this.http.request(
|
|
4958
|
+
return this.http.request(routes6.get, { query });
|
|
4536
4959
|
}
|
|
4537
4960
|
};
|
|
4538
4961
|
|
|
4539
4962
|
// src/resources/provisioning.ts
|
|
4540
|
-
var
|
|
4963
|
+
var routes7 = contract.provisioning;
|
|
4541
4964
|
var Provisioning = class {
|
|
4542
4965
|
constructor(http) {
|
|
4543
4966
|
this.http = http;
|
|
@@ -4548,20 +4971,20 @@ var Provisioning = class {
|
|
|
4548
4971
|
* `created: false, apiKey: null`, so it's safe to retry.
|
|
4549
4972
|
*/
|
|
4550
4973
|
async provisionTeam(input) {
|
|
4551
|
-
return this.http.request(
|
|
4974
|
+
return this.http.request(routes7.provisionTeam, {
|
|
4552
4975
|
body: input,
|
|
4553
4976
|
retrySafe: true
|
|
4554
4977
|
});
|
|
4555
4978
|
}
|
|
4556
4979
|
/** `teams:read` */
|
|
4557
4980
|
async getTeam(teamId) {
|
|
4558
|
-
return this.http.request(
|
|
4981
|
+
return this.http.request(routes7.getTeam, {
|
|
4559
4982
|
params: { teamId: assertId(teamId, "teamId") }
|
|
4560
4983
|
});
|
|
4561
4984
|
}
|
|
4562
4985
|
/** `teams:manage` */
|
|
4563
4986
|
async updateTeam(teamId, input) {
|
|
4564
|
-
return this.http.request(
|
|
4987
|
+
return this.http.request(routes7.updateTeam, {
|
|
4565
4988
|
params: { teamId: assertId(teamId, "teamId") },
|
|
4566
4989
|
body: input
|
|
4567
4990
|
});
|
|
@@ -4569,106 +4992,106 @@ var Provisioning = class {
|
|
|
4569
4992
|
/** Replaces the team's integration key (`teams:keys`); keys previously
|
|
4570
4993
|
* issued through provisioning are revoked. */
|
|
4571
4994
|
async createTeamKey(teamId, input) {
|
|
4572
|
-
return this.http.request(
|
|
4995
|
+
return this.http.request(routes7.createTeamKey, {
|
|
4573
4996
|
params: { teamId: assertId(teamId, "teamId") },
|
|
4574
4997
|
body: input
|
|
4575
4998
|
});
|
|
4576
4999
|
}
|
|
4577
5000
|
/** `teams:manage` */
|
|
4578
5001
|
async suspendTeam(teamId) {
|
|
4579
|
-
return this.http.request(
|
|
5002
|
+
return this.http.request(routes7.suspendTeam, {
|
|
4580
5003
|
params: { teamId: assertId(teamId, "teamId") }
|
|
4581
5004
|
});
|
|
4582
5005
|
}
|
|
4583
5006
|
/** `teams:manage` */
|
|
4584
5007
|
async resumeTeam(teamId) {
|
|
4585
|
-
return this.http.request(
|
|
5008
|
+
return this.http.request(routes7.resumeTeam, {
|
|
4586
5009
|
params: { teamId: assertId(teamId, "teamId") }
|
|
4587
5010
|
});
|
|
4588
5011
|
}
|
|
4589
5012
|
/** Soft-deprovisions the team (`teams:manage`). There is no unarchive. */
|
|
4590
5013
|
async archiveTeam(teamId) {
|
|
4591
|
-
await this.http.request(
|
|
5014
|
+
await this.http.request(routes7.archiveTeam, {
|
|
4592
5015
|
params: { teamId: assertId(teamId, "teamId") }
|
|
4593
5016
|
});
|
|
4594
5017
|
}
|
|
4595
5018
|
/** `usage:read` */
|
|
4596
5019
|
async getTeamUsage(teamId) {
|
|
4597
|
-
return this.http.request(
|
|
5020
|
+
return this.http.request(routes7.getTeamUsage, {
|
|
4598
5021
|
params: { teamId: assertId(teamId, "teamId") }
|
|
4599
5022
|
});
|
|
4600
5023
|
}
|
|
4601
5024
|
};
|
|
4602
5025
|
|
|
4603
5026
|
// src/resources/segments.ts
|
|
4604
|
-
var
|
|
5027
|
+
var routes8 = contract.segments;
|
|
4605
5028
|
var Segments = class {
|
|
4606
5029
|
constructor(http) {
|
|
4607
5030
|
this.http = http;
|
|
4608
5031
|
}
|
|
4609
5032
|
async create(input) {
|
|
4610
|
-
return this.http.request(
|
|
5033
|
+
return this.http.request(routes8.create, { body: input });
|
|
4611
5034
|
}
|
|
4612
5035
|
async list() {
|
|
4613
|
-
return this.http.request(
|
|
5036
|
+
return this.http.request(routes8.list);
|
|
4614
5037
|
}
|
|
4615
5038
|
async get(segmentId) {
|
|
4616
|
-
return this.http.request(
|
|
5039
|
+
return this.http.request(routes8.get, {
|
|
4617
5040
|
params: { segmentId: assertId(segmentId, "segmentId") }
|
|
4618
5041
|
});
|
|
4619
5042
|
}
|
|
4620
5043
|
async update(segmentId, input) {
|
|
4621
|
-
return this.http.request(
|
|
5044
|
+
return this.http.request(routes8.update, {
|
|
4622
5045
|
params: { segmentId: assertId(segmentId, "segmentId") },
|
|
4623
5046
|
body: input
|
|
4624
5047
|
});
|
|
4625
5048
|
}
|
|
4626
5049
|
async remove(segmentId) {
|
|
4627
|
-
await this.http.request(
|
|
5050
|
+
await this.http.request(routes8.remove, {
|
|
4628
5051
|
params: { segmentId: assertId(segmentId, "segmentId") }
|
|
4629
5052
|
});
|
|
4630
5053
|
}
|
|
4631
5054
|
};
|
|
4632
5055
|
|
|
4633
5056
|
// src/resources/sequences.ts
|
|
4634
|
-
var
|
|
5057
|
+
var routes9 = contract.sequences;
|
|
4635
5058
|
var Sequences = class {
|
|
4636
5059
|
constructor(http) {
|
|
4637
5060
|
this.http = http;
|
|
4638
5061
|
}
|
|
4639
5062
|
async create(input) {
|
|
4640
|
-
return this.http.request(
|
|
5063
|
+
return this.http.request(routes9.create, { body: input });
|
|
4641
5064
|
}
|
|
4642
5065
|
async list(query) {
|
|
4643
|
-
return this.http.request(
|
|
5066
|
+
return this.http.request(routes9.list, { query });
|
|
4644
5067
|
}
|
|
4645
5068
|
listAll(query) {
|
|
4646
5069
|
return paginate((offset) => this.list({ ...query, offset }));
|
|
4647
5070
|
}
|
|
4648
5071
|
async get(sequenceId) {
|
|
4649
|
-
return this.http.request(
|
|
5072
|
+
return this.http.request(routes9.get, {
|
|
4650
5073
|
params: { sequenceId: assertId(sequenceId, "sequenceId") }
|
|
4651
5074
|
});
|
|
4652
5075
|
}
|
|
4653
5076
|
async update(sequenceId, input) {
|
|
4654
|
-
return this.http.request(
|
|
5077
|
+
return this.http.request(routes9.update, {
|
|
4655
5078
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4656
5079
|
body: input
|
|
4657
5080
|
});
|
|
4658
5081
|
}
|
|
4659
5082
|
async remove(sequenceId) {
|
|
4660
|
-
await this.http.request(
|
|
5083
|
+
await this.http.request(routes9.remove, {
|
|
4661
5084
|
params: { sequenceId: assertId(sequenceId, "sequenceId") }
|
|
4662
5085
|
});
|
|
4663
5086
|
}
|
|
4664
5087
|
async addEmail(sequenceId, input) {
|
|
4665
|
-
return this.http.request(
|
|
5088
|
+
return this.http.request(routes9.addEmail, {
|
|
4666
5089
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4667
5090
|
body: input
|
|
4668
5091
|
});
|
|
4669
5092
|
}
|
|
4670
5093
|
async updateEmail(sequenceId, emailId, input) {
|
|
4671
|
-
return this.http.request(
|
|
5094
|
+
return this.http.request(routes9.updateEmail, {
|
|
4672
5095
|
params: {
|
|
4673
5096
|
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4674
5097
|
emailId: assertId(emailId, "emailId")
|
|
@@ -4680,21 +5103,21 @@ var Sequences = class {
|
|
|
4680
5103
|
* sequence, so sends use them. While it's active, `updateEmail` saves
|
|
4681
5104
|
* subject and content changes as a draft. */
|
|
4682
5105
|
async publishChanges(sequenceId, input = {}) {
|
|
4683
|
-
return this.http.request(
|
|
5106
|
+
return this.http.request(routes9.publishChanges, {
|
|
4684
5107
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4685
5108
|
body: input
|
|
4686
5109
|
});
|
|
4687
5110
|
}
|
|
4688
5111
|
/** Throws away unpublished email changes. Sends are not affected. */
|
|
4689
5112
|
async discardChanges(sequenceId, input = {}) {
|
|
4690
|
-
return this.http.request(
|
|
5113
|
+
return this.http.request(routes9.discardChanges, {
|
|
4691
5114
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4692
5115
|
body: input
|
|
4693
5116
|
});
|
|
4694
5117
|
}
|
|
4695
5118
|
/** The versions an email has been published with, live one first. */
|
|
4696
5119
|
async emailVersions(sequenceId, emailId) {
|
|
4697
|
-
const { items } = await this.http.request(
|
|
5120
|
+
const { items } = await this.http.request(routes9.emailVersions, {
|
|
4698
5121
|
params: {
|
|
4699
5122
|
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4700
5123
|
emailId: assertId(emailId, "emailId")
|
|
@@ -4705,7 +5128,7 @@ var Sequences = class {
|
|
|
4705
5128
|
/** Loads an earlier published version into the email's draft; publish
|
|
4706
5129
|
* it with `publishChanges` to roll back. */
|
|
4707
5130
|
async restoreEmailVersion(sequenceId, emailId, versionId) {
|
|
4708
|
-
return this.http.request(
|
|
5131
|
+
return this.http.request(routes9.restoreEmailVersion, {
|
|
4709
5132
|
params: {
|
|
4710
5133
|
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4711
5134
|
emailId: assertId(emailId, "emailId"),
|
|
@@ -4714,7 +5137,7 @@ var Sequences = class {
|
|
|
4714
5137
|
});
|
|
4715
5138
|
}
|
|
4716
5139
|
async removeEmail(sequenceId, emailId) {
|
|
4717
|
-
return this.http.request(
|
|
5140
|
+
return this.http.request(routes9.removeEmail, {
|
|
4718
5141
|
params: {
|
|
4719
5142
|
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4720
5143
|
emailId: assertId(emailId, "emailId")
|
|
@@ -4724,17 +5147,17 @@ var Sequences = class {
|
|
|
4724
5147
|
/** Sends a broadcast, or activates a sequence so its trigger starts
|
|
4725
5148
|
* enrolling contacts. Requires a mailing address in general settings. */
|
|
4726
5149
|
async start(sequenceId) {
|
|
4727
|
-
return this.http.request(
|
|
5150
|
+
return this.http.request(routes9.start, {
|
|
4728
5151
|
params: { sequenceId: assertId(sequenceId, "sequenceId") }
|
|
4729
5152
|
});
|
|
4730
5153
|
}
|
|
4731
5154
|
async pause(sequenceId) {
|
|
4732
|
-
return this.http.request(
|
|
5155
|
+
return this.http.request(routes9.pause, {
|
|
4733
5156
|
params: { sequenceId: assertId(sequenceId, "sequenceId") }
|
|
4734
5157
|
});
|
|
4735
5158
|
}
|
|
4736
5159
|
async stats(sequenceId) {
|
|
4737
|
-
return this.http.request(
|
|
5160
|
+
return this.http.request(routes9.stats, {
|
|
4738
5161
|
params: { sequenceId: assertId(sequenceId, "sequenceId") }
|
|
4739
5162
|
});
|
|
4740
5163
|
}
|
|
@@ -4742,7 +5165,7 @@ var Sequences = class {
|
|
|
4742
5165
|
* `outcome: "bounced"` or `"complained"` lists the recipients behind the
|
|
4743
5166
|
* stats' bounce and complaint rates. */
|
|
4744
5167
|
async deliveries(sequenceId, query = {}) {
|
|
4745
|
-
return this.http.request(
|
|
5168
|
+
return this.http.request(routes9.deliveries, {
|
|
4746
5169
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4747
5170
|
query
|
|
4748
5171
|
});
|
|
@@ -4754,7 +5177,7 @@ var Sequences = class {
|
|
|
4754
5177
|
* send with a `[Test]` subject prefix. Tests count against the team's test
|
|
4755
5178
|
* limits (429 `test_send_limit_reached` / `test_send_email_limit_reached`). */
|
|
4756
5179
|
async sendEmailTest(sequenceId, emailId, input) {
|
|
4757
|
-
return this.http.request(
|
|
5180
|
+
return this.http.request(routes9.sendEmailTest, {
|
|
4758
5181
|
params: {
|
|
4759
5182
|
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4760
5183
|
emailId: assertId(emailId, "emailId")
|
|
@@ -4764,7 +5187,7 @@ var Sequences = class {
|
|
|
4764
5187
|
}
|
|
4765
5188
|
/** IDs of contacts that have received this broadcast or sequence. */
|
|
4766
5189
|
async subscribers(sequenceId, query = {}) {
|
|
4767
|
-
return this.http.request(
|
|
5190
|
+
return this.http.request(routes9.subscribers, {
|
|
4768
5191
|
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4769
5192
|
query
|
|
4770
5193
|
});
|
|
@@ -4772,16 +5195,16 @@ var Sequences = class {
|
|
|
4772
5195
|
};
|
|
4773
5196
|
|
|
4774
5197
|
// src/resources/settings.ts
|
|
4775
|
-
var
|
|
5198
|
+
var routes10 = contract.settings.general;
|
|
4776
5199
|
var GeneralSettingsResource = class {
|
|
4777
5200
|
constructor(http) {
|
|
4778
5201
|
this.http = http;
|
|
4779
5202
|
}
|
|
4780
5203
|
async get() {
|
|
4781
|
-
return this.http.request(
|
|
5204
|
+
return this.http.request(routes10.get);
|
|
4782
5205
|
}
|
|
4783
5206
|
async update(input) {
|
|
4784
|
-
return this.http.request(
|
|
5207
|
+
return this.http.request(routes10.update, { body: input });
|
|
4785
5208
|
}
|
|
4786
5209
|
};
|
|
4787
5210
|
var Settings = class {
|
|
@@ -4791,26 +5214,26 @@ var Settings = class {
|
|
|
4791
5214
|
};
|
|
4792
5215
|
|
|
4793
5216
|
// src/resources/suppressions.ts
|
|
4794
|
-
var
|
|
5217
|
+
var routes11 = contract.suppressions;
|
|
4795
5218
|
var Suppressions = class {
|
|
4796
5219
|
constructor(http) {
|
|
4797
5220
|
this.http = http;
|
|
4798
5221
|
}
|
|
4799
5222
|
async list(query = {}) {
|
|
4800
|
-
return this.http.request(
|
|
5223
|
+
return this.http.request(routes11.list, { query });
|
|
4801
5224
|
}
|
|
4802
5225
|
listAll(query = {}) {
|
|
4803
5226
|
return paginate((offset) => this.list({ ...query, offset }));
|
|
4804
5227
|
}
|
|
4805
5228
|
async get(suppressionId) {
|
|
4806
|
-
return this.http.request(
|
|
5229
|
+
return this.http.request(routes11.get, {
|
|
4807
5230
|
params: { suppressionId: assertId(suppressionId, "suppressionId") }
|
|
4808
5231
|
});
|
|
4809
5232
|
}
|
|
4810
5233
|
/** Complaint suppressions can't be released (409
|
|
4811
5234
|
* `suppression_not_releasable`). */
|
|
4812
5235
|
async release(suppressionId, input = {}) {
|
|
4813
|
-
return this.http.request(
|
|
5236
|
+
return this.http.request(routes11.release, {
|
|
4814
5237
|
params: { suppressionId: assertId(suppressionId, "suppressionId") },
|
|
4815
5238
|
body: input
|
|
4816
5239
|
});
|
|
@@ -4818,70 +5241,70 @@ var Suppressions = class {
|
|
|
4818
5241
|
};
|
|
4819
5242
|
|
|
4820
5243
|
// src/resources/tags.ts
|
|
4821
|
-
var
|
|
5244
|
+
var routes12 = contract.tags;
|
|
4822
5245
|
var Tags = class {
|
|
4823
5246
|
constructor(http) {
|
|
4824
5247
|
this.http = http;
|
|
4825
5248
|
}
|
|
4826
5249
|
async list() {
|
|
4827
|
-
return this.http.request(
|
|
5250
|
+
return this.http.request(routes12.list);
|
|
4828
5251
|
}
|
|
4829
5252
|
async references(tag) {
|
|
4830
|
-
return this.http.request(
|
|
5253
|
+
return this.http.request(routes12.references, {
|
|
4831
5254
|
params: { tag: encodeSegment(tag, "tag") }
|
|
4832
5255
|
});
|
|
4833
5256
|
}
|
|
4834
5257
|
/** Renames a tag on every contact and everywhere it's referenced. */
|
|
4835
5258
|
async rename(tag, input) {
|
|
4836
|
-
return this.http.request(
|
|
5259
|
+
return this.http.request(routes12.rename, {
|
|
4837
5260
|
params: { tag: encodeSegment(tag, "tag") },
|
|
4838
5261
|
body: input
|
|
4839
5262
|
});
|
|
4840
5263
|
}
|
|
4841
5264
|
/** Removes a tag from every contact. */
|
|
4842
5265
|
async remove(tag) {
|
|
4843
|
-
return this.http.request(
|
|
5266
|
+
return this.http.request(routes12.remove, {
|
|
4844
5267
|
params: { tag: encodeSegment(tag, "tag") }
|
|
4845
5268
|
});
|
|
4846
5269
|
}
|
|
4847
5270
|
};
|
|
4848
5271
|
|
|
4849
5272
|
// src/resources/templates.ts
|
|
4850
|
-
var
|
|
5273
|
+
var routes13 = contract.templates;
|
|
4851
5274
|
var Templates = class {
|
|
4852
5275
|
constructor(http) {
|
|
4853
5276
|
this.http = http;
|
|
4854
5277
|
}
|
|
4855
5278
|
async list(query = {}) {
|
|
4856
|
-
return this.http.request(
|
|
5279
|
+
return this.http.request(routes13.list, { query });
|
|
4857
5280
|
}
|
|
4858
5281
|
/** Built-in starters, shared by every team. Duplicate one into the team
|
|
4859
5282
|
* before using it for transactional sends. */
|
|
4860
5283
|
async listSystem(query = {}) {
|
|
4861
|
-
return this.http.request(
|
|
5284
|
+
return this.http.request(routes13.listSystem, { query });
|
|
4862
5285
|
}
|
|
4863
5286
|
async get(templateId) {
|
|
4864
|
-
return this.http.request(
|
|
5287
|
+
return this.http.request(routes13.get, {
|
|
4865
5288
|
params: { templateId: assertId(templateId, "templateId") }
|
|
4866
5289
|
});
|
|
4867
5290
|
}
|
|
4868
5291
|
async create(input) {
|
|
4869
|
-
return this.http.request(
|
|
5292
|
+
return this.http.request(routes13.create, { body: input });
|
|
4870
5293
|
}
|
|
4871
5294
|
async update(templateId, input) {
|
|
4872
|
-
return this.http.request(
|
|
5295
|
+
return this.http.request(routes13.update, {
|
|
4873
5296
|
params: { templateId: assertId(templateId, "templateId") },
|
|
4874
5297
|
body: input
|
|
4875
5298
|
});
|
|
4876
5299
|
}
|
|
4877
5300
|
async duplicate(templateId, input = {}) {
|
|
4878
|
-
return this.http.request(
|
|
5301
|
+
return this.http.request(routes13.duplicate, {
|
|
4879
5302
|
params: { templateId: assertId(templateId, "templateId") },
|
|
4880
5303
|
body: input
|
|
4881
5304
|
});
|
|
4882
5305
|
}
|
|
4883
5306
|
async remove(templateId) {
|
|
4884
|
-
await this.http.request(
|
|
5307
|
+
await this.http.request(routes13.remove, {
|
|
4885
5308
|
params: { templateId: assertId(templateId, "templateId") }
|
|
4886
5309
|
});
|
|
4887
5310
|
}
|
|
@@ -4946,6 +5369,7 @@ var SendLit = class {
|
|
|
4946
5369
|
this.sequences = new Sequences(http);
|
|
4947
5370
|
this.emails = new Emails(http);
|
|
4948
5371
|
this.events = new Events(http);
|
|
5372
|
+
this.forms = new Forms(http);
|
|
4949
5373
|
this.provisioning = new Provisioning(http);
|
|
4950
5374
|
this.suppressions = new Suppressions(http);
|
|
4951
5375
|
this.deliveryEvents = new DeliveryEvents(http);
|
|
@@ -4961,6 +5385,7 @@ exports.DeliveryEvents = DeliveryEvents;
|
|
|
4961
5385
|
exports.Emails = Emails;
|
|
4962
5386
|
exports.EventDefinitions = EventDefinitions;
|
|
4963
5387
|
exports.Events = Events;
|
|
5388
|
+
exports.Forms = Forms;
|
|
4964
5389
|
exports.GeneralSettingsResource = GeneralSettingsResource;
|
|
4965
5390
|
exports.OverviewResource = OverviewResource;
|
|
4966
5391
|
exports.Provisioning = Provisioning;
|