@gravity-rail/sdk 0.11.0 → 0.12.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.
@@ -4724,24 +4724,24 @@ var OrgApi = class extends BaseApiClient {
4724
4724
  return this.fetch(`o/${orgUuid}/phone-numbers/a2p/status`);
4725
4725
  }
4726
4726
  /**
4727
- * Start org-level A2P brand registration.
4727
+ * Start A2P brand registration under a legal entity. `legalEntityUuid`
4728
+ * is required — brands register per legal entity (Customer Profile);
4729
+ * there is no primary-entity fallback.
4728
4730
  */
4729
- async startA2PRegistration(orgUuid, brandName, brandDescription) {
4730
- return this.fetch(
4731
- `o/${orgUuid}/phone-numbers/a2p/start`,
4732
- {
4733
- method: "POST",
4734
- body: JSON.stringify({ brandName, brandDescription })
4735
- }
4736
- );
4731
+ async startA2PRegistration(orgUuid, legalEntityUuid, brandName, brandDescription) {
4732
+ return this.fetch(`o/${orgUuid}/phone-numbers/a2p/start`, {
4733
+ method: "POST",
4734
+ body: JSON.stringify({ legalEntityUuid, brandName, brandDescription })
4735
+ });
4737
4736
  }
4738
4737
  /**
4739
- * Approve sample messages for the org's A2P campaign.
4738
+ * Approve sample messages for one brand's A2P campaign. Signals the
4739
+ * brand's registration workflow to create the TCR campaign.
4740
4740
  */
4741
- async approveA2PMessages(orgUuid, sampleMessages) {
4741
+ async approveA2PMessages(orgUuid, brandUuid, sampleMessages) {
4742
4742
  return this.fetch(`o/${orgUuid}/phone-numbers/a2p/approve-messages`, {
4743
4743
  method: "POST",
4744
- body: JSON.stringify({ sampleMessages })
4744
+ body: JSON.stringify({ brandUuid, sampleMessages })
4745
4745
  });
4746
4746
  }
4747
4747
  // ============================================================================
@@ -4757,8 +4757,8 @@ var OrgApi = class extends BaseApiClient {
4757
4757
  * which is impossible (lifecycle status is one of `draft` /
4758
4758
  * `pending-review` / `in-review` / `twilio-approved` / `twilio-rejected`).
4759
4759
  */
4760
- async getBusinessProfile(orgUuid) {
4761
- return this.fetch(`o/${orgUuid}/business-profile`);
4760
+ async getBusinessProfile(orgUuid, legalEntityUuid) {
4761
+ return this.fetch(businessProfilePath(orgUuid, legalEntityUuid));
4762
4762
  }
4763
4763
  /**
4764
4764
  * Upsert the org's business profile. Idempotent via cached SIDs.
@@ -4766,8 +4766,8 @@ var OrgApi = class extends BaseApiClient {
4766
4766
  * compliance evaluation result so the frontend can immediately enable
4767
4767
  * Submit without a second round-trip.
4768
4768
  */
4769
- async updateBusinessProfile(orgUuid, data) {
4770
- return this.fetch(`o/${orgUuid}/business-profile`, {
4769
+ async updateBusinessProfile(orgUuid, data, legalEntityUuid) {
4770
+ return this.fetch(businessProfilePath(orgUuid, legalEntityUuid), {
4771
4771
  method: "PUT",
4772
4772
  body: JSON.stringify(data)
4773
4773
  });
@@ -4777,20 +4777,46 @@ var OrgApi = class extends BaseApiClient {
4777
4777
  * compliance live and returns 412 if the profile is not currently
4778
4778
  * `compliant`; returns 409 if a review is already in flight.
4779
4779
  */
4780
- async submitBusinessProfile(orgUuid) {
4781
- return this.fetch(`o/${orgUuid}/business-profile/submit`, {
4782
- method: "POST"
4783
- });
4780
+ async submitBusinessProfile(orgUuid, legalEntityUuid) {
4781
+ return this.fetch(
4782
+ `${businessProfilePath(orgUuid, legalEntityUuid)}/submit`,
4783
+ { method: "POST" }
4784
+ );
4784
4785
  }
4785
4786
  /**
4786
4787
  * Cancel an in-flight Twilio review. Resets the cached profile state
4787
4788
  * to `draft` so the user can edit and resubmit.
4788
4789
  */
4789
- async cancelBusinessProfile(orgUuid) {
4790
- return this.fetch(`o/${orgUuid}/business-profile/cancel`, {
4791
- method: "POST"
4790
+ async cancelBusinessProfile(orgUuid, legalEntityUuid) {
4791
+ return this.fetch(
4792
+ `${businessProfilePath(orgUuid, legalEntityUuid)}/cancel`,
4793
+ { method: "POST" }
4794
+ );
4795
+ }
4796
+ // ============================================================================
4797
+ // Legal entities (Twilio Secondary Customer Profiles)
4798
+ // ============================================================================
4799
+ /** List the org's legal entities (one Customer Profile each). */
4800
+ async listLegalEntities(orgUuid) {
4801
+ return this.fetch(`o/${orgUuid}/legal-entities`);
4802
+ }
4803
+ /** Create a legal entity. Its business profile is edited via the entity-scoped business-profile methods. */
4804
+ async createLegalEntity(orgUuid, data) {
4805
+ return this.fetch(`o/${orgUuid}/legal-entities`, {
4806
+ method: "POST",
4807
+ body: JSON.stringify(data)
4792
4808
  });
4793
4809
  }
4810
+ async getLegalEntity(orgUuid, legalEntityUuid) {
4811
+ return this.fetch(`o/${orgUuid}/legal-entities/${legalEntityUuid}`);
4812
+ }
4813
+ /**
4814
+ * Brand detail with live registration-workflow state (`workflowStatus`,
4815
+ * `pendingSampleMessages`) for the sample-approval step.
4816
+ */
4817
+ async getA2PBrand(orgUuid, brandUuid) {
4818
+ return this.fetch(`o/${orgUuid}/a2p-brands/${brandUuid}`);
4819
+ }
4794
4820
  /**
4795
4821
  * List the org's A2P brands (broker resources). The SMS-consent editor uses
4796
4822
  * this to pick which brand's consent config to edit.
@@ -4894,6 +4920,9 @@ var OrgApi = class extends BaseApiClient {
4894
4920
  );
4895
4921
  }
4896
4922
  };
4923
+ function businessProfilePath(orgUuid, legalEntityUuid) {
4924
+ return legalEntityUuid ? `o/${orgUuid}/legal-entities/${legalEntityUuid}/business-profile` : `o/${orgUuid}/business-profile`;
4925
+ }
4897
4926
 
4898
4927
  // src/api/oauth.ts
4899
4928
  function getOAuthPath(providerSlug, action) {
@@ -6186,11 +6215,11 @@ var SubscriptionsApi = class extends BaseApiClient {
6186
6215
  * customer, and subscription are created on payment by the checkout
6187
6216
  * completion handler.
6188
6217
  */
6189
- async createCheckoutSession(productId, planPeriod = "month") {
6218
+ async createCheckoutSession(productId, planPeriod = "month", options = {}) {
6190
6219
  return this.fetch(`subscriptions/checkout-session`, {
6191
6220
  method: "POST",
6192
6221
  credentials: "include",
6193
- body: JSON.stringify({ productId, planPeriod }),
6222
+ body: JSON.stringify({ productId, planPeriod, ...options }),
6194
6223
  headers: { "Content-Type": "application/json" }
6195
6224
  });
6196
6225
  }
@@ -6247,12 +6276,15 @@ var SubscriptionsApi = class extends BaseApiClient {
6247
6276
  return this.fetch(`subscriptions/${subscriptionId}/items`);
6248
6277
  }
6249
6278
  /** Purchase extra credits on a subscription (org-level). */
6250
- async purchaseCredits(subscriptionId, amountCents) {
6279
+ async purchaseCredits(subscriptionId, amountCents, idempotencyKey = crypto.randomUUID()) {
6251
6280
  return this.fetch(`subscriptions/${subscriptionId}/purchase-credits`, {
6252
6281
  method: "POST",
6253
6282
  credentials: "include",
6254
6283
  body: JSON.stringify({ amount_cents: amountCents }),
6255
- headers: { "Content-Type": "application/json" }
6284
+ headers: {
6285
+ "Content-Type": "application/json",
6286
+ "Idempotency-Key": idempotencyKey
6287
+ }
6256
6288
  });
6257
6289
  }
6258
6290
  };
@@ -6395,6 +6427,13 @@ var CustomersApi = class extends BaseApiClient {
6395
6427
  async getMyCustomerInvoices(uuid) {
6396
6428
  return this.fetch(`customers/${uuid}/invoices`);
6397
6429
  }
6430
+ async createMyCustomerPortalSession(uuid, returnUrl) {
6431
+ return this.fetch(`customers/${uuid}/stripe/portal-session`, {
6432
+ method: "POST",
6433
+ body: JSON.stringify({ returnUrl }),
6434
+ headers: { "Content-Type": "application/json" }
6435
+ });
6436
+ }
6398
6437
  async updateMyCustomer(uuid, data) {
6399
6438
  return this.fetch(`customers/${uuid}`, {
6400
6439
  method: "PUT",
@@ -6412,7 +6451,8 @@ var CustomersApi = class extends BaseApiClient {
6412
6451
  async attachMyCustomerPaymentMethod(uuid, paymentMethodId, setAsDefault = false) {
6413
6452
  return this.fetch(`customers/${uuid}/stripe/payment-methods/${paymentMethodId}/attach`, {
6414
6453
  method: "POST",
6415
- body: JSON.stringify({ setAsDefault })
6454
+ body: JSON.stringify({ setAsDefault }),
6455
+ headers: { "Content-Type": "application/json" }
6416
6456
  });
6417
6457
  }
6418
6458
  async detachMyCustomerPaymentMethod(uuid, paymentMethodId) {
@@ -7411,6 +7451,7 @@ var EventRuleObjectType = /* @__PURE__ */ ((EventRuleObjectType2) => {
7411
7451
  EventRuleObjectType2["CALENDAR_EVENT_TYPE"] = "calendar_event_type";
7412
7452
  EventRuleObjectType2["JOURNEY"] = "journey";
7413
7453
  EventRuleObjectType2["CALL"] = "call";
7454
+ EventRuleObjectType2["VOICEMAIL"] = "voicemail";
7414
7455
  return EventRuleObjectType2;
7415
7456
  })(EventRuleObjectType || {});
7416
7457
  var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
@@ -7442,6 +7483,7 @@ var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
7442
7483
  EventRuleEventType2["CALL_STARTED"] = "call:started";
7443
7484
  EventRuleEventType2["CALL_COMPLETED"] = "call:completed";
7444
7485
  EventRuleEventType2["CALL_SUMMARY"] = "call:summary";
7486
+ EventRuleEventType2["VOICEMAIL_RECEIVED"] = "voicemail:received";
7445
7487
  return EventRuleEventType2;
7446
7488
  })(EventRuleEventType || {});
7447
7489
  var EventRuleActionType = /* @__PURE__ */ ((EventRuleActionType2) => {
@@ -7492,11 +7534,9 @@ var WorkspaceFeature = /* @__PURE__ */ ((WorkspaceFeature2) => {
7492
7534
  WorkspaceFeature2["BROWSER"] = "browser";
7493
7535
  WorkspaceFeature2["WEB_SEARCH"] = "web_search";
7494
7536
  WorkspaceFeature2["CALENDAR"] = "calendar";
7495
- WorkspaceFeature2["DIRECT_MESSAGES"] = "direct_messages";
7496
7537
  WorkspaceFeature2["JOURNEYS"] = "journeys";
7497
7538
  WorkspaceFeature2["EXPERIMENTS"] = "experiments";
7498
7539
  WorkspaceFeature2["OPERATOR"] = "operator";
7499
- WorkspaceFeature2["PRESENCE"] = "presence";
7500
7540
  WorkspaceFeature2["GMAIL"] = "gmail";
7501
7541
  WorkspaceFeature2["GCALENDAR"] = "gcalendar";
7502
7542
  WorkspaceFeature2["MONDAY"] = "monday";
@@ -10337,6 +10377,7 @@ function bindCustomersMethods(target, customers) {
10337
10377
  target.getMyCustomerAccounts = customers.getMyCustomerAccounts.bind(customers);
10338
10378
  target.getMyCustomerSubscriptions = customers.getMyCustomerSubscriptions.bind(customers);
10339
10379
  target.getMyCustomerInvoices = customers.getMyCustomerInvoices.bind(customers);
10380
+ target.createMyCustomerPortalSession = customers.createMyCustomerPortalSession.bind(customers);
10340
10381
  target.updateMyCustomer = customers.updateMyCustomer.bind(customers);
10341
10382
  target.createMyCustomerSetupIntent = customers.createMyCustomerSetupIntent.bind(customers);
10342
10383
  target.getMyCustomerPaymentMethods = customers.getMyCustomerPaymentMethods.bind(customers);
@@ -11323,6 +11364,7 @@ var GravityRailClient = class {
11323
11364
  getMyCustomerAccounts;
11324
11365
  getMyCustomerSubscriptions;
11325
11366
  getMyCustomerInvoices;
11367
+ createMyCustomerPortalSession;
11326
11368
  updateMyCustomer;
11327
11369
  createMyCustomerSetupIntent;
11328
11370
  getMyCustomerPaymentMethods;
@@ -12885,4 +12927,4 @@ export {
12885
12927
  SCOPE_PRESETS,
12886
12928
  getRevisionState
12887
12929
  };
12888
- //# sourceMappingURL=chunk-YESHLUL7.js.map
12930
+ //# sourceMappingURL=chunk-LODUVCW6.js.map