@buildbase/sdk 0.0.68 → 0.0.71

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 (56) hide show
  1. package/AGENTS.md +5 -2
  2. package/CHANGELOG.md +42 -0
  3. package/README.md +110 -5
  4. package/dist/css/styles.css +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +505 -14
  7. package/dist/index.mjs +1 -1
  8. package/dist/mcp/index.cjs +1 -1
  9. package/dist/mcp/index.d.ts +72 -0
  10. package/dist/mcp/index.mjs +1 -1
  11. package/dist/react/chunks/SettingsDialog-D5lLHG9-.cjs +2 -0
  12. package/dist/react/chunks/SettingsDialog-DiTnAWFt.mjs +2 -0
  13. package/dist/react/chunks/SubscriptionDialog-Bkue_qyM.cjs +2 -0
  14. package/dist/react/chunks/SubscriptionDialog-ZjdyTmxn.mjs +2 -0
  15. package/dist/react/chunks/ar-By_nJtJ6.mjs +2 -0
  16. package/dist/react/chunks/ar-D_agqxXa.cjs +2 -0
  17. package/dist/react/chunks/de-CQW2yLLr.mjs +2 -0
  18. package/dist/react/chunks/de-D7j-9T8u.cjs +2 -0
  19. package/dist/react/chunks/es-CggBj8dc.mjs +2 -0
  20. package/dist/react/chunks/es-DYtfnqFg.cjs +2 -0
  21. package/dist/react/chunks/fr-Bu6_05LA.cjs +2 -0
  22. package/dist/react/chunks/fr-CbvudRKC.mjs +2 -0
  23. package/dist/react/chunks/hi-DrJIuj_0.mjs +2 -0
  24. package/dist/react/chunks/hi-dKtSIE95.cjs +2 -0
  25. package/dist/react/chunks/ja-6AwwCaS_.cjs +2 -0
  26. package/dist/react/chunks/ja-BtZsSYAE.mjs +2 -0
  27. package/dist/react/chunks/react-BIZcTNos.mjs +2 -0
  28. package/dist/react/chunks/react-DM1nGVlR.cjs +2 -0
  29. package/dist/react/chunks/zh-BZsPG6yc.mjs +2 -0
  30. package/dist/react/chunks/zh-C6onHYpa.cjs +2 -0
  31. package/dist/react/index.cjs +1 -1
  32. package/dist/react/index.d.ts +736 -20
  33. package/dist/react/index.mjs +1 -1
  34. package/docs/ERROR_CODES.md +24 -0
  35. package/docs/UI-CONFIG.md +1 -0
  36. package/package.json +2 -1
  37. package/dist/react/chunks/SettingsDialog-CmVCLPsu.cjs +0 -2
  38. package/dist/react/chunks/SettingsDialog-arrlxX6I.mjs +0 -2
  39. package/dist/react/chunks/SubscriptionDialog-C1diRL3y.mjs +0 -2
  40. package/dist/react/chunks/SubscriptionDialog-DklgwSWz.cjs +0 -2
  41. package/dist/react/chunks/ar-CHTRXlXt.mjs +0 -2
  42. package/dist/react/chunks/ar-DPJVNHJV.cjs +0 -2
  43. package/dist/react/chunks/de-CdPeKWZ2.mjs +0 -2
  44. package/dist/react/chunks/de-DPd09yf-.cjs +0 -2
  45. package/dist/react/chunks/es-BWGnjJKJ.mjs +0 -2
  46. package/dist/react/chunks/es-WdOYGt6G.cjs +0 -2
  47. package/dist/react/chunks/fr-Big5DFPB.mjs +0 -2
  48. package/dist/react/chunks/fr-LIbCvYeh.cjs +0 -2
  49. package/dist/react/chunks/hi-BoCY3pFe.cjs +0 -2
  50. package/dist/react/chunks/hi-jArNRknR.mjs +0 -2
  51. package/dist/react/chunks/ja-Cwdz0hCu.mjs +0 -2
  52. package/dist/react/chunks/ja-E0jqCiVq.cjs +0 -2
  53. package/dist/react/chunks/react-DoJBZJu7.cjs +0 -2
  54. package/dist/react/chunks/react-yio5IEhU.mjs +0 -2
  55. package/dist/react/chunks/zh-glRKcdia.mjs +0 -2
  56. package/dist/react/chunks/zh-tU-AqFYI.cjs +0 -2
@@ -855,6 +855,59 @@ interface IWorkspaceUser {
855
855
  role: string;
856
856
  }
857
857
 
858
+ /** Mirrors the server enum, string-typed so an app can compare without an import. */
859
+ type IWorkspaceInvitationStatus = 'invited' | 'accepted' | 'rejected' | 'expired';
860
+ /**
861
+ * A workspace invitation: an email address a member invited, before (or
862
+ * after) the person behind it accepted. A pending row bills a seat until it is
863
+ * accepted, declined, revoked or expired.
864
+ */
865
+ interface IWorkspaceInvitation {
866
+ _id: string;
867
+ /** The workspace, populated with `name` and `image` on the invitee's list. */
868
+ workspace: string | Pick<IWorkspace, '_id' | 'name' | 'image'>;
869
+ email: string;
870
+ role: string;
871
+ status: IWorkspaceInvitationStatus;
872
+ invitedAt: string;
873
+ /** When last emailed; absent until the first resend. Read `lastSentAt ?? invitedAt`. */
874
+ lastSentAt?: string;
875
+ /**
876
+ * When a resend stops being refused. The server derives it from the last
877
+ * send and its own cooldown, so a countdown here cannot disagree with the
878
+ * 429 that enforces it. Null unless the row is pending; absent from a
879
+ * server older than this field, which `resendCooldownSeconds` reads as
880
+ * "no cooldown known".
881
+ */
882
+ resendAvailableAt?: string | null;
883
+ /** The inviter, populated with `name`, `email` and `image`; null when their account is gone. */
884
+ invitedBy: string | (Pick<IUser, '_id' | 'name' | 'email'> & {
885
+ image?: string;
886
+ }) | null;
887
+ /** Null once accepted: the link no longer has anything to expire. */
888
+ validTill: string | null;
889
+ acceptedAt?: string;
890
+ rejectedAt?: string;
891
+ /** The app URL the emailed link lands on. */
892
+ landingUrl?: string;
893
+ clientId?: string;
894
+ }
895
+ /** What the public preview returns for a link token. The email is scrambled. */
896
+ interface IWorkspaceInvitationPreview {
897
+ id: string;
898
+ workspaceName: string;
899
+ inviterName: string;
900
+ role: string;
901
+ email: string;
902
+ expiresAt: string | null;
903
+ status: IWorkspaceInvitationStatus;
904
+ /**
905
+ * False when the organization has switched invitations off, so accepting
906
+ * cannot succeed. Absent from older servers, which is read as joinable.
907
+ */
908
+ joinable?: boolean;
909
+ }
910
+
858
911
  /** Event type constants */
859
912
  declare const SDKEvent: {
860
913
  readonly UserCreated: "user:created";
@@ -866,6 +919,10 @@ declare const SDKEvent: {
866
919
  readonly WorkspaceUserRoleChanged: "workspace:user-role-changed";
867
920
  readonly WorkspaceCreated: "workspace:created";
868
921
  readonly WorkspaceDeleted: "workspace:deleted";
922
+ readonly WorkspaceInvitationSent: "workspace:invitation-sent";
923
+ readonly WorkspaceInvitationAccepted: "workspace:invitation-accepted";
924
+ readonly WorkspaceInvitationDeclined: "workspace:invitation-declined";
925
+ readonly WorkspaceInvitationRevoked: "workspace:invitation-revoked";
869
926
  };
870
927
  type EventType = (typeof SDKEvent)[keyof typeof SDKEvent];
871
928
  /**
@@ -907,10 +964,27 @@ interface WorkspaceCreatedEventData {
907
964
  interface WorkspaceDeletedEventData {
908
965
  workspace: IWorkspace;
909
966
  }
967
+ /** An invitation was sent from this client. The invitee may have no account yet. */
968
+ interface WorkspaceInvitationSentEventData {
969
+ invitation: IWorkspaceInvitation;
970
+ workspaceId: string;
971
+ }
972
+ /** The signed-in user accepted an invitation; `WorkspaceUserAdded` fires too. */
973
+ interface WorkspaceInvitationAcceptedEventData {
974
+ invitation: IWorkspaceInvitation;
975
+ workspace: IWorkspace;
976
+ }
977
+ interface WorkspaceInvitationDeclinedEventData {
978
+ invitation: IWorkspaceInvitation;
979
+ }
980
+ interface WorkspaceInvitationRevokedEventData {
981
+ invitationId: string;
982
+ workspaceId: string;
983
+ }
910
984
  /**
911
985
  * Union type for all event data
912
986
  */
913
- type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData;
987
+ type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData | WorkspaceInvitationSentEventData | WorkspaceInvitationAcceptedEventData | WorkspaceInvitationDeclinedEventData | WorkspaceInvitationRevokedEventData;
914
988
  /**
915
989
  * Single event callback function
916
990
  * Handles all events with conditional logic based on event type
@@ -1290,6 +1364,23 @@ declare class AuthApi extends BaseApi {
1290
1364
  * handling device identity. Returns '' for agent/machine sessions (no device).
1291
1365
  */
1292
1366
  getDeviceToken(sessionId: string, signal?: AbortSignal): Promise<string>;
1367
+ /**
1368
+ * Revoke the session server-side. This is what makes signing out mean
1369
+ * something: dropping the id from storage only hides it from this tab, and
1370
+ * the session stays valid until its TTL, so anyone who still holds the id -
1371
+ * a synced browser profile, a backup, an extension - remains signed in.
1372
+ *
1373
+ * `all: true` revokes every session the user has, which is "sign out
1374
+ * everywhere". Signing out one OTHER session is `SessionsApi.revoke`.
1375
+ *
1376
+ * The endpoint sits ahead of the session gate, so it answers for an id that
1377
+ * has already expired or was never valid, and it is idempotent - calling it
1378
+ * twice is not an error. Failures still throw: the caller decides, and
1379
+ * `signOut` clears local state either way.
1380
+ */
1381
+ logout(sessionId?: string, options?: {
1382
+ all?: boolean;
1383
+ }, signal?: AbortSignal): Promise<void>;
1293
1384
  }
1294
1385
 
1295
1386
  interface IScreenDetail {
@@ -1407,6 +1498,111 @@ declare class DevicesApi extends BaseApi {
1407
1498
  }>;
1408
1499
  }
1409
1500
 
1501
+ /**
1502
+ * API client for the signed-in user's notification inbox. Session-authed
1503
+ * (x-session-id) and scoped to the current user by the server: every call
1504
+ * reads or changes only their own items. Extends BaseApi for shared
1505
+ * URL/auth/request handling.
1506
+ *
1507
+ * One item is one notification, however it was delivered: an event sent by
1508
+ * email and push is a single item whose `channels` say what each did.
1509
+ */
1510
+
1511
+ type NotificationChannelStatus = 'none' | 'queued' | 'sent' | 'failed' | 'skipped';
1512
+ type NotificationSource = 'system' | 'custom' | 'workflow' | 'campaign' | 'console';
1513
+ /** How an item was first read: in the inbox, or by clicking its email or push link. */
1514
+ type NotificationReadVia = 'inbox' | 'email_click' | 'push_click';
1515
+ /** One notification in the signed-in user's inbox. Dates are ISO strings. */
1516
+ interface INotificationItem {
1517
+ id: string;
1518
+ /** The workspace it is about, or null for an account notice. */
1519
+ workspaceId: string | null;
1520
+ /** The event slug that sent it. */
1521
+ event: string;
1522
+ source: NotificationSource;
1523
+ title: string;
1524
+ body: string;
1525
+ /** The destination as the app set it, for display. */
1526
+ url: string | null;
1527
+ /**
1528
+ * What to open when the item is clicked: an absolute destination routed
1529
+ * through the server's link check (which also marks the item read), a path
1530
+ * inside the app as it is, or null when there is nothing safe to open.
1531
+ */
1532
+ link: string | null;
1533
+ icon: string | null;
1534
+ channels: {
1535
+ /** An open is recorded but does not read the item; a click does. */
1536
+ email: {
1537
+ status: NotificationChannelStatus;
1538
+ openedAt: string | null;
1539
+ clickedAt: string | null;
1540
+ };
1541
+ push: {
1542
+ status: NotificationChannelStatus;
1543
+ clickedAt: string | null;
1544
+ };
1545
+ };
1546
+ createdAt: string | null;
1547
+ /** The inbox was opened while this was in it. Not the same as read. */
1548
+ seenAt: string | null;
1549
+ readAt: string | null;
1550
+ readVia: NotificationReadVia | null;
1551
+ archivedAt: string | null;
1552
+ }
1553
+ /**
1554
+ * Which items: one workspace's, `'none'` for the account notices that belong
1555
+ * to no workspace, or omitted for everything.
1556
+ */
1557
+ type NotificationScope = string | 'none' | undefined;
1558
+ interface NotificationListParams {
1559
+ workspaceId?: NotificationScope;
1560
+ /** Only unread items. */
1561
+ unread?: boolean;
1562
+ /** Include archived items, which the default list leaves out. */
1563
+ archived?: boolean;
1564
+ page?: number;
1565
+ /** At most 100. */
1566
+ limit?: number;
1567
+ }
1568
+ interface NotificationPage {
1569
+ notifications: INotificationItem[];
1570
+ page: number;
1571
+ limit: number;
1572
+ total: number;
1573
+ hasNextPage: boolean;
1574
+ }
1575
+ interface NotificationCounts {
1576
+ /** Unread and not archived: the number on the bell. */
1577
+ unread: number;
1578
+ /** Unread and never seen: whether anything is new since the inbox was last opened. */
1579
+ unseen: number;
1580
+ }
1581
+ declare class NotificationsApi extends BaseApi {
1582
+ constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
1583
+ sessionId?: string;
1584
+ });
1585
+ /** A page of the current user's items, newest first. */
1586
+ list(params?: NotificationListParams, signal?: AbortSignal): Promise<NotificationPage>;
1587
+ /** Unread and unseen counts, for a badge. */
1588
+ counts(workspaceId?: NotificationScope, signal?: AbortSignal): Promise<NotificationCounts>;
1589
+ /**
1590
+ * Mark one item read. Returns it as it now stands. Sent with `keepalive`,
1591
+ * because it is usually followed at once by opening the item's link, and a
1592
+ * page that navigates away would otherwise cancel it.
1593
+ */
1594
+ markRead(id: string): Promise<INotificationItem>;
1595
+ markUnread(id: string): Promise<INotificationItem>;
1596
+ /** Move an item out of the default list. It stays in history (`archived: true`). */
1597
+ archive(id: string): Promise<INotificationItem>;
1598
+ unarchive(id: string): Promise<INotificationItem>;
1599
+ /** Read everything in scope. */
1600
+ markAllRead(workspaceId?: NotificationScope): Promise<void>;
1601
+ /** The inbox was opened: clears "new" without reading anything. */
1602
+ markSeen(workspaceId?: NotificationScope): Promise<void>;
1603
+ private itemAction;
1604
+ }
1605
+
1410
1606
  declare class PushApi extends BaseApi {
1411
1607
  constructor(config: Pick<IBaseApiConfig, 'serverUrl' | 'version' | 'orgId' | 'sessionId'>);
1412
1608
  getVapidPublicKey(): Promise<{
@@ -1576,6 +1772,23 @@ interface NotificationEvent {
1576
1772
  push: boolean;
1577
1773
  };
1578
1774
  }
1775
+ /** One event's channels. A channel left out is on. */
1776
+ interface NotificationChannelPreference {
1777
+ email?: boolean;
1778
+ push?: boolean;
1779
+ }
1780
+ /** The workspace's setting for one event: the default, and whether members may change it. */
1781
+ interface WorkspaceNotificationDefault extends NotificationChannelPreference {
1782
+ /** Members cannot change this event: the default is what they get. */
1783
+ required?: boolean;
1784
+ }
1785
+ /** The signed-in member's notification settings in one workspace. */
1786
+ interface MyNotificationPreferences {
1787
+ /** The workspace's defaults, by event slug. */
1788
+ defaults: Record<string, WorkspaceNotificationDefault>;
1789
+ /** The member's own choices over them, by event slug. */
1790
+ mine: Record<string, NotificationChannelPreference>;
1791
+ }
1579
1792
  declare class WorkspaceApi extends BaseApi {
1580
1793
  constructor(config: IOsConfig & {
1581
1794
  sessionId?: string;
@@ -1599,6 +1812,61 @@ declare class WorkspaceApi extends BaseApi {
1599
1812
  workspace: IWorkspace;
1600
1813
  message: string;
1601
1814
  }>;
1815
+ private fetchInvitation;
1816
+ /** The workspace's invitations, pending first. Needs `MEMBERS_VIEW`. */
1817
+ listInvitations(workspaceId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
1818
+ /**
1819
+ * Invite an email address to a workspace. The person need not have an
1820
+ * account: they get a link that lands on the app's own auth redirect URL
1821
+ * (or on `landingUrl`, which must be one of the auth client's allowed
1822
+ * redirect URLs). Needs `MEMBERS_INVITE`. A pending invitation bills a seat.
1823
+ */
1824
+ inviteMember(workspaceId: string, config: {
1825
+ email: string;
1826
+ role: string;
1827
+ landingUrl?: string;
1828
+ }, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
1829
+ message: string;
1830
+ }>;
1831
+ /** Send the same invitation again (five-minute cooldown). Revives an expired one. */
1832
+ resendInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
1833
+ message: string;
1834
+ }>;
1835
+ /** Withdraw a pending invitation. The invitee is told; the seat is released. */
1836
+ revokeInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<{
1837
+ success: boolean;
1838
+ message: string;
1839
+ }>;
1840
+ /** The signed-in user's own pending invitations, across workspaces. */
1841
+ myInvitations(signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
1842
+ /**
1843
+ * Accept an invitation addressed to the signed-in user's email.
1844
+ *
1845
+ * Pass the `token` from the invitation link when the user arrived by
1846
+ * following it: the token was mailed to that address and to nowhere else, so
1847
+ * it proves the mailbox and the account does not have to be verified
1848
+ * separately first. Without it, the server requires a verified email, which
1849
+ * is the case when accepting from the in-app list.
1850
+ */
1851
+ acceptInvitation(invitationId: string, options?: {
1852
+ token?: string;
1853
+ }, signal?: AbortSignal): Promise<{
1854
+ invitation: IWorkspaceInvitation;
1855
+ /** Null only when another tab accepted a moment earlier and its membership write is still in flight. */
1856
+ workspace: IWorkspace | null;
1857
+ message: string;
1858
+ }>;
1859
+ /** Decline an invitation addressed to the signed-in user's email. */
1860
+ declineInvitation(invitationId: string, signal?: AbortSignal): Promise<{
1861
+ invitation: IWorkspaceInvitation;
1862
+ message: string;
1863
+ }>;
1864
+ /**
1865
+ * What an invitation link resolves to, before sign-in. Public: keyed by the
1866
+ * link's token, answers with the workspace name, the inviter, the role, the
1867
+ * scrambled address and the status. 404 for an unknown or revoked token.
1868
+ */
1869
+ previewInvitation(token: string, signal?: AbortSignal): Promise<IWorkspaceInvitationPreview>;
1602
1870
  removeUser(workspaceId: string, userId: string, signal?: AbortSignal): Promise<{
1603
1871
  userId: string;
1604
1872
  workspace: IWorkspace;
@@ -1823,17 +2091,24 @@ declare class WorkspaceApi extends BaseApi {
1823
2091
  */
1824
2092
  sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData, signal?: AbortSignal): Promise<NotificationResult>;
1825
2093
  getNotificationEvents(workspaceId: string, signal?: AbortSignal): Promise<NotificationEvent[]>;
1826
- getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, {
1827
- email?: boolean;
1828
- push?: boolean;
1829
- }>>;
1830
- updateNotificationPreferences(workspaceId: string, preferences: Record<string, {
1831
- email?: boolean;
1832
- push?: boolean;
1833
- }>, signal?: AbortSignal): Promise<Record<string, {
1834
- email?: boolean;
1835
- push?: boolean;
1836
- }>>;
2094
+ /** The workspace's defaults for every member. Needs `SETTINGS_VIEW`. */
2095
+ getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
2096
+ /**
2097
+ * Change the workspace's defaults (and `required`) for every member. Needs
2098
+ * `SETTINGS_EDIT`. Merged per event: send only what changes.
2099
+ */
2100
+ updateNotificationPreferences(workspaceId: string, preferences: Record<string, WorkspaceNotificationDefault>, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
2101
+ /** The signed-in member's own settings here, and the defaults they sit over. Any member. */
2102
+ getMyNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<MyNotificationPreferences>;
2103
+ /**
2104
+ * Change the signed-in member's own settings. `null` for a channel goes back
2105
+ * to the workspace default. A required event answers 409 with
2106
+ * `code: 'NOTIFICATION_PREFERENCE_REQUIRED'`.
2107
+ */
2108
+ updateMyNotificationPreferences(workspaceId: string, preferences: Record<string, {
2109
+ email?: boolean | null;
2110
+ push?: boolean | null;
2111
+ }>, signal?: AbortSignal): Promise<MyNotificationPreferences>;
1837
2112
  /**
1838
2113
  * Get credit balance for a workspace.
1839
2114
  * @param workspaceId - The workspace ID
@@ -1953,6 +2228,14 @@ declare class EventEmitter {
1953
2228
  * @param role - The role assigned to the user
1954
2229
  */
1955
2230
  emitWorkspaceUserAdded(userId: string, workspace: IWorkspace, role: string): Promise<void>;
2231
+ /** An invitation was sent from this client. */
2232
+ emitWorkspaceInvitationSent(invitation: IWorkspaceInvitation, workspaceId: string): Promise<void>;
2233
+ /** The signed-in user accepted an invitation and joined `workspace`. */
2234
+ emitWorkspaceInvitationAccepted(invitation: IWorkspaceInvitation, workspace: IWorkspace): Promise<void>;
2235
+ /** The signed-in user declined an invitation. */
2236
+ emitWorkspaceInvitationDeclined(invitation: IWorkspaceInvitation): Promise<void>;
2237
+ /** A pending invitation was withdrawn from this client. */
2238
+ emitWorkspaceInvitationRevoked(invitationId: string, workspaceId: string): Promise<void>;
1956
2239
  /**
1957
2240
  * Trigger workspace user removed event
1958
2241
  * @param userId - The ID of the user that was removed
@@ -2839,6 +3122,60 @@ interface SDKMessages {
2839
3122
  memberLimitMessage: string;
2840
3123
  selectRole: string;
2841
3124
  inviteAs: string;
3125
+ invitations: {
3126
+ title: string;
3127
+ pendingCount: string;
3128
+ sent: string;
3129
+ resend: string;
3130
+ resendIn: string;
3131
+ revoke: string;
3132
+ /** Title of the revoke confirmation. */
3133
+ revokeTitle: string;
3134
+ revokeConfirm: string;
3135
+ sentAt: string;
3136
+ expiresAt: string;
3137
+ seatNote: string;
3138
+ formerMember: string;
3139
+ loadFailed: string;
3140
+ resendFailed: string;
3141
+ revokeFailed: string;
3142
+ status: {
3143
+ invited: string;
3144
+ accepted: string;
3145
+ rejected: string;
3146
+ expired: string;
3147
+ };
3148
+ };
3149
+ };
3150
+ invitations: {
3151
+ title: string;
3152
+ description: string;
3153
+ /** The list of the caller's own invitations, above the rows. */
3154
+ listDescription: string;
3155
+ /** Dialog title once the invitee has joined. */
3156
+ titleJoined: string;
3157
+ /** Dialog title for a link that can no longer be used: revoked, expired, switched off. */
3158
+ titleUnavailable: string;
3159
+ sentTo: string;
3160
+ invitedAs: string;
3161
+ accept: string;
3162
+ decline: string;
3163
+ accepted: string;
3164
+ declined: string;
3165
+ expired: string;
3166
+ revoked: string;
3167
+ alreadyAccepted: string;
3168
+ wrongAccount: string;
3169
+ verifyFirst: string;
3170
+ workspaceFull: string;
3171
+ disabled: string;
3172
+ empty: string;
3173
+ signInToAccept: string;
3174
+ dismiss: string;
3175
+ signOut: string;
3176
+ loadFailed: string;
3177
+ acceptFailed: string;
3178
+ declineFailed: string;
2842
3179
  };
2843
3180
  invoices: {
2844
3181
  title: string;
@@ -2952,6 +3289,28 @@ interface SDKMessages {
2952
3289
  failedToDelete: string;
2953
3290
  };
2954
3291
  notifications: {
3292
+ inbox: {
3293
+ title: string;
3294
+ description: string;
3295
+ bellLabel: string;
3296
+ bellUnread: string;
3297
+ filterAll: string;
3298
+ filterUnread: string;
3299
+ markAllRead: string;
3300
+ markRead: string;
3301
+ markUnread: string;
3302
+ archive: string;
3303
+ loadMore: string;
3304
+ empty: string;
3305
+ emptyUnread: string;
3306
+ loadFailed: string;
3307
+ updateFailed: string;
3308
+ channelEmail: string;
3309
+ channelPush: string;
3310
+ opened: string;
3311
+ clicked: string;
3312
+ notDelivered: string;
3313
+ };
2955
3314
  title: string;
2956
3315
  permissionDenied: string;
2957
3316
  notSupported: string;
@@ -2969,6 +3328,13 @@ interface SDKMessages {
2969
3328
  pushDescription: string;
2970
3329
  deviceNote: string;
2971
3330
  prefsSaved: string;
3331
+ prefsSaveFailed: string;
3332
+ yourTitle: string;
3333
+ yourDescription: string;
3334
+ defaultsTitle: string;
3335
+ defaultsDescription: string;
3336
+ requiredLabel: string;
3337
+ requiredHint: string;
2972
3338
  loadingPrefs: string;
2973
3339
  categories: {
2974
3340
  workspace: string;
@@ -3237,6 +3603,97 @@ type Level4 = {
3237
3603
  /** Union of all valid translation key paths (e.g. "settings.titles.profile") */
3238
3604
  type TranslationKey = Level2 | Level3 | Level4;
3239
3605
 
3606
+ /**
3607
+ * The error an invitation call throws. A plain `Error` (so every existing
3608
+ * `catch (err) { err.message }` keeps working) carrying the server's fields
3609
+ * as properties, so a screen can act on the shape of the refusal: open the
3610
+ * plan picker on a seat limit, count down a resend cooldown, show which
3611
+ * address the invitation was for.
3612
+ */
3613
+ declare const INVITATION_ERROR_CODE: {
3614
+ readonly NOT_FOUND: "INVITATION_NOT_FOUND";
3615
+ readonly EXPIRED: "INVITATION_EXPIRED";
3616
+ readonly ALREADY_HANDLED: "INVITATION_ALREADY_HANDLED";
3617
+ readonly EMAIL_MISMATCH: "INVITATION_EMAIL_MISMATCH";
3618
+ readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
3619
+ readonly INVITES_DISABLED: "WORKSPACE_INVITES_DISABLED";
3620
+ readonly RATE_LIMITED: "INVITATION_RATE_LIMITED";
3621
+ readonly EMAIL_FAILED: "INVITATION_EMAIL_FAILED";
3622
+ readonly SEAT_LIMIT: "SEAT_LIMIT_REACHED";
3623
+ /** The invited or accepting account is blocked. */
3624
+ readonly USER_BLOCKED: "USER_BLOCKED";
3625
+ /**
3626
+ * The organization has no usable email sender, so no invitation can be sent.
3627
+ *
3628
+ * This one is refused by the server's `requireEmailSender` middleware rather
3629
+ * than by the invitation route, so the string is that middleware's
3630
+ * (`EMAIL_SENDER_CODE.NO_SENDER_CONFIGURED`), not an invitation code. Named
3631
+ * after it on purpose: the value is what arrives, and a prettier alias here
3632
+ * would simply never match.
3633
+ */
3634
+ readonly NO_SENDER_CONFIGURED: "NO_SENDER_CONFIGURED";
3635
+ };
3636
+ type InvitationErrorCode = (typeof INVITATION_ERROR_CODE)[keyof typeof INVITATION_ERROR_CODE];
3637
+ interface InvitationErrorFields {
3638
+ /** The HTTP status the server answered with. */
3639
+ status: number;
3640
+ /** A stable code, from the body when the server sent one, else derived from the status. */
3641
+ code: string;
3642
+ /** On a 402: members plus pending invitations, and the ceiling they hit. */
3643
+ currentUserCount?: number;
3644
+ limit?: number;
3645
+ /** On a resend's 429: seconds until the cooldown ends. */
3646
+ retryAfterSeconds?: number;
3647
+ /** On an email mismatch: the invited address, scrambled. */
3648
+ invitedEmail?: string;
3649
+ /** On "already invited": the live invitation, so the caller can offer resend. */
3650
+ invitationId?: string;
3651
+ /** On "already handled": the row's status. */
3652
+ invitationStatus?: string;
3653
+ }
3654
+ type InvitationError = Error & InvitationErrorFields;
3655
+ /** True when an unknown thrown value is an invitation error carrying a status. */
3656
+ declare function isInvitationError(err: unknown): err is InvitationError;
3657
+
3658
+ /**
3659
+ * The admin's ordering: pending first, then newest first within a status. An
3660
+ * admin should see what lapsed, so nothing is dropped here.
3661
+ */
3662
+ declare function sortInvitations(rows: IWorkspaceInvitation[]): IWorkspaceInvitation[];
3663
+ /** Pending and not past its expiry: something the invitee can still accept or decline. */
3664
+ declare function isInvitationActionable(row: IWorkspaceInvitation, now?: Date): boolean;
3665
+ /**
3666
+ * The invitee's list: "a list of things you can act on should contain only
3667
+ * things you can act on". The server already filters, this keeps a stale
3668
+ * client list honest between refreshes.
3669
+ */
3670
+ declare function actionableInvitations(rows: IWorkspaceInvitation[], now?: Date): IWorkspaceInvitation[];
3671
+ /** Pending, past its expiry, not yet swept: shown as expired by the admin's list. */
3672
+ declare function isInvitationLapsed(row: IWorkspaceInvitation, now?: Date): boolean;
3673
+ declare function workspaceNameOf(row: IWorkspaceInvitation): string;
3674
+ declare function workspaceIdOf(row: IWorkspaceInvitation): string;
3675
+ /** The inviter's display name, or null when their account is gone. */
3676
+ declare function inviterNameOf(row: IWorkspaceInvitation): string | null;
3677
+ /**
3678
+ * Seconds until a row may be resent, zero when it may. The cooldown itself is
3679
+ * the server's rule and stays there: this counts down to the `resendAvailableAt`
3680
+ * the server puts on every pending row, so the button cannot unlock a second
3681
+ * before the endpoint stops answering 429. A row without the field (a server
3682
+ * older than it) reports zero, leaving that 429 as the only authority.
3683
+ */
3684
+ declare function resendCooldownSeconds(row: IWorkspaceInvitation, now?: Date): number;
3685
+
3686
+ /** Park a token for `orgId`. A malformed token is ignored rather than stored. */
3687
+ declare function parkPendingInvite(token: string, orgId: string): void;
3688
+ /**
3689
+ * The parked token for `orgId`, or null when there is none, it is older than a
3690
+ * day, or it belongs to another org. Does not clear: the flow clears it on a
3691
+ * terminal answer (accepted, declined, expired, handled), never on a network
3692
+ * error, so a retry stays possible.
3693
+ */
3694
+ declare function readPendingInvite(orgId: string, now?: number): string | null;
3695
+ declare function clearPendingInvite(): void;
3696
+
3240
3697
  /** Props passed to the custom loadingComponent render function. */
3241
3698
  interface LoadingProps {
3242
3699
  /** Human-readable, locale-aware message describing what's happening */
@@ -3430,6 +3887,8 @@ interface SDKUIConfig {
3430
3887
  remove?: boolean;
3431
3888
  /** Seat usage / seat pricing block above the member list. */
3432
3889
  seatPricing?: boolean;
3890
+ /** The pending-invitations list (with resend and revoke) under the invite form. */
3891
+ invitations?: boolean;
3433
3892
  };
3434
3893
  /** Subscription screen — hide billing actions. */
3435
3894
  subscription?: {
@@ -3757,7 +4216,7 @@ interface SaaSOSProviderProps extends IOsState {
3757
4216
  }
3758
4217
  declare const SaaSOSProvider: React__default.FC<SaaSOSProviderProps>;
3759
4218
 
3760
- interface IProps$2 {
4219
+ interface IProps$3 {
3761
4220
  children: React.ReactNode;
3762
4221
  /** Optional component/element to show while auth status is still loading. */
3763
4222
  loadingComponent?: React.ReactNode;
@@ -3791,7 +4250,7 @@ interface IProps$2 {
3791
4250
  * ```
3792
4251
  */
3793
4252
  declare const WhenAuthenticated: {
3794
- (props: IProps$2): React$1.ReactNode;
4253
+ (props: IProps$3): React$1.ReactNode;
3795
4254
  displayName: string;
3796
4255
  };
3797
4256
  /**
@@ -3839,13 +4298,134 @@ declare const WhenAuthenticated: {
3839
4298
  * ```
3840
4299
  */
3841
4300
  declare const WhenUnauthenticated: {
3842
- (props: IProps$2): React$1.ReactNode;
4301
+ (props: IProps$3): React$1.ReactNode;
3843
4302
  displayName: string;
3844
4303
  };
3845
4304
 
4305
+ interface PendingInvitationsProps {
4306
+ /** Extra classes for the root element. */
4307
+ className?: string;
4308
+ /** Heading text. Defaults to the translated title; set to null to hide. */
4309
+ title?: string | null;
4310
+ /** Sub-heading under the title. Defaults to the translated description; set to null to hide. */
4311
+ description?: string | null;
4312
+ /** Text shown when nothing is waiting. Defaults to the translated label. */
4313
+ emptyLabel?: string;
4314
+ /** Render nothing at all when nothing is waiting (for a host that has its own empty state). */
4315
+ hideWhenEmpty?: boolean;
4316
+ /** Switch to the workspace after accepting. Defaults to `true`. */
4317
+ switchOnAccept?: boolean;
4318
+ /** Called after an invitation is accepted, with the workspace joined. */
4319
+ onAccepted?: (workspace: IWorkspace) => void;
4320
+ }
4321
+ /**
4322
+ * The signed-in user's pending workspace invitations, with Accept and
4323
+ * Decline. Rendered by default inside the workspace switcher's empty state,
4324
+ * so an invite-only app's new user lands on their invitations rather than on
4325
+ * "No workspaces available"; place it on your own no-workspace screen too.
4326
+ * For a fully custom UI, use `useMyInvitations()`.
4327
+ */
4328
+ declare function PendingInvitations({ className, title, description, emptyLabel, hideWhenEmpty, switchOnAccept, onAccepted, }: PendingInvitationsProps): React$1.JSX.Element | null;
4329
+
4330
+ interface IProps$2 {
4331
+ children: React__default.ReactNode;
4332
+ /** Optional content while the list resolves. */
4333
+ loadingComponent?: React__default.ReactNode;
4334
+ /** Optional content when nothing is waiting. */
4335
+ fallbackComponent?: React__default.ReactNode;
4336
+ }
4337
+ /**
4338
+ * Renders children only when the signed-in user has a pending workspace
4339
+ * invitation. The gate for an invite-only app's onboarding: show the
4340
+ * invitations screen when there is something to accept, the empty state
4341
+ * otherwise. Nothing renders while signed out.
4342
+ */
4343
+ declare const WhenPendingInvitations: (props: IProps$2) => React__default.ReactNode;
4344
+
4345
+ interface UseMyInvitations {
4346
+ /** The invitations the signed-in user can act on: pending and not expired. */
4347
+ invitations: IWorkspaceInvitation[];
4348
+ /** True while the list is loading (false when signed out: there is nothing to load). */
4349
+ loading: boolean;
4350
+ /** Error message from the last list, accept or decline, if any. */
4351
+ error: string | null;
4352
+ /** The invitation id being accepted or declined, or null. */
4353
+ busy: string | null;
4354
+ /** Re-fetch the list. */
4355
+ refresh: () => Promise<void>;
4356
+ /**
4357
+ * Accept: joins the workspace and returns it. Null only when a second tab
4358
+ * accepted the same invitation a moment earlier and its membership write
4359
+ * is still in flight; the workspace list refreshes either way.
4360
+ *
4361
+ * Pass the invitation link's `token` if you built your own landing page from
4362
+ * it: the link proves the address, so an account that has not verified its
4363
+ * email separately is still let in.
4364
+ */
4365
+ accept: (invitationId: string, options?: {
4366
+ token?: string;
4367
+ }) => Promise<IWorkspace | null>;
4368
+ /** Decline. */
4369
+ decline: (invitationId: string) => Promise<void>;
4370
+ }
4371
+ /**
4372
+ * The invitee's own invitations, across workspaces. Empty (and not loading)
4373
+ * while signed out; fetched once the session is authenticated and shared by
4374
+ * every consumer of the same org (one request per page load, not one per
4375
+ * component). This is the server-side truth the invite link is only a shortcut
4376
+ * to: a user whose link expired, or who signed in from another device, still
4377
+ * sees what is waiting.
4378
+ */
4379
+ declare function useMyInvitations(): UseMyInvitations;
4380
+
4381
+ interface UseWorkspaceInvitations {
4382
+ /** Every invitation of the workspace, pending first, newest first within a status. */
4383
+ invitations: IWorkspaceInvitation[];
4384
+ /** The rows still pending (and billing a seat). */
4385
+ pendingCount: number;
4386
+ /** True while the list is loading. */
4387
+ loading: boolean;
4388
+ /** Error message from the last list, resend or revoke, if any. */
4389
+ error: string | null;
4390
+ /** The invitation id being resent or revoked, or null. */
4391
+ busy: string | null;
4392
+ /** Re-fetch the list. */
4393
+ refresh: () => Promise<void>;
4394
+ /** Send an invitation again. Throws the invitation error (429 carries `retryAfterSeconds`). */
4395
+ resend: (invitationId: string) => Promise<IWorkspaceInvitation>;
4396
+ /** Withdraw a pending invitation. */
4397
+ revoke: (invitationId: string) => Promise<void>;
4398
+ }
4399
+ /**
4400
+ * The admin's view of a workspace's invitations: the list, and resend and
4401
+ * revoke on it. Needs `MEMBERS_VIEW` for the list and `MEMBERS_INVITE` for the
4402
+ * actions. Pass `null` to render nothing (no request is made).
4403
+ */
4404
+ declare function useWorkspaceInvitations(workspaceId: string | null | undefined): UseWorkspaceInvitations;
4405
+
4406
+ /** What `signOut` accepts. */
4407
+ interface SignOutOptions {
4408
+ /** Revoke every session this user has, on every device, not just this one. */
4409
+ everywhere?: boolean;
4410
+ }
4411
+ /**
4412
+ * What `signOut` will actually be handed.
4413
+ *
4414
+ * `onClick={signOut}` is the documented pattern (README), and React hands an
4415
+ * event to it. An all-optional options type is not assignable from an event, so
4416
+ * typing the parameter as `SignOutOptions` alone would turn every one of those
4417
+ * call sites into a compile error - a code change demanded in exchange for a
4418
+ * security fix, which is how a security fix goes unadopted. So the event shape
4419
+ * is accepted and ignored. `{ nativeEvent }` rather than React's own type
4420
+ * because this module has no reason to import React.
4421
+ */
4422
+ type SignOutArg = SignOutOptions | {
4423
+ nativeEvent: unknown;
4424
+ } | undefined;
4425
+
3846
4426
  declare function useSaaSAuth(): {
3847
4427
  signIn: (returnUrl?: string) => Promise<void>;
3848
- signOut: () => Promise<void>;
4428
+ signOut: (options?: SignOutArg) => Promise<void>;
3849
4429
  openWorkspaceSettings: (section?: WorkspaceSettingsSection) => void;
3850
4430
  openCreditStore: () => void;
3851
4431
  openPlanPicker: () => void;
@@ -4308,6 +4888,117 @@ interface SessionsProps {
4308
4888
  */
4309
4889
  declare function Sessions({ className, title, description, showSignOut, signOutLabel, emptyLabel, }: SessionsProps): React$1.JSX.Element;
4310
4890
 
4891
+ /** Memoized NotificationsApi instance. Recreates only when serverUrl/version change. */
4892
+ declare function useNotificationsApi(): NotificationsApi;
4893
+
4894
+ interface UseNotificationsOptions {
4895
+ /**
4896
+ * Whose items: a workspace id, `'current'` for the selected workspace,
4897
+ * `'none'` for the account notices that belong to no workspace, or omitted
4898
+ * for everything the user has been sent.
4899
+ */
4900
+ workspaceId?: NotificationScope | 'current';
4901
+ /** Items per page. Defaults to 20, at most 100. */
4902
+ pageSize?: number;
4903
+ /**
4904
+ * How often to check for new items while the tab is visible, in ms.
4905
+ * Defaults to 60 000; 0 turns polling off. Still runs with `live`, as the
4906
+ * fallback when the live connection is down.
4907
+ */
4908
+ pollIntervalMs?: number;
4909
+ /**
4910
+ * Hear about new and changed items the moment they happen, over one shared
4911
+ * connection per tab. Defaults to true.
4912
+ */
4913
+ live?: boolean;
4914
+ }
4915
+ interface UseNotifications {
4916
+ /** Loaded items, newest first, archived ones left out. */
4917
+ notifications: INotificationItem[];
4918
+ /** The loaded items not yet read. More may be on later pages: see `counts`. */
4919
+ unread: INotificationItem[];
4920
+ /** Server counts for the whole scope, not just what is loaded. */
4921
+ counts: NotificationCounts;
4922
+ /** True while the first page is loading. */
4923
+ loading: boolean;
4924
+ loadingMore: boolean;
4925
+ hasMore: boolean;
4926
+ /** Error message from the last load or action, if any. */
4927
+ error: string | null;
4928
+ refresh: () => Promise<void>;
4929
+ loadMore: () => Promise<void>;
4930
+ /** Read in the inbox. A no-op for an item already read. */
4931
+ markRead: (id: string) => Promise<void>;
4932
+ markUnread: (id: string) => Promise<void>;
4933
+ /** Out of the list; it stays in the user's history. */
4934
+ archive: (id: string) => Promise<void>;
4935
+ markAllRead: () => Promise<void>;
4936
+ /** The inbox was opened: clears the "new" state without reading anything. */
4937
+ markSeen: () => Promise<void>;
4938
+ }
4939
+ /**
4940
+ * The signed-in user's notification inbox: everything the app has sent them,
4941
+ * by email, push or both, one item per notification. Empty (and not loading)
4942
+ * while signed out. Shared by every consumer of the same org and scope, so a
4943
+ * bell and an inbox page are one request and a read in either updates both.
4944
+ *
4945
+ * Headless; `<NotificationBell />` and `<NotificationInbox />` are built on it.
4946
+ */
4947
+ declare function useNotifications(options?: UseNotificationsOptions): UseNotifications;
4948
+
4949
+ interface NotificationInboxProps extends UseNotificationsOptions {
4950
+ /** Extra classes for the root element. */
4951
+ className?: string;
4952
+ /** Heading text. Defaults to the translated title; set to null to hide. */
4953
+ title?: string | null;
4954
+ /** Sub-heading under the title. Defaults to the translated description; null to hide. */
4955
+ description?: string | null;
4956
+ /** Show the All / Unread switch. Defaults to true. */
4957
+ showFilter?: boolean;
4958
+ /**
4959
+ * Called when an item is clicked, after it is marked read. Defaults to
4960
+ * opening its `link` in the current tab when it has one. Pass your
4961
+ * router's navigation here for an app path (`item.link` starting with
4962
+ * `/`) to avoid a full page load.
4963
+ */
4964
+ onSelect?: (item: INotificationItem) => void;
4965
+ /** Text shown when there is nothing to list. */
4966
+ emptyLabel?: string;
4967
+ /** Mark everything seen once the inbox has shown it. Defaults to true. */
4968
+ markSeenOnView?: boolean;
4969
+ /** Tighter spacing, for a popover. */
4970
+ compact?: boolean;
4971
+ }
4972
+ /**
4973
+ * A ready-made notification inbox: everything the app has sent the signed-in
4974
+ * user, one item per notification however it was delivered, with read state,
4975
+ * archive and what each channel did. Scoped to the current user; pass
4976
+ * `workspaceId` for one workspace's items.
4977
+ *
4978
+ * For a fully custom UI, use the `useNotifications()` hook.
4979
+ */
4980
+ declare function NotificationInbox({ className, title, description, showFilter, onSelect, emptyLabel, markSeenOnView, compact, ...options }: NotificationInboxProps): React$1.JSX.Element;
4981
+
4982
+ interface NotificationBellProps extends UseNotificationsOptions {
4983
+ /** Extra classes for the bell button. */
4984
+ className?: string;
4985
+ /** Which edge of the bell the panel lines up with. Defaults to `end`. */
4986
+ align?: 'start' | 'center' | 'end';
4987
+ /** Props for the inbox inside the panel (title, onSelect, empty text...). */
4988
+ inboxProps?: Omit<NotificationInboxProps, keyof UseNotificationsOptions | 'compact'>;
4989
+ /** Largest number the badge shows before it reads "99+". Defaults to 99. */
4990
+ maxCount?: number;
4991
+ }
4992
+ /**
4993
+ * A bell with the unread count, opening the inbox in a panel. Opening it
4994
+ * marks what is there as seen, which clears the badge's highlight without
4995
+ * reading anything; items are read when opened or clicked.
4996
+ *
4997
+ * Shares its data with any `<NotificationInbox />` or `useNotifications()`
4998
+ * for the same scope, so a read in one updates the other.
4999
+ */
5000
+ declare function NotificationBell({ className, align, inboxProps, maxCount, ...options }: NotificationBellProps): React$1.JSX.Element;
5001
+
4311
5002
  interface IProps {
4312
5003
  slug: string;
4313
5004
  children: React.ReactNode;
@@ -5277,7 +5968,10 @@ declare function useUserFeatures(): {
5277
5968
  * - `deleteWorkspace(workspaceId)`: Function to delete a workspace (owner only)
5278
5969
  * - `getWorkspace(workspaceId)`: Function to fetch a specific workspace
5279
5970
  * - `getUsers(workspaceId)`: Function to fetch users in a workspace
5280
- * - `addUser(workspaceId, email, role)`: Function to add a user to a workspace
5971
+ * - `addUser(workspaceId, email, role)`: Add an EXISTING account to a workspace (404 when the address has none)
5972
+ * - `inviteMember(workspaceId, email, role, options?)`: Invite an email address that may have no account yet
5973
+ * - `listInvitations(workspaceId)`, `resendInvitation(workspaceId, id)`, `revokeInvitation(workspaceId, id)`: The admin's side of invitations
5974
+ * - `myInvitations()`, `acceptInvitation(id, { token? })`, `declineInvitation(id)`, `previewInvitation(token)`: The invitee's side
5281
5975
  * - `removeUser(workspaceId, userId)`: Function to remove a user from a workspace
5282
5976
  * - `updateUser(workspaceId, userId, config)`: Function to update a user in a workspace
5283
5977
  * - `getProfile()`: Function to fetch current user profile
@@ -5395,6 +6089,21 @@ declare const useSaaSWorkspaces: () => {
5395
6089
  permissions: Record<string, string[]>;
5396
6090
  }) => Promise<unknown>;
5397
6091
  updateWorkspacePermissions: (workspaceId: string, permissions: Record<string, string[]>) => Promise<unknown>;
6092
+ listInvitations: (workspaceId: string) => Promise<IWorkspaceInvitation[]>;
6093
+ inviteMember: (workspaceId: string, email: string, role: string, options?: {
6094
+ landingUrl?: string;
6095
+ }) => Promise<IWorkspaceInvitation>;
6096
+ resendInvitation: (workspaceId: string, invitationId: string) => Promise<IWorkspaceInvitation>;
6097
+ revokeInvitation: (workspaceId: string, invitationId: string) => Promise<void>;
6098
+ myInvitations: () => Promise<IWorkspaceInvitation[]>;
6099
+ acceptInvitation: (invitationId: string, options?: {
6100
+ token?: string;
6101
+ }) => Promise<{
6102
+ invitation: IWorkspaceInvitation;
6103
+ workspace: IWorkspace | null;
6104
+ }>;
6105
+ declineInvitation: (invitationId: string) => Promise<IWorkspaceInvitation>;
6106
+ previewInvitation: (token: string) => Promise<IWorkspaceInvitationPreview>;
5398
6107
  workspaces: IWorkspace[];
5399
6108
  loading: boolean;
5400
6109
  error: string | null;
@@ -6166,7 +6875,8 @@ declare const useUsageLogs: (workspaceId: string | null | undefined, quotaSlug?:
6166
6875
 
6167
6876
  /**
6168
6877
  * Hook to get the credit balance for a workspace.
6169
- * Automatically fetches when workspaceId changes.
6878
+ * Automatically fetches when workspaceId changes, and refetches whenever
6879
+ * `invalidateCreditBalance()` is called (after a consume or a purchase).
6170
6880
  *
6171
6881
  * @param workspaceId - The workspace ID. Can be null/undefined to disable fetching.
6172
6882
  * @returns { balance, loading, error, refetch }
@@ -6460,6 +7170,12 @@ declare function useSeatStatus(workspace: {
6460
7170
  billingCurrency?: string | null;
6461
7171
  } | null, options?: {
6462
7172
  settingsMaxUsers?: number | null;
7173
+ /**
7174
+ * Live pending invitations. Each one holds a seat until it is answered,
7175
+ * and the server counts them against the ceiling, so leaving them out
7176
+ * offers an invite form that can only answer 402.
7177
+ */
7178
+ pendingInvitations?: number;
6463
7179
  }): SeatStatus;
6464
7180
 
6465
7181
  interface BetaFormProps {
@@ -6778,5 +7494,5 @@ declare class WorkspaceSettingsManager {
6778
7494
  }
6779
7495
  declare const workspaceSettingsManager: WorkspaceSettingsManager;
6780
7496
 
6781
- export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBaseBadge, SaaSOSProvider as BuildBaseProvider, CURRENCY_DISPLAY, CURRENCY_FLAG, ConnectMcpGuide, ConnectedAgents, ConnectedAgentsApi, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, Devices, DevicesApi, DunningState, EmptyState, EventEmitter, FullScreenLoader, InvoiceStatuses, LoadingState, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SectionHeader, Sessions, SessionsApi, SettingsApi, SettingsScreen, SidebarNavItem, SidebarNavSection, StatusBanner, SubscriptionContextProvider, SubscriptionItemType, SubscriptionStatus, UserApi, WhenAuthenticated, WhenCreditsAvailable, WhenCreditsExhausted, WhenCreditsLow, WhenNoSubscription, WhenNotTrialing, WhenPermission, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAuthIntent, coerceBadgeRef, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, eventEmitter, fillMcpTemplate, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, isZeroDecimalCurrency, mcpServerKey, mergeUIConfig, minorAmountToDisplay, readBBParams, resolveMaxUsers, resolvePermissions, safeRedirect, saveAuthIntent, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useConnectedAgents, useConnectedAgentsApi, useConsumeCredits, useCreateCheckoutSession, useCreditBalance, useCreditBalanceContext, useCreditPackages, useCreditTransactions, useDevices, useDevicesApi, useExpiringCredits, useFullScreenLoader, useInvoice, useInvoices, useMcpConnection, usePermissions, usePlanGroup, usePlanGroupVersions, usePublicCreditPackages, usePublicPlanGroupVersion, usePublicPlans, usePurchaseCredits, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSessions, useSessionsApi, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUIConfig, useUIVisibility, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, validateInvite, validateRedirectUrl, workspaceSettingsManager };
6782
- export type { BBActionType, BBScreenType, BBStatusType, BadgeHrefOptions, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseBadgeProps, BuildBaseBadgeSize, BuildBaseBadgeTheme, BuildBaseBadgeVariant, SaaSOSProviderProps as BuildBaseProviderProps, CheckoutResult, ConnectMcpGuideProps, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DevicesProps, DunningStateType, EmptyStateProps, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConnectedAgent, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IDeviceView, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IIpInfoLite, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISessionView, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, McpClientGuide, McpConnectionConfig, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PartialSDKMessages, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SessionsProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UseDevices, UseSessions, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
7497
+ export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBaseBadge, SaaSOSProvider as BuildBaseProvider, CURRENCY_DISPLAY, CURRENCY_FLAG, ConnectMcpGuide, ConnectedAgents, ConnectedAgentsApi, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, Devices, DevicesApi, DunningState, EmptyState, EventEmitter, FullScreenLoader, INVITATION_ERROR_CODE, InvoiceStatuses, LoadingState, NotificationBell, NotificationInbox, NotificationsApi, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, PendingInvitations, Permission, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SectionHeader, Sessions, SessionsApi, SettingsApi, SettingsScreen, SidebarNavItem, SidebarNavSection, StatusBanner, SubscriptionContextProvider, SubscriptionItemType, SubscriptionStatus, UserApi, WhenAuthenticated, WhenCreditsAvailable, WhenCreditsExhausted, WhenCreditsLow, WhenNoSubscription, WhenNotTrialing, WhenPendingInvitations, WhenPermission, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher, actionableInvitations, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAuthIntent, clearPendingInvite, coerceBadgeRef, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, eventEmitter, fillMcpTemplate, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, inviterNameOf, isInvitationActionable, isInvitationError, isInvitationLapsed, isZeroDecimalCurrency, mcpServerKey, mergeUIConfig, minorAmountToDisplay, parkPendingInvite, readBBParams, readPendingInvite, resendCooldownSeconds, resolveMaxUsers, resolvePermissions, safeRedirect, saveAuthIntent, sortInvitations, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useConnectedAgents, useConnectedAgentsApi, useConsumeCredits, useCreateCheckoutSession, useCreditBalance, useCreditBalanceContext, useCreditPackages, useCreditTransactions, useDevices, useDevicesApi, useExpiringCredits, useFullScreenLoader, useInvoice, useInvoices, useMcpConnection, useMyInvitations, useNotifications, useNotificationsApi, usePermissions, usePlanGroup, usePlanGroupVersions, usePublicCreditPackages, usePublicPlanGroupVersion, usePublicPlans, usePurchaseCredits, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSessions, useSessionsApi, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUIConfig, useUIVisibility, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, useWorkspaceInvitations, validateInvite, validateRedirectUrl, workspaceIdOf, workspaceNameOf, workspaceSettingsManager };
7498
+ export type { BBActionType, BBScreenType, BBStatusType, BadgeHrefOptions, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseBadgeProps, BuildBaseBadgeSize, BuildBaseBadgeTheme, BuildBaseBadgeVariant, SaaSOSProviderProps as BuildBaseProviderProps, CheckoutResult, ConnectMcpGuideProps, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DevicesProps, DunningStateType, EmptyStateProps, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConnectedAgent, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IDeviceView, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IIpInfoLite, INotificationItem, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISessionView, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, IWorkspaceInvitation, IWorkspaceInvitationPreview, IWorkspaceInvitationStatus, InvitationError, InvitationErrorCode, InvitationErrorFields, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, McpClientGuide, McpConnectionConfig, MyNotificationPreferences, NotificationBellProps, NotificationChannelPreference, NotificationCounts, NotificationData, NotificationEvent, NotificationInboxProps, NotificationListParams, NotificationPage, NotificationResult, NotificationScope, OnWorkspaceChangeParams, PartialSDKMessages, PendingInvitationsProps, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SessionsProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, SignOutOptions, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UseDevices, UseMyInvitations, UseNotifications, UseNotificationsOptions, UseSessions, UseWorkspaceInvitations, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceInvitationAcceptedEventData, WorkspaceInvitationDeclinedEventData, WorkspaceInvitationRevokedEventData, WorkspaceInvitationSentEventData, WorkspaceNotificationDefault, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };