@sendly/node 3.31.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/dist/index.d.mts CHANGED
@@ -4151,6 +4151,251 @@ declare class RulesResource {
4151
4151
  delete(id: string): Promise<void>;
4152
4152
  }
4153
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
+
4154
4399
  /**
4155
4400
  * Sendly Client
4156
4401
  * @packageDocumentation
@@ -4361,6 +4606,31 @@ declare class Sendly {
4361
4606
  * ```
4362
4607
  */
4363
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;
4364
4634
  private readonly http;
4365
4635
  private readonly config;
4366
4636
  /**
package/dist/index.d.ts CHANGED
@@ -4151,6 +4151,251 @@ declare class RulesResource {
4151
4151
  delete(id: string): Promise<void>;
4152
4152
  }
4153
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
+
4154
4399
  /**
4155
4400
  * Sendly Client
4156
4401
  * @packageDocumentation
@@ -4361,6 +4606,31 @@ declare class Sendly {
4361
4606
  * ```
4362
4607
  */
4363
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;
4364
4634
  private readonly http;
4365
4635
  private readonly config;
4366
4636
  /**
package/dist/index.js CHANGED
@@ -3817,6 +3817,130 @@ var RulesResource = class {
3817
3817
  }
3818
3818
  };
3819
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
+
3820
3944
  // src/client.ts
3821
3945
  var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
3822
3946
  var DEFAULT_TIMEOUT2 = 3e4;
@@ -3995,6 +4119,31 @@ var Sendly = class {
3995
4119
  * ```
3996
4120
  */
3997
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;
3998
4147
  http;
3999
4148
  config;
4000
4149
  /**
@@ -4038,6 +4187,7 @@ var Sendly = class {
4038
4187
  this.contacts = new ContactsResource(this.http);
4039
4188
  this.media = new MediaResource(this.http);
4040
4189
  this.enterprise = new EnterpriseResource(this.http);
4190
+ this.businessUpgrade = new BusinessUpgradeResource(this.http);
4041
4191
  }
4042
4192
  /**
4043
4193
  * Check if the client is using a test API key
package/dist/index.mjs CHANGED
@@ -3757,6 +3757,130 @@ var RulesResource = class {
3757
3757
  }
3758
3758
  };
3759
3759
 
3760
+ // src/resources/businessUpgrade.ts
3761
+ var BusinessUpgradeResource = class {
3762
+ constructor(http) {
3763
+ this.http = http;
3764
+ }
3765
+ /**
3766
+ * Validate a candidate entity upgrade payload before submission.
3767
+ * Returns issues + proposed auto-fixes. No writes — purely advisory.
3768
+ */
3769
+ async preflight(candidate) {
3770
+ return this.http.request({
3771
+ method: "POST",
3772
+ path: "/verification/preflight",
3773
+ body: candidate
3774
+ });
3775
+ }
3776
+ /**
3777
+ * Get a "best-of" prefill across all the caller's verified workspaces.
3778
+ * Returns most-recent non-empty values per messaging field. Use this
3779
+ * to pre-populate the upgrade form for users whose current workspace
3780
+ * has incomplete data.
3781
+ */
3782
+ async bestPrefill() {
3783
+ return this.http.request({
3784
+ method: "GET",
3785
+ path: "/verification/best-prefill"
3786
+ });
3787
+ }
3788
+ /**
3789
+ * Start an entity upgrade for the given workspace. Auto-provisions
3790
+ * a new toll-free number + messaging profile and submits to the
3791
+ * carrier for review. Returns the pending verification details.
3792
+ *
3793
+ * The current toll-free number continues sending throughout the
3794
+ * 1-2 week carrier review; on approval, an atomic swap promotes
3795
+ * the new number.
3796
+ */
3797
+ async start(workspaceId, params, options) {
3798
+ const form = new FormData();
3799
+ for (const [k, v] of Object.entries(params)) {
3800
+ if (v === void 0 || v === null) continue;
3801
+ form.append(k, typeof v === "boolean" ? String(v) : v);
3802
+ }
3803
+ if (options?.einDoc) {
3804
+ const blob = new Blob([options.einDoc.buffer], {
3805
+ type: options.einDoc.contentType || "application/pdf"
3806
+ });
3807
+ form.append(
3808
+ "einDoc",
3809
+ blob,
3810
+ options.einDoc.filename || "ein-doc.pdf"
3811
+ );
3812
+ }
3813
+ return this.http.requestFormData(
3814
+ `/workspaces/${encodeURIComponent(workspaceId)}/upgrade`,
3815
+ form
3816
+ );
3817
+ }
3818
+ /**
3819
+ * Check whether the given workspace has a pending entity upgrade.
3820
+ * Returns `{ pending: null }` if no upgrade is in flight.
3821
+ */
3822
+ async status(workspaceId) {
3823
+ return this.http.request({
3824
+ method: "GET",
3825
+ path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/status`
3826
+ });
3827
+ }
3828
+ /**
3829
+ * Cancel a pending entity upgrade for the given workspace. Releases
3830
+ * the reserved toll-free number, deletes the new messaging profile,
3831
+ * and removes the stored EIN document. Idempotent.
3832
+ */
3833
+ async cancel(workspaceId) {
3834
+ return this.http.request({
3835
+ method: "POST",
3836
+ path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/cancel`
3837
+ });
3838
+ }
3839
+ /**
3840
+ * Resubmit a rejected (or waiting-for-customer) entity upgrade with
3841
+ * updated fields and optionally a new EIN document.
3842
+ */
3843
+ async resubmit(workspaceId, params, options) {
3844
+ const form = new FormData();
3845
+ for (const [k, v] of Object.entries(params)) {
3846
+ if (v === void 0 || v === null) continue;
3847
+ form.append(k, typeof v === "boolean" ? String(v) : v);
3848
+ }
3849
+ if (options?.einDoc) {
3850
+ const blob = new Blob([options.einDoc.buffer], {
3851
+ type: options.einDoc.contentType || "application/pdf"
3852
+ });
3853
+ form.append(
3854
+ "einDoc",
3855
+ blob,
3856
+ options.einDoc.filename || "ein-doc.pdf"
3857
+ );
3858
+ }
3859
+ return this.http.requestFormData(
3860
+ `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/resubmit`,
3861
+ form
3862
+ );
3863
+ }
3864
+ /**
3865
+ * After a successful entity-upgrade approval, choose what happens to
3866
+ * the old toll-free number:
3867
+ *
3868
+ * - `moved`: keep it active under another workspace owned by the
3869
+ * same user (requires `targetWorkspaceId`)
3870
+ * - `released`: return it to the carrier pool
3871
+ */
3872
+ async setDisposition(workspaceId, body) {
3873
+ return this.http.request({
3874
+ method: "POST",
3875
+ path: `/workspaces/${encodeURIComponent(workspaceId)}/upgrade/disposition`,
3876
+ body: {
3877
+ disposition: body.disposition,
3878
+ targetOrgId: body.targetWorkspaceId
3879
+ }
3880
+ });
3881
+ }
3882
+ };
3883
+
3760
3884
  // src/client.ts
3761
3885
  var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
3762
3886
  var DEFAULT_TIMEOUT2 = 3e4;
@@ -3935,6 +4059,31 @@ var Sendly = class {
3935
4059
  * ```
3936
4060
  */
3937
4061
  enterprise;
4062
+ /**
4063
+ * Business Upgrade resource — toll-free entity-upgrade flow.
4064
+ *
4065
+ * @example
4066
+ * ```typescript
4067
+ * // Preview a candidate upgrade before submitting
4068
+ * const preview = await sendly.businessUpgrade.preflight({
4069
+ * businessName: "Acme Holdings LLC",
4070
+ * brn: "12-3456789",
4071
+ * brnType: "EIN",
4072
+ * brnCountry: "US",
4073
+ * entityType: "PRIVATE_PROFIT",
4074
+ * });
4075
+ *
4076
+ * // Start an upgrade — auto-reserves a new toll-free number
4077
+ * const { pendingVerificationId } = await sendly.businessUpgrade.start("ws_abc", {
4078
+ * businessName: "Acme Holdings LLC",
4079
+ * brn: "12-3456789",
4080
+ * brnType: "EIN",
4081
+ * brnCountry: "US",
4082
+ * entityType: "PRIVATE_PROFIT",
4083
+ * }, { einDoc: { buffer: pdfBuffer } });
4084
+ * ```
4085
+ */
4086
+ businessUpgrade;
3938
4087
  http;
3939
4088
  config;
3940
4089
  /**
@@ -3978,6 +4127,7 @@ var Sendly = class {
3978
4127
  this.contacts = new ContactsResource(this.http);
3979
4128
  this.media = new MediaResource(this.http);
3980
4129
  this.enterprise = new EnterpriseResource(this.http);
4130
+ this.businessUpgrade = new BusinessUpgradeResource(this.http);
3981
4131
  }
3982
4132
  /**
3983
4133
  * Check if the client is using a test API key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendly/node",
3
- "version": "3.31.0",
3
+ "version": "3.33.0",
4
4
  "description": "Official Sendly Node.js SDK for SMS messaging",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",