@gravity-rail/sdk 3.2.0 → 4.0.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.
Files changed (38) hide show
  1. package/README.md +16 -1
  2. package/dist/{chat-interaction-Cc9hQNyx.d.ts → chat-interaction-DXgKjFqZ.d.cts} +490 -522
  3. package/dist/{chat-interaction-CoHsIqyX.d.cts → chat-interaction-a7U-tHfQ.d.ts} +490 -522
  4. package/dist/{chunk-MAPAZORN.js → chunk-WHRIIBJ4.js} +181 -144
  5. package/dist/chunk-WHRIIBJ4.js.map +1 -0
  6. package/dist/{chunk-RLFS7O2L.js → chunk-ZLF3N3ZD.js} +183 -81
  7. package/dist/chunk-ZLF3N3ZD.js.map +1 -0
  8. package/dist/helpers.cjs.map +1 -1
  9. package/dist/helpers.d.cts +2 -2
  10. package/dist/helpers.d.ts +2 -2
  11. package/dist/helpers.js +1 -1
  12. package/dist/index.cjs +339 -220
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +6 -6
  15. package/dist/index.d.ts +6 -6
  16. package/dist/index.js +2 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/internal.cjs +367 -224
  19. package/dist/internal.cjs.map +1 -1
  20. package/dist/internal.d.cts +45 -9
  21. package/dist/internal.d.ts +45 -9
  22. package/dist/internal.js +14 -6
  23. package/dist/internal.js.map +1 -1
  24. package/dist/{member-import-9h52_4KO.d.cts → member-import-BHtOru8g.d.cts} +1 -1
  25. package/dist/{member-import-BWyl88Qx.d.ts → member-import-VOLKR5dY.d.ts} +1 -1
  26. package/dist/{path-ChuuGGLG.d.ts → path-B3b3_El9.d.cts} +36 -18
  27. package/dist/{path-CXnjBalr.d.cts → path-CUY-Iw70.d.ts} +36 -18
  28. package/dist/schemas.cjs +2 -4
  29. package/dist/schemas.cjs.map +1 -1
  30. package/dist/schemas.d.cts +5 -6
  31. package/dist/schemas.d.ts +5 -6
  32. package/dist/schemas.js +2 -4
  33. package/dist/schemas.js.map +1 -1
  34. package/dist/{tasks-B7tIHQcS.d.cts → tasks-CgptqCsN.d.cts} +13 -45
  35. package/dist/{tasks-B7tIHQcS.d.ts → tasks-CgptqCsN.d.ts} +13 -45
  36. package/package.json +3 -3
  37. package/dist/chunk-MAPAZORN.js.map +0 -1
  38. package/dist/chunk-RLFS7O2L.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -341,21 +341,20 @@ function parseOrgAuthChallenge(wwwAuthenticate) {
341
341
  if (!wwwAuthenticate.includes('realm="org"')) return null;
342
342
  const orgUuidMatch = wwwAuthenticate.match(/org_uuid="([^"]+)"/);
343
343
  const authUrlMatch = wwwAuthenticate.match(/auth_url="([^"]+)"/);
344
+ const acrValues = wwwAuthenticate.match(/acr_values="([^"]*)"/)?.[1]?.trim().split(/\s+/).filter(Boolean);
344
345
  if (!orgUuidMatch?.[1] || !authUrlMatch?.[1]) {
345
346
  console.warn("Invalid org auth challenge header: missing required fields");
346
347
  return null;
347
348
  }
348
349
  return {
349
350
  orgUuid: orgUuidMatch[1],
350
- authUrl: authUrlMatch[1]
351
+ authUrl: authUrlMatch[1],
352
+ ...acrValues?.length ? { acrValues } : {}
351
353
  };
352
354
  }
353
- function orgAuthHeaderName(token) {
354
- return token.startsWith("gr_sess_") ? "X-Org-Session" : "X-Org-Token";
355
- }
356
355
  function setOrgAuthHeader(headers, token) {
357
356
  if (!token) return;
358
- headers.set(orgAuthHeaderName(token), token);
357
+ headers.set("X-Org-Session", token);
359
358
  }
360
359
  var BaseApiClient = class {
361
360
  baseUrl;
@@ -366,13 +365,13 @@ var BaseApiClient = class {
366
365
  enhancedAuthInProgress = null;
367
366
  orgAuthHandler;
368
367
  orgAuthInProgress = null;
368
+ orgSessionRevision = 0;
369
+ orgSessionRejectionHandler;
369
370
  orgSession;
370
371
  /**
371
- * The org_uuid that issued the current org auth credential. Tracked so we can detect
372
- * a 401 challenge from a *different* org and re-fire the handler — the
373
- * credential is opaque to the client, so without this the original guard
374
- * `!this.orgSession` would prevent re-auth across orgs and surface as a silent
375
- * 401 in multi-org CLI workflows.
372
+ * Optional issuer context supplied with an opaque credential. A handler
373
+ * cannot complete a challenge with a session explicitly bound to another org.
374
+ * The server remains responsible for validating the credential itself.
376
375
  */
377
376
  orgSessionOrgUuid;
378
377
  constructor(apiKey, baseUrl, customFetch) {
@@ -407,24 +406,25 @@ var BaseApiClient = class {
407
406
  }
408
407
  /**
409
408
  * Set the opaque org session credential a bearer client sends as `X-Org-Session`.
410
- * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
411
- * use X-Org-Token through setOrgToken() during the migration window.
409
+ * Only opaque `gr_sess_` credentials are supported. A legacy org token
410
+ * raises an error; sign in to the organization again to obtain a session.
411
+ * Pass `undefined` to clear the session.
412
412
  *
413
- * `orgUuid` is the org that issued the credential; passing it lets the 401
414
- * handler detect a stale session when a subsequent request targets a
415
- * different org and re-fire the org-auth handler instead of silently
416
- * 401-ing. Callers without that context (legacy / unknown) may omit it.
413
+ * `orgUuid` is the org that issued the credential. When supplied by an
414
+ * org-auth handler, it must match the challenge the handler completes.
415
+ * Callers without that context may omit it. Any rejected credential can
416
+ * trigger one reauthentication attempt, including for the same org.
417
417
  */
418
418
  setOrgSession(session, orgUuid) {
419
+ if (session !== void 0 && !/^gr_sess_[A-Za-z0-9_-]+$/.test(session)) {
420
+ throw new Error(
421
+ "Unsupported organization session. Sign in again to obtain an opaque gr_sess_ credential."
422
+ );
423
+ }
424
+ this.orgSessionRejectionHandler = void 0;
419
425
  this.orgSession = session;
420
426
  this.orgSessionOrgUuid = session ? orgUuid : void 0;
421
- }
422
- /**
423
- * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
424
- * Prefer setOrgSession() for opaque org browser sessions.
425
- */
426
- setOrgToken(token, orgUuid) {
427
- this.setOrgSession(token, orgUuid);
427
+ this.orgSessionRevision += 1;
428
428
  }
429
429
  /**
430
430
  * The `credentials` a request carries: none for a bearer client (the fetch
@@ -435,33 +435,99 @@ var BaseApiClient = class {
435
435
  }
436
436
  /**
437
437
  * Run the org-auth handler once for concurrent challenges. A bearer client's
438
- * handler sets the org session with `setOrgSession`; a same-origin session's
438
+ * handler returns a candidate; a same-origin session's
439
439
  * handler leaves an httpOnly org-session cookie on the page's origin instead,
440
440
  * which the retry presents. A bearer client whose handler issued nothing has
441
441
  * nothing to retry with.
442
442
  */
443
- async answerOrgAuthChallenge(orgAuthInfo) {
443
+ async answerOrgAuthChallenge(info, presented, requestRevision) {
444
444
  const handler = this.orgAuthHandler;
445
- if (!handler) return;
446
- if (!this.orgAuthInProgress) {
447
- this.orgAuthInProgress = (async () => {
448
- try {
449
- await handler(orgAuthInfo);
450
- } finally {
451
- this.orgAuthInProgress = null;
452
- }
453
- })();
445
+ if (!handler) throw new ApiError("Organization authentication handler is unavailable", 401);
446
+ if (this.orgAuthInProgress) {
447
+ if (this.orgAuthInProgress.orgUuid !== info.orgUuid || this.orgAuthInProgress.requestRevision !== requestRevision) {
448
+ throw new ApiError(
449
+ "Organization authentication context changed. Retry the request.",
450
+ 401
451
+ );
452
+ }
453
+ return this.orgAuthInProgress.promise;
454
454
  }
455
- await this.orgAuthInProgress;
456
- if (this.orgSession) {
457
- this.orgSessionOrgUuid = orgAuthInfo.orgUuid;
458
- return;
455
+ if (this.orgSessionRevision !== requestRevision) {
456
+ throw new ApiError("Organization authentication context changed. Retry the request.", 401);
457
+ }
458
+ this.clearOrgSessionIfCurrent(presented);
459
+ const attemptRevision = this.orgSessionRevision;
460
+ const promise = Promise.resolve().then(() => handler(info)).then((candidate) => {
461
+ if (this.orgSessionRevision !== attemptRevision) {
462
+ throw new ApiError(
463
+ "Organization authentication context changed. Retry the request.",
464
+ 401
465
+ );
466
+ }
467
+ if (candidate === void 0) {
468
+ if (this.apiKey) {
469
+ throw new ApiError(
470
+ "Organization authentication must return a session candidate",
471
+ 401
472
+ );
473
+ }
474
+ return "cookie";
475
+ }
476
+ if (!candidate || typeof candidate.session !== "string" || candidate.source !== "cache" && candidate.source !== "new") {
477
+ throw new ApiError(
478
+ "Organization authentication returned an invalid session candidate",
479
+ 401
480
+ );
481
+ }
482
+ if (candidate.orgUuid !== info.orgUuid) {
483
+ throw new ApiError(
484
+ "Organization authentication issued a session for another organization",
485
+ 401
486
+ );
487
+ }
488
+ if (candidate.source === "cache" && info.sessionRejected) {
489
+ throw new ApiError(
490
+ "Organization authentication requires a newly issued session after rejection",
491
+ 401
492
+ );
493
+ }
494
+ this.setOrgSession(candidate.session, candidate.orgUuid);
495
+ let rejected = false;
496
+ this.orgSessionRejectionHandler = () => {
497
+ if (rejected) return;
498
+ rejected = true;
499
+ candidate.onRejected?.();
500
+ };
501
+ return candidate.source;
502
+ }).finally(() => {
503
+ if (this.orgAuthInProgress?.promise === promise) this.orgAuthInProgress = null;
504
+ });
505
+ this.orgAuthInProgress = { orgUuid: info.orgUuid, requestRevision, promise };
506
+ return promise;
507
+ }
508
+ assertOrgAuthContext(orgUuid) {
509
+ if (this.orgSession && this.orgSessionOrgUuid !== orgUuid || this.apiKey && !this.orgSession) {
510
+ throw new ApiError("Organization authentication context changed. Retry the request.", 401);
459
511
  }
460
- if (this.apiKey) {
461
- throw new ApiError("Organization authentication did not issue a session", 401);
512
+ }
513
+ notifyOrgSessionRejected(presented, callback) {
514
+ try {
515
+ callback?.();
516
+ } catch {
517
+ this.clearOrgSessionIfCurrent(presented);
518
+ throw new ApiError("Could not discard rejected organization session", 401);
462
519
  }
463
520
  }
464
- async fetch(endpoint, options, orgAuthRetry = false) {
521
+ hasNewerOrgSession(presented, orgUuid) {
522
+ return Boolean(
523
+ presented && this.orgSession && this.orgSession !== presented && this.orgSessionOrgUuid === orgUuid
524
+ );
525
+ }
526
+ clearOrgSessionIfCurrent(expected) {
527
+ if (this.orgSession !== expected || this.orgSession === void 0) return;
528
+ this.setOrgSession(void 0);
529
+ }
530
+ async fetch(endpoint, options, orgAuthRetriesRemaining = this.apiKey && !this.orgSession ? 2 : 1, enhancedAuthRetry = false) {
465
531
  try {
466
532
  const headers = new Headers({
467
533
  // Don't set Content-Type for FormData — the browser must set it
@@ -473,6 +539,10 @@ var BaseApiClient = class {
473
539
  headers.set("Authorization", `Bearer ${this.apiKey}`);
474
540
  }
475
541
  setOrgAuthHeader(headers, this.orgSession);
542
+ const presentedOrgSession = headers.get("X-Org-Session");
543
+ const requestOrgRevision = this.orgSessionRevision;
544
+ const presentedOrgUuid = this.orgSessionOrgUuid;
545
+ const rejectionHandler = this.orgSessionRejectionHandler;
476
546
  const fullUrl = `${this.baseUrl}/api/v2/${endpoint}`;
477
547
  const response = await this.fetchFunction(fullUrl, {
478
548
  ...options,
@@ -481,7 +551,7 @@ var BaseApiClient = class {
481
551
  headers
482
552
  });
483
553
  if (!response.ok) {
484
- if (response.status === 401 && requiresStepUpAuth(response.headers.get("WWW-Authenticate")) && this.enhancedAuthHandler) {
554
+ if (response.status === 401 && !enhancedAuthRetry && requiresStepUpAuth(response.headers.get("WWW-Authenticate")) && this.enhancedAuthHandler) {
485
555
  if (this.enhancedAuthInProgress) {
486
556
  await this.enhancedAuthInProgress;
487
557
  } else {
@@ -493,28 +563,36 @@ var BaseApiClient = class {
493
563
  this.enhancedAuthInProgress = null;
494
564
  }
495
565
  }
496
- try {
497
- return await this.fetch(endpoint, options);
498
- } catch (retryError) {
499
- this.orgSession = void 0;
500
- this.orgSessionOrgUuid = void 0;
501
- throw retryError;
502
- }
566
+ return await this.fetch(endpoint, options, orgAuthRetriesRemaining, true);
503
567
  }
504
568
  if (response.status === 401) {
505
569
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
506
- if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
507
- this.orgSession = void 0;
508
- this.orgSessionOrgUuid = void 0;
570
+ if (orgAuthInfo && presentedOrgSession) {
571
+ orgAuthInfo.sessionRejected = true;
572
+ if (presentedOrgUuid === orgAuthInfo.orgUuid) {
573
+ this.notifyOrgSessionRejected(presentedOrgSession, rejectionHandler);
574
+ }
509
575
  }
510
- if (orgAuthInfo && !this.orgSession && !orgAuthRetry && this.orgAuthHandler) {
511
- await this.answerOrgAuthChallenge(orgAuthInfo);
512
- try {
513
- return await this.fetch(endpoint, options, true);
514
- } catch (retryError) {
515
- this.orgSession = void 0;
516
- this.orgSessionOrgUuid = void 0;
517
- throw retryError;
576
+ if (orgAuthInfo && orgAuthRetriesRemaining > 0 && this.orgAuthHandler) {
577
+ let nextOrgRetries = orgAuthRetriesRemaining - 1;
578
+ if (!this.hasNewerOrgSession(presentedOrgSession, orgAuthInfo.orgUuid)) {
579
+ const completion = await this.answerOrgAuthChallenge(
580
+ orgAuthInfo,
581
+ presentedOrgSession,
582
+ requestOrgRevision
583
+ );
584
+ if (completion !== "cache") nextOrgRetries = 0;
585
+ }
586
+ this.assertOrgAuthContext(orgAuthInfo.orgUuid);
587
+ return await this.fetch(endpoint, options, nextOrgRetries, enhancedAuthRetry);
588
+ }
589
+ if (orgAuthInfo) {
590
+ this.clearOrgSessionIfCurrent(presentedOrgSession);
591
+ if (orgAuthInfo.acrValues?.includes("urn:gravity:mfa")) {
592
+ throw new ApiError(
593
+ "Organization sign-in still requires MFA. Complete MFA with your account or configured identity provider. For SSO, verify that the provider requires MFA and returns verified method evidence.",
594
+ 401
595
+ );
518
596
  }
519
597
  }
520
598
  }
@@ -576,7 +654,7 @@ ${formattedErrors}`, response.status);
576
654
  throw error;
577
655
  }
578
656
  }
579
- async fetchRaw(endpoint, options, allowedErrorStatuses = [], orgAuthRetry = false) {
657
+ async fetchRaw(endpoint, options, allowedErrorStatuses = [], orgAuthRetriesRemaining = this.apiKey && !this.orgSession ? 2 : 1, enhancedAuthRetry = false) {
580
658
  try {
581
659
  const headers = new Headers({
582
660
  ...options?.headers || {}
@@ -588,6 +666,10 @@ ${formattedErrors}`, response.status);
588
666
  headers.set("Authorization", `Bearer ${this.apiKey}`);
589
667
  }
590
668
  setOrgAuthHeader(headers, this.orgSession);
669
+ const presentedOrgSession = headers.get("X-Org-Session");
670
+ const requestOrgRevision = this.orgSessionRevision;
671
+ const presentedOrgUuid = this.orgSessionOrgUuid;
672
+ const rejectionHandler = this.orgSessionRejectionHandler;
591
673
  const response = await this.fetchFunction(`${this.baseUrl}/api/v2/${endpoint}`, {
592
674
  ...options,
593
675
  ...this.credentialsInit(),
@@ -595,7 +677,7 @@ ${formattedErrors}`, response.status);
595
677
  headers
596
678
  });
597
679
  if (!response.ok) {
598
- if (response.status === 401 && requiresStepUpAuth(response.headers.get("WWW-Authenticate")) && this.enhancedAuthHandler) {
680
+ if (response.status === 401 && !enhancedAuthRetry && requiresStepUpAuth(response.headers.get("WWW-Authenticate")) && this.enhancedAuthHandler) {
599
681
  if (this.enhancedAuthInProgress) {
600
682
  await this.enhancedAuthInProgress;
601
683
  } else {
@@ -607,28 +689,48 @@ ${formattedErrors}`, response.status);
607
689
  this.enhancedAuthInProgress = null;
608
690
  }
609
691
  }
610
- try {
611
- return await this.fetchRaw(endpoint, options, allowedErrorStatuses);
612
- } catch (retryError) {
613
- this.orgSession = void 0;
614
- this.orgSessionOrgUuid = void 0;
615
- throw retryError;
616
- }
692
+ return await this.fetchRaw(
693
+ endpoint,
694
+ options,
695
+ allowedErrorStatuses,
696
+ orgAuthRetriesRemaining,
697
+ true
698
+ );
617
699
  }
618
700
  if (response.status === 401) {
619
701
  const orgAuthInfo = parseOrgAuthChallenge(response.headers.get("WWW-Authenticate"));
620
- if (orgAuthInfo && this.orgSession && this.orgSessionOrgUuid && this.orgSessionOrgUuid !== orgAuthInfo.orgUuid) {
621
- this.orgSession = void 0;
622
- this.orgSessionOrgUuid = void 0;
702
+ if (orgAuthInfo && presentedOrgSession) {
703
+ orgAuthInfo.sessionRejected = true;
704
+ if (presentedOrgUuid === orgAuthInfo.orgUuid) {
705
+ this.notifyOrgSessionRejected(presentedOrgSession, rejectionHandler);
706
+ }
623
707
  }
624
- if (orgAuthInfo && !this.orgSession && !orgAuthRetry && this.orgAuthHandler) {
625
- await this.answerOrgAuthChallenge(orgAuthInfo);
626
- try {
627
- return await this.fetchRaw(endpoint, options, allowedErrorStatuses, true);
628
- } catch (retryError) {
629
- this.orgSession = void 0;
630
- this.orgSessionOrgUuid = void 0;
631
- throw retryError;
708
+ if (orgAuthInfo && orgAuthRetriesRemaining > 0 && this.orgAuthHandler) {
709
+ let nextOrgRetries = orgAuthRetriesRemaining - 1;
710
+ if (!this.hasNewerOrgSession(presentedOrgSession, orgAuthInfo.orgUuid)) {
711
+ const completion = await this.answerOrgAuthChallenge(
712
+ orgAuthInfo,
713
+ presentedOrgSession,
714
+ requestOrgRevision
715
+ );
716
+ if (completion !== "cache") nextOrgRetries = 0;
717
+ }
718
+ this.assertOrgAuthContext(orgAuthInfo.orgUuid);
719
+ return await this.fetchRaw(
720
+ endpoint,
721
+ options,
722
+ allowedErrorStatuses,
723
+ nextOrgRetries,
724
+ enhancedAuthRetry
725
+ );
726
+ }
727
+ if (orgAuthInfo) {
728
+ this.clearOrgSessionIfCurrent(presentedOrgSession);
729
+ if (!allowedErrorStatuses.includes(401) && orgAuthInfo.acrValues?.includes("urn:gravity:mfa")) {
730
+ throw new ApiError(
731
+ "Organization sign-in still requires MFA. Complete MFA with your account or configured identity provider. For SSO, verify that the provider requires MFA and returns verified method evidence.",
732
+ 401
733
+ );
632
734
  }
633
735
  }
634
736
  }
@@ -1402,6 +1504,21 @@ var ApiKeysApi = class extends BaseApiClient {
1402
1504
  }
1403
1505
  };
1404
1506
 
1507
+ // src/api/app-links.ts
1508
+ var AppLinksApi = class extends BaseApiClient {
1509
+ /**
1510
+ * Resolve an App Link to the concrete chat it opens.
1511
+ *
1512
+ * `linkParams` is the `?with=&mode=&action=&channel=` suffix built from the
1513
+ * link's search params (an empty string when the link carries none). The
1514
+ * resolver re-runs the current session's workspace authorization; the
1515
+ * response is ids and closed-vocabulary enums only, never PHI.
1516
+ */
1517
+ async resolveAppLink(wid, linkParams = "") {
1518
+ return this.fetch(`w/${wid}/app-links/resolve${linkParams}`);
1519
+ }
1520
+ };
1521
+
1405
1522
  // src/api/apps.ts
1406
1523
  var AppsApi = class extends BaseApiClient {
1407
1524
  /**
@@ -3860,13 +3977,6 @@ var EventsApi = class extends BaseApiClient {
3860
3977
  method: "DELETE"
3861
3978
  });
3862
3979
  }
3863
- /** Send a one-off test webhook for an existing webhook event rule. */
3864
- async testWebhook(wid, id, request) {
3865
- return this.fetch(`w/${wid}/event-rules/${id}/test-webhook`, {
3866
- method: "POST",
3867
- body: JSON.stringify(request)
3868
- });
3869
- }
3870
3980
  /** Reorder event rules by specifying the desired rule ID sequence. */
3871
3981
  async reorderEventRules(wid, ruleIds) {
3872
3982
  return this.fetch(`w/${wid}/event-rules/reorder`, {
@@ -3874,19 +3984,6 @@ var EventsApi = class extends BaseApiClient {
3874
3984
  body: JSON.stringify(ruleIds)
3875
3985
  });
3876
3986
  }
3877
- /** List webhook logs with optional filtering by event type and success status. */
3878
- async getWebhookLogs(wid, options = {}) {
3879
- const params = new URLSearchParams();
3880
- if (options.page) params.append("page", options.page.toString());
3881
- if (options.pageSize) params.append("pageSize", options.pageSize.toString());
3882
- if (options.sortBy) params.append("sortBy", options.sortBy);
3883
- if (options.sortOrder) params.append("sortOrder", options.sortOrder);
3884
- if (options.eventType) params.append("eventType", options.eventType);
3885
- if (options.success !== void 0) params.append("success", options.success.toString());
3886
- return this.fetch(
3887
- `w/${wid}/webhook-logs${params.toString() ? `?${params.toString()}` : ""}`
3888
- );
3889
- }
3890
3987
  /** List event rule executions with cursor-based pagination and filtering. */
3891
3988
  async getRuleExecutions(wid, options = {}) {
3892
3989
  const params = new URLSearchParams();
@@ -6921,27 +7018,15 @@ var OrgApi = class extends BaseApiClient {
6921
7018
  method: "DELETE"
6922
7019
  });
6923
7020
  }
6924
- /**
6925
- * Get the billing customer and this organization's billable subscription.
6926
- *
6927
- * `subscriptionId` is the org-scoped row — never pick the customer's
6928
- * newest subscription from the list endpoint. One customer can bill many
6929
- * organizations.
6930
- *
6931
- * Returns the generated `OrgBillingCustomerResponse` — the contract the
6932
- * route actually emits, `audiences` included. The hand-written mirror that
6933
- * used to live here listed four fields and silently dropped `audiences`,
6934
- * so callers could not see the commercial roles they hold (GRA-8792).
6935
- * Regenerate the shape (`yarn generate:types`) rather than re-declaring it.
6936
- */
6937
- async getOrgBillingCustomer(orgIdOrUuid) {
6938
- return this.fetch(`o/${orgIdOrUuid}/billing-customer`);
7021
+ /** Current Organization billing access and billable subscription. */
7022
+ async getOrgBillingAccess(orgIdOrUuid) {
7023
+ return this.fetch(`o/${orgIdOrUuid}/billing-access`);
6939
7024
  }
6940
7025
  /**
6941
7026
  * Per-workspace usage for this organization's current credit window.
6942
7027
  *
6943
- * Requires a billing role on the organization's billing customer — the
6944
- * same gate `getOrgBillingCustomer().hasAccess` reports, and the one that
7028
+ * Requires Organization billing access, the
7029
+ * same gate `getOrgBillingAccess().hasAccess` reports, and the one that
6945
7030
  * decides whether the billing tab is shown at all.
6946
7031
  *
6947
7032
  * `creditsUsed` is a real organization-wide total or it is null; it is
@@ -6984,6 +7069,12 @@ var OrgApi = class extends BaseApiClient {
6984
7069
  body: JSON.stringify(data)
6985
7070
  });
6986
7071
  }
7072
+ async setOrganizationMemberBillingRole(orgUuid, memberId, billingRole) {
7073
+ return this.fetch(`o/${orgUuid}/members/${memberId}/billing-role`, {
7074
+ method: "PUT",
7075
+ body: JSON.stringify({ billingRole })
7076
+ });
7077
+ }
6987
7078
  /**
6988
7079
  * Remove a member from an organization.
6989
7080
  */
@@ -9466,6 +9557,24 @@ var ConnectionSyncApi = class extends BaseApiClient {
9466
9557
 
9467
9558
  // src/api/hubspot.ts
9468
9559
  var HubspotApi = class extends BaseApiClient {
9560
+ async bindHubspotCalendar(wid, calendarId, linkId) {
9561
+ return this.fetch(`w/${wid}/app-connections/hubspot/calendars/${calendarId}/binding`, {
9562
+ method: "PUT",
9563
+ body: JSON.stringify({ linkId })
9564
+ });
9565
+ }
9566
+ async unlinkHubspotCalendar(wid, calendarId) {
9567
+ return this.fetch(`w/${wid}/app-connections/hubspot/calendars/${calendarId}/binding`, {
9568
+ method: "DELETE"
9569
+ });
9570
+ }
9571
+ /** Import one page into native CalendarEvents. Does not book or send invitations. */
9572
+ async importHubspotCalendarEvents(wid, calendarId, eventTypeId) {
9573
+ return this.fetch(`w/${wid}/app-connections/hubspot/calendars/${calendarId}/events/sync`, {
9574
+ method: "POST",
9575
+ body: JSON.stringify({ eventTypeId })
9576
+ });
9577
+ }
9469
9578
  async getHubspotBookingReceipt(wid, meetingId) {
9470
9579
  return this.fetch(
9471
9580
  `w/${wid}/app-connections/hubspot/booking-deals/${encodeURIComponent(meetingId)}/receipt`
@@ -10255,18 +10364,32 @@ var SupportRequestsApi = class extends BaseApiClient {
10255
10364
  }
10256
10365
  };
10257
10366
 
10258
- // src/api/customers.ts
10259
- var CustomersApi = class extends BaseApiClient {
10260
- async getMyCustomers() {
10261
- return this.fetch("customers");
10367
+ // src/api/organization-billing.ts
10368
+ var OrganizationBillingApi = class extends BaseApiClient {
10369
+ async getOrganizationSubscription(orgUuid) {
10370
+ return this.fetch(`o/${orgUuid}/billing/subscription`);
10371
+ }
10372
+ async updateOrganizationCreditSettings(orgUuid, updates) {
10373
+ return this.fetch(`o/${orgUuid}/billing/subscription`, {
10374
+ method: "PUT",
10375
+ body: JSON.stringify(updates),
10376
+ headers: { "Content-Type": "application/json" }
10377
+ });
10262
10378
  }
10263
- async getMyCustomer(uuid) {
10264
- return this.fetch(`customers/${uuid}`);
10379
+ async purchaseOrganizationCredits(orgUuid, amountCents, idempotencyKey = crypto.randomUUID()) {
10380
+ return this.fetch(`o/${orgUuid}/billing/subscription/purchase-credits`, {
10381
+ method: "POST",
10382
+ body: JSON.stringify({ amountCents }),
10383
+ headers: { "Content-Type": "application/json", "Idempotency-Key": idempotencyKey }
10384
+ });
10265
10385
  }
10266
- async getMyCustomerAccounts(uuid) {
10267
- return this.fetch(`customers/${uuid}/accounts`);
10386
+ async getBillingOrganizations() {
10387
+ return this.fetch("o/billing-organizations");
10268
10388
  }
10269
- async getMyCustomerSubscriptions(uuid, opts) {
10389
+ async getOrganizationBilling(uuid) {
10390
+ return this.fetch(`o/${uuid}/billing`);
10391
+ }
10392
+ async getOrganizationBillingSubscriptions(uuid, opts) {
10270
10393
  const params = new URLSearchParams();
10271
10394
  if (opts?.status) params.set("status", opts.status);
10272
10395
  if (opts?.page !== void 0) params.set("page", String(opts.page));
@@ -10275,50 +10398,53 @@ var CustomersApi = class extends BaseApiClient {
10275
10398
  params.set("subscription_id", String(opts.subscriptionId));
10276
10399
  }
10277
10400
  const qs = params.toString();
10278
- return this.fetch(`customers/${uuid}/subscriptions${qs ? "?" + qs : ""}`);
10401
+ return this.fetch(`o/${uuid}/billing/subscriptions${qs ? "?" + qs : ""}`);
10279
10402
  }
10280
- async getMyCustomerInvoices(uuid) {
10281
- return this.fetch(`customers/${uuid}/invoices`);
10403
+ async getOrganizationInvoices(uuid) {
10404
+ return this.fetch(`o/${uuid}/billing/invoices`);
10282
10405
  }
10283
- async createMyCustomerPortalSession(uuid, returnUrl) {
10284
- return this.fetch(`customers/${uuid}/stripe/portal-session`, {
10406
+ async createOrganizationPortalSession(uuid, returnUrl) {
10407
+ return this.fetch(`o/${uuid}/billing/stripe/portal-session`, {
10285
10408
  method: "POST",
10286
10409
  body: JSON.stringify({ returnUrl }),
10287
10410
  headers: { "Content-Type": "application/json" }
10288
10411
  });
10289
10412
  }
10290
- async updateMyCustomer(uuid, data) {
10291
- return this.fetch(`customers/${uuid}`, {
10413
+ async updateOrganizationBilling(uuid, data) {
10414
+ return this.fetch(`o/${uuid}/billing`, {
10292
10415
  method: "PUT",
10293
10416
  body: JSON.stringify(data),
10294
10417
  headers: { "Content-Type": "application/json" }
10295
10418
  });
10296
10419
  }
10297
10420
  // ===== Payment Methods =====
10298
- async createMyCustomerSetupIntent(uuid) {
10299
- return this.fetch(`customers/${uuid}/stripe/setup-intent`, { method: "POST" });
10421
+ async createOrganizationSetupIntent(uuid) {
10422
+ return this.fetch(`o/${uuid}/billing/stripe/setup-intent`, {
10423
+ method: "POST",
10424
+ body: JSON.stringify({})
10425
+ });
10300
10426
  }
10301
- async getMyCustomerPaymentMethods(uuid) {
10302
- return this.fetch(`customers/${uuid}/stripe/payment-methods`);
10427
+ async getOrganizationPaymentMethods(uuid) {
10428
+ return this.fetch(`o/${uuid}/billing/stripe/payment-methods`);
10303
10429
  }
10304
- async attachMyCustomerPaymentMethod(uuid, paymentMethodId, setAsDefault = false) {
10305
- return this.fetch(`customers/${uuid}/stripe/payment-methods/${paymentMethodId}/attach`, {
10430
+ async attachOrganizationPaymentMethod(uuid, paymentMethodId, setAsDefault = false) {
10431
+ return this.fetch(`o/${uuid}/billing/stripe/payment-methods/${paymentMethodId}/attach`, {
10306
10432
  method: "POST",
10307
10433
  body: JSON.stringify({ setAsDefault }),
10308
10434
  headers: { "Content-Type": "application/json" }
10309
10435
  });
10310
10436
  }
10311
- async detachMyCustomerPaymentMethod(uuid, paymentMethodId) {
10312
- return this.fetch(`customers/${uuid}/stripe/payment-methods/${paymentMethodId}`, {
10437
+ async detachOrganizationPaymentMethod(uuid, paymentMethodId) {
10438
+ return this.fetch(`o/${uuid}/billing/stripe/payment-methods/${paymentMethodId}`, {
10313
10439
  method: "DELETE"
10314
10440
  });
10315
10441
  }
10316
- async setDefaultMyCustomerPaymentMethod(uuid, paymentMethodId) {
10317
- return this.fetch(`customers/${uuid}/stripe/payment-methods/${paymentMethodId}/set-default`, {
10442
+ async setDefaultOrganizationPaymentMethod(uuid, paymentMethodId) {
10443
+ return this.fetch(`o/${uuid}/billing/stripe/payment-methods/${paymentMethodId}/set-default`, {
10318
10444
  method: "PUT"
10319
10445
  });
10320
10446
  }
10321
- async getMyCustomerCreditGrants(uuid, opts) {
10447
+ async getOrganizationCreditGrants(uuid, opts) {
10322
10448
  const params = new URLSearchParams();
10323
10449
  if (opts?.subscriptionId !== void 0) {
10324
10450
  params.set("subscription_id", String(opts.subscriptionId));
@@ -10326,7 +10452,7 @@ var CustomersApi = class extends BaseApiClient {
10326
10452
  if (opts?.page !== void 0) params.set("page", String(opts.page));
10327
10453
  if (opts?.pageSize !== void 0) params.set("page_size", String(opts.pageSize));
10328
10454
  const qs = params.toString();
10329
- return this.fetch(`customers/${uuid}/credit-grants${qs ? "?" + qs : ""}`);
10455
+ return this.fetch(`o/${uuid}/billing/credit-grants${qs ? "?" + qs : ""}`);
10330
10456
  }
10331
10457
  };
10332
10458
 
@@ -11799,7 +11925,6 @@ var EventRuleActionType = /* @__PURE__ */ ((EventRuleActionType2) => {
11799
11925
  EventRuleActionType2["MEMBER_NOTIFY_ACTION"] = "member:notify";
11800
11926
  EventRuleActionType2["MEMBER_LABEL_ACTION"] = "member:label";
11801
11927
  EventRuleActionType2["MEMBER_UPSERT"] = "member:upsert";
11802
- EventRuleActionType2["SEND_WEBHOOK"] = "webhook:send";
11803
11928
  EventRuleActionType2["SWITCH_TASK_ACTION"] = "task:switch";
11804
11929
  EventRuleActionType2["ASSISTANT_MESSAGE"] = "assistant:message";
11805
11930
  EventRuleActionType2["FORM_FIELD_UPDATE"] = "form:update_field";
@@ -13115,8 +13240,8 @@ var WorkspacesApi = class extends BaseApiClient {
13115
13240
  *
13116
13241
  * `bindings` values are sent in the request body only. They are never
13117
13242
  * projected from a response and must never be logged: the point of a
13118
- * binding is that a webhook endpoint and a signing secret belong to ONE
13119
- * target workspace.
13243
+ * binding is that a phone number, inbox or Member belongs to ONE target
13244
+ * workspace.
13120
13245
  */
13121
13246
  /** Download a workspace export ZIP (``export.json`` + file blobs). */
13122
13247
  async exportWorkspaceZip(wid, workflowId, scope, exclude, options) {
@@ -13177,10 +13302,6 @@ var WorkspacesApi = class extends BaseApiClient {
13177
13302
  * Pass ``archive`` (the ZIP from ``exportWorkspaceZip``) to restore file
13178
13303
  * contents. ``exportData`` may be omitted when the ZIP contains it.
13179
13304
  *
13180
- * ``activateWebhookRules`` is safety-default false: imported
13181
- * ``webhook:send`` EventRules are force-disabled unless the operator
13182
- * opts in. An exported-inactive rule stays inactive either way.
13183
- *
13184
13305
  * With ``options.intent = 'template_reapply'`` this is the GUARDED apply.
13185
13306
  * It requires ``options.expectedPlanFingerprint`` — the digest a preview
13186
13307
  * returned — and answers 200 ``success``, 200 ``noop`` (the target already
@@ -13188,15 +13309,14 @@ var WorkspacesApi = class extends BaseApiClient {
13188
13309
  * ``stale_import_plan`` or 409 ``import_plan_refused``. Both 409s commit
13189
13310
  * nothing and carry the complete values-free ``planRows``.
13190
13311
  */
13191
- async importWorkspace(wid, exportData, importMappings, createNew, archive, activateWebhookRules, autoMap, options) {
13312
+ async importWorkspace(wid, exportData, importMappings, createNew, archive, autoMap, options) {
13192
13313
  if (archive) {
13193
13314
  return this.importWorkspaceZip(wid, archive, {
13194
13315
  ...options,
13195
13316
  exportData,
13196
13317
  importMappings,
13197
13318
  createNew,
13198
- autoMap,
13199
- activateWebhookRules
13319
+ autoMap
13200
13320
  });
13201
13321
  }
13202
13322
  if (!exportData) {
@@ -13208,9 +13328,6 @@ var WorkspacesApi = class extends BaseApiClient {
13208
13328
  createNew,
13209
13329
  ...planFields(options)
13210
13330
  };
13211
- if (activateWebhookRules) {
13212
- payload.activateWebhookRules = activateWebhookRules;
13213
- }
13214
13331
  if (autoMap) {
13215
13332
  payload.autoMap = autoMap;
13216
13333
  }
@@ -13236,25 +13353,17 @@ var WorkspacesApi = class extends BaseApiClient {
13236
13353
  *
13237
13354
  * `options.bindings` values are sent in the request body only. They are
13238
13355
  * never projected from a response and must never be logged: the point of a
13239
- * binding is that a webhook endpoint and a signing secret belong to ONE
13240
- * target workspace.
13356
+ * binding is that a phone number, inbox or Member belongs to ONE target
13357
+ * workspace.
13241
13358
  */
13242
13359
  async importWorkspaceZip(wid, archive, options) {
13243
- const {
13244
- exportData,
13245
- importMappings,
13246
- createNew,
13247
- autoMap,
13248
- activateWebhookRules,
13249
- ...planOptions
13250
- } = options ?? {};
13360
+ const { exportData, importMappings, createNew, autoMap, ...planOptions } = options ?? {};
13251
13361
  const payload = {
13252
13362
  importMappings: importMappings ?? {},
13253
13363
  createNew: createNew ?? {},
13254
13364
  ...planFields(planOptions)
13255
13365
  };
13256
13366
  if (exportData) payload.exportData = exportData;
13257
- if (activateWebhookRules) payload.activateWebhookRules = activateWebhookRules;
13258
13367
  if (autoMap) payload.autoMap = autoMap;
13259
13368
  const form = new FormData();
13260
13369
  form.append(
@@ -13546,6 +13655,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
13546
13655
  agents: new AgentsApi(apiKey, baseUrl, customFetch),
13547
13656
  aiModels: new AIModelsApi(apiKey, baseUrl, customFetch),
13548
13657
  apiKeys: new ApiKeysApi(apiKey, baseUrl, customFetch),
13658
+ appLinks: new AppLinksApi(apiKey, baseUrl, customFetch),
13549
13659
  apps: new AppsApi(apiKey, baseUrl, customFetch),
13550
13660
  assignments: new AssignmentsApi(apiKey, baseUrl, customFetch),
13551
13661
  auth: new AuthApi(apiKey, baseUrl, customFetch),
@@ -13556,7 +13666,7 @@ function createApiModules(apiKey, baseUrl, customFetch) {
13556
13666
  calls: new CallsApi(apiKey, baseUrl, customFetch),
13557
13667
  cel: new CELApi(apiKey, baseUrl, customFetch),
13558
13668
  chats: new ChatsApi(apiKey, baseUrl, customFetch),
13559
- customers: new CustomersApi(apiKey, baseUrl, customFetch),
13669
+ customers: new OrganizationBillingApi(apiKey, baseUrl, customFetch),
13560
13670
  resellers: new ResellersApi(apiKey, baseUrl, customFetch),
13561
13671
  customToolkits: new CustomToolkitsApi(apiKey, baseUrl, customFetch),
13562
13672
  dashboards: new DashboardsApi(apiKey, baseUrl, customFetch),
@@ -14113,6 +14223,9 @@ var WORKSPACE_METHOD_NAMES = [
14113
14223
  "getHubspotObjectProperties",
14114
14224
  "getHubspotReconciliationMatches",
14115
14225
  "getHubspotStatus",
14226
+ "bindHubspotCalendar",
14227
+ "unlinkHubspotCalendar",
14228
+ "importHubspotCalendarEvents",
14116
14229
  "getHubspotBookingReceipt",
14117
14230
  "releaseHubspotBookingAttempt",
14118
14231
  "getHubspotSyncLogs",
@@ -14279,7 +14392,6 @@ var WORKSPACE_METHOD_NAMES = [
14279
14392
  "getUsageDashboard",
14280
14393
  "getVariableRegistry",
14281
14394
  "getVoiceUsageReport",
14282
- "getWebhookLogs",
14283
14395
  "getWorkflow",
14284
14396
  "getWorkflowOpeningTurnConversionReport",
14285
14397
  "getWorkflowActivity",
@@ -14482,7 +14594,6 @@ var WORKSPACE_METHOD_NAMES = [
14482
14594
  "testMcpServerConnection",
14483
14595
  "testMondayConnection",
14484
14596
  "testRunJourney",
14485
- "testWebhook",
14486
14597
  "toggleFieldIndex",
14487
14598
  "unarchiveAgent",
14488
14599
  "unarchiveChat",
@@ -14628,6 +14739,11 @@ function bindAccessGrantsMethods(target, accessGrants) {
14628
14739
  target.getGranteeGrants = accessGrants.getGranteeGrants.bind(accessGrants);
14629
14740
  }
14630
14741
 
14742
+ // src/client/bindings/app-links.ts
14743
+ function bindAppLinksMethods(target, appLinks) {
14744
+ target.resolveAppLink = appLinks.resolveAppLink.bind(appLinks);
14745
+ }
14746
+
14631
14747
  // src/client/bindings/intervention-requests.ts
14632
14748
  function bindInterventionRequestsMethods(target, interventionRequests) {
14633
14749
  target.getAgentModeAttention = interventionRequests.getAgentModeAttention.bind(interventionRequests);
@@ -15187,9 +15303,7 @@ function bindEventsMethods(target, events) {
15187
15303
  target.createEventRule = events.createEventRule.bind(events);
15188
15304
  target.updateEventRule = events.updateEventRule.bind(events);
15189
15305
  target.deleteEventRule = events.deleteEventRule.bind(events);
15190
- target.testWebhook = events.testWebhook.bind(events);
15191
15306
  target.reorderEventRules = events.reorderEventRules.bind(events);
15192
- target.getWebhookLogs = events.getWebhookLogs.bind(events);
15193
15307
  target.getRuleExecutions = events.getRuleExecutions.bind(events);
15194
15308
  target.getRoutines = events.getRoutines.bind(events);
15195
15309
  target.getRoutine = events.getRoutine.bind(events);
@@ -15632,6 +15746,9 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
15632
15746
  target.describeSalesforceObject = salesforce.describeSalesforceObject.bind(salesforce);
15633
15747
  target.searchSalesforceRecords = salesforce.searchSalesforceRecords.bind(salesforce);
15634
15748
  target.importSalesforceMembers = salesforce.importSalesforceMembers.bind(salesforce);
15749
+ target.bindHubspotCalendar = hubspot.bindHubspotCalendar.bind(hubspot);
15750
+ target.unlinkHubspotCalendar = hubspot.unlinkHubspotCalendar.bind(hubspot);
15751
+ target.importHubspotCalendarEvents = hubspot.importHubspotCalendarEvents.bind(hubspot);
15635
15752
  target.getHubspotBookingReceipt = hubspot.getHubspotBookingReceipt.bind(hubspot);
15636
15753
  target.releaseHubspotBookingAttempt = hubspot.releaseHubspotBookingAttempt.bind(hubspot);
15637
15754
  target.installHubspot = hubspot.installHubspot.bind(hubspot);
@@ -15749,7 +15866,7 @@ function bindOrgMethods(target, org) {
15749
15866
  target.getOrganizationWorkspaces = org.getOrganizationWorkspaces.bind(org);
15750
15867
  target.getOrganizationWorkspace = org.getOrganizationWorkspace.bind(org);
15751
15868
  target.updateOrganizationWorkspace = org.updateOrganizationWorkspace.bind(org);
15752
- target.getOrgBillingCustomer = org.getOrgBillingCustomer.bind(org);
15869
+ target.getOrgBillingAccess = org.getOrgBillingAccess.bind(org);
15753
15870
  target.getA2PCampaignConfig = org.getA2PCampaignConfig.bind(org);
15754
15871
  target.updateA2PCampaignConfig = org.updateA2PCampaignConfig.bind(org);
15755
15872
  target.getOrgWorkspaceUsage = org.getOrgWorkspaceUsage.bind(org);
@@ -15948,21 +16065,23 @@ function bindQueriesMethods(target, queries) {
15948
16065
  target.runQuery = queries.runQuery.bind(queries);
15949
16066
  }
15950
16067
 
15951
- // src/client/bindings/customers.ts
15952
- function bindCustomersMethods(target, customers) {
15953
- target.getMyCustomers = customers.getMyCustomers.bind(customers);
15954
- target.getMyCustomer = customers.getMyCustomer.bind(customers);
15955
- target.getMyCustomerAccounts = customers.getMyCustomerAccounts.bind(customers);
15956
- target.getMyCustomerSubscriptions = customers.getMyCustomerSubscriptions.bind(customers);
15957
- target.getMyCustomerInvoices = customers.getMyCustomerInvoices.bind(customers);
15958
- target.createMyCustomerPortalSession = customers.createMyCustomerPortalSession.bind(customers);
15959
- target.updateMyCustomer = customers.updateMyCustomer.bind(customers);
15960
- target.createMyCustomerSetupIntent = customers.createMyCustomerSetupIntent.bind(customers);
15961
- target.getMyCustomerPaymentMethods = customers.getMyCustomerPaymentMethods.bind(customers);
15962
- target.attachMyCustomerPaymentMethod = customers.attachMyCustomerPaymentMethod.bind(customers);
15963
- target.detachMyCustomerPaymentMethod = customers.detachMyCustomerPaymentMethod.bind(customers);
15964
- target.setDefaultMyCustomerPaymentMethod = customers.setDefaultMyCustomerPaymentMethod.bind(customers);
15965
- target.getMyCustomerCreditGrants = customers.getMyCustomerCreditGrants.bind(customers);
16068
+ // src/client/bindings/organization-billing.ts
16069
+ function bindOrganizationBillingMethods(target, billing) {
16070
+ target.getOrganizationSubscription = billing.getOrganizationSubscription.bind(billing);
16071
+ target.updateOrganizationCreditSettings = billing.updateOrganizationCreditSettings.bind(billing);
16072
+ target.purchaseOrganizationCredits = billing.purchaseOrganizationCredits.bind(billing);
16073
+ target.getBillingOrganizations = billing.getBillingOrganizations.bind(billing);
16074
+ target.getOrganizationBilling = billing.getOrganizationBilling.bind(billing);
16075
+ target.getOrganizationBillingSubscriptions = billing.getOrganizationBillingSubscriptions.bind(billing);
16076
+ target.getOrganizationInvoices = billing.getOrganizationInvoices.bind(billing);
16077
+ target.createOrganizationPortalSession = billing.createOrganizationPortalSession.bind(billing);
16078
+ target.updateOrganizationBilling = billing.updateOrganizationBilling.bind(billing);
16079
+ target.createOrganizationSetupIntent = billing.createOrganizationSetupIntent.bind(billing);
16080
+ target.getOrganizationPaymentMethods = billing.getOrganizationPaymentMethods.bind(billing);
16081
+ target.attachOrganizationPaymentMethod = billing.attachOrganizationPaymentMethod.bind(billing);
16082
+ target.detachOrganizationPaymentMethod = billing.detachOrganizationPaymentMethod.bind(billing);
16083
+ target.setDefaultOrganizationPaymentMethod = billing.setDefaultOrganizationPaymentMethod.bind(billing);
16084
+ target.getOrganizationCreditGrants = billing.getOrganizationCreditGrants.bind(billing);
15966
16085
  }
15967
16086
 
15968
16087
  // src/client/bindings/resellers.ts
@@ -16325,6 +16444,8 @@ var GravityRailClient = class {
16325
16444
  resolveEntityRefs;
16326
16445
  resolveOrgEntityRefs;
16327
16446
  resolveAccountEntityRefs;
16447
+ // App Links API
16448
+ resolveAppLink;
16328
16449
  // MOTD API
16329
16450
  getMotd;
16330
16451
  // Tracked Links analytics (#10934)
@@ -16559,7 +16680,7 @@ var GravityRailClient = class {
16559
16680
  getOrganizationWorkspaces;
16560
16681
  getOrganizationWorkspace;
16561
16682
  updateOrganizationWorkspace;
16562
- getOrgBillingCustomer;
16683
+ getOrgBillingAccess;
16563
16684
  getA2PCampaignConfig;
16564
16685
  updateA2PCampaignConfig;
16565
16686
  getOrgWorkspaceUsage;
@@ -16768,9 +16889,7 @@ var GravityRailClient = class {
16768
16889
  createEventRule;
16769
16890
  updateEventRule;
16770
16891
  deleteEventRule;
16771
- testWebhook;
16772
16892
  reorderEventRules;
16773
- getWebhookLogs;
16774
16893
  getRuleExecutions;
16775
16894
  getRoutines;
16776
16895
  getRoutine;
@@ -17191,6 +17310,9 @@ var GravityRailClient = class {
17191
17310
  searchSalesforceRecords;
17192
17311
  importSalesforceMembers;
17193
17312
  // HubSpot API
17313
+ bindHubspotCalendar;
17314
+ unlinkHubspotCalendar;
17315
+ importHubspotCalendarEvents;
17194
17316
  getHubspotBookingReceipt;
17195
17317
  releaseHubspotBookingAttempt;
17196
17318
  installHubspot;
@@ -17267,20 +17389,22 @@ var GravityRailClient = class {
17267
17389
  suggestPronunciations;
17268
17390
  getRecommendedVoices;
17269
17391
  previewPronunciation;
17270
- // Customers API (self-service billing portal)
17271
- getMyCustomers;
17272
- getMyCustomer;
17273
- getMyCustomerAccounts;
17274
- getMyCustomerSubscriptions;
17275
- getMyCustomerInvoices;
17276
- createMyCustomerPortalSession;
17277
- updateMyCustomer;
17278
- createMyCustomerSetupIntent;
17279
- getMyCustomerPaymentMethods;
17280
- attachMyCustomerPaymentMethod;
17281
- detachMyCustomerPaymentMethod;
17282
- setDefaultMyCustomerPaymentMethod;
17283
- getMyCustomerCreditGrants;
17392
+ // Organization billing API
17393
+ getOrganizationSubscription;
17394
+ updateOrganizationCreditSettings;
17395
+ purchaseOrganizationCredits;
17396
+ getBillingOrganizations;
17397
+ getOrganizationBilling;
17398
+ getOrganizationBillingSubscriptions;
17399
+ getOrganizationInvoices;
17400
+ createOrganizationPortalSession;
17401
+ updateOrganizationBilling;
17402
+ createOrganizationSetupIntent;
17403
+ getOrganizationPaymentMethods;
17404
+ attachOrganizationPaymentMethod;
17405
+ detachOrganizationPaymentMethod;
17406
+ setDefaultOrganizationPaymentMethod;
17407
+ getOrganizationCreditGrants;
17284
17408
  // Resellers API (self-service reseller portal)
17285
17409
  getMyResellers;
17286
17410
  getMyReseller;
@@ -17365,6 +17489,7 @@ var GravityRailClient = class {
17365
17489
  bindDashboardsMethods(this, apis.dashboards);
17366
17490
  bindActivityMethods(this, apis.activity);
17367
17491
  bindMotdMethods(this, apis.motd);
17492
+ bindAppLinksMethods(this, apis.appLinks);
17368
17493
  bindTrackedLinksMethods(this, apis.trackedLinks);
17369
17494
  bindJourneysMethods(this, apis.journeys);
17370
17495
  bindBundlesMethods(this, apis.bundles, apis.resourceWorkflows);
@@ -17421,7 +17546,7 @@ var GravityRailClient = class {
17421
17546
  apis.confluence
17422
17547
  );
17423
17548
  bindPronunciationsMethods(this, apis.pronunciations);
17424
- bindCustomersMethods(this, apis.customers);
17549
+ bindOrganizationBillingMethods(this, apis.customers);
17425
17550
  bindResellersMethods(this, apis.resellers);
17426
17551
  bindSupportRequestMethods(this, apis.supportRequests);
17427
17552
  bindRoutingRulesMethods(this, apis.routingRules);
@@ -17468,8 +17593,9 @@ var GravityRailClient = class {
17468
17593
  }
17469
17594
  /**
17470
17595
  * Set the org session credential for cross-domain / non-browser clients (e.g. CLI).
17471
- * Opaque gr_sess_ values use X-Org-Session. Legacy orgToken JWE values still
17472
- * use X-Org-Token during the migration window.
17596
+ * Only opaque `gr_sess_` credentials are supported and sent as `X-Org-Session`.
17597
+ * Legacy org tokens raise an error. Sign in again to obtain a session;
17598
+ * pass `undefined` to clear it.
17473
17599
  *
17474
17600
  * `orgUuid` is the org that issued the session. Pass it so the SDK can
17475
17601
  * detect a stale session (e.g. switching orgs mid-session) and re-fire the
@@ -17484,13 +17610,6 @@ var GravityRailClient = class {
17484
17610
  }
17485
17611
  });
17486
17612
  }
17487
- /**
17488
- * @deprecated Legacy compatibility for stateless orgToken JWE credentials.
17489
- * Prefer setOrgSession() for opaque org browser sessions.
17490
- */
17491
- setOrgToken(token, orgUuid) {
17492
- this.setOrgSession(token, orgUuid);
17493
- }
17494
17613
  /**
17495
17614
  * Update the API key across all modules.
17496
17615
  * Used after successful re-authentication.
@@ -21307,18 +21426,18 @@ var SCOPES = {
21307
21426
  "webhooks:read": {
21308
21427
  name: "webhooks:read",
21309
21428
  category: "webhooks" /* WEBHOOKS */,
21310
- description: "View webhook logs"
21429
+ description: "View the organization webhook endpoints that cover this workspace"
21311
21430
  },
21312
21431
  "webhooks:write": {
21313
21432
  name: "webhooks:write",
21314
21433
  category: "webhooks" /* WEBHOOKS */,
21315
- description: "Configure webhooks",
21434
+ description: "Legacy webhook scope; grants no write operation (includes webhooks:read)",
21316
21435
  implies: ["webhooks:read"]
21317
21436
  },
21318
21437
  "webhooks:admin": {
21319
21438
  name: "webhooks:admin",
21320
21439
  category: "webhooks" /* WEBHOOKS */,
21321
- description: "Delete webhooks",
21440
+ description: "Legacy webhook scope; grants no write operation (includes webhooks:read)",
21322
21441
  implies: ["webhooks:write"]
21323
21442
  },
21324
21443
  "webhooks:raw": {