@buildbase/sdk 0.0.70 → 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 +33 -0
  3. package/README.md +108 -4
  4. package/dist/css/styles.css +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +488 -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 +698 -19
  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-VKPguQBs.mjs +0 -2
  38. package/dist/react/chunks/SettingsDialog-_kfJ6j25.cjs +0 -2
  39. package/dist/react/chunks/SubscriptionDialog-C_1ipsC2.cjs +0 -2
  40. package/dist/react/chunks/SubscriptionDialog-Cbk3EGBr.mjs +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-B0MFoaXI.mjs +0 -2
  54. package/dist/react/chunks/react-DSRfaDnZ.cjs +0 -2
  55. package/dist/react/chunks/zh-glRKcdia.mjs +0 -2
  56. package/dist/react/chunks/zh-tU-AqFYI.cjs +0 -2
package/dist/index.d.ts CHANGED
@@ -852,6 +852,59 @@ interface IWorkspaceUser {
852
852
  role: string;
853
853
  }
854
854
 
855
+ /** Mirrors the server enum, string-typed so an app can compare without an import. */
856
+ type IWorkspaceInvitationStatus = 'invited' | 'accepted' | 'rejected' | 'expired';
857
+ /**
858
+ * A workspace invitation: an email address a member invited, before (or
859
+ * after) the person behind it accepted. A pending row bills a seat until it is
860
+ * accepted, declined, revoked or expired.
861
+ */
862
+ interface IWorkspaceInvitation {
863
+ _id: string;
864
+ /** The workspace, populated with `name` and `image` on the invitee's list. */
865
+ workspace: string | Pick<IWorkspace, '_id' | 'name' | 'image'>;
866
+ email: string;
867
+ role: string;
868
+ status: IWorkspaceInvitationStatus;
869
+ invitedAt: string;
870
+ /** When last emailed; absent until the first resend. Read `lastSentAt ?? invitedAt`. */
871
+ lastSentAt?: string;
872
+ /**
873
+ * When a resend stops being refused. The server derives it from the last
874
+ * send and its own cooldown, so a countdown here cannot disagree with the
875
+ * 429 that enforces it. Null unless the row is pending; absent from a
876
+ * server older than this field, which `resendCooldownSeconds` reads as
877
+ * "no cooldown known".
878
+ */
879
+ resendAvailableAt?: string | null;
880
+ /** The inviter, populated with `name`, `email` and `image`; null when their account is gone. */
881
+ invitedBy: string | (Pick<IUser, '_id' | 'name' | 'email'> & {
882
+ image?: string;
883
+ }) | null;
884
+ /** Null once accepted: the link no longer has anything to expire. */
885
+ validTill: string | null;
886
+ acceptedAt?: string;
887
+ rejectedAt?: string;
888
+ /** The app URL the emailed link lands on. */
889
+ landingUrl?: string;
890
+ clientId?: string;
891
+ }
892
+ /** What the public preview returns for a link token. The email is scrambled. */
893
+ interface IWorkspaceInvitationPreview {
894
+ id: string;
895
+ workspaceName: string;
896
+ inviterName: string;
897
+ role: string;
898
+ email: string;
899
+ expiresAt: string | null;
900
+ status: IWorkspaceInvitationStatus;
901
+ /**
902
+ * False when the organization has switched invitations off, so accepting
903
+ * cannot succeed. Absent from older servers, which is read as joinable.
904
+ */
905
+ joinable?: boolean;
906
+ }
907
+
855
908
  /** Event type constants */
856
909
  declare const SDKEvent: {
857
910
  readonly UserCreated: "user:created";
@@ -863,6 +916,10 @@ declare const SDKEvent: {
863
916
  readonly WorkspaceUserRoleChanged: "workspace:user-role-changed";
864
917
  readonly WorkspaceCreated: "workspace:created";
865
918
  readonly WorkspaceDeleted: "workspace:deleted";
919
+ readonly WorkspaceInvitationSent: "workspace:invitation-sent";
920
+ readonly WorkspaceInvitationAccepted: "workspace:invitation-accepted";
921
+ readonly WorkspaceInvitationDeclined: "workspace:invitation-declined";
922
+ readonly WorkspaceInvitationRevoked: "workspace:invitation-revoked";
866
923
  };
867
924
  type EventType = (typeof SDKEvent)[keyof typeof SDKEvent];
868
925
  /**
@@ -904,10 +961,27 @@ interface WorkspaceCreatedEventData {
904
961
  interface WorkspaceDeletedEventData {
905
962
  workspace: IWorkspace;
906
963
  }
964
+ /** An invitation was sent from this client. The invitee may have no account yet. */
965
+ interface WorkspaceInvitationSentEventData {
966
+ invitation: IWorkspaceInvitation;
967
+ workspaceId: string;
968
+ }
969
+ /** The signed-in user accepted an invitation; `WorkspaceUserAdded` fires too. */
970
+ interface WorkspaceInvitationAcceptedEventData {
971
+ invitation: IWorkspaceInvitation;
972
+ workspace: IWorkspace;
973
+ }
974
+ interface WorkspaceInvitationDeclinedEventData {
975
+ invitation: IWorkspaceInvitation;
976
+ }
977
+ interface WorkspaceInvitationRevokedEventData {
978
+ invitationId: string;
979
+ workspaceId: string;
980
+ }
907
981
  /**
908
982
  * Union type for all event data
909
983
  */
910
- type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData;
984
+ type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData | WorkspaceInvitationSentEventData | WorkspaceInvitationAcceptedEventData | WorkspaceInvitationDeclinedEventData | WorkspaceInvitationRevokedEventData;
911
985
  /**
912
986
  * Single event callback function
913
987
  * Handles all events with conditional logic based on event type
@@ -1416,6 +1490,111 @@ declare class DevicesApi extends BaseApi {
1416
1490
  }>;
1417
1491
  }
1418
1492
 
1493
+ /**
1494
+ * API client for the signed-in user's notification inbox. Session-authed
1495
+ * (x-session-id) and scoped to the current user by the server: every call
1496
+ * reads or changes only their own items. Extends BaseApi for shared
1497
+ * URL/auth/request handling.
1498
+ *
1499
+ * One item is one notification, however it was delivered: an event sent by
1500
+ * email and push is a single item whose `channels` say what each did.
1501
+ */
1502
+
1503
+ type NotificationChannelStatus = 'none' | 'queued' | 'sent' | 'failed' | 'skipped';
1504
+ type NotificationSource = 'system' | 'custom' | 'workflow' | 'campaign' | 'console';
1505
+ /** How an item was first read: in the inbox, or by clicking its email or push link. */
1506
+ type NotificationReadVia = 'inbox' | 'email_click' | 'push_click';
1507
+ /** One notification in the signed-in user's inbox. Dates are ISO strings. */
1508
+ interface INotificationItem {
1509
+ id: string;
1510
+ /** The workspace it is about, or null for an account notice. */
1511
+ workspaceId: string | null;
1512
+ /** The event slug that sent it. */
1513
+ event: string;
1514
+ source: NotificationSource;
1515
+ title: string;
1516
+ body: string;
1517
+ /** The destination as the app set it, for display. */
1518
+ url: string | null;
1519
+ /**
1520
+ * What to open when the item is clicked: an absolute destination routed
1521
+ * through the server's link check (which also marks the item read), a path
1522
+ * inside the app as it is, or null when there is nothing safe to open.
1523
+ */
1524
+ link: string | null;
1525
+ icon: string | null;
1526
+ channels: {
1527
+ /** An open is recorded but does not read the item; a click does. */
1528
+ email: {
1529
+ status: NotificationChannelStatus;
1530
+ openedAt: string | null;
1531
+ clickedAt: string | null;
1532
+ };
1533
+ push: {
1534
+ status: NotificationChannelStatus;
1535
+ clickedAt: string | null;
1536
+ };
1537
+ };
1538
+ createdAt: string | null;
1539
+ /** The inbox was opened while this was in it. Not the same as read. */
1540
+ seenAt: string | null;
1541
+ readAt: string | null;
1542
+ readVia: NotificationReadVia | null;
1543
+ archivedAt: string | null;
1544
+ }
1545
+ /**
1546
+ * Which items: one workspace's, `'none'` for the account notices that belong
1547
+ * to no workspace, or omitted for everything.
1548
+ */
1549
+ type NotificationScope = string | 'none' | undefined;
1550
+ interface NotificationListParams {
1551
+ workspaceId?: NotificationScope;
1552
+ /** Only unread items. */
1553
+ unread?: boolean;
1554
+ /** Include archived items, which the default list leaves out. */
1555
+ archived?: boolean;
1556
+ page?: number;
1557
+ /** At most 100. */
1558
+ limit?: number;
1559
+ }
1560
+ interface NotificationPage {
1561
+ notifications: INotificationItem[];
1562
+ page: number;
1563
+ limit: number;
1564
+ total: number;
1565
+ hasNextPage: boolean;
1566
+ }
1567
+ interface NotificationCounts {
1568
+ /** Unread and not archived: the number on the bell. */
1569
+ unread: number;
1570
+ /** Unread and never seen: whether anything is new since the inbox was last opened. */
1571
+ unseen: number;
1572
+ }
1573
+ declare class NotificationsApi extends BaseApi {
1574
+ constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
1575
+ sessionId?: string;
1576
+ });
1577
+ /** A page of the current user's items, newest first. */
1578
+ list(params?: NotificationListParams, signal?: AbortSignal): Promise<NotificationPage>;
1579
+ /** Unread and unseen counts, for a badge. */
1580
+ counts(workspaceId?: NotificationScope, signal?: AbortSignal): Promise<NotificationCounts>;
1581
+ /**
1582
+ * Mark one item read. Returns it as it now stands. Sent with `keepalive`,
1583
+ * because it is usually followed at once by opening the item's link, and a
1584
+ * page that navigates away would otherwise cancel it.
1585
+ */
1586
+ markRead(id: string): Promise<INotificationItem>;
1587
+ markUnread(id: string): Promise<INotificationItem>;
1588
+ /** Move an item out of the default list. It stays in history (`archived: true`). */
1589
+ archive(id: string): Promise<INotificationItem>;
1590
+ unarchive(id: string): Promise<INotificationItem>;
1591
+ /** Read everything in scope. */
1592
+ markAllRead(workspaceId?: NotificationScope): Promise<void>;
1593
+ /** The inbox was opened: clears "new" without reading anything. */
1594
+ markSeen(workspaceId?: NotificationScope): Promise<void>;
1595
+ private itemAction;
1596
+ }
1597
+
1419
1598
  declare class PushApi extends BaseApi {
1420
1599
  constructor(config: Pick<IBaseApiConfig, 'serverUrl' | 'version' | 'orgId' | 'sessionId'>);
1421
1600
  getVapidPublicKey(): Promise<{
@@ -1585,6 +1764,23 @@ interface NotificationEvent {
1585
1764
  push: boolean;
1586
1765
  };
1587
1766
  }
1767
+ /** One event's channels. A channel left out is on. */
1768
+ interface NotificationChannelPreference {
1769
+ email?: boolean;
1770
+ push?: boolean;
1771
+ }
1772
+ /** The workspace's setting for one event: the default, and whether members may change it. */
1773
+ interface WorkspaceNotificationDefault extends NotificationChannelPreference {
1774
+ /** Members cannot change this event: the default is what they get. */
1775
+ required?: boolean;
1776
+ }
1777
+ /** The signed-in member's notification settings in one workspace. */
1778
+ interface MyNotificationPreferences {
1779
+ /** The workspace's defaults, by event slug. */
1780
+ defaults: Record<string, WorkspaceNotificationDefault>;
1781
+ /** The member's own choices over them, by event slug. */
1782
+ mine: Record<string, NotificationChannelPreference>;
1783
+ }
1588
1784
  declare class WorkspaceApi extends BaseApi {
1589
1785
  constructor(config: IOsConfig & {
1590
1786
  sessionId?: string;
@@ -1608,6 +1804,61 @@ declare class WorkspaceApi extends BaseApi {
1608
1804
  workspace: IWorkspace;
1609
1805
  message: string;
1610
1806
  }>;
1807
+ private fetchInvitation;
1808
+ /** The workspace's invitations, pending first. Needs `MEMBERS_VIEW`. */
1809
+ listInvitations(workspaceId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
1810
+ /**
1811
+ * Invite an email address to a workspace. The person need not have an
1812
+ * account: they get a link that lands on the app's own auth redirect URL
1813
+ * (or on `landingUrl`, which must be one of the auth client's allowed
1814
+ * redirect URLs). Needs `MEMBERS_INVITE`. A pending invitation bills a seat.
1815
+ */
1816
+ inviteMember(workspaceId: string, config: {
1817
+ email: string;
1818
+ role: string;
1819
+ landingUrl?: string;
1820
+ }, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
1821
+ message: string;
1822
+ }>;
1823
+ /** Send the same invitation again (five-minute cooldown). Revives an expired one. */
1824
+ resendInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
1825
+ message: string;
1826
+ }>;
1827
+ /** Withdraw a pending invitation. The invitee is told; the seat is released. */
1828
+ revokeInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<{
1829
+ success: boolean;
1830
+ message: string;
1831
+ }>;
1832
+ /** The signed-in user's own pending invitations, across workspaces. */
1833
+ myInvitations(signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
1834
+ /**
1835
+ * Accept an invitation addressed to the signed-in user's email.
1836
+ *
1837
+ * Pass the `token` from the invitation link when the user arrived by
1838
+ * following it: the token was mailed to that address and to nowhere else, so
1839
+ * it proves the mailbox and the account does not have to be verified
1840
+ * separately first. Without it, the server requires a verified email, which
1841
+ * is the case when accepting from the in-app list.
1842
+ */
1843
+ acceptInvitation(invitationId: string, options?: {
1844
+ token?: string;
1845
+ }, signal?: AbortSignal): Promise<{
1846
+ invitation: IWorkspaceInvitation;
1847
+ /** Null only when another tab accepted a moment earlier and its membership write is still in flight. */
1848
+ workspace: IWorkspace | null;
1849
+ message: string;
1850
+ }>;
1851
+ /** Decline an invitation addressed to the signed-in user's email. */
1852
+ declineInvitation(invitationId: string, signal?: AbortSignal): Promise<{
1853
+ invitation: IWorkspaceInvitation;
1854
+ message: string;
1855
+ }>;
1856
+ /**
1857
+ * What an invitation link resolves to, before sign-in. Public: keyed by the
1858
+ * link's token, answers with the workspace name, the inviter, the role, the
1859
+ * scrambled address and the status. 404 for an unknown or revoked token.
1860
+ */
1861
+ previewInvitation(token: string, signal?: AbortSignal): Promise<IWorkspaceInvitationPreview>;
1611
1862
  removeUser(workspaceId: string, userId: string, signal?: AbortSignal): Promise<{
1612
1863
  userId: string;
1613
1864
  workspace: IWorkspace;
@@ -1832,17 +2083,24 @@ declare class WorkspaceApi extends BaseApi {
1832
2083
  */
1833
2084
  sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData, signal?: AbortSignal): Promise<NotificationResult>;
1834
2085
  getNotificationEvents(workspaceId: string, signal?: AbortSignal): Promise<NotificationEvent[]>;
1835
- getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, {
1836
- email?: boolean;
1837
- push?: boolean;
1838
- }>>;
1839
- updateNotificationPreferences(workspaceId: string, preferences: Record<string, {
1840
- email?: boolean;
1841
- push?: boolean;
1842
- }>, signal?: AbortSignal): Promise<Record<string, {
1843
- email?: boolean;
1844
- push?: boolean;
1845
- }>>;
2086
+ /** The workspace's defaults for every member. Needs `SETTINGS_VIEW`. */
2087
+ getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
2088
+ /**
2089
+ * Change the workspace's defaults (and `required`) for every member. Needs
2090
+ * `SETTINGS_EDIT`. Merged per event: send only what changes.
2091
+ */
2092
+ updateNotificationPreferences(workspaceId: string, preferences: Record<string, WorkspaceNotificationDefault>, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
2093
+ /** The signed-in member's own settings here, and the defaults they sit over. Any member. */
2094
+ getMyNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<MyNotificationPreferences>;
2095
+ /**
2096
+ * Change the signed-in member's own settings. `null` for a channel goes back
2097
+ * to the workspace default. A required event answers 409 with
2098
+ * `code: 'NOTIFICATION_PREFERENCE_REQUIRED'`.
2099
+ */
2100
+ updateMyNotificationPreferences(workspaceId: string, preferences: Record<string, {
2101
+ email?: boolean | null;
2102
+ push?: boolean | null;
2103
+ }>, signal?: AbortSignal): Promise<MyNotificationPreferences>;
1846
2104
  /**
1847
2105
  * Get credit balance for a workspace.
1848
2106
  * @param workspaceId - The workspace ID
@@ -1962,6 +2220,14 @@ declare class EventEmitter {
1962
2220
  * @param role - The role assigned to the user
1963
2221
  */
1964
2222
  emitWorkspaceUserAdded(userId: string, workspace: IWorkspace, role: string): Promise<void>;
2223
+ /** An invitation was sent from this client. */
2224
+ emitWorkspaceInvitationSent(invitation: IWorkspaceInvitation, workspaceId: string): Promise<void>;
2225
+ /** The signed-in user accepted an invitation and joined `workspace`. */
2226
+ emitWorkspaceInvitationAccepted(invitation: IWorkspaceInvitation, workspace: IWorkspace): Promise<void>;
2227
+ /** The signed-in user declined an invitation. */
2228
+ emitWorkspaceInvitationDeclined(invitation: IWorkspaceInvitation): Promise<void>;
2229
+ /** A pending invitation was withdrawn from this client. */
2230
+ emitWorkspaceInvitationRevoked(invitationId: string, workspaceId: string): Promise<void>;
1965
2231
  /**
1966
2232
  * Trigger workspace user removed event
1967
2233
  * @param userId - The ID of the user that was removed
@@ -2848,6 +3114,60 @@ interface SDKMessages {
2848
3114
  memberLimitMessage: string;
2849
3115
  selectRole: string;
2850
3116
  inviteAs: string;
3117
+ invitations: {
3118
+ title: string;
3119
+ pendingCount: string;
3120
+ sent: string;
3121
+ resend: string;
3122
+ resendIn: string;
3123
+ revoke: string;
3124
+ /** Title of the revoke confirmation. */
3125
+ revokeTitle: string;
3126
+ revokeConfirm: string;
3127
+ sentAt: string;
3128
+ expiresAt: string;
3129
+ seatNote: string;
3130
+ formerMember: string;
3131
+ loadFailed: string;
3132
+ resendFailed: string;
3133
+ revokeFailed: string;
3134
+ status: {
3135
+ invited: string;
3136
+ accepted: string;
3137
+ rejected: string;
3138
+ expired: string;
3139
+ };
3140
+ };
3141
+ };
3142
+ invitations: {
3143
+ title: string;
3144
+ description: string;
3145
+ /** The list of the caller's own invitations, above the rows. */
3146
+ listDescription: string;
3147
+ /** Dialog title once the invitee has joined. */
3148
+ titleJoined: string;
3149
+ /** Dialog title for a link that can no longer be used: revoked, expired, switched off. */
3150
+ titleUnavailable: string;
3151
+ sentTo: string;
3152
+ invitedAs: string;
3153
+ accept: string;
3154
+ decline: string;
3155
+ accepted: string;
3156
+ declined: string;
3157
+ expired: string;
3158
+ revoked: string;
3159
+ alreadyAccepted: string;
3160
+ wrongAccount: string;
3161
+ verifyFirst: string;
3162
+ workspaceFull: string;
3163
+ disabled: string;
3164
+ empty: string;
3165
+ signInToAccept: string;
3166
+ dismiss: string;
3167
+ signOut: string;
3168
+ loadFailed: string;
3169
+ acceptFailed: string;
3170
+ declineFailed: string;
2851
3171
  };
2852
3172
  invoices: {
2853
3173
  title: string;
@@ -2961,6 +3281,28 @@ interface SDKMessages {
2961
3281
  failedToDelete: string;
2962
3282
  };
2963
3283
  notifications: {
3284
+ inbox: {
3285
+ title: string;
3286
+ description: string;
3287
+ bellLabel: string;
3288
+ bellUnread: string;
3289
+ filterAll: string;
3290
+ filterUnread: string;
3291
+ markAllRead: string;
3292
+ markRead: string;
3293
+ markUnread: string;
3294
+ archive: string;
3295
+ loadMore: string;
3296
+ empty: string;
3297
+ emptyUnread: string;
3298
+ loadFailed: string;
3299
+ updateFailed: string;
3300
+ channelEmail: string;
3301
+ channelPush: string;
3302
+ opened: string;
3303
+ clicked: string;
3304
+ notDelivered: string;
3305
+ };
2964
3306
  title: string;
2965
3307
  permissionDenied: string;
2966
3308
  notSupported: string;
@@ -2978,6 +3320,13 @@ interface SDKMessages {
2978
3320
  pushDescription: string;
2979
3321
  deviceNote: string;
2980
3322
  prefsSaved: string;
3323
+ prefsSaveFailed: string;
3324
+ yourTitle: string;
3325
+ yourDescription: string;
3326
+ defaultsTitle: string;
3327
+ defaultsDescription: string;
3328
+ requiredLabel: string;
3329
+ requiredHint: string;
2981
3330
  loadingPrefs: string;
2982
3331
  categories: {
2983
3332
  workspace: string;
@@ -3235,6 +3584,97 @@ type Level4 = {
3235
3584
  /** Union of all valid translation key paths (e.g. "settings.titles.profile") */
3236
3585
  type TranslationKey = Level2 | Level3 | Level4;
3237
3586
 
3587
+ /**
3588
+ * The error an invitation call throws. A plain `Error` (so every existing
3589
+ * `catch (err) { err.message }` keeps working) carrying the server's fields
3590
+ * as properties, so a screen can act on the shape of the refusal: open the
3591
+ * plan picker on a seat limit, count down a resend cooldown, show which
3592
+ * address the invitation was for.
3593
+ */
3594
+ declare const INVITATION_ERROR_CODE: {
3595
+ readonly NOT_FOUND: "INVITATION_NOT_FOUND";
3596
+ readonly EXPIRED: "INVITATION_EXPIRED";
3597
+ readonly ALREADY_HANDLED: "INVITATION_ALREADY_HANDLED";
3598
+ readonly EMAIL_MISMATCH: "INVITATION_EMAIL_MISMATCH";
3599
+ readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
3600
+ readonly INVITES_DISABLED: "WORKSPACE_INVITES_DISABLED";
3601
+ readonly RATE_LIMITED: "INVITATION_RATE_LIMITED";
3602
+ readonly EMAIL_FAILED: "INVITATION_EMAIL_FAILED";
3603
+ readonly SEAT_LIMIT: "SEAT_LIMIT_REACHED";
3604
+ /** The invited or accepting account is blocked. */
3605
+ readonly USER_BLOCKED: "USER_BLOCKED";
3606
+ /**
3607
+ * The organization has no usable email sender, so no invitation can be sent.
3608
+ *
3609
+ * This one is refused by the server's `requireEmailSender` middleware rather
3610
+ * than by the invitation route, so the string is that middleware's
3611
+ * (`EMAIL_SENDER_CODE.NO_SENDER_CONFIGURED`), not an invitation code. Named
3612
+ * after it on purpose: the value is what arrives, and a prettier alias here
3613
+ * would simply never match.
3614
+ */
3615
+ readonly NO_SENDER_CONFIGURED: "NO_SENDER_CONFIGURED";
3616
+ };
3617
+ type InvitationErrorCode = (typeof INVITATION_ERROR_CODE)[keyof typeof INVITATION_ERROR_CODE];
3618
+ interface InvitationErrorFields {
3619
+ /** The HTTP status the server answered with. */
3620
+ status: number;
3621
+ /** A stable code, from the body when the server sent one, else derived from the status. */
3622
+ code: string;
3623
+ /** On a 402: members plus pending invitations, and the ceiling they hit. */
3624
+ currentUserCount?: number;
3625
+ limit?: number;
3626
+ /** On a resend's 429: seconds until the cooldown ends. */
3627
+ retryAfterSeconds?: number;
3628
+ /** On an email mismatch: the invited address, scrambled. */
3629
+ invitedEmail?: string;
3630
+ /** On "already invited": the live invitation, so the caller can offer resend. */
3631
+ invitationId?: string;
3632
+ /** On "already handled": the row's status. */
3633
+ invitationStatus?: string;
3634
+ }
3635
+ type InvitationError = Error & InvitationErrorFields;
3636
+ /** True when an unknown thrown value is an invitation error carrying a status. */
3637
+ declare function isInvitationError(err: unknown): err is InvitationError;
3638
+
3639
+ /**
3640
+ * The admin's ordering: pending first, then newest first within a status. An
3641
+ * admin should see what lapsed, so nothing is dropped here.
3642
+ */
3643
+ declare function sortInvitations(rows: IWorkspaceInvitation[]): IWorkspaceInvitation[];
3644
+ /** Pending and not past its expiry: something the invitee can still accept or decline. */
3645
+ declare function isInvitationActionable(row: IWorkspaceInvitation, now?: Date): boolean;
3646
+ /**
3647
+ * The invitee's list: "a list of things you can act on should contain only
3648
+ * things you can act on". The server already filters, this keeps a stale
3649
+ * client list honest between refreshes.
3650
+ */
3651
+ declare function actionableInvitations(rows: IWorkspaceInvitation[], now?: Date): IWorkspaceInvitation[];
3652
+ /** Pending, past its expiry, not yet swept: shown as expired by the admin's list. */
3653
+ declare function isInvitationLapsed(row: IWorkspaceInvitation, now?: Date): boolean;
3654
+ declare function workspaceNameOf(row: IWorkspaceInvitation): string;
3655
+ declare function workspaceIdOf(row: IWorkspaceInvitation): string;
3656
+ /** The inviter's display name, or null when their account is gone. */
3657
+ declare function inviterNameOf(row: IWorkspaceInvitation): string | null;
3658
+ /**
3659
+ * Seconds until a row may be resent, zero when it may. The cooldown itself is
3660
+ * the server's rule and stays there: this counts down to the `resendAvailableAt`
3661
+ * the server puts on every pending row, so the button cannot unlock a second
3662
+ * before the endpoint stops answering 429. A row without the field (a server
3663
+ * older than it) reports zero, leaving that 429 as the only authority.
3664
+ */
3665
+ declare function resendCooldownSeconds(row: IWorkspaceInvitation, now?: Date): number;
3666
+
3667
+ /** Park a token for `orgId`. A malformed token is ignored rather than stored. */
3668
+ declare function parkPendingInvite(token: string, orgId: string): void;
3669
+ /**
3670
+ * The parked token for `orgId`, or null when there is none, it is older than a
3671
+ * day, or it belongs to another org. Does not clear: the flow clears it on a
3672
+ * terminal answer (accepted, declined, expired, handled), never on a network
3673
+ * error, so a retry stays possible.
3674
+ */
3675
+ declare function readPendingInvite(orgId: string, now?: number): string | null;
3676
+ declare function clearPendingInvite(): void;
3677
+
3238
3678
  /**
3239
3679
  * Verify that a webhook request came from BuildBase.
3240
3680
  *
@@ -4190,6 +4630,11 @@ interface WorkspaceActions {
4190
4630
  }
4191
4631
  interface UserActions {
4192
4632
  list(workspaceId: string): Promise<IWorkspaceUser[]>;
4633
+ /**
4634
+ * Add an EXISTING account to the workspace at once. Answers 404 when the
4635
+ * address has no account. To reach someone with no account, send an
4636
+ * invitation with `invitations.create`.
4637
+ */
4193
4638
  invite(workspaceId: string, email: string, role: string): Promise<{
4194
4639
  userId: string;
4195
4640
  workspace: IWorkspace;
@@ -4338,9 +4783,38 @@ interface CreditActions {
4338
4783
  getPublicPackages(): Promise<IPublicCreditPackagesResponse>;
4339
4784
  }
4340
4785
  /** All action modules bound to a specific session. Returned by `withSession()`. */
4786
+ /**
4787
+ * Workspace invitations: reach an address that may have no account. A
4788
+ * pending invitation bills a seat until accepted, declined, revoked or
4789
+ * expired. The accept and decline side belongs to the invitee's own session,
4790
+ * so it lives on the client (`useMyInvitations`, `<PendingInvitations />`).
4791
+ */
4792
+ interface InvitationActions {
4793
+ /** The workspace's invitations, pending first. */
4794
+ list(workspaceId: string): Promise<IWorkspaceInvitation[]>;
4795
+ /**
4796
+ * Invite an email address. `landingUrl` is where the emailed link lands;
4797
+ * left out, the first allowed redirect URL of the auth client the session
4798
+ * signed in through. A session minted from an API token has no client, so
4799
+ * pass it: one of the allowed redirect URLs of an auth client in the org.
4800
+ */
4801
+ create(workspaceId: string, email: string, role: string, landingUrl?: string): Promise<IWorkspaceInvitation & {
4802
+ message: string;
4803
+ }>;
4804
+ /** Send it again (five-minute cooldown). Revives an expired invitation. */
4805
+ resend(workspaceId: string, invitationId: string): Promise<IWorkspaceInvitation & {
4806
+ message: string;
4807
+ }>;
4808
+ /** Withdraw a pending invitation. */
4809
+ revoke(workspaceId: string, invitationId: string): Promise<{
4810
+ success: boolean;
4811
+ message: string;
4812
+ }>;
4813
+ }
4341
4814
  interface ScopedActions {
4342
4815
  workspace: WorkspaceActions;
4343
4816
  users: UserActions;
4817
+ invitations: InvitationActions;
4344
4818
  subscription: SubscriptionActions;
4345
4819
  plans: PlanActions;
4346
4820
  invoices: InvoiceActions;
@@ -4602,5 +5076,5 @@ declare function buildbaseAuth(options: BuildBaseAuthOptions): {
4602
5076
  resourceMetadataUrl?: string;
4603
5077
  };
4604
5078
 
4605
- export { AI_BOT_USER_AGENTS, ApiVersion, AppBridgeError, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBase, CURRENCY_DISPLAY, CURRENCY_FLAG, CreditBucketSource, CreditBucketStatus, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, DunningState, EventEmitter, InvoiceStatuses, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PushApi, SDKEvent, SettingsApi, SubscriptionItemType, SubscriptionStatus, UserApi, WorkspaceApi, appTokenFailure, appTokenSuccess, bearerChallenge, buildA2AAgentCard, buildAgentCard, buildAgentSkillsIndex, buildApiCatalog, buildAuthMd, buildDiscoveryLinkHeader, buildDnsAidRecords, buildLlmsFullTxt, buildLlmsTxt, buildMcpDiscoveryManifest, buildMcpServerCard, buildProtectedResourceMetadata, buildRobotsTxt, buildSecurityTxt, buildSitemap, buildSkillMd, buildWebBotAuthDirectory, buildbaseAuth, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAgentReadinessCache, clearAuthIntent, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, createSessionRefCrypto, BuildBase as default, eventEmitter, extractBearerToken, fetchAgentReadiness, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, handleAppRevokeRequest, handleAppTokenRequest, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, isZeroDecimalCurrency, minorAmountToDisplay, mintAgentToken, negotiateMarkdown, parseWebhookEvent, provideWebMcpTools, readBBParams, resolveAgentPath, resolveMaxUsers, resolvePermissions, resolveWellKnown, safeRedirect, saveAuthIntent, sha256Digest, signClientJwt, validateInvite, validateRedirectUrl, verifyAppRevokeRequest, verifyAppTokenRequest, verifyClientJwt, verifyWebhookSignature, wantsMarkdown };
4606
- export type { A2ACardConfig, A2ACardSkill, AgentReadinessBundle, AgentReadyConfig, AgentSkill, ApiCatalogApi, AppRevokeRequestClaims, AppScope, AppTokenRequestClaims, AppTokenResponseBody, AppTokenResult, BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseAuthOptions, BuildBaseConfig, BuildBaseResult, BuildBaseSession, CheckoutResult, ContentSignals, CreditActions, CreditBucketSourceType, CreditBucketStatusType, CreditTransactionTypeValue, DiscoveryDocument, DnsAidRecord, DunningStateType, EventData, EventType, FeatureActions, FormatQuotaWithPriceOptions, GetCheckoutStripeParams, HandlerResult, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, 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, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, InviteBlockReason, InviteValidation, InvoiceActions, InvoiceStatus, InvoiceStatusType, MaxUsersConfig, McpServerCard, MintAgentTokenOptions, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PermissionActions, PermissionContext, PermissionKey, PlanActions, PlanVersionWithPricingVariants, QuotaDisplayValue, QuotaDisplayWithOverage, RedirectValidationOptions, RobotsConfig, RobotsPolicy, RolePermissionMap, ScopedActions, SessionRefCrypto, SettingsActions, SitemapUrl, SubscriptionActions, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, UsageActions, UserActions, UserCreatedEventData, UserUpdatedEventData, WebMcpTool, WorkspaceActions, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
5079
+ export { AI_BOT_USER_AGENTS, ApiVersion, AppBridgeError, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBase, CURRENCY_DISPLAY, CURRENCY_FLAG, CreditBucketSource, CreditBucketStatus, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, DunningState, EventEmitter, INVITATION_ERROR_CODE, InvoiceStatuses, NotificationsApi, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PushApi, SDKEvent, SettingsApi, SubscriptionItemType, SubscriptionStatus, UserApi, WorkspaceApi, actionableInvitations, appTokenFailure, appTokenSuccess, bearerChallenge, buildA2AAgentCard, buildAgentCard, buildAgentSkillsIndex, buildApiCatalog, buildAuthMd, buildDiscoveryLinkHeader, buildDnsAidRecords, buildLlmsFullTxt, buildLlmsTxt, buildMcpDiscoveryManifest, buildMcpServerCard, buildProtectedResourceMetadata, buildRobotsTxt, buildSecurityTxt, buildSitemap, buildSkillMd, buildWebBotAuthDirectory, buildbaseAuth, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAgentReadinessCache, clearAuthIntent, clearPendingInvite, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, createSessionRefCrypto, BuildBase as default, eventEmitter, extractBearerToken, fetchAgentReadiness, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, handleAppRevokeRequest, handleAppTokenRequest, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, inviterNameOf, isInvitationActionable, isInvitationError, isInvitationLapsed, isZeroDecimalCurrency, minorAmountToDisplay, mintAgentToken, negotiateMarkdown, parkPendingInvite, parseWebhookEvent, provideWebMcpTools, readBBParams, readPendingInvite, resendCooldownSeconds, resolveAgentPath, resolveMaxUsers, resolvePermissions, resolveWellKnown, safeRedirect, saveAuthIntent, sha256Digest, signClientJwt, sortInvitations, validateInvite, validateRedirectUrl, verifyAppRevokeRequest, verifyAppTokenRequest, verifyClientJwt, verifyWebhookSignature, wantsMarkdown, workspaceIdOf, workspaceNameOf };
5080
+ export type { A2ACardConfig, A2ACardSkill, AgentReadinessBundle, AgentReadyConfig, AgentSkill, ApiCatalogApi, AppRevokeRequestClaims, AppScope, AppTokenRequestClaims, AppTokenResponseBody, AppTokenResult, BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseAuthOptions, BuildBaseConfig, BuildBaseResult, BuildBaseSession, CheckoutResult, ContentSignals, CreditActions, CreditBucketSourceType, CreditBucketStatusType, CreditTransactionTypeValue, DiscoveryDocument, DnsAidRecord, DunningStateType, EventData, EventType, FeatureActions, FormatQuotaWithPriceOptions, GetCheckoutStripeParams, HandlerResult, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, 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, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, IWorkspaceInvitation, IWorkspaceInvitationPreview, IWorkspaceInvitationStatus, InvitationActions, InvitationError, InvitationErrorCode, InvitationErrorFields, InviteBlockReason, InviteValidation, InvoiceActions, InvoiceStatus, InvoiceStatusType, MaxUsersConfig, McpServerCard, MintAgentTokenOptions, MyNotificationPreferences, NotificationChannelPreference, NotificationCounts, NotificationData, NotificationEvent, NotificationListParams, NotificationPage, NotificationResult, NotificationScope, OnWorkspaceChangeParams, PermissionActions, PermissionContext, PermissionKey, PlanActions, PlanVersionWithPricingVariants, QuotaDisplayValue, QuotaDisplayWithOverage, RedirectValidationOptions, RobotsConfig, RobotsPolicy, RolePermissionMap, ScopedActions, SessionRefCrypto, SettingsActions, SitemapUrl, SubscriptionActions, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, UsageActions, UserActions, UserCreatedEventData, UserUpdatedEventData, WebMcpTool, WorkspaceActions, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceInvitationAcceptedEventData, WorkspaceInvitationDeclinedEventData, WorkspaceInvitationRevokedEventData, WorkspaceInvitationSentEventData, WorkspaceNotificationDefault, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };