@sendly/node 3.30.0 → 3.33.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 +30 -30
- package/dist/index.d.mts +353 -12
- package/dist/index.d.ts +353 -12
- package/dist/index.js +196 -12
- package/dist/index.mjs +196 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3895,6 +3895,49 @@ declare class MediaResource {
|
|
|
3895
3895
|
upload(file: Buffer | NodeJS.ReadableStream, options?: MediaUploadOptions): Promise<MediaFile>;
|
|
3896
3896
|
}
|
|
3897
3897
|
|
|
3898
|
+
/**
|
|
3899
|
+
* Verification submit/resubmit payload. All fields optional for resubmits
|
|
3900
|
+
* (server merges with existing record). For initial provision via
|
|
3901
|
+
* `submitVerification` (no existing record), the validator requires:
|
|
3902
|
+
* businessName, website, address, contact, useCase, useCaseSummary,
|
|
3903
|
+
* sampleMessages, optInWorkflow.
|
|
3904
|
+
*/
|
|
3905
|
+
interface VerificationSubmitInput {
|
|
3906
|
+
businessName?: string;
|
|
3907
|
+
doingBusinessAs?: string;
|
|
3908
|
+
website?: string;
|
|
3909
|
+
address?: {
|
|
3910
|
+
street?: string;
|
|
3911
|
+
address1?: string;
|
|
3912
|
+
address2?: string | null;
|
|
3913
|
+
city?: string;
|
|
3914
|
+
state?: string;
|
|
3915
|
+
zip?: string;
|
|
3916
|
+
country?: string;
|
|
3917
|
+
};
|
|
3918
|
+
contact?: {
|
|
3919
|
+
firstName?: string;
|
|
3920
|
+
lastName?: string;
|
|
3921
|
+
email?: string;
|
|
3922
|
+
phone?: string;
|
|
3923
|
+
};
|
|
3924
|
+
brn?: string | null;
|
|
3925
|
+
brnType?: "EIN" | "SSN" | "DUNS" | "CRA" | "VAT" | "LEI" | "OTHER" | null;
|
|
3926
|
+
brnCountry?: string | null;
|
|
3927
|
+
entityType?: "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT";
|
|
3928
|
+
useCase?: string;
|
|
3929
|
+
useCaseSummary?: string;
|
|
3930
|
+
sampleMessages?: string;
|
|
3931
|
+
optInWorkflow?: string;
|
|
3932
|
+
optInImageUrls?: string;
|
|
3933
|
+
monthlyVolume?: string;
|
|
3934
|
+
additionalInformation?: string;
|
|
3935
|
+
ageGatedContent?: boolean;
|
|
3936
|
+
isvReseller?: string;
|
|
3937
|
+
privacyUrl?: string;
|
|
3938
|
+
termsUrl?: string;
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3898
3941
|
declare class WorkspacesSubResource {
|
|
3899
3942
|
private readonly http;
|
|
3900
3943
|
constructor(http: HttpClient);
|
|
@@ -3919,18 +3962,46 @@ declare class WorkspacesSubResource {
|
|
|
3919
3962
|
}>;
|
|
3920
3963
|
get(workspaceId: string): Promise<EnterpriseWorkspaceDetail>;
|
|
3921
3964
|
delete(workspaceId: string): Promise<void>;
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3965
|
+
/**
|
|
3966
|
+
* Submit (or resubmit) a verification for an enterprise workspace.
|
|
3967
|
+
*
|
|
3968
|
+
* Partial-update friendly (May 2026): for resubmit on an existing
|
|
3969
|
+
* workspace, you only need to send the fields you want to change —
|
|
3970
|
+
* everything else is preserved from the existing record. Hosted page
|
|
3971
|
+
* URLs (`/biz/`, `/opt-in/`, `/legal/`) generated during provision
|
|
3972
|
+
* are auto-preserved.
|
|
3973
|
+
*
|
|
3974
|
+
* For sole proprietors, leave `brn`, `brnType`, `brnCountry` undefined
|
|
3975
|
+
* — the server strips them before forwarding to the carrier.
|
|
3976
|
+
*
|
|
3977
|
+
* @example Full submit
|
|
3978
|
+
* ```ts
|
|
3979
|
+
* await sendly.enterprise.workspaces.submitVerification(workspaceId, {
|
|
3980
|
+
* businessName: "Acme LLC",
|
|
3981
|
+
* website: "https://acme.com",
|
|
3982
|
+
* address: { street: "...", city: "...", state: "California", zip: "90001", country: "US" },
|
|
3983
|
+
* contact: { firstName: "...", lastName: "...", email: "...", phone: "+15551234567" },
|
|
3984
|
+
* useCase: "Insurance Services",
|
|
3985
|
+
* useCaseSummary: "...",
|
|
3986
|
+
* sampleMessages: "...",
|
|
3987
|
+
* optInWorkflow: "...",
|
|
3988
|
+
* entityType: "SOLE_PROPRIETOR",
|
|
3989
|
+
* });
|
|
3990
|
+
* ```
|
|
3991
|
+
*
|
|
3992
|
+
* @example Partial-update resubmit (only changing email)
|
|
3993
|
+
* ```ts
|
|
3994
|
+
* await sendly.enterprise.workspaces.submitVerification(workspaceId, {
|
|
3995
|
+
* contact: { email: "new@email.com" },
|
|
3996
|
+
* });
|
|
3997
|
+
* ```
|
|
3998
|
+
*/
|
|
3999
|
+
submitVerification(workspaceId: string, data: VerificationSubmitInput): Promise<unknown>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Convenience alias for resubmits. Reads more naturally when you only
|
|
4002
|
+
* want to update a few fields after a rejection.
|
|
4003
|
+
*/
|
|
4004
|
+
resubmitVerification(workspaceId: string, partialUpdates: VerificationSubmitInput): Promise<unknown>;
|
|
3934
4005
|
inheritVerification(workspaceId: string, options: {
|
|
3935
4006
|
sourceWorkspaceId: string;
|
|
3936
4007
|
}): Promise<unknown>;
|
|
@@ -4080,6 +4151,251 @@ declare class RulesResource {
|
|
|
4080
4151
|
delete(id: string): Promise<void>;
|
|
4081
4152
|
}
|
|
4082
4153
|
|
|
4154
|
+
/**
|
|
4155
|
+
* Business Upgrade Resource — Entity-Upgrade ("fork-with-new-number")
|
|
4156
|
+
*
|
|
4157
|
+
* @packageDocumentation
|
|
4158
|
+
*
|
|
4159
|
+
* Manages the toll-free business entity upgrade flow: when a customer
|
|
4160
|
+
* forms a new legal entity (e.g. an LLC), this resource lets them
|
|
4161
|
+
* reserve a new toll-free number under the new entity, submit it for
|
|
4162
|
+
* carrier review, and atomically swap to it on approval — without
|
|
4163
|
+
* disrupting outbound SMS during the 1-2 week review window.
|
|
4164
|
+
*
|
|
4165
|
+
* @see https://sendly.live/docs/business-upgrade
|
|
4166
|
+
*/
|
|
4167
|
+
|
|
4168
|
+
type EntityType = "SOLE_PROPRIETOR" | "PRIVATE_PROFIT" | "PUBLIC_PROFIT" | "NON_PROFIT" | "GOVERNMENT";
|
|
4169
|
+
type BrnType = "EIN" | "SSN" | "DUNS" | "CRA" | "VAT" | "LEI" | "OTHER";
|
|
4170
|
+
type Disposition = "moved" | "released";
|
|
4171
|
+
interface PreflightCandidate {
|
|
4172
|
+
businessName: string;
|
|
4173
|
+
doingBusinessAs?: string;
|
|
4174
|
+
brn: string;
|
|
4175
|
+
brnType: BrnType;
|
|
4176
|
+
brnCountry: string;
|
|
4177
|
+
entityType: EntityType;
|
|
4178
|
+
website?: string;
|
|
4179
|
+
address1?: string;
|
|
4180
|
+
address2?: string;
|
|
4181
|
+
city?: string;
|
|
4182
|
+
state?: string;
|
|
4183
|
+
zip?: string;
|
|
4184
|
+
addressCountry?: string;
|
|
4185
|
+
contactFirstName?: string;
|
|
4186
|
+
contactLastName?: string;
|
|
4187
|
+
contactEmail?: string;
|
|
4188
|
+
contactPhone?: string;
|
|
4189
|
+
monthlyVolume?: string;
|
|
4190
|
+
useCase?: string;
|
|
4191
|
+
useCaseSummary?: string;
|
|
4192
|
+
sampleMessages?: string;
|
|
4193
|
+
optInWorkflow?: string;
|
|
4194
|
+
privacyUrl?: string;
|
|
4195
|
+
termsUrl?: string;
|
|
4196
|
+
additionalInformation?: string;
|
|
4197
|
+
ageGatedContent?: boolean;
|
|
4198
|
+
}
|
|
4199
|
+
interface PreflightIssue {
|
|
4200
|
+
severity: "blocker" | "warning" | "info";
|
|
4201
|
+
field: string;
|
|
4202
|
+
code: string;
|
|
4203
|
+
message: string;
|
|
4204
|
+
suggestion?: string;
|
|
4205
|
+
}
|
|
4206
|
+
interface PreflightProposedFix {
|
|
4207
|
+
field: string;
|
|
4208
|
+
current: unknown;
|
|
4209
|
+
proposed: unknown;
|
|
4210
|
+
reason: string;
|
|
4211
|
+
}
|
|
4212
|
+
interface PreflightReport {
|
|
4213
|
+
verificationId: string;
|
|
4214
|
+
businessName: string | null;
|
|
4215
|
+
country: "CA" | "US" | "OTHER" | "UNKNOWN";
|
|
4216
|
+
verdict: "ready" | "warnings" | "blocked";
|
|
4217
|
+
issues: PreflightIssue[];
|
|
4218
|
+
proposedFixes: PreflightProposedFix[];
|
|
4219
|
+
}
|
|
4220
|
+
interface StartUpgradeParams {
|
|
4221
|
+
businessName: string;
|
|
4222
|
+
brn: string;
|
|
4223
|
+
brnType: BrnType;
|
|
4224
|
+
brnCountry: string;
|
|
4225
|
+
entityType: EntityType;
|
|
4226
|
+
doingBusinessAs?: string;
|
|
4227
|
+
website?: string;
|
|
4228
|
+
address1?: string;
|
|
4229
|
+
address2?: string;
|
|
4230
|
+
city?: string;
|
|
4231
|
+
state?: string;
|
|
4232
|
+
zip?: string;
|
|
4233
|
+
addressCountry?: string;
|
|
4234
|
+
contactFirstName?: string;
|
|
4235
|
+
contactLastName?: string;
|
|
4236
|
+
contactEmail?: string;
|
|
4237
|
+
contactPhone?: string;
|
|
4238
|
+
monthlyVolume?: string;
|
|
4239
|
+
useCase?: string;
|
|
4240
|
+
useCaseSummary?: string;
|
|
4241
|
+
sampleMessages?: string;
|
|
4242
|
+
optInWorkflow?: string;
|
|
4243
|
+
privacyUrl?: string;
|
|
4244
|
+
termsUrl?: string;
|
|
4245
|
+
additionalInformation?: string;
|
|
4246
|
+
ageGatedContent?: boolean;
|
|
4247
|
+
}
|
|
4248
|
+
interface EinDocumentInput {
|
|
4249
|
+
/** Buffer containing the PDF bytes */
|
|
4250
|
+
buffer: Buffer | Uint8Array;
|
|
4251
|
+
/** Filename (defaults to "ein-doc.pdf") */
|
|
4252
|
+
filename?: string;
|
|
4253
|
+
/** Content-Type (defaults to "application/pdf") */
|
|
4254
|
+
contentType?: string;
|
|
4255
|
+
}
|
|
4256
|
+
interface StartUpgradeResponse {
|
|
4257
|
+
success: true;
|
|
4258
|
+
pendingVerificationId: string;
|
|
4259
|
+
telnyxVerificationId: string;
|
|
4260
|
+
tollFreeNumber: string;
|
|
4261
|
+
telnyxMessagingProfileId: string;
|
|
4262
|
+
einDocStored: boolean;
|
|
4263
|
+
message: string;
|
|
4264
|
+
}
|
|
4265
|
+
interface UpgradeStatusResponse {
|
|
4266
|
+
pending: {
|
|
4267
|
+
id: string;
|
|
4268
|
+
businessName: string;
|
|
4269
|
+
status: string;
|
|
4270
|
+
entityType: string | null;
|
|
4271
|
+
brnType: string | null;
|
|
4272
|
+
brnCountry: string | null;
|
|
4273
|
+
tollFreeNumber: string | null;
|
|
4274
|
+
rejectionReason: string | null;
|
|
4275
|
+
createdAt: string;
|
|
4276
|
+
updatedAt: string;
|
|
4277
|
+
} | null;
|
|
4278
|
+
}
|
|
4279
|
+
interface CancelUpgradeResponse {
|
|
4280
|
+
success: boolean;
|
|
4281
|
+
cancelled: boolean;
|
|
4282
|
+
cancelledVerificationId?: string;
|
|
4283
|
+
message: string;
|
|
4284
|
+
}
|
|
4285
|
+
interface ResubmitUpgradeResponse {
|
|
4286
|
+
success: boolean;
|
|
4287
|
+
pendingVerificationId: string;
|
|
4288
|
+
message: string;
|
|
4289
|
+
}
|
|
4290
|
+
interface DispositionResponse {
|
|
4291
|
+
success: boolean;
|
|
4292
|
+
disposition: Disposition;
|
|
4293
|
+
supersededVerificationId: string;
|
|
4294
|
+
message: string;
|
|
4295
|
+
}
|
|
4296
|
+
interface BestPrefillResponse {
|
|
4297
|
+
prefill: {
|
|
4298
|
+
monthlyVolume?: string;
|
|
4299
|
+
useCase?: string;
|
|
4300
|
+
useCaseSummary?: string;
|
|
4301
|
+
sampleMessages?: string;
|
|
4302
|
+
optInWorkflow?: string;
|
|
4303
|
+
optInImageUrls?: string;
|
|
4304
|
+
optInSource?: string;
|
|
4305
|
+
privacyUrl?: string;
|
|
4306
|
+
termsUrl?: string;
|
|
4307
|
+
additionalInformation?: string;
|
|
4308
|
+
isvReseller?: string;
|
|
4309
|
+
ageGatedContent?: boolean;
|
|
4310
|
+
};
|
|
4311
|
+
sourceWorkspaceCount: number;
|
|
4312
|
+
}
|
|
4313
|
+
/**
|
|
4314
|
+
* BusinessUpgrade resource
|
|
4315
|
+
*
|
|
4316
|
+
* @example
|
|
4317
|
+
* ```typescript
|
|
4318
|
+
* // Preview validation before submitting
|
|
4319
|
+
* const preview = await sendly.businessUpgrade.preflight({
|
|
4320
|
+
* businessName: "Acme Holdings LLC",
|
|
4321
|
+
* brn: "12-3456789",
|
|
4322
|
+
* brnType: "EIN",
|
|
4323
|
+
* brnCountry: "US",
|
|
4324
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4325
|
+
* });
|
|
4326
|
+
*
|
|
4327
|
+
* // Submit the upgrade with the IRS letter
|
|
4328
|
+
* import { readFileSync } from "fs";
|
|
4329
|
+
* const result = await sendly.businessUpgrade.start("ws_abc", {
|
|
4330
|
+
* businessName: "Acme Holdings LLC",
|
|
4331
|
+
* brn: "12-3456789",
|
|
4332
|
+
* brnType: "EIN",
|
|
4333
|
+
* brnCountry: "US",
|
|
4334
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4335
|
+
* }, {
|
|
4336
|
+
* einDoc: { buffer: readFileSync("./CP-575.pdf"), filename: "CP-575.pdf" }
|
|
4337
|
+
* });
|
|
4338
|
+
* ```
|
|
4339
|
+
*/
|
|
4340
|
+
declare class BusinessUpgradeResource {
|
|
4341
|
+
private readonly http;
|
|
4342
|
+
constructor(http: HttpClient);
|
|
4343
|
+
/**
|
|
4344
|
+
* Validate a candidate entity upgrade payload before submission.
|
|
4345
|
+
* Returns issues + proposed auto-fixes. No writes — purely advisory.
|
|
4346
|
+
*/
|
|
4347
|
+
preflight(candidate: PreflightCandidate): Promise<PreflightReport>;
|
|
4348
|
+
/**
|
|
4349
|
+
* Get a "best-of" prefill across all the caller's verified workspaces.
|
|
4350
|
+
* Returns most-recent non-empty values per messaging field. Use this
|
|
4351
|
+
* to pre-populate the upgrade form for users whose current workspace
|
|
4352
|
+
* has incomplete data.
|
|
4353
|
+
*/
|
|
4354
|
+
bestPrefill(): Promise<BestPrefillResponse>;
|
|
4355
|
+
/**
|
|
4356
|
+
* Start an entity upgrade for the given workspace. Auto-provisions
|
|
4357
|
+
* a new toll-free number + messaging profile and submits to the
|
|
4358
|
+
* carrier for review. Returns the pending verification details.
|
|
4359
|
+
*
|
|
4360
|
+
* The current toll-free number continues sending throughout the
|
|
4361
|
+
* 1-2 week carrier review; on approval, an atomic swap promotes
|
|
4362
|
+
* the new number.
|
|
4363
|
+
*/
|
|
4364
|
+
start(workspaceId: string, params: StartUpgradeParams, options?: {
|
|
4365
|
+
einDoc?: EinDocumentInput;
|
|
4366
|
+
}): Promise<StartUpgradeResponse>;
|
|
4367
|
+
/**
|
|
4368
|
+
* Check whether the given workspace has a pending entity upgrade.
|
|
4369
|
+
* Returns `{ pending: null }` if no upgrade is in flight.
|
|
4370
|
+
*/
|
|
4371
|
+
status(workspaceId: string): Promise<UpgradeStatusResponse>;
|
|
4372
|
+
/**
|
|
4373
|
+
* Cancel a pending entity upgrade for the given workspace. Releases
|
|
4374
|
+
* the reserved toll-free number, deletes the new messaging profile,
|
|
4375
|
+
* and removes the stored EIN document. Idempotent.
|
|
4376
|
+
*/
|
|
4377
|
+
cancel(workspaceId: string): Promise<CancelUpgradeResponse>;
|
|
4378
|
+
/**
|
|
4379
|
+
* Resubmit a rejected (or waiting-for-customer) entity upgrade with
|
|
4380
|
+
* updated fields and optionally a new EIN document.
|
|
4381
|
+
*/
|
|
4382
|
+
resubmit(workspaceId: string, params: Partial<StartUpgradeParams>, options?: {
|
|
4383
|
+
einDoc?: EinDocumentInput;
|
|
4384
|
+
}): Promise<ResubmitUpgradeResponse>;
|
|
4385
|
+
/**
|
|
4386
|
+
* After a successful entity-upgrade approval, choose what happens to
|
|
4387
|
+
* the old toll-free number:
|
|
4388
|
+
*
|
|
4389
|
+
* - `moved`: keep it active under another workspace owned by the
|
|
4390
|
+
* same user (requires `targetWorkspaceId`)
|
|
4391
|
+
* - `released`: return it to the carrier pool
|
|
4392
|
+
*/
|
|
4393
|
+
setDisposition(workspaceId: string, body: {
|
|
4394
|
+
disposition: Disposition;
|
|
4395
|
+
targetWorkspaceId?: string;
|
|
4396
|
+
}): Promise<DispositionResponse>;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4083
4399
|
/**
|
|
4084
4400
|
* Sendly Client
|
|
4085
4401
|
* @packageDocumentation
|
|
@@ -4290,6 +4606,31 @@ declare class Sendly {
|
|
|
4290
4606
|
* ```
|
|
4291
4607
|
*/
|
|
4292
4608
|
readonly enterprise: EnterpriseResource;
|
|
4609
|
+
/**
|
|
4610
|
+
* Business Upgrade resource — toll-free entity-upgrade flow.
|
|
4611
|
+
*
|
|
4612
|
+
* @example
|
|
4613
|
+
* ```typescript
|
|
4614
|
+
* // Preview a candidate upgrade before submitting
|
|
4615
|
+
* const preview = await sendly.businessUpgrade.preflight({
|
|
4616
|
+
* businessName: "Acme Holdings LLC",
|
|
4617
|
+
* brn: "12-3456789",
|
|
4618
|
+
* brnType: "EIN",
|
|
4619
|
+
* brnCountry: "US",
|
|
4620
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4621
|
+
* });
|
|
4622
|
+
*
|
|
4623
|
+
* // Start an upgrade — auto-reserves a new toll-free number
|
|
4624
|
+
* const { pendingVerificationId } = await sendly.businessUpgrade.start("ws_abc", {
|
|
4625
|
+
* businessName: "Acme Holdings LLC",
|
|
4626
|
+
* brn: "12-3456789",
|
|
4627
|
+
* brnType: "EIN",
|
|
4628
|
+
* brnCountry: "US",
|
|
4629
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4630
|
+
* }, { einDoc: { buffer: pdfBuffer } });
|
|
4631
|
+
* ```
|
|
4632
|
+
*/
|
|
4633
|
+
readonly businessUpgrade: BusinessUpgradeResource;
|
|
4293
4634
|
private readonly http;
|
|
4294
4635
|
private readonly config;
|
|
4295
4636
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3075,25 +3075,59 @@ var WorkspacesSubResource = class {
|
|
|
3075
3075
|
path: `/enterprise/workspaces/${encodeURIComponent(workspaceId)}`
|
|
3076
3076
|
});
|
|
3077
3077
|
}
|
|
3078
|
+
/**
|
|
3079
|
+
* Submit (or resubmit) a verification for an enterprise workspace.
|
|
3080
|
+
*
|
|
3081
|
+
* Partial-update friendly (May 2026): for resubmit on an existing
|
|
3082
|
+
* workspace, you only need to send the fields you want to change —
|
|
3083
|
+
* everything else is preserved from the existing record. Hosted page
|
|
3084
|
+
* URLs (`/biz/`, `/opt-in/`, `/legal/`) generated during provision
|
|
3085
|
+
* are auto-preserved.
|
|
3086
|
+
*
|
|
3087
|
+
* For sole proprietors, leave `brn`, `brnType`, `brnCountry` undefined
|
|
3088
|
+
* — the server strips them before forwarding to the carrier.
|
|
3089
|
+
*
|
|
3090
|
+
* @example Full submit
|
|
3091
|
+
* ```ts
|
|
3092
|
+
* await sendly.enterprise.workspaces.submitVerification(workspaceId, {
|
|
3093
|
+
* businessName: "Acme LLC",
|
|
3094
|
+
* website: "https://acme.com",
|
|
3095
|
+
* address: { street: "...", city: "...", state: "California", zip: "90001", country: "US" },
|
|
3096
|
+
* contact: { firstName: "...", lastName: "...", email: "...", phone: "+15551234567" },
|
|
3097
|
+
* useCase: "Insurance Services",
|
|
3098
|
+
* useCaseSummary: "...",
|
|
3099
|
+
* sampleMessages: "...",
|
|
3100
|
+
* optInWorkflow: "...",
|
|
3101
|
+
* entityType: "SOLE_PROPRIETOR",
|
|
3102
|
+
* });
|
|
3103
|
+
* ```
|
|
3104
|
+
*
|
|
3105
|
+
* @example Partial-update resubmit (only changing email)
|
|
3106
|
+
* ```ts
|
|
3107
|
+
* await sendly.enterprise.workspaces.submitVerification(workspaceId, {
|
|
3108
|
+
* contact: { email: "new@email.com" },
|
|
3109
|
+
* });
|
|
3110
|
+
* ```
|
|
3111
|
+
*/
|
|
3078
3112
|
async submitVerification(workspaceId, data) {
|
|
3113
|
+
const body = {};
|
|
3114
|
+
for (const [k, v] of Object.entries(data)) {
|
|
3115
|
+
if (v !== void 0) body[k] = v;
|
|
3116
|
+
}
|
|
3079
3117
|
const response = await this.http.request({
|
|
3080
3118
|
method: "POST",
|
|
3081
3119
|
path: `/enterprise/workspaces/${encodeURIComponent(workspaceId)}/verification/submit`,
|
|
3082
|
-
body
|
|
3083
|
-
business_name: data.businessName,
|
|
3084
|
-
business_type: data.businessType,
|
|
3085
|
-
ein: data.ein,
|
|
3086
|
-
address: data.address,
|
|
3087
|
-
city: data.city,
|
|
3088
|
-
state: data.state,
|
|
3089
|
-
zip: data.zip,
|
|
3090
|
-
use_case: data.useCase,
|
|
3091
|
-
sample_messages: data.sampleMessages,
|
|
3092
|
-
...data.monthlyVolume && { monthly_volume: data.monthlyVolume }
|
|
3093
|
-
}
|
|
3120
|
+
body
|
|
3094
3121
|
});
|
|
3095
3122
|
return transformKeys(response);
|
|
3096
3123
|
}
|
|
3124
|
+
/**
|
|
3125
|
+
* Convenience alias for resubmits. Reads more naturally when you only
|
|
3126
|
+
* want to update a few fields after a rejection.
|
|
3127
|
+
*/
|
|
3128
|
+
async resubmitVerification(workspaceId, partialUpdates) {
|
|
3129
|
+
return this.submitVerification(workspaceId, partialUpdates);
|
|
3130
|
+
}
|
|
3097
3131
|
async inheritVerification(workspaceId, options) {
|
|
3098
3132
|
const response = await this.http.request({
|
|
3099
3133
|
method: "POST",
|
|
@@ -3783,6 +3817,130 @@ var RulesResource = class {
|
|
|
3783
3817
|
}
|
|
3784
3818
|
};
|
|
3785
3819
|
|
|
3820
|
+
// src/resources/businessUpgrade.ts
|
|
3821
|
+
var BusinessUpgradeResource = class {
|
|
3822
|
+
constructor(http) {
|
|
3823
|
+
this.http = http;
|
|
3824
|
+
}
|
|
3825
|
+
/**
|
|
3826
|
+
* Validate a candidate entity upgrade payload before submission.
|
|
3827
|
+
* Returns issues + proposed auto-fixes. No writes — purely advisory.
|
|
3828
|
+
*/
|
|
3829
|
+
async preflight(candidate) {
|
|
3830
|
+
return this.http.request({
|
|
3831
|
+
method: "POST",
|
|
3832
|
+
path: "/verification/preflight",
|
|
3833
|
+
body: candidate
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
/**
|
|
3837
|
+
* Get a "best-of" prefill across all the caller's verified workspaces.
|
|
3838
|
+
* Returns most-recent non-empty values per messaging field. Use this
|
|
3839
|
+
* to pre-populate the upgrade form for users whose current workspace
|
|
3840
|
+
* has incomplete data.
|
|
3841
|
+
*/
|
|
3842
|
+
async bestPrefill() {
|
|
3843
|
+
return this.http.request({
|
|
3844
|
+
method: "GET",
|
|
3845
|
+
path: "/verification/best-prefill"
|
|
3846
|
+
});
|
|
3847
|
+
}
|
|
3848
|
+
/**
|
|
3849
|
+
* Start an entity upgrade for the given workspace. Auto-provisions
|
|
3850
|
+
* a new toll-free number + messaging profile and submits to the
|
|
3851
|
+
* carrier for review. Returns the pending verification details.
|
|
3852
|
+
*
|
|
3853
|
+
* The current toll-free number continues sending throughout the
|
|
3854
|
+
* 1-2 week carrier review; on approval, an atomic swap promotes
|
|
3855
|
+
* the new number.
|
|
3856
|
+
*/
|
|
3857
|
+
async start(workspaceId, params, options) {
|
|
3858
|
+
const form = new FormData();
|
|
3859
|
+
for (const [k, v] of Object.entries(params)) {
|
|
3860
|
+
if (v === void 0 || v === null) continue;
|
|
3861
|
+
form.append(k, typeof v === "boolean" ? String(v) : v);
|
|
3862
|
+
}
|
|
3863
|
+
if (options?.einDoc) {
|
|
3864
|
+
const blob = new Blob([options.einDoc.buffer], {
|
|
3865
|
+
type: options.einDoc.contentType || "application/pdf"
|
|
3866
|
+
});
|
|
3867
|
+
form.append(
|
|
3868
|
+
"einDoc",
|
|
3869
|
+
blob,
|
|
3870
|
+
options.einDoc.filename || "ein-doc.pdf"
|
|
3871
|
+
);
|
|
3872
|
+
}
|
|
3873
|
+
return this.http.requestFormData(
|
|
3874
|
+
`/workspaces/${encodeURIComponent(workspaceId)}/upgrade`,
|
|
3875
|
+
form
|
|
3876
|
+
);
|
|
3877
|
+
}
|
|
3878
|
+
/**
|
|
3879
|
+
* Check whether the given workspace has a pending entity upgrade.
|
|
3880
|
+
* Returns `{ pending: null }` if no upgrade is in flight.
|
|
3881
|
+
*/
|
|
3882
|
+
async status(workspaceId) {
|
|
3883
|
+
return this.http.request({
|
|
3884
|
+
method: "GET",
|
|
3885
|
+
path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/status`
|
|
3886
|
+
});
|
|
3887
|
+
}
|
|
3888
|
+
/**
|
|
3889
|
+
* Cancel a pending entity upgrade for the given workspace. Releases
|
|
3890
|
+
* the reserved toll-free number, deletes the new messaging profile,
|
|
3891
|
+
* and removes the stored EIN document. Idempotent.
|
|
3892
|
+
*/
|
|
3893
|
+
async cancel(workspaceId) {
|
|
3894
|
+
return this.http.request({
|
|
3895
|
+
method: "POST",
|
|
3896
|
+
path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/cancel`
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* Resubmit a rejected (or waiting-for-customer) entity upgrade with
|
|
3901
|
+
* updated fields and optionally a new EIN document.
|
|
3902
|
+
*/
|
|
3903
|
+
async resubmit(workspaceId, params, options) {
|
|
3904
|
+
const form = new FormData();
|
|
3905
|
+
for (const [k, v] of Object.entries(params)) {
|
|
3906
|
+
if (v === void 0 || v === null) continue;
|
|
3907
|
+
form.append(k, typeof v === "boolean" ? String(v) : v);
|
|
3908
|
+
}
|
|
3909
|
+
if (options?.einDoc) {
|
|
3910
|
+
const blob = new Blob([options.einDoc.buffer], {
|
|
3911
|
+
type: options.einDoc.contentType || "application/pdf"
|
|
3912
|
+
});
|
|
3913
|
+
form.append(
|
|
3914
|
+
"einDoc",
|
|
3915
|
+
blob,
|
|
3916
|
+
options.einDoc.filename || "ein-doc.pdf"
|
|
3917
|
+
);
|
|
3918
|
+
}
|
|
3919
|
+
return this.http.requestFormData(
|
|
3920
|
+
`/workspaces/${encodeURIComponent(workspaceId)}/upgrade/resubmit`,
|
|
3921
|
+
form
|
|
3922
|
+
);
|
|
3923
|
+
}
|
|
3924
|
+
/**
|
|
3925
|
+
* After a successful entity-upgrade approval, choose what happens to
|
|
3926
|
+
* the old toll-free number:
|
|
3927
|
+
*
|
|
3928
|
+
* - `moved`: keep it active under another workspace owned by the
|
|
3929
|
+
* same user (requires `targetWorkspaceId`)
|
|
3930
|
+
* - `released`: return it to the carrier pool
|
|
3931
|
+
*/
|
|
3932
|
+
async setDisposition(workspaceId, body) {
|
|
3933
|
+
return this.http.request({
|
|
3934
|
+
method: "POST",
|
|
3935
|
+
path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/disposition`,
|
|
3936
|
+
body: {
|
|
3937
|
+
disposition: body.disposition,
|
|
3938
|
+
targetOrgId: body.targetWorkspaceId
|
|
3939
|
+
}
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
|
|
3786
3944
|
// src/client.ts
|
|
3787
3945
|
var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
|
|
3788
3946
|
var DEFAULT_TIMEOUT2 = 3e4;
|
|
@@ -3961,6 +4119,31 @@ var Sendly = class {
|
|
|
3961
4119
|
* ```
|
|
3962
4120
|
*/
|
|
3963
4121
|
enterprise;
|
|
4122
|
+
/**
|
|
4123
|
+
* Business Upgrade resource — toll-free entity-upgrade flow.
|
|
4124
|
+
*
|
|
4125
|
+
* @example
|
|
4126
|
+
* ```typescript
|
|
4127
|
+
* // Preview a candidate upgrade before submitting
|
|
4128
|
+
* const preview = await sendly.businessUpgrade.preflight({
|
|
4129
|
+
* businessName: "Acme Holdings LLC",
|
|
4130
|
+
* brn: "12-3456789",
|
|
4131
|
+
* brnType: "EIN",
|
|
4132
|
+
* brnCountry: "US",
|
|
4133
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4134
|
+
* });
|
|
4135
|
+
*
|
|
4136
|
+
* // Start an upgrade — auto-reserves a new toll-free number
|
|
4137
|
+
* const { pendingVerificationId } = await sendly.businessUpgrade.start("ws_abc", {
|
|
4138
|
+
* businessName: "Acme Holdings LLC",
|
|
4139
|
+
* brn: "12-3456789",
|
|
4140
|
+
* brnType: "EIN",
|
|
4141
|
+
* brnCountry: "US",
|
|
4142
|
+
* entityType: "PRIVATE_PROFIT",
|
|
4143
|
+
* }, { einDoc: { buffer: pdfBuffer } });
|
|
4144
|
+
* ```
|
|
4145
|
+
*/
|
|
4146
|
+
businessUpgrade;
|
|
3964
4147
|
http;
|
|
3965
4148
|
config;
|
|
3966
4149
|
/**
|
|
@@ -4004,6 +4187,7 @@ var Sendly = class {
|
|
|
4004
4187
|
this.contacts = new ContactsResource(this.http);
|
|
4005
4188
|
this.media = new MediaResource(this.http);
|
|
4006
4189
|
this.enterprise = new EnterpriseResource(this.http);
|
|
4190
|
+
this.businessUpgrade = new BusinessUpgradeResource(this.http);
|
|
4007
4191
|
}
|
|
4008
4192
|
/**
|
|
4009
4193
|
* Check if the client is using a test API key
|