@buildbase/sdk 0.0.70 → 0.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +5 -2
- package/CHANGELOG.md +114 -0
- package/README.md +141 -4
- package/dist/cli.mjs +2 -0
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +589 -14
- package/dist/index.mjs +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +102 -0
- package/dist/mcp/index.mjs +1 -1
- package/dist/react/chunks/SettingsDialog-CvBSuMf-.mjs +2 -0
- package/dist/react/chunks/SettingsDialog-DdOUkwIi.cjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-CdZzF5eK.cjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-D8_frxHc.mjs +2 -0
- package/dist/react/chunks/ar-CRVhjpVE.cjs +2 -0
- package/dist/react/chunks/ar-DFPDdu2U.mjs +2 -0
- package/dist/react/chunks/de-BGhzn711.cjs +2 -0
- package/dist/react/chunks/de-Bqi8scew.mjs +2 -0
- package/dist/react/chunks/es-D_Eqhob3.mjs +2 -0
- package/dist/react/chunks/es-DyrMaeUp.cjs +2 -0
- package/dist/react/chunks/fr-C0SkloRr.cjs +2 -0
- package/dist/react/chunks/fr-DkZpFQ1Q.mjs +2 -0
- package/dist/react/chunks/hi-B9TK87T8.cjs +2 -0
- package/dist/react/chunks/hi-DrTcPkiY.mjs +2 -0
- package/dist/react/chunks/ja-Dgahn--0.mjs +2 -0
- package/dist/react/chunks/ja-LjzlAhAT.cjs +2 -0
- package/dist/react/chunks/react-BSHCN-ZU.mjs +2 -0
- package/dist/react/chunks/react-DQqr117G.cjs +2 -0
- package/dist/react/chunks/zh-BezRHDHs.mjs +2 -0
- package/dist/react/chunks/zh-CcodKi4U.cjs +2 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +826 -25
- package/dist/react/index.mjs +1 -1
- package/dist/server/browser.cjs +1 -0
- package/dist/server/browser.mjs +1 -0
- package/dist/server/index.cjs +1 -0
- package/dist/server/index.d.ts +556 -0
- package/dist/server/index.mjs +1 -0
- package/dist/server/next/index.cjs +1 -0
- package/dist/server/next/index.d.ts +156 -0
- package/dist/server/next/index.mjs +1 -0
- package/dist/tracking/index.cjs +1 -1
- package/dist/tracking/index.d.ts +205 -8
- package/dist/tracking/index.mjs +1 -1
- package/docs/ERROR_CODES.md +24 -0
- package/docs/SERVER-CONTENT.md +297 -0
- package/docs/UI-CONFIG.md +1 -0
- package/package.json +66 -5
- package/dist/react/chunks/SettingsDialog-VKPguQBs.mjs +0 -2
- package/dist/react/chunks/SettingsDialog-_kfJ6j25.cjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-C_1ipsC2.cjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-Cbk3EGBr.mjs +0 -2
- package/dist/react/chunks/ar-CHTRXlXt.mjs +0 -2
- package/dist/react/chunks/ar-DPJVNHJV.cjs +0 -2
- package/dist/react/chunks/de-CdPeKWZ2.mjs +0 -2
- package/dist/react/chunks/de-DPd09yf-.cjs +0 -2
- package/dist/react/chunks/es-BWGnjJKJ.mjs +0 -2
- package/dist/react/chunks/es-WdOYGt6G.cjs +0 -2
- package/dist/react/chunks/fr-Big5DFPB.mjs +0 -2
- package/dist/react/chunks/fr-LIbCvYeh.cjs +0 -2
- package/dist/react/chunks/hi-BoCY3pFe.cjs +0 -2
- package/dist/react/chunks/hi-jArNRknR.mjs +0 -2
- package/dist/react/chunks/ja-Cwdz0hCu.mjs +0 -2
- package/dist/react/chunks/ja-E0jqCiVq.cjs +0 -2
- package/dist/react/chunks/react-B0MFoaXI.mjs +0 -2
- package/dist/react/chunks/react-DSRfaDnZ.cjs +0 -2
- package/dist/react/chunks/zh-glRKcdia.mjs +0 -2
- 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
|
|
@@ -1028,6 +1102,16 @@ interface ISettings {
|
|
|
1028
1102
|
canInviteMembers: boolean | 'admin-only';
|
|
1029
1103
|
/** Custom role→permission mapping. Overrides SDK defaults when provided by backend. */
|
|
1030
1104
|
permissions?: Record<string, string[]>;
|
|
1105
|
+
/**
|
|
1106
|
+
* The organization's own permissions, defined in the BuildBase console:
|
|
1107
|
+
* `{ key: 'app:reports:export', label: 'Export reports', group: 'Reports' }`.
|
|
1108
|
+
* Absent on a server from before release 23.
|
|
1109
|
+
*/
|
|
1110
|
+
customPermissions?: {
|
|
1111
|
+
key: string;
|
|
1112
|
+
label: string;
|
|
1113
|
+
group?: string;
|
|
1114
|
+
}[];
|
|
1031
1115
|
/** Show workspace switcher in the UI */
|
|
1032
1116
|
showSwitcher: boolean;
|
|
1033
1117
|
/** Max workspaces a user can own. 0 = unlimited */
|
|
@@ -1230,6 +1314,18 @@ interface AuthRequestParams {
|
|
|
1230
1314
|
* Populated automatically from the tracking provider when one is mounted.
|
|
1231
1315
|
* Omitted means unanswered, which is not the same as refused.
|
|
1232
1316
|
*/
|
|
1317
|
+
/**
|
|
1318
|
+
* Where the visitor came from - the click ids and campaign fields captured
|
|
1319
|
+
* on their landing page, when, and where. Stored on the user the hosted
|
|
1320
|
+
* pages create, so a conversion that happens later with no browser (a trial
|
|
1321
|
+
* converting, a renewal) can still be joined to the ad click. Populated
|
|
1322
|
+
* automatically from the attribution cookie when tracking is mounted.
|
|
1323
|
+
*/
|
|
1324
|
+
trackingAttribution?: {
|
|
1325
|
+
params: Record<string, string>;
|
|
1326
|
+
capturedAt?: number;
|
|
1327
|
+
landingUrl?: string;
|
|
1328
|
+
};
|
|
1233
1329
|
trackingConsent?: {
|
|
1234
1330
|
analytics: boolean;
|
|
1235
1331
|
marketing: boolean;
|
|
@@ -1416,6 +1512,111 @@ declare class DevicesApi extends BaseApi {
|
|
|
1416
1512
|
}>;
|
|
1417
1513
|
}
|
|
1418
1514
|
|
|
1515
|
+
/**
|
|
1516
|
+
* API client for the signed-in user's notification inbox. Session-authed
|
|
1517
|
+
* (x-session-id) and scoped to the current user by the server: every call
|
|
1518
|
+
* reads or changes only their own items. Extends BaseApi for shared
|
|
1519
|
+
* URL/auth/request handling.
|
|
1520
|
+
*
|
|
1521
|
+
* One item is one notification, however it was delivered: an event sent by
|
|
1522
|
+
* email and push is a single item whose `channels` say what each did.
|
|
1523
|
+
*/
|
|
1524
|
+
|
|
1525
|
+
type NotificationChannelStatus = 'none' | 'queued' | 'sent' | 'failed' | 'skipped';
|
|
1526
|
+
type NotificationSource = 'system' | 'custom' | 'workflow' | 'campaign' | 'console';
|
|
1527
|
+
/** How an item was first read: in the inbox, or by clicking its email or push link. */
|
|
1528
|
+
type NotificationReadVia = 'inbox' | 'email_click' | 'push_click';
|
|
1529
|
+
/** One notification in the signed-in user's inbox. Dates are ISO strings. */
|
|
1530
|
+
interface INotificationItem {
|
|
1531
|
+
id: string;
|
|
1532
|
+
/** The workspace it is about, or null for an account notice. */
|
|
1533
|
+
workspaceId: string | null;
|
|
1534
|
+
/** The event slug that sent it. */
|
|
1535
|
+
event: string;
|
|
1536
|
+
source: NotificationSource;
|
|
1537
|
+
title: string;
|
|
1538
|
+
body: string;
|
|
1539
|
+
/** The destination as the app set it, for display. */
|
|
1540
|
+
url: string | null;
|
|
1541
|
+
/**
|
|
1542
|
+
* What to open when the item is clicked: an absolute destination routed
|
|
1543
|
+
* through the server's link check (which also marks the item read), a path
|
|
1544
|
+
* inside the app as it is, or null when there is nothing safe to open.
|
|
1545
|
+
*/
|
|
1546
|
+
link: string | null;
|
|
1547
|
+
icon: string | null;
|
|
1548
|
+
channels: {
|
|
1549
|
+
/** An open is recorded but does not read the item; a click does. */
|
|
1550
|
+
email: {
|
|
1551
|
+
status: NotificationChannelStatus;
|
|
1552
|
+
openedAt: string | null;
|
|
1553
|
+
clickedAt: string | null;
|
|
1554
|
+
};
|
|
1555
|
+
push: {
|
|
1556
|
+
status: NotificationChannelStatus;
|
|
1557
|
+
clickedAt: string | null;
|
|
1558
|
+
};
|
|
1559
|
+
};
|
|
1560
|
+
createdAt: string | null;
|
|
1561
|
+
/** The inbox was opened while this was in it. Not the same as read. */
|
|
1562
|
+
seenAt: string | null;
|
|
1563
|
+
readAt: string | null;
|
|
1564
|
+
readVia: NotificationReadVia | null;
|
|
1565
|
+
archivedAt: string | null;
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Which items: one workspace's, `'none'` for the account notices that belong
|
|
1569
|
+
* to no workspace, or omitted for everything.
|
|
1570
|
+
*/
|
|
1571
|
+
type NotificationScope = string | 'none' | undefined;
|
|
1572
|
+
interface NotificationListParams {
|
|
1573
|
+
workspaceId?: NotificationScope;
|
|
1574
|
+
/** Only unread items. */
|
|
1575
|
+
unread?: boolean;
|
|
1576
|
+
/** Include archived items, which the default list leaves out. */
|
|
1577
|
+
archived?: boolean;
|
|
1578
|
+
page?: number;
|
|
1579
|
+
/** At most 100. */
|
|
1580
|
+
limit?: number;
|
|
1581
|
+
}
|
|
1582
|
+
interface NotificationPage {
|
|
1583
|
+
notifications: INotificationItem[];
|
|
1584
|
+
page: number;
|
|
1585
|
+
limit: number;
|
|
1586
|
+
total: number;
|
|
1587
|
+
hasNextPage: boolean;
|
|
1588
|
+
}
|
|
1589
|
+
interface NotificationCounts {
|
|
1590
|
+
/** Unread and not archived: the number on the bell. */
|
|
1591
|
+
unread: number;
|
|
1592
|
+
/** Unread and never seen: whether anything is new since the inbox was last opened. */
|
|
1593
|
+
unseen: number;
|
|
1594
|
+
}
|
|
1595
|
+
declare class NotificationsApi extends BaseApi {
|
|
1596
|
+
constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
|
|
1597
|
+
sessionId?: string;
|
|
1598
|
+
});
|
|
1599
|
+
/** A page of the current user's items, newest first. */
|
|
1600
|
+
list(params?: NotificationListParams, signal?: AbortSignal): Promise<NotificationPage>;
|
|
1601
|
+
/** Unread and unseen counts, for a badge. */
|
|
1602
|
+
counts(workspaceId?: NotificationScope, signal?: AbortSignal): Promise<NotificationCounts>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Mark one item read. Returns it as it now stands. Sent with `keepalive`,
|
|
1605
|
+
* because it is usually followed at once by opening the item's link, and a
|
|
1606
|
+
* page that navigates away would otherwise cancel it.
|
|
1607
|
+
*/
|
|
1608
|
+
markRead(id: string): Promise<INotificationItem>;
|
|
1609
|
+
markUnread(id: string): Promise<INotificationItem>;
|
|
1610
|
+
/** Move an item out of the default list. It stays in history (`archived: true`). */
|
|
1611
|
+
archive(id: string): Promise<INotificationItem>;
|
|
1612
|
+
unarchive(id: string): Promise<INotificationItem>;
|
|
1613
|
+
/** Read everything in scope. */
|
|
1614
|
+
markAllRead(workspaceId?: NotificationScope): Promise<void>;
|
|
1615
|
+
/** The inbox was opened: clears "new" without reading anything. */
|
|
1616
|
+
markSeen(workspaceId?: NotificationScope): Promise<void>;
|
|
1617
|
+
private itemAction;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1419
1620
|
declare class PushApi extends BaseApi {
|
|
1420
1621
|
constructor(config: Pick<IBaseApiConfig, 'serverUrl' | 'version' | 'orgId' | 'sessionId'>);
|
|
1421
1622
|
getVapidPublicKey(): Promise<{
|
|
@@ -1503,6 +1704,15 @@ declare class UserApi extends BaseApi {
|
|
|
1503
1704
|
getFeatures(signal?: AbortSignal): Promise<Record<string, boolean>>;
|
|
1504
1705
|
}
|
|
1505
1706
|
|
|
1707
|
+
/** What a member may do in a workspace, as the server resolved it. */
|
|
1708
|
+
interface WorkspaceMemberPermissions {
|
|
1709
|
+
/** The member's role, or null when they are not a member. */
|
|
1710
|
+
role: string | null;
|
|
1711
|
+
/** The workspace's owner holds every permission. */
|
|
1712
|
+
isOwner: boolean;
|
|
1713
|
+
/** Platform keys (`workspace:*`) and the organization's own keys. */
|
|
1714
|
+
permissions: string[];
|
|
1715
|
+
}
|
|
1506
1716
|
/** Data passed to a notification template for merge tag replacement. */
|
|
1507
1717
|
interface NotificationData {
|
|
1508
1718
|
/** Push notification title. Falls back to the event name if not provided. */
|
|
@@ -1585,6 +1795,23 @@ interface NotificationEvent {
|
|
|
1585
1795
|
push: boolean;
|
|
1586
1796
|
};
|
|
1587
1797
|
}
|
|
1798
|
+
/** One event's channels. A channel left out is on. */
|
|
1799
|
+
interface NotificationChannelPreference {
|
|
1800
|
+
email?: boolean;
|
|
1801
|
+
push?: boolean;
|
|
1802
|
+
}
|
|
1803
|
+
/** The workspace's setting for one event: the default, and whether members may change it. */
|
|
1804
|
+
interface WorkspaceNotificationDefault extends NotificationChannelPreference {
|
|
1805
|
+
/** Members cannot change this event: the default is what they get. */
|
|
1806
|
+
required?: boolean;
|
|
1807
|
+
}
|
|
1808
|
+
/** The signed-in member's notification settings in one workspace. */
|
|
1809
|
+
interface MyNotificationPreferences {
|
|
1810
|
+
/** The workspace's defaults, by event slug. */
|
|
1811
|
+
defaults: Record<string, WorkspaceNotificationDefault>;
|
|
1812
|
+
/** The member's own choices over them, by event slug. */
|
|
1813
|
+
mine: Record<string, NotificationChannelPreference>;
|
|
1814
|
+
}
|
|
1588
1815
|
declare class WorkspaceApi extends BaseApi {
|
|
1589
1816
|
constructor(config: IOsConfig & {
|
|
1590
1817
|
sessionId?: string;
|
|
@@ -1594,6 +1821,12 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1594
1821
|
createWorkspace(data: {
|
|
1595
1822
|
name: string;
|
|
1596
1823
|
image?: string;
|
|
1824
|
+
/** Where the creator came from. Stored on the workspace for conversions recorded later. */
|
|
1825
|
+
trackingAttribution?: {
|
|
1826
|
+
params: Record<string, string>;
|
|
1827
|
+
capturedAt?: number;
|
|
1828
|
+
landingUrl?: string;
|
|
1829
|
+
};
|
|
1597
1830
|
}, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1598
1831
|
updateWorkspace(id: string, data: Partial<IWorkspace>, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1599
1832
|
deleteWorkspace(id: string, signal?: AbortSignal): Promise<{
|
|
@@ -1608,6 +1841,61 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1608
1841
|
workspace: IWorkspace;
|
|
1609
1842
|
message: string;
|
|
1610
1843
|
}>;
|
|
1844
|
+
private fetchInvitation;
|
|
1845
|
+
/** The workspace's invitations, pending first. Needs `MEMBERS_VIEW`. */
|
|
1846
|
+
listInvitations(workspaceId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Invite an email address to a workspace. The person need not have an
|
|
1849
|
+
* account: they get a link that lands on the app's own auth redirect URL
|
|
1850
|
+
* (or on `landingUrl`, which must be one of the auth client's allowed
|
|
1851
|
+
* redirect URLs). Needs `MEMBERS_INVITE`. A pending invitation bills a seat.
|
|
1852
|
+
*/
|
|
1853
|
+
inviteMember(workspaceId: string, config: {
|
|
1854
|
+
email: string;
|
|
1855
|
+
role: string;
|
|
1856
|
+
landingUrl?: string;
|
|
1857
|
+
}, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
|
|
1858
|
+
message: string;
|
|
1859
|
+
}>;
|
|
1860
|
+
/** Send the same invitation again (five-minute cooldown). Revives an expired one. */
|
|
1861
|
+
resendInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
|
|
1862
|
+
message: string;
|
|
1863
|
+
}>;
|
|
1864
|
+
/** Withdraw a pending invitation. The invitee is told; the seat is released. */
|
|
1865
|
+
revokeInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<{
|
|
1866
|
+
success: boolean;
|
|
1867
|
+
message: string;
|
|
1868
|
+
}>;
|
|
1869
|
+
/** The signed-in user's own pending invitations, across workspaces. */
|
|
1870
|
+
myInvitations(signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
|
|
1871
|
+
/**
|
|
1872
|
+
* Accept an invitation addressed to the signed-in user's email.
|
|
1873
|
+
*
|
|
1874
|
+
* Pass the `token` from the invitation link when the user arrived by
|
|
1875
|
+
* following it: the token was mailed to that address and to nowhere else, so
|
|
1876
|
+
* it proves the mailbox and the account does not have to be verified
|
|
1877
|
+
* separately first. Without it, the server requires a verified email, which
|
|
1878
|
+
* is the case when accepting from the in-app list.
|
|
1879
|
+
*/
|
|
1880
|
+
acceptInvitation(invitationId: string, options?: {
|
|
1881
|
+
token?: string;
|
|
1882
|
+
}, signal?: AbortSignal): Promise<{
|
|
1883
|
+
invitation: IWorkspaceInvitation;
|
|
1884
|
+
/** Null only when another tab accepted a moment earlier and its membership write is still in flight. */
|
|
1885
|
+
workspace: IWorkspace | null;
|
|
1886
|
+
message: string;
|
|
1887
|
+
}>;
|
|
1888
|
+
/** Decline an invitation addressed to the signed-in user's email. */
|
|
1889
|
+
declineInvitation(invitationId: string, signal?: AbortSignal): Promise<{
|
|
1890
|
+
invitation: IWorkspaceInvitation;
|
|
1891
|
+
message: string;
|
|
1892
|
+
}>;
|
|
1893
|
+
/**
|
|
1894
|
+
* What an invitation link resolves to, before sign-in. Public: keyed by the
|
|
1895
|
+
* link's token, answers with the workspace name, the inviter, the role, the
|
|
1896
|
+
* scrambled address and the status. 404 for an unknown or revoked token.
|
|
1897
|
+
*/
|
|
1898
|
+
previewInvitation(token: string, signal?: AbortSignal): Promise<IWorkspaceInvitationPreview>;
|
|
1611
1899
|
removeUser(workspaceId: string, userId: string, signal?: AbortSignal): Promise<{
|
|
1612
1900
|
userId: string;
|
|
1613
1901
|
workspace: IWorkspace;
|
|
@@ -1622,6 +1910,12 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1622
1910
|
permissions: Record<string, string[]>;
|
|
1623
1911
|
}, signal?: AbortSignal): Promise<any>;
|
|
1624
1912
|
updateWorkspacePermissions(workspaceId: string, permissions: Record<string, string[]>, signal?: AbortSignal): Promise<any>;
|
|
1913
|
+
/**
|
|
1914
|
+
* What the signed-in member may do in a workspace, as the server resolves
|
|
1915
|
+
* it: the platform's permissions and the organization's own. A backend asks
|
|
1916
|
+
* this rather than trusting a flag the browser sent.
|
|
1917
|
+
*/
|
|
1918
|
+
getMyPermissions(workspaceId: string, signal?: AbortSignal): Promise<WorkspaceMemberPermissions>;
|
|
1625
1919
|
getFeatures(signal?: AbortSignal): Promise<IWorkspaceFeature[]>;
|
|
1626
1920
|
updateFeature(workspaceId: string, key: string, value: boolean, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1627
1921
|
getWorkspace(workspaceId: string, signal?: AbortSignal): Promise<IWorkspace>;
|
|
@@ -1832,17 +2126,24 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1832
2126
|
*/
|
|
1833
2127
|
sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData, signal?: AbortSignal): Promise<NotificationResult>;
|
|
1834
2128
|
getNotificationEvents(workspaceId: string, signal?: AbortSignal): Promise<NotificationEvent[]>;
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
2129
|
+
/** The workspace's defaults for every member. Needs `SETTINGS_VIEW`. */
|
|
2130
|
+
getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Change the workspace's defaults (and `required`) for every member. Needs
|
|
2133
|
+
* `SETTINGS_EDIT`. Merged per event: send only what changes.
|
|
2134
|
+
*/
|
|
2135
|
+
updateNotificationPreferences(workspaceId: string, preferences: Record<string, WorkspaceNotificationDefault>, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
|
|
2136
|
+
/** The signed-in member's own settings here, and the defaults they sit over. Any member. */
|
|
2137
|
+
getMyNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<MyNotificationPreferences>;
|
|
2138
|
+
/**
|
|
2139
|
+
* Change the signed-in member's own settings. `null` for a channel goes back
|
|
2140
|
+
* to the workspace default. A required event answers 409 with
|
|
2141
|
+
* `code: 'NOTIFICATION_PREFERENCE_REQUIRED'`.
|
|
2142
|
+
*/
|
|
2143
|
+
updateMyNotificationPreferences(workspaceId: string, preferences: Record<string, {
|
|
2144
|
+
email?: boolean | null;
|
|
2145
|
+
push?: boolean | null;
|
|
2146
|
+
}>, signal?: AbortSignal): Promise<MyNotificationPreferences>;
|
|
1846
2147
|
/**
|
|
1847
2148
|
* Get credit balance for a workspace.
|
|
1848
2149
|
* @param workspaceId - The workspace ID
|
|
@@ -1962,6 +2263,14 @@ declare class EventEmitter {
|
|
|
1962
2263
|
* @param role - The role assigned to the user
|
|
1963
2264
|
*/
|
|
1964
2265
|
emitWorkspaceUserAdded(userId: string, workspace: IWorkspace, role: string): Promise<void>;
|
|
2266
|
+
/** An invitation was sent from this client. */
|
|
2267
|
+
emitWorkspaceInvitationSent(invitation: IWorkspaceInvitation, workspaceId: string): Promise<void>;
|
|
2268
|
+
/** The signed-in user accepted an invitation and joined `workspace`. */
|
|
2269
|
+
emitWorkspaceInvitationAccepted(invitation: IWorkspaceInvitation, workspace: IWorkspace): Promise<void>;
|
|
2270
|
+
/** The signed-in user declined an invitation. */
|
|
2271
|
+
emitWorkspaceInvitationDeclined(invitation: IWorkspaceInvitation): Promise<void>;
|
|
2272
|
+
/** A pending invitation was withdrawn from this client. */
|
|
2273
|
+
emitWorkspaceInvitationRevoked(invitationId: string, workspaceId: string): Promise<void>;
|
|
1965
2274
|
/**
|
|
1966
2275
|
* Trigger workspace user removed event
|
|
1967
2276
|
* @param userId - The ID of the user that was removed
|
|
@@ -2464,17 +2773,45 @@ declare const Permission: {
|
|
|
2464
2773
|
readonly WORKSPACE_BILLING_VIEW: "workspace:billing:view";
|
|
2465
2774
|
readonly WORKSPACE_BILLING_MANAGE: "workspace:billing:manage";
|
|
2466
2775
|
readonly WORKSPACE_USAGE_VIEW: "workspace:usage:view";
|
|
2776
|
+
/** Record usage and spend the workspace's credits. Withheld from viewers. */
|
|
2777
|
+
readonly WORKSPACE_USAGE_RECORD: "workspace:usage:record";
|
|
2467
2778
|
};
|
|
2468
2779
|
type PermissionKey = (typeof Permission)[keyof typeof Permission];
|
|
2469
2780
|
type RolePermissionMap = Record<string, string[]>;
|
|
2781
|
+
/**
|
|
2782
|
+
* Defaults for the three roles every org is seeded with, the same lists the
|
|
2783
|
+
* server enforces. Servers now send each role's effective permissions in the
|
|
2784
|
+
* public settings, so these apply only to a server that does not. There is no
|
|
2785
|
+
* `member` entry: no one can hold that role, and `editor` had none, so an
|
|
2786
|
+
* editor was shown nothing the server let them do.
|
|
2787
|
+
*/
|
|
2470
2788
|
declare const DEFAULT_ROLE_PERMISSIONS: RolePermissionMap;
|
|
2789
|
+
/** The least privileged built-in role, used when no default is usable. */
|
|
2790
|
+
declare const FALLBACK_WORKSPACE_ROLE = "viewer";
|
|
2791
|
+
/**
|
|
2792
|
+
* The role to preselect for someone joining: the org's default role when it
|
|
2793
|
+
* is on the list, but never `admin`, which must be a deliberate choice. Then
|
|
2794
|
+
* viewer, then any role other than admin.
|
|
2795
|
+
*/
|
|
2796
|
+
declare function pickDefaultRole(roles: readonly string[], defaultRole?: string | null): string;
|
|
2471
2797
|
interface WorkspaceLike extends WorkspaceLike$1 {
|
|
2472
2798
|
permissions?: Record<string, string[]>;
|
|
2473
2799
|
}
|
|
2800
|
+
/**
|
|
2801
|
+
* A permission the organization defined for its own application, in the
|
|
2802
|
+
* BuildBase console. The server stores and resolves it exactly like a platform
|
|
2803
|
+
* permission; what it means is the application's business.
|
|
2804
|
+
*/
|
|
2805
|
+
interface WorkspacePermissionDefinition {
|
|
2806
|
+
key: string;
|
|
2807
|
+
label: string;
|
|
2808
|
+
group?: string;
|
|
2809
|
+
}
|
|
2474
2810
|
interface SettingsLike {
|
|
2475
2811
|
workspace?: {
|
|
2476
2812
|
defaultRole?: string;
|
|
2477
2813
|
permissions?: Record<string, string[]>;
|
|
2814
|
+
customPermissions?: WorkspacePermissionDefinition[];
|
|
2478
2815
|
canInviteMembers?: boolean | 'admin-only';
|
|
2479
2816
|
canCreateWorkspace?: boolean | 'owner-only';
|
|
2480
2817
|
};
|
|
@@ -2504,12 +2841,31 @@ interface PermissionContext {
|
|
|
2504
2841
|
* 7. Apply setting restrictions (canInviteMembers)
|
|
2505
2842
|
*/
|
|
2506
2843
|
declare function resolvePermissions(ctx: PermissionContext): Set<string>;
|
|
2844
|
+
/**
|
|
2845
|
+
* What one role may do in a workspace, by the same tiers the server uses.
|
|
2846
|
+
* `resolvePermissions` answers for a user; this answers for a role, which is
|
|
2847
|
+
* what a screen editing the matrix needs. `applyRestrictions: false` leaves
|
|
2848
|
+
* out the org's live switches (who may invite), so a screen does not write a
|
|
2849
|
+
* switch's current effect into a saved override.
|
|
2850
|
+
*/
|
|
2851
|
+
declare function resolveRolePermissions(role: string, ctx: Pick<PermissionContext, 'workspace' | 'settings' | 'appPermissions'>, options?: {
|
|
2852
|
+
applyRestrictions?: boolean;
|
|
2853
|
+
}): Set<string>;
|
|
2507
2854
|
/**
|
|
2508
2855
|
* Check if a user has a specific permission (or all of an array).
|
|
2509
2856
|
* Works with both platform permissions (Permission.WORKSPACE_*) and
|
|
2510
2857
|
* app permissions (any custom string).
|
|
2511
2858
|
*/
|
|
2512
2859
|
declare function hasPermission(permission: string | string[], ctx: PermissionContext): boolean;
|
|
2860
|
+
/** Where a permission the app checks was defined. */
|
|
2861
|
+
declare const APP_PERMISSION_FALLBACK_GROUP = "App";
|
|
2862
|
+
/**
|
|
2863
|
+
* Every permission this application defines, for a UI that lists them: the
|
|
2864
|
+
* organization's catalogue from the console, plus any key the app passed
|
|
2865
|
+
* through `defaultPermissions` that the catalogue does not name yet. Keys from
|
|
2866
|
+
* the prop keep working, so adopting the console costs nothing.
|
|
2867
|
+
*/
|
|
2868
|
+
declare function appPermissionCatalogue(settings?: SettingsLike | null, appPermissions?: Record<string, string[]> | null): WorkspacePermissionDefinition[];
|
|
2513
2869
|
|
|
2514
2870
|
/**
|
|
2515
2871
|
* Push notification service worker source code.
|
|
@@ -2848,6 +3204,60 @@ interface SDKMessages {
|
|
|
2848
3204
|
memberLimitMessage: string;
|
|
2849
3205
|
selectRole: string;
|
|
2850
3206
|
inviteAs: string;
|
|
3207
|
+
invitations: {
|
|
3208
|
+
title: string;
|
|
3209
|
+
pendingCount: string;
|
|
3210
|
+
sent: string;
|
|
3211
|
+
resend: string;
|
|
3212
|
+
resendIn: string;
|
|
3213
|
+
revoke: string;
|
|
3214
|
+
/** Title of the revoke confirmation. */
|
|
3215
|
+
revokeTitle: string;
|
|
3216
|
+
revokeConfirm: string;
|
|
3217
|
+
sentAt: string;
|
|
3218
|
+
expiresAt: string;
|
|
3219
|
+
seatNote: string;
|
|
3220
|
+
formerMember: string;
|
|
3221
|
+
loadFailed: string;
|
|
3222
|
+
resendFailed: string;
|
|
3223
|
+
revokeFailed: string;
|
|
3224
|
+
status: {
|
|
3225
|
+
invited: string;
|
|
3226
|
+
accepted: string;
|
|
3227
|
+
rejected: string;
|
|
3228
|
+
expired: string;
|
|
3229
|
+
};
|
|
3230
|
+
};
|
|
3231
|
+
};
|
|
3232
|
+
invitations: {
|
|
3233
|
+
title: string;
|
|
3234
|
+
description: string;
|
|
3235
|
+
/** The list of the caller's own invitations, above the rows. */
|
|
3236
|
+
listDescription: string;
|
|
3237
|
+
/** Dialog title once the invitee has joined. */
|
|
3238
|
+
titleJoined: string;
|
|
3239
|
+
/** Dialog title for a link that can no longer be used: revoked, expired, switched off. */
|
|
3240
|
+
titleUnavailable: string;
|
|
3241
|
+
sentTo: string;
|
|
3242
|
+
invitedAs: string;
|
|
3243
|
+
accept: string;
|
|
3244
|
+
decline: string;
|
|
3245
|
+
accepted: string;
|
|
3246
|
+
declined: string;
|
|
3247
|
+
expired: string;
|
|
3248
|
+
revoked: string;
|
|
3249
|
+
alreadyAccepted: string;
|
|
3250
|
+
wrongAccount: string;
|
|
3251
|
+
verifyFirst: string;
|
|
3252
|
+
workspaceFull: string;
|
|
3253
|
+
disabled: string;
|
|
3254
|
+
empty: string;
|
|
3255
|
+
signInToAccept: string;
|
|
3256
|
+
dismiss: string;
|
|
3257
|
+
signOut: string;
|
|
3258
|
+
loadFailed: string;
|
|
3259
|
+
acceptFailed: string;
|
|
3260
|
+
declineFailed: string;
|
|
2851
3261
|
};
|
|
2852
3262
|
invoices: {
|
|
2853
3263
|
title: string;
|
|
@@ -2961,6 +3371,28 @@ interface SDKMessages {
|
|
|
2961
3371
|
failedToDelete: string;
|
|
2962
3372
|
};
|
|
2963
3373
|
notifications: {
|
|
3374
|
+
inbox: {
|
|
3375
|
+
title: string;
|
|
3376
|
+
description: string;
|
|
3377
|
+
bellLabel: string;
|
|
3378
|
+
bellUnread: string;
|
|
3379
|
+
filterAll: string;
|
|
3380
|
+
filterUnread: string;
|
|
3381
|
+
markAllRead: string;
|
|
3382
|
+
markRead: string;
|
|
3383
|
+
markUnread: string;
|
|
3384
|
+
archive: string;
|
|
3385
|
+
loadMore: string;
|
|
3386
|
+
empty: string;
|
|
3387
|
+
emptyUnread: string;
|
|
3388
|
+
loadFailed: string;
|
|
3389
|
+
updateFailed: string;
|
|
3390
|
+
channelEmail: string;
|
|
3391
|
+
channelPush: string;
|
|
3392
|
+
opened: string;
|
|
3393
|
+
clicked: string;
|
|
3394
|
+
notDelivered: string;
|
|
3395
|
+
};
|
|
2964
3396
|
title: string;
|
|
2965
3397
|
permissionDenied: string;
|
|
2966
3398
|
notSupported: string;
|
|
@@ -2978,6 +3410,13 @@ interface SDKMessages {
|
|
|
2978
3410
|
pushDescription: string;
|
|
2979
3411
|
deviceNote: string;
|
|
2980
3412
|
prefsSaved: string;
|
|
3413
|
+
prefsSaveFailed: string;
|
|
3414
|
+
yourTitle: string;
|
|
3415
|
+
yourDescription: string;
|
|
3416
|
+
defaultsTitle: string;
|
|
3417
|
+
defaultsDescription: string;
|
|
3418
|
+
requiredLabel: string;
|
|
3419
|
+
requiredHint: string;
|
|
2981
3420
|
loadingPrefs: string;
|
|
2982
3421
|
categories: {
|
|
2983
3422
|
workspace: string;
|
|
@@ -3235,6 +3674,97 @@ type Level4 = {
|
|
|
3235
3674
|
/** Union of all valid translation key paths (e.g. "settings.titles.profile") */
|
|
3236
3675
|
type TranslationKey = Level2 | Level3 | Level4;
|
|
3237
3676
|
|
|
3677
|
+
/**
|
|
3678
|
+
* The error an invitation call throws. A plain `Error` (so every existing
|
|
3679
|
+
* `catch (err) { err.message }` keeps working) carrying the server's fields
|
|
3680
|
+
* as properties, so a screen can act on the shape of the refusal: open the
|
|
3681
|
+
* plan picker on a seat limit, count down a resend cooldown, show which
|
|
3682
|
+
* address the invitation was for.
|
|
3683
|
+
*/
|
|
3684
|
+
declare const INVITATION_ERROR_CODE: {
|
|
3685
|
+
readonly NOT_FOUND: "INVITATION_NOT_FOUND";
|
|
3686
|
+
readonly EXPIRED: "INVITATION_EXPIRED";
|
|
3687
|
+
readonly ALREADY_HANDLED: "INVITATION_ALREADY_HANDLED";
|
|
3688
|
+
readonly EMAIL_MISMATCH: "INVITATION_EMAIL_MISMATCH";
|
|
3689
|
+
readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
|
|
3690
|
+
readonly INVITES_DISABLED: "WORKSPACE_INVITES_DISABLED";
|
|
3691
|
+
readonly RATE_LIMITED: "INVITATION_RATE_LIMITED";
|
|
3692
|
+
readonly EMAIL_FAILED: "INVITATION_EMAIL_FAILED";
|
|
3693
|
+
readonly SEAT_LIMIT: "SEAT_LIMIT_REACHED";
|
|
3694
|
+
/** The invited or accepting account is blocked. */
|
|
3695
|
+
readonly USER_BLOCKED: "USER_BLOCKED";
|
|
3696
|
+
/**
|
|
3697
|
+
* The organization has no usable email sender, so no invitation can be sent.
|
|
3698
|
+
*
|
|
3699
|
+
* This one is refused by the server's `requireEmailSender` middleware rather
|
|
3700
|
+
* than by the invitation route, so the string is that middleware's
|
|
3701
|
+
* (`EMAIL_SENDER_CODE.NO_SENDER_CONFIGURED`), not an invitation code. Named
|
|
3702
|
+
* after it on purpose: the value is what arrives, and a prettier alias here
|
|
3703
|
+
* would simply never match.
|
|
3704
|
+
*/
|
|
3705
|
+
readonly NO_SENDER_CONFIGURED: "NO_SENDER_CONFIGURED";
|
|
3706
|
+
};
|
|
3707
|
+
type InvitationErrorCode = (typeof INVITATION_ERROR_CODE)[keyof typeof INVITATION_ERROR_CODE];
|
|
3708
|
+
interface InvitationErrorFields {
|
|
3709
|
+
/** The HTTP status the server answered with. */
|
|
3710
|
+
status: number;
|
|
3711
|
+
/** A stable code, from the body when the server sent one, else derived from the status. */
|
|
3712
|
+
code: string;
|
|
3713
|
+
/** On a 402: members plus pending invitations, and the ceiling they hit. */
|
|
3714
|
+
currentUserCount?: number;
|
|
3715
|
+
limit?: number;
|
|
3716
|
+
/** On a resend's 429: seconds until the cooldown ends. */
|
|
3717
|
+
retryAfterSeconds?: number;
|
|
3718
|
+
/** On an email mismatch: the invited address, scrambled. */
|
|
3719
|
+
invitedEmail?: string;
|
|
3720
|
+
/** On "already invited": the live invitation, so the caller can offer resend. */
|
|
3721
|
+
invitationId?: string;
|
|
3722
|
+
/** On "already handled": the row's status. */
|
|
3723
|
+
invitationStatus?: string;
|
|
3724
|
+
}
|
|
3725
|
+
type InvitationError = Error & InvitationErrorFields;
|
|
3726
|
+
/** True when an unknown thrown value is an invitation error carrying a status. */
|
|
3727
|
+
declare function isInvitationError(err: unknown): err is InvitationError;
|
|
3728
|
+
|
|
3729
|
+
/**
|
|
3730
|
+
* The admin's ordering: pending first, then newest first within a status. An
|
|
3731
|
+
* admin should see what lapsed, so nothing is dropped here.
|
|
3732
|
+
*/
|
|
3733
|
+
declare function sortInvitations(rows: IWorkspaceInvitation[]): IWorkspaceInvitation[];
|
|
3734
|
+
/** Pending and not past its expiry: something the invitee can still accept or decline. */
|
|
3735
|
+
declare function isInvitationActionable(row: IWorkspaceInvitation, now?: Date): boolean;
|
|
3736
|
+
/**
|
|
3737
|
+
* The invitee's list: "a list of things you can act on should contain only
|
|
3738
|
+
* things you can act on". The server already filters, this keeps a stale
|
|
3739
|
+
* client list honest between refreshes.
|
|
3740
|
+
*/
|
|
3741
|
+
declare function actionableInvitations(rows: IWorkspaceInvitation[], now?: Date): IWorkspaceInvitation[];
|
|
3742
|
+
/** Pending, past its expiry, not yet swept: shown as expired by the admin's list. */
|
|
3743
|
+
declare function isInvitationLapsed(row: IWorkspaceInvitation, now?: Date): boolean;
|
|
3744
|
+
declare function workspaceNameOf(row: IWorkspaceInvitation): string;
|
|
3745
|
+
declare function workspaceIdOf(row: IWorkspaceInvitation): string;
|
|
3746
|
+
/** The inviter's display name, or null when their account is gone. */
|
|
3747
|
+
declare function inviterNameOf(row: IWorkspaceInvitation): string | null;
|
|
3748
|
+
/**
|
|
3749
|
+
* Seconds until a row may be resent, zero when it may. The cooldown itself is
|
|
3750
|
+
* the server's rule and stays there: this counts down to the `resendAvailableAt`
|
|
3751
|
+
* the server puts on every pending row, so the button cannot unlock a second
|
|
3752
|
+
* before the endpoint stops answering 429. A row without the field (a server
|
|
3753
|
+
* older than it) reports zero, leaving that 429 as the only authority.
|
|
3754
|
+
*/
|
|
3755
|
+
declare function resendCooldownSeconds(row: IWorkspaceInvitation, now?: Date): number;
|
|
3756
|
+
|
|
3757
|
+
/** Park a token for `orgId`. A malformed token is ignored rather than stored. */
|
|
3758
|
+
declare function parkPendingInvite(token: string, orgId: string): void;
|
|
3759
|
+
/**
|
|
3760
|
+
* The parked token for `orgId`, or null when there is none, it is older than a
|
|
3761
|
+
* day, or it belongs to another org. Does not clear: the flow clears it on a
|
|
3762
|
+
* terminal answer (accepted, declined, expired, handled), never on a network
|
|
3763
|
+
* error, so a retry stays possible.
|
|
3764
|
+
*/
|
|
3765
|
+
declare function readPendingInvite(orgId: string, now?: number): string | null;
|
|
3766
|
+
declare function clearPendingInvite(): void;
|
|
3767
|
+
|
|
3238
3768
|
/**
|
|
3239
3769
|
* Verify that a webhook request came from BuildBase.
|
|
3240
3770
|
*
|
|
@@ -4187,9 +4717,25 @@ interface WorkspaceActions {
|
|
|
4187
4717
|
delete(workspaceId: string): Promise<{
|
|
4188
4718
|
success: boolean;
|
|
4189
4719
|
}>;
|
|
4720
|
+
/**
|
|
4721
|
+
* What the session's user may do in a workspace, resolved by the server:
|
|
4722
|
+
* `{ role, isOwner, permissions }`. Use it in your backend before acting,
|
|
4723
|
+
* instead of trusting the browser's answer.
|
|
4724
|
+
*/
|
|
4725
|
+
permissions(workspaceId: string): Promise<WorkspaceMemberPermissions>;
|
|
4726
|
+
/**
|
|
4727
|
+
* Whether the session's user holds a permission (or every one of a list)
|
|
4728
|
+
* in a workspace, platform or your own: `can(id, 'app:reports:export')`.
|
|
4729
|
+
*/
|
|
4730
|
+
can(workspaceId: string, permission: string | string[]): Promise<boolean>;
|
|
4190
4731
|
}
|
|
4191
4732
|
interface UserActions {
|
|
4192
4733
|
list(workspaceId: string): Promise<IWorkspaceUser[]>;
|
|
4734
|
+
/**
|
|
4735
|
+
* Add an EXISTING account to the workspace at once. Answers 404 when the
|
|
4736
|
+
* address has no account. To reach someone with no account, send an
|
|
4737
|
+
* invitation with `invitations.create`.
|
|
4738
|
+
*/
|
|
4193
4739
|
invite(workspaceId: string, email: string, role: string): Promise<{
|
|
4194
4740
|
userId: string;
|
|
4195
4741
|
workspace: IWorkspace;
|
|
@@ -4338,9 +4884,38 @@ interface CreditActions {
|
|
|
4338
4884
|
getPublicPackages(): Promise<IPublicCreditPackagesResponse>;
|
|
4339
4885
|
}
|
|
4340
4886
|
/** All action modules bound to a specific session. Returned by `withSession()`. */
|
|
4887
|
+
/**
|
|
4888
|
+
* Workspace invitations: reach an address that may have no account. A
|
|
4889
|
+
* pending invitation bills a seat until accepted, declined, revoked or
|
|
4890
|
+
* expired. The accept and decline side belongs to the invitee's own session,
|
|
4891
|
+
* so it lives on the client (`useMyInvitations`, `<PendingInvitations />`).
|
|
4892
|
+
*/
|
|
4893
|
+
interface InvitationActions {
|
|
4894
|
+
/** The workspace's invitations, pending first. */
|
|
4895
|
+
list(workspaceId: string): Promise<IWorkspaceInvitation[]>;
|
|
4896
|
+
/**
|
|
4897
|
+
* Invite an email address. `landingUrl` is where the emailed link lands;
|
|
4898
|
+
* left out, the first allowed redirect URL of the auth client the session
|
|
4899
|
+
* signed in through. A session minted from an API token has no client, so
|
|
4900
|
+
* pass it: one of the allowed redirect URLs of an auth client in the org.
|
|
4901
|
+
*/
|
|
4902
|
+
create(workspaceId: string, email: string, role: string, landingUrl?: string): Promise<IWorkspaceInvitation & {
|
|
4903
|
+
message: string;
|
|
4904
|
+
}>;
|
|
4905
|
+
/** Send it again (five-minute cooldown). Revives an expired invitation. */
|
|
4906
|
+
resend(workspaceId: string, invitationId: string): Promise<IWorkspaceInvitation & {
|
|
4907
|
+
message: string;
|
|
4908
|
+
}>;
|
|
4909
|
+
/** Withdraw a pending invitation. */
|
|
4910
|
+
revoke(workspaceId: string, invitationId: string): Promise<{
|
|
4911
|
+
success: boolean;
|
|
4912
|
+
message: string;
|
|
4913
|
+
}>;
|
|
4914
|
+
}
|
|
4341
4915
|
interface ScopedActions {
|
|
4342
4916
|
workspace: WorkspaceActions;
|
|
4343
4917
|
users: UserActions;
|
|
4918
|
+
invitations: InvitationActions;
|
|
4344
4919
|
subscription: SubscriptionActions;
|
|
4345
4920
|
plans: PlanActions;
|
|
4346
4921
|
invoices: InvoiceActions;
|
|
@@ -4602,5 +5177,5 @@ declare function buildbaseAuth(options: BuildBaseAuthOptions): {
|
|
|
4602
5177
|
resourceMetadataUrl?: string;
|
|
4603
5178
|
};
|
|
4604
5179
|
|
|
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 };
|
|
5180
|
+
export { AI_BOT_USER_AGENTS, APP_PERMISSION_FALLBACK_GROUP, 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, FALLBACK_WORKSPACE_ROLE, INVITATION_ERROR_CODE, InvoiceStatuses, NotificationsApi, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PushApi, SDKEvent, SettingsApi, SubscriptionItemType, SubscriptionStatus, UserApi, WorkspaceApi, actionableInvitations, appPermissionCatalogue, 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, pickDefaultRole, provideWebMcpTools, readBBParams, readPendingInvite, resendCooldownSeconds, resolveAgentPath, resolveMaxUsers, resolvePermissions, resolveRolePermissions, resolveWellKnown, safeRedirect, saveAuthIntent, sha256Digest, signClientJwt, sortInvitations, validateInvite, validateRedirectUrl, verifyAppRevokeRequest, verifyAppTokenRequest, verifyClientJwt, verifyWebhookSignature, wantsMarkdown, workspaceIdOf, workspaceNameOf };
|
|
5181
|
+
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, WorkspaceMemberPermissions, WorkspaceNotificationDefault, WorkspacePermissionDefinition, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|