@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/react/index.d.ts
CHANGED
|
@@ -855,6 +855,59 @@ interface IWorkspaceUser {
|
|
|
855
855
|
role: string;
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
+
/** Mirrors the server enum, string-typed so an app can compare without an import. */
|
|
859
|
+
type IWorkspaceInvitationStatus = 'invited' | 'accepted' | 'rejected' | 'expired';
|
|
860
|
+
/**
|
|
861
|
+
* A workspace invitation: an email address a member invited, before (or
|
|
862
|
+
* after) the person behind it accepted. A pending row bills a seat until it is
|
|
863
|
+
* accepted, declined, revoked or expired.
|
|
864
|
+
*/
|
|
865
|
+
interface IWorkspaceInvitation {
|
|
866
|
+
_id: string;
|
|
867
|
+
/** The workspace, populated with `name` and `image` on the invitee's list. */
|
|
868
|
+
workspace: string | Pick<IWorkspace, '_id' | 'name' | 'image'>;
|
|
869
|
+
email: string;
|
|
870
|
+
role: string;
|
|
871
|
+
status: IWorkspaceInvitationStatus;
|
|
872
|
+
invitedAt: string;
|
|
873
|
+
/** When last emailed; absent until the first resend. Read `lastSentAt ?? invitedAt`. */
|
|
874
|
+
lastSentAt?: string;
|
|
875
|
+
/**
|
|
876
|
+
* When a resend stops being refused. The server derives it from the last
|
|
877
|
+
* send and its own cooldown, so a countdown here cannot disagree with the
|
|
878
|
+
* 429 that enforces it. Null unless the row is pending; absent from a
|
|
879
|
+
* server older than this field, which `resendCooldownSeconds` reads as
|
|
880
|
+
* "no cooldown known".
|
|
881
|
+
*/
|
|
882
|
+
resendAvailableAt?: string | null;
|
|
883
|
+
/** The inviter, populated with `name`, `email` and `image`; null when their account is gone. */
|
|
884
|
+
invitedBy: string | (Pick<IUser, '_id' | 'name' | 'email'> & {
|
|
885
|
+
image?: string;
|
|
886
|
+
}) | null;
|
|
887
|
+
/** Null once accepted: the link no longer has anything to expire. */
|
|
888
|
+
validTill: string | null;
|
|
889
|
+
acceptedAt?: string;
|
|
890
|
+
rejectedAt?: string;
|
|
891
|
+
/** The app URL the emailed link lands on. */
|
|
892
|
+
landingUrl?: string;
|
|
893
|
+
clientId?: string;
|
|
894
|
+
}
|
|
895
|
+
/** What the public preview returns for a link token. The email is scrambled. */
|
|
896
|
+
interface IWorkspaceInvitationPreview {
|
|
897
|
+
id: string;
|
|
898
|
+
workspaceName: string;
|
|
899
|
+
inviterName: string;
|
|
900
|
+
role: string;
|
|
901
|
+
email: string;
|
|
902
|
+
expiresAt: string | null;
|
|
903
|
+
status: IWorkspaceInvitationStatus;
|
|
904
|
+
/**
|
|
905
|
+
* False when the organization has switched invitations off, so accepting
|
|
906
|
+
* cannot succeed. Absent from older servers, which is read as joinable.
|
|
907
|
+
*/
|
|
908
|
+
joinable?: boolean;
|
|
909
|
+
}
|
|
910
|
+
|
|
858
911
|
/** Event type constants */
|
|
859
912
|
declare const SDKEvent: {
|
|
860
913
|
readonly UserCreated: "user:created";
|
|
@@ -866,6 +919,10 @@ declare const SDKEvent: {
|
|
|
866
919
|
readonly WorkspaceUserRoleChanged: "workspace:user-role-changed";
|
|
867
920
|
readonly WorkspaceCreated: "workspace:created";
|
|
868
921
|
readonly WorkspaceDeleted: "workspace:deleted";
|
|
922
|
+
readonly WorkspaceInvitationSent: "workspace:invitation-sent";
|
|
923
|
+
readonly WorkspaceInvitationAccepted: "workspace:invitation-accepted";
|
|
924
|
+
readonly WorkspaceInvitationDeclined: "workspace:invitation-declined";
|
|
925
|
+
readonly WorkspaceInvitationRevoked: "workspace:invitation-revoked";
|
|
869
926
|
};
|
|
870
927
|
type EventType = (typeof SDKEvent)[keyof typeof SDKEvent];
|
|
871
928
|
/**
|
|
@@ -907,10 +964,27 @@ interface WorkspaceCreatedEventData {
|
|
|
907
964
|
interface WorkspaceDeletedEventData {
|
|
908
965
|
workspace: IWorkspace;
|
|
909
966
|
}
|
|
967
|
+
/** An invitation was sent from this client. The invitee may have no account yet. */
|
|
968
|
+
interface WorkspaceInvitationSentEventData {
|
|
969
|
+
invitation: IWorkspaceInvitation;
|
|
970
|
+
workspaceId: string;
|
|
971
|
+
}
|
|
972
|
+
/** The signed-in user accepted an invitation; `WorkspaceUserAdded` fires too. */
|
|
973
|
+
interface WorkspaceInvitationAcceptedEventData {
|
|
974
|
+
invitation: IWorkspaceInvitation;
|
|
975
|
+
workspace: IWorkspace;
|
|
976
|
+
}
|
|
977
|
+
interface WorkspaceInvitationDeclinedEventData {
|
|
978
|
+
invitation: IWorkspaceInvitation;
|
|
979
|
+
}
|
|
980
|
+
interface WorkspaceInvitationRevokedEventData {
|
|
981
|
+
invitationId: string;
|
|
982
|
+
workspaceId: string;
|
|
983
|
+
}
|
|
910
984
|
/**
|
|
911
985
|
* Union type for all event data
|
|
912
986
|
*/
|
|
913
|
-
type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData;
|
|
987
|
+
type EventData = UserCreatedEventData | UserUpdatedEventData | WorkspaceChangedEventData | WorkspaceUpdatedEventData | WorkspaceUserAddedEventData | WorkspaceUserRemovedEventData | WorkspaceUserRoleChangedEventData | WorkspaceCreatedEventData | WorkspaceDeletedEventData | WorkspaceInvitationSentEventData | WorkspaceInvitationAcceptedEventData | WorkspaceInvitationDeclinedEventData | WorkspaceInvitationRevokedEventData;
|
|
914
988
|
/**
|
|
915
989
|
* Single event callback function
|
|
916
990
|
* Handles all events with conditional logic based on event type
|
|
@@ -1036,6 +1110,16 @@ interface ISettings {
|
|
|
1036
1110
|
canInviteMembers: boolean | 'admin-only';
|
|
1037
1111
|
/** Custom role→permission mapping. Overrides SDK defaults when provided by backend. */
|
|
1038
1112
|
permissions?: Record<string, string[]>;
|
|
1113
|
+
/**
|
|
1114
|
+
* The organization's own permissions, defined in the BuildBase console:
|
|
1115
|
+
* `{ key: 'app:reports:export', label: 'Export reports', group: 'Reports' }`.
|
|
1116
|
+
* Absent on a server from before release 23.
|
|
1117
|
+
*/
|
|
1118
|
+
customPermissions?: {
|
|
1119
|
+
key: string;
|
|
1120
|
+
label: string;
|
|
1121
|
+
group?: string;
|
|
1122
|
+
}[];
|
|
1039
1123
|
/** Show workspace switcher in the UI */
|
|
1040
1124
|
showSwitcher: boolean;
|
|
1041
1125
|
/** Max workspaces a user can own. 0 = unlimited */
|
|
@@ -1238,6 +1322,18 @@ interface AuthRequestParams {
|
|
|
1238
1322
|
* Populated automatically from the tracking provider when one is mounted.
|
|
1239
1323
|
* Omitted means unanswered, which is not the same as refused.
|
|
1240
1324
|
*/
|
|
1325
|
+
/**
|
|
1326
|
+
* Where the visitor came from - the click ids and campaign fields captured
|
|
1327
|
+
* on their landing page, when, and where. Stored on the user the hosted
|
|
1328
|
+
* pages create, so a conversion that happens later with no browser (a trial
|
|
1329
|
+
* converting, a renewal) can still be joined to the ad click. Populated
|
|
1330
|
+
* automatically from the attribution cookie when tracking is mounted.
|
|
1331
|
+
*/
|
|
1332
|
+
trackingAttribution?: {
|
|
1333
|
+
params: Record<string, string>;
|
|
1334
|
+
capturedAt?: number;
|
|
1335
|
+
landingUrl?: string;
|
|
1336
|
+
};
|
|
1241
1337
|
trackingConsent?: {
|
|
1242
1338
|
analytics: boolean;
|
|
1243
1339
|
marketing: boolean;
|
|
@@ -1424,6 +1520,111 @@ declare class DevicesApi extends BaseApi {
|
|
|
1424
1520
|
}>;
|
|
1425
1521
|
}
|
|
1426
1522
|
|
|
1523
|
+
/**
|
|
1524
|
+
* API client for the signed-in user's notification inbox. Session-authed
|
|
1525
|
+
* (x-session-id) and scoped to the current user by the server: every call
|
|
1526
|
+
* reads or changes only their own items. Extends BaseApi for shared
|
|
1527
|
+
* URL/auth/request handling.
|
|
1528
|
+
*
|
|
1529
|
+
* One item is one notification, however it was delivered: an event sent by
|
|
1530
|
+
* email and push is a single item whose `channels` say what each did.
|
|
1531
|
+
*/
|
|
1532
|
+
|
|
1533
|
+
type NotificationChannelStatus = 'none' | 'queued' | 'sent' | 'failed' | 'skipped';
|
|
1534
|
+
type NotificationSource = 'system' | 'custom' | 'workflow' | 'campaign' | 'console';
|
|
1535
|
+
/** How an item was first read: in the inbox, or by clicking its email or push link. */
|
|
1536
|
+
type NotificationReadVia = 'inbox' | 'email_click' | 'push_click';
|
|
1537
|
+
/** One notification in the signed-in user's inbox. Dates are ISO strings. */
|
|
1538
|
+
interface INotificationItem {
|
|
1539
|
+
id: string;
|
|
1540
|
+
/** The workspace it is about, or null for an account notice. */
|
|
1541
|
+
workspaceId: string | null;
|
|
1542
|
+
/** The event slug that sent it. */
|
|
1543
|
+
event: string;
|
|
1544
|
+
source: NotificationSource;
|
|
1545
|
+
title: string;
|
|
1546
|
+
body: string;
|
|
1547
|
+
/** The destination as the app set it, for display. */
|
|
1548
|
+
url: string | null;
|
|
1549
|
+
/**
|
|
1550
|
+
* What to open when the item is clicked: an absolute destination routed
|
|
1551
|
+
* through the server's link check (which also marks the item read), a path
|
|
1552
|
+
* inside the app as it is, or null when there is nothing safe to open.
|
|
1553
|
+
*/
|
|
1554
|
+
link: string | null;
|
|
1555
|
+
icon: string | null;
|
|
1556
|
+
channels: {
|
|
1557
|
+
/** An open is recorded but does not read the item; a click does. */
|
|
1558
|
+
email: {
|
|
1559
|
+
status: NotificationChannelStatus;
|
|
1560
|
+
openedAt: string | null;
|
|
1561
|
+
clickedAt: string | null;
|
|
1562
|
+
};
|
|
1563
|
+
push: {
|
|
1564
|
+
status: NotificationChannelStatus;
|
|
1565
|
+
clickedAt: string | null;
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
createdAt: string | null;
|
|
1569
|
+
/** The inbox was opened while this was in it. Not the same as read. */
|
|
1570
|
+
seenAt: string | null;
|
|
1571
|
+
readAt: string | null;
|
|
1572
|
+
readVia: NotificationReadVia | null;
|
|
1573
|
+
archivedAt: string | null;
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Which items: one workspace's, `'none'` for the account notices that belong
|
|
1577
|
+
* to no workspace, or omitted for everything.
|
|
1578
|
+
*/
|
|
1579
|
+
type NotificationScope = string | 'none' | undefined;
|
|
1580
|
+
interface NotificationListParams {
|
|
1581
|
+
workspaceId?: NotificationScope;
|
|
1582
|
+
/** Only unread items. */
|
|
1583
|
+
unread?: boolean;
|
|
1584
|
+
/** Include archived items, which the default list leaves out. */
|
|
1585
|
+
archived?: boolean;
|
|
1586
|
+
page?: number;
|
|
1587
|
+
/** At most 100. */
|
|
1588
|
+
limit?: number;
|
|
1589
|
+
}
|
|
1590
|
+
interface NotificationPage {
|
|
1591
|
+
notifications: INotificationItem[];
|
|
1592
|
+
page: number;
|
|
1593
|
+
limit: number;
|
|
1594
|
+
total: number;
|
|
1595
|
+
hasNextPage: boolean;
|
|
1596
|
+
}
|
|
1597
|
+
interface NotificationCounts {
|
|
1598
|
+
/** Unread and not archived: the number on the bell. */
|
|
1599
|
+
unread: number;
|
|
1600
|
+
/** Unread and never seen: whether anything is new since the inbox was last opened. */
|
|
1601
|
+
unseen: number;
|
|
1602
|
+
}
|
|
1603
|
+
declare class NotificationsApi extends BaseApi {
|
|
1604
|
+
constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
|
|
1605
|
+
sessionId?: string;
|
|
1606
|
+
});
|
|
1607
|
+
/** A page of the current user's items, newest first. */
|
|
1608
|
+
list(params?: NotificationListParams, signal?: AbortSignal): Promise<NotificationPage>;
|
|
1609
|
+
/** Unread and unseen counts, for a badge. */
|
|
1610
|
+
counts(workspaceId?: NotificationScope, signal?: AbortSignal): Promise<NotificationCounts>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Mark one item read. Returns it as it now stands. Sent with `keepalive`,
|
|
1613
|
+
* because it is usually followed at once by opening the item's link, and a
|
|
1614
|
+
* page that navigates away would otherwise cancel it.
|
|
1615
|
+
*/
|
|
1616
|
+
markRead(id: string): Promise<INotificationItem>;
|
|
1617
|
+
markUnread(id: string): Promise<INotificationItem>;
|
|
1618
|
+
/** Move an item out of the default list. It stays in history (`archived: true`). */
|
|
1619
|
+
archive(id: string): Promise<INotificationItem>;
|
|
1620
|
+
unarchive(id: string): Promise<INotificationItem>;
|
|
1621
|
+
/** Read everything in scope. */
|
|
1622
|
+
markAllRead(workspaceId?: NotificationScope): Promise<void>;
|
|
1623
|
+
/** The inbox was opened: clears "new" without reading anything. */
|
|
1624
|
+
markSeen(workspaceId?: NotificationScope): Promise<void>;
|
|
1625
|
+
private itemAction;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1427
1628
|
declare class PushApi extends BaseApi {
|
|
1428
1629
|
constructor(config: Pick<IBaseApiConfig, 'serverUrl' | 'version' | 'orgId' | 'sessionId'>);
|
|
1429
1630
|
getVapidPublicKey(): Promise<{
|
|
@@ -1511,6 +1712,15 @@ declare class UserApi extends BaseApi {
|
|
|
1511
1712
|
getFeatures(signal?: AbortSignal): Promise<Record<string, boolean>>;
|
|
1512
1713
|
}
|
|
1513
1714
|
|
|
1715
|
+
/** What a member may do in a workspace, as the server resolved it. */
|
|
1716
|
+
interface WorkspaceMemberPermissions {
|
|
1717
|
+
/** The member's role, or null when they are not a member. */
|
|
1718
|
+
role: string | null;
|
|
1719
|
+
/** The workspace's owner holds every permission. */
|
|
1720
|
+
isOwner: boolean;
|
|
1721
|
+
/** Platform keys (`workspace:*`) and the organization's own keys. */
|
|
1722
|
+
permissions: string[];
|
|
1723
|
+
}
|
|
1514
1724
|
/** Data passed to a notification template for merge tag replacement. */
|
|
1515
1725
|
interface NotificationData {
|
|
1516
1726
|
/** Push notification title. Falls back to the event name if not provided. */
|
|
@@ -1593,6 +1803,23 @@ interface NotificationEvent {
|
|
|
1593
1803
|
push: boolean;
|
|
1594
1804
|
};
|
|
1595
1805
|
}
|
|
1806
|
+
/** One event's channels. A channel left out is on. */
|
|
1807
|
+
interface NotificationChannelPreference {
|
|
1808
|
+
email?: boolean;
|
|
1809
|
+
push?: boolean;
|
|
1810
|
+
}
|
|
1811
|
+
/** The workspace's setting for one event: the default, and whether members may change it. */
|
|
1812
|
+
interface WorkspaceNotificationDefault extends NotificationChannelPreference {
|
|
1813
|
+
/** Members cannot change this event: the default is what they get. */
|
|
1814
|
+
required?: boolean;
|
|
1815
|
+
}
|
|
1816
|
+
/** The signed-in member's notification settings in one workspace. */
|
|
1817
|
+
interface MyNotificationPreferences {
|
|
1818
|
+
/** The workspace's defaults, by event slug. */
|
|
1819
|
+
defaults: Record<string, WorkspaceNotificationDefault>;
|
|
1820
|
+
/** The member's own choices over them, by event slug. */
|
|
1821
|
+
mine: Record<string, NotificationChannelPreference>;
|
|
1822
|
+
}
|
|
1596
1823
|
declare class WorkspaceApi extends BaseApi {
|
|
1597
1824
|
constructor(config: IOsConfig & {
|
|
1598
1825
|
sessionId?: string;
|
|
@@ -1602,6 +1829,12 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1602
1829
|
createWorkspace(data: {
|
|
1603
1830
|
name: string;
|
|
1604
1831
|
image?: string;
|
|
1832
|
+
/** Where the creator came from. Stored on the workspace for conversions recorded later. */
|
|
1833
|
+
trackingAttribution?: {
|
|
1834
|
+
params: Record<string, string>;
|
|
1835
|
+
capturedAt?: number;
|
|
1836
|
+
landingUrl?: string;
|
|
1837
|
+
};
|
|
1605
1838
|
}, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1606
1839
|
updateWorkspace(id: string, data: Partial<IWorkspace>, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1607
1840
|
deleteWorkspace(id: string, signal?: AbortSignal): Promise<{
|
|
@@ -1616,6 +1849,61 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1616
1849
|
workspace: IWorkspace;
|
|
1617
1850
|
message: string;
|
|
1618
1851
|
}>;
|
|
1852
|
+
private fetchInvitation;
|
|
1853
|
+
/** The workspace's invitations, pending first. Needs `MEMBERS_VIEW`. */
|
|
1854
|
+
listInvitations(workspaceId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
|
|
1855
|
+
/**
|
|
1856
|
+
* Invite an email address to a workspace. The person need not have an
|
|
1857
|
+
* account: they get a link that lands on the app's own auth redirect URL
|
|
1858
|
+
* (or on `landingUrl`, which must be one of the auth client's allowed
|
|
1859
|
+
* redirect URLs). Needs `MEMBERS_INVITE`. A pending invitation bills a seat.
|
|
1860
|
+
*/
|
|
1861
|
+
inviteMember(workspaceId: string, config: {
|
|
1862
|
+
email: string;
|
|
1863
|
+
role: string;
|
|
1864
|
+
landingUrl?: string;
|
|
1865
|
+
}, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
|
|
1866
|
+
message: string;
|
|
1867
|
+
}>;
|
|
1868
|
+
/** Send the same invitation again (five-minute cooldown). Revives an expired one. */
|
|
1869
|
+
resendInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<IWorkspaceInvitation & {
|
|
1870
|
+
message: string;
|
|
1871
|
+
}>;
|
|
1872
|
+
/** Withdraw a pending invitation. The invitee is told; the seat is released. */
|
|
1873
|
+
revokeInvitation(workspaceId: string, invitationId: string, signal?: AbortSignal): Promise<{
|
|
1874
|
+
success: boolean;
|
|
1875
|
+
message: string;
|
|
1876
|
+
}>;
|
|
1877
|
+
/** The signed-in user's own pending invitations, across workspaces. */
|
|
1878
|
+
myInvitations(signal?: AbortSignal): Promise<IWorkspaceInvitation[]>;
|
|
1879
|
+
/**
|
|
1880
|
+
* Accept an invitation addressed to the signed-in user's email.
|
|
1881
|
+
*
|
|
1882
|
+
* Pass the `token` from the invitation link when the user arrived by
|
|
1883
|
+
* following it: the token was mailed to that address and to nowhere else, so
|
|
1884
|
+
* it proves the mailbox and the account does not have to be verified
|
|
1885
|
+
* separately first. Without it, the server requires a verified email, which
|
|
1886
|
+
* is the case when accepting from the in-app list.
|
|
1887
|
+
*/
|
|
1888
|
+
acceptInvitation(invitationId: string, options?: {
|
|
1889
|
+
token?: string;
|
|
1890
|
+
}, signal?: AbortSignal): Promise<{
|
|
1891
|
+
invitation: IWorkspaceInvitation;
|
|
1892
|
+
/** Null only when another tab accepted a moment earlier and its membership write is still in flight. */
|
|
1893
|
+
workspace: IWorkspace | null;
|
|
1894
|
+
message: string;
|
|
1895
|
+
}>;
|
|
1896
|
+
/** Decline an invitation addressed to the signed-in user's email. */
|
|
1897
|
+
declineInvitation(invitationId: string, signal?: AbortSignal): Promise<{
|
|
1898
|
+
invitation: IWorkspaceInvitation;
|
|
1899
|
+
message: string;
|
|
1900
|
+
}>;
|
|
1901
|
+
/**
|
|
1902
|
+
* What an invitation link resolves to, before sign-in. Public: keyed by the
|
|
1903
|
+
* link's token, answers with the workspace name, the inviter, the role, the
|
|
1904
|
+
* scrambled address and the status. 404 for an unknown or revoked token.
|
|
1905
|
+
*/
|
|
1906
|
+
previewInvitation(token: string, signal?: AbortSignal): Promise<IWorkspaceInvitationPreview>;
|
|
1619
1907
|
removeUser(workspaceId: string, userId: string, signal?: AbortSignal): Promise<{
|
|
1620
1908
|
userId: string;
|
|
1621
1909
|
workspace: IWorkspace;
|
|
@@ -1630,6 +1918,12 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1630
1918
|
permissions: Record<string, string[]>;
|
|
1631
1919
|
}, signal?: AbortSignal): Promise<any>;
|
|
1632
1920
|
updateWorkspacePermissions(workspaceId: string, permissions: Record<string, string[]>, signal?: AbortSignal): Promise<any>;
|
|
1921
|
+
/**
|
|
1922
|
+
* What the signed-in member may do in a workspace, as the server resolves
|
|
1923
|
+
* it: the platform's permissions and the organization's own. A backend asks
|
|
1924
|
+
* this rather than trusting a flag the browser sent.
|
|
1925
|
+
*/
|
|
1926
|
+
getMyPermissions(workspaceId: string, signal?: AbortSignal): Promise<WorkspaceMemberPermissions>;
|
|
1633
1927
|
getFeatures(signal?: AbortSignal): Promise<IWorkspaceFeature[]>;
|
|
1634
1928
|
updateFeature(workspaceId: string, key: string, value: boolean, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1635
1929
|
getWorkspace(workspaceId: string, signal?: AbortSignal): Promise<IWorkspace>;
|
|
@@ -1840,17 +2134,24 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1840
2134
|
*/
|
|
1841
2135
|
sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData, signal?: AbortSignal): Promise<NotificationResult>;
|
|
1842
2136
|
getNotificationEvents(workspaceId: string, signal?: AbortSignal): Promise<NotificationEvent[]>;
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
2137
|
+
/** The workspace's defaults for every member. Needs `SETTINGS_VIEW`. */
|
|
2138
|
+
getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
|
|
2139
|
+
/**
|
|
2140
|
+
* Change the workspace's defaults (and `required`) for every member. Needs
|
|
2141
|
+
* `SETTINGS_EDIT`. Merged per event: send only what changes.
|
|
2142
|
+
*/
|
|
2143
|
+
updateNotificationPreferences(workspaceId: string, preferences: Record<string, WorkspaceNotificationDefault>, signal?: AbortSignal): Promise<Record<string, WorkspaceNotificationDefault>>;
|
|
2144
|
+
/** The signed-in member's own settings here, and the defaults they sit over. Any member. */
|
|
2145
|
+
getMyNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<MyNotificationPreferences>;
|
|
2146
|
+
/**
|
|
2147
|
+
* Change the signed-in member's own settings. `null` for a channel goes back
|
|
2148
|
+
* to the workspace default. A required event answers 409 with
|
|
2149
|
+
* `code: 'NOTIFICATION_PREFERENCE_REQUIRED'`.
|
|
2150
|
+
*/
|
|
2151
|
+
updateMyNotificationPreferences(workspaceId: string, preferences: Record<string, {
|
|
2152
|
+
email?: boolean | null;
|
|
2153
|
+
push?: boolean | null;
|
|
2154
|
+
}>, signal?: AbortSignal): Promise<MyNotificationPreferences>;
|
|
1854
2155
|
/**
|
|
1855
2156
|
* Get credit balance for a workspace.
|
|
1856
2157
|
* @param workspaceId - The workspace ID
|
|
@@ -1970,6 +2271,14 @@ declare class EventEmitter {
|
|
|
1970
2271
|
* @param role - The role assigned to the user
|
|
1971
2272
|
*/
|
|
1972
2273
|
emitWorkspaceUserAdded(userId: string, workspace: IWorkspace, role: string): Promise<void>;
|
|
2274
|
+
/** An invitation was sent from this client. */
|
|
2275
|
+
emitWorkspaceInvitationSent(invitation: IWorkspaceInvitation, workspaceId: string): Promise<void>;
|
|
2276
|
+
/** The signed-in user accepted an invitation and joined `workspace`. */
|
|
2277
|
+
emitWorkspaceInvitationAccepted(invitation: IWorkspaceInvitation, workspace: IWorkspace): Promise<void>;
|
|
2278
|
+
/** The signed-in user declined an invitation. */
|
|
2279
|
+
emitWorkspaceInvitationDeclined(invitation: IWorkspaceInvitation): Promise<void>;
|
|
2280
|
+
/** A pending invitation was withdrawn from this client. */
|
|
2281
|
+
emitWorkspaceInvitationRevoked(invitationId: string, workspaceId: string): Promise<void>;
|
|
1973
2282
|
/**
|
|
1974
2283
|
* Trigger workspace user removed event
|
|
1975
2284
|
* @param userId - The ID of the user that was removed
|
|
@@ -2472,17 +2781,45 @@ declare const Permission: {
|
|
|
2472
2781
|
readonly WORKSPACE_BILLING_VIEW: "workspace:billing:view";
|
|
2473
2782
|
readonly WORKSPACE_BILLING_MANAGE: "workspace:billing:manage";
|
|
2474
2783
|
readonly WORKSPACE_USAGE_VIEW: "workspace:usage:view";
|
|
2784
|
+
/** Record usage and spend the workspace's credits. Withheld from viewers. */
|
|
2785
|
+
readonly WORKSPACE_USAGE_RECORD: "workspace:usage:record";
|
|
2475
2786
|
};
|
|
2476
2787
|
type PermissionKey = (typeof Permission)[keyof typeof Permission];
|
|
2477
2788
|
type RolePermissionMap = Record<string, string[]>;
|
|
2789
|
+
/**
|
|
2790
|
+
* Defaults for the three roles every org is seeded with, the same lists the
|
|
2791
|
+
* server enforces. Servers now send each role's effective permissions in the
|
|
2792
|
+
* public settings, so these apply only to a server that does not. There is no
|
|
2793
|
+
* `member` entry: no one can hold that role, and `editor` had none, so an
|
|
2794
|
+
* editor was shown nothing the server let them do.
|
|
2795
|
+
*/
|
|
2478
2796
|
declare const DEFAULT_ROLE_PERMISSIONS: RolePermissionMap;
|
|
2797
|
+
/** The least privileged built-in role, used when no default is usable. */
|
|
2798
|
+
declare const FALLBACK_WORKSPACE_ROLE = "viewer";
|
|
2799
|
+
/**
|
|
2800
|
+
* The role to preselect for someone joining: the org's default role when it
|
|
2801
|
+
* is on the list, but never `admin`, which must be a deliberate choice. Then
|
|
2802
|
+
* viewer, then any role other than admin.
|
|
2803
|
+
*/
|
|
2804
|
+
declare function pickDefaultRole(roles: readonly string[], defaultRole?: string | null): string;
|
|
2479
2805
|
interface WorkspaceLike extends WorkspaceLike$1 {
|
|
2480
2806
|
permissions?: Record<string, string[]>;
|
|
2481
2807
|
}
|
|
2808
|
+
/**
|
|
2809
|
+
* A permission the organization defined for its own application, in the
|
|
2810
|
+
* BuildBase console. The server stores and resolves it exactly like a platform
|
|
2811
|
+
* permission; what it means is the application's business.
|
|
2812
|
+
*/
|
|
2813
|
+
interface WorkspacePermissionDefinition {
|
|
2814
|
+
key: string;
|
|
2815
|
+
label: string;
|
|
2816
|
+
group?: string;
|
|
2817
|
+
}
|
|
2482
2818
|
interface SettingsLike {
|
|
2483
2819
|
workspace?: {
|
|
2484
2820
|
defaultRole?: string;
|
|
2485
2821
|
permissions?: Record<string, string[]>;
|
|
2822
|
+
customPermissions?: WorkspacePermissionDefinition[];
|
|
2486
2823
|
canInviteMembers?: boolean | 'admin-only';
|
|
2487
2824
|
canCreateWorkspace?: boolean | 'owner-only';
|
|
2488
2825
|
};
|
|
@@ -2512,12 +2849,31 @@ interface PermissionContext {
|
|
|
2512
2849
|
* 7. Apply setting restrictions (canInviteMembers)
|
|
2513
2850
|
*/
|
|
2514
2851
|
declare function resolvePermissions(ctx: PermissionContext): Set<string>;
|
|
2852
|
+
/**
|
|
2853
|
+
* What one role may do in a workspace, by the same tiers the server uses.
|
|
2854
|
+
* `resolvePermissions` answers for a user; this answers for a role, which is
|
|
2855
|
+
* what a screen editing the matrix needs. `applyRestrictions: false` leaves
|
|
2856
|
+
* out the org's live switches (who may invite), so a screen does not write a
|
|
2857
|
+
* switch's current effect into a saved override.
|
|
2858
|
+
*/
|
|
2859
|
+
declare function resolveRolePermissions(role: string, ctx: Pick<PermissionContext, 'workspace' | 'settings' | 'appPermissions'>, options?: {
|
|
2860
|
+
applyRestrictions?: boolean;
|
|
2861
|
+
}): Set<string>;
|
|
2515
2862
|
/**
|
|
2516
2863
|
* Check if a user has a specific permission (or all of an array).
|
|
2517
2864
|
* Works with both platform permissions (Permission.WORKSPACE_*) and
|
|
2518
2865
|
* app permissions (any custom string).
|
|
2519
2866
|
*/
|
|
2520
2867
|
declare function hasPermission(permission: string | string[], ctx: PermissionContext): boolean;
|
|
2868
|
+
/** Where a permission the app checks was defined. */
|
|
2869
|
+
declare const APP_PERMISSION_FALLBACK_GROUP = "App";
|
|
2870
|
+
/**
|
|
2871
|
+
* Every permission this application defines, for a UI that lists them: the
|
|
2872
|
+
* organization's catalogue from the console, plus any key the app passed
|
|
2873
|
+
* through `defaultPermissions` that the catalogue does not name yet. Keys from
|
|
2874
|
+
* the prop keep working, so adopting the console costs nothing.
|
|
2875
|
+
*/
|
|
2876
|
+
declare function appPermissionCatalogue(settings?: SettingsLike | null, appPermissions?: Record<string, string[]> | null): WorkspacePermissionDefinition[];
|
|
2521
2877
|
|
|
2522
2878
|
/**
|
|
2523
2879
|
* Push notification service worker source code.
|
|
@@ -2856,6 +3212,60 @@ interface SDKMessages {
|
|
|
2856
3212
|
memberLimitMessage: string;
|
|
2857
3213
|
selectRole: string;
|
|
2858
3214
|
inviteAs: string;
|
|
3215
|
+
invitations: {
|
|
3216
|
+
title: string;
|
|
3217
|
+
pendingCount: string;
|
|
3218
|
+
sent: string;
|
|
3219
|
+
resend: string;
|
|
3220
|
+
resendIn: string;
|
|
3221
|
+
revoke: string;
|
|
3222
|
+
/** Title of the revoke confirmation. */
|
|
3223
|
+
revokeTitle: string;
|
|
3224
|
+
revokeConfirm: string;
|
|
3225
|
+
sentAt: string;
|
|
3226
|
+
expiresAt: string;
|
|
3227
|
+
seatNote: string;
|
|
3228
|
+
formerMember: string;
|
|
3229
|
+
loadFailed: string;
|
|
3230
|
+
resendFailed: string;
|
|
3231
|
+
revokeFailed: string;
|
|
3232
|
+
status: {
|
|
3233
|
+
invited: string;
|
|
3234
|
+
accepted: string;
|
|
3235
|
+
rejected: string;
|
|
3236
|
+
expired: string;
|
|
3237
|
+
};
|
|
3238
|
+
};
|
|
3239
|
+
};
|
|
3240
|
+
invitations: {
|
|
3241
|
+
title: string;
|
|
3242
|
+
description: string;
|
|
3243
|
+
/** The list of the caller's own invitations, above the rows. */
|
|
3244
|
+
listDescription: string;
|
|
3245
|
+
/** Dialog title once the invitee has joined. */
|
|
3246
|
+
titleJoined: string;
|
|
3247
|
+
/** Dialog title for a link that can no longer be used: revoked, expired, switched off. */
|
|
3248
|
+
titleUnavailable: string;
|
|
3249
|
+
sentTo: string;
|
|
3250
|
+
invitedAs: string;
|
|
3251
|
+
accept: string;
|
|
3252
|
+
decline: string;
|
|
3253
|
+
accepted: string;
|
|
3254
|
+
declined: string;
|
|
3255
|
+
expired: string;
|
|
3256
|
+
revoked: string;
|
|
3257
|
+
alreadyAccepted: string;
|
|
3258
|
+
wrongAccount: string;
|
|
3259
|
+
verifyFirst: string;
|
|
3260
|
+
workspaceFull: string;
|
|
3261
|
+
disabled: string;
|
|
3262
|
+
empty: string;
|
|
3263
|
+
signInToAccept: string;
|
|
3264
|
+
dismiss: string;
|
|
3265
|
+
signOut: string;
|
|
3266
|
+
loadFailed: string;
|
|
3267
|
+
acceptFailed: string;
|
|
3268
|
+
declineFailed: string;
|
|
2859
3269
|
};
|
|
2860
3270
|
invoices: {
|
|
2861
3271
|
title: string;
|
|
@@ -2969,6 +3379,28 @@ interface SDKMessages {
|
|
|
2969
3379
|
failedToDelete: string;
|
|
2970
3380
|
};
|
|
2971
3381
|
notifications: {
|
|
3382
|
+
inbox: {
|
|
3383
|
+
title: string;
|
|
3384
|
+
description: string;
|
|
3385
|
+
bellLabel: string;
|
|
3386
|
+
bellUnread: string;
|
|
3387
|
+
filterAll: string;
|
|
3388
|
+
filterUnread: string;
|
|
3389
|
+
markAllRead: string;
|
|
3390
|
+
markRead: string;
|
|
3391
|
+
markUnread: string;
|
|
3392
|
+
archive: string;
|
|
3393
|
+
loadMore: string;
|
|
3394
|
+
empty: string;
|
|
3395
|
+
emptyUnread: string;
|
|
3396
|
+
loadFailed: string;
|
|
3397
|
+
updateFailed: string;
|
|
3398
|
+
channelEmail: string;
|
|
3399
|
+
channelPush: string;
|
|
3400
|
+
opened: string;
|
|
3401
|
+
clicked: string;
|
|
3402
|
+
notDelivered: string;
|
|
3403
|
+
};
|
|
2972
3404
|
title: string;
|
|
2973
3405
|
permissionDenied: string;
|
|
2974
3406
|
notSupported: string;
|
|
@@ -2986,6 +3418,13 @@ interface SDKMessages {
|
|
|
2986
3418
|
pushDescription: string;
|
|
2987
3419
|
deviceNote: string;
|
|
2988
3420
|
prefsSaved: string;
|
|
3421
|
+
prefsSaveFailed: string;
|
|
3422
|
+
yourTitle: string;
|
|
3423
|
+
yourDescription: string;
|
|
3424
|
+
defaultsTitle: string;
|
|
3425
|
+
defaultsDescription: string;
|
|
3426
|
+
requiredLabel: string;
|
|
3427
|
+
requiredHint: string;
|
|
2989
3428
|
loadingPrefs: string;
|
|
2990
3429
|
categories: {
|
|
2991
3430
|
workspace: string;
|
|
@@ -3254,6 +3693,97 @@ type Level4 = {
|
|
|
3254
3693
|
/** Union of all valid translation key paths (e.g. "settings.titles.profile") */
|
|
3255
3694
|
type TranslationKey = Level2 | Level3 | Level4;
|
|
3256
3695
|
|
|
3696
|
+
/**
|
|
3697
|
+
* The error an invitation call throws. A plain `Error` (so every existing
|
|
3698
|
+
* `catch (err) { err.message }` keeps working) carrying the server's fields
|
|
3699
|
+
* as properties, so a screen can act on the shape of the refusal: open the
|
|
3700
|
+
* plan picker on a seat limit, count down a resend cooldown, show which
|
|
3701
|
+
* address the invitation was for.
|
|
3702
|
+
*/
|
|
3703
|
+
declare const INVITATION_ERROR_CODE: {
|
|
3704
|
+
readonly NOT_FOUND: "INVITATION_NOT_FOUND";
|
|
3705
|
+
readonly EXPIRED: "INVITATION_EXPIRED";
|
|
3706
|
+
readonly ALREADY_HANDLED: "INVITATION_ALREADY_HANDLED";
|
|
3707
|
+
readonly EMAIL_MISMATCH: "INVITATION_EMAIL_MISMATCH";
|
|
3708
|
+
readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
|
|
3709
|
+
readonly INVITES_DISABLED: "WORKSPACE_INVITES_DISABLED";
|
|
3710
|
+
readonly RATE_LIMITED: "INVITATION_RATE_LIMITED";
|
|
3711
|
+
readonly EMAIL_FAILED: "INVITATION_EMAIL_FAILED";
|
|
3712
|
+
readonly SEAT_LIMIT: "SEAT_LIMIT_REACHED";
|
|
3713
|
+
/** The invited or accepting account is blocked. */
|
|
3714
|
+
readonly USER_BLOCKED: "USER_BLOCKED";
|
|
3715
|
+
/**
|
|
3716
|
+
* The organization has no usable email sender, so no invitation can be sent.
|
|
3717
|
+
*
|
|
3718
|
+
* This one is refused by the server's `requireEmailSender` middleware rather
|
|
3719
|
+
* than by the invitation route, so the string is that middleware's
|
|
3720
|
+
* (`EMAIL_SENDER_CODE.NO_SENDER_CONFIGURED`), not an invitation code. Named
|
|
3721
|
+
* after it on purpose: the value is what arrives, and a prettier alias here
|
|
3722
|
+
* would simply never match.
|
|
3723
|
+
*/
|
|
3724
|
+
readonly NO_SENDER_CONFIGURED: "NO_SENDER_CONFIGURED";
|
|
3725
|
+
};
|
|
3726
|
+
type InvitationErrorCode = (typeof INVITATION_ERROR_CODE)[keyof typeof INVITATION_ERROR_CODE];
|
|
3727
|
+
interface InvitationErrorFields {
|
|
3728
|
+
/** The HTTP status the server answered with. */
|
|
3729
|
+
status: number;
|
|
3730
|
+
/** A stable code, from the body when the server sent one, else derived from the status. */
|
|
3731
|
+
code: string;
|
|
3732
|
+
/** On a 402: members plus pending invitations, and the ceiling they hit. */
|
|
3733
|
+
currentUserCount?: number;
|
|
3734
|
+
limit?: number;
|
|
3735
|
+
/** On a resend's 429: seconds until the cooldown ends. */
|
|
3736
|
+
retryAfterSeconds?: number;
|
|
3737
|
+
/** On an email mismatch: the invited address, scrambled. */
|
|
3738
|
+
invitedEmail?: string;
|
|
3739
|
+
/** On "already invited": the live invitation, so the caller can offer resend. */
|
|
3740
|
+
invitationId?: string;
|
|
3741
|
+
/** On "already handled": the row's status. */
|
|
3742
|
+
invitationStatus?: string;
|
|
3743
|
+
}
|
|
3744
|
+
type InvitationError = Error & InvitationErrorFields;
|
|
3745
|
+
/** True when an unknown thrown value is an invitation error carrying a status. */
|
|
3746
|
+
declare function isInvitationError(err: unknown): err is InvitationError;
|
|
3747
|
+
|
|
3748
|
+
/**
|
|
3749
|
+
* The admin's ordering: pending first, then newest first within a status. An
|
|
3750
|
+
* admin should see what lapsed, so nothing is dropped here.
|
|
3751
|
+
*/
|
|
3752
|
+
declare function sortInvitations(rows: IWorkspaceInvitation[]): IWorkspaceInvitation[];
|
|
3753
|
+
/** Pending and not past its expiry: something the invitee can still accept or decline. */
|
|
3754
|
+
declare function isInvitationActionable(row: IWorkspaceInvitation, now?: Date): boolean;
|
|
3755
|
+
/**
|
|
3756
|
+
* The invitee's list: "a list of things you can act on should contain only
|
|
3757
|
+
* things you can act on". The server already filters, this keeps a stale
|
|
3758
|
+
* client list honest between refreshes.
|
|
3759
|
+
*/
|
|
3760
|
+
declare function actionableInvitations(rows: IWorkspaceInvitation[], now?: Date): IWorkspaceInvitation[];
|
|
3761
|
+
/** Pending, past its expiry, not yet swept: shown as expired by the admin's list. */
|
|
3762
|
+
declare function isInvitationLapsed(row: IWorkspaceInvitation, now?: Date): boolean;
|
|
3763
|
+
declare function workspaceNameOf(row: IWorkspaceInvitation): string;
|
|
3764
|
+
declare function workspaceIdOf(row: IWorkspaceInvitation): string;
|
|
3765
|
+
/** The inviter's display name, or null when their account is gone. */
|
|
3766
|
+
declare function inviterNameOf(row: IWorkspaceInvitation): string | null;
|
|
3767
|
+
/**
|
|
3768
|
+
* Seconds until a row may be resent, zero when it may. The cooldown itself is
|
|
3769
|
+
* the server's rule and stays there: this counts down to the `resendAvailableAt`
|
|
3770
|
+
* the server puts on every pending row, so the button cannot unlock a second
|
|
3771
|
+
* before the endpoint stops answering 429. A row without the field (a server
|
|
3772
|
+
* older than it) reports zero, leaving that 429 as the only authority.
|
|
3773
|
+
*/
|
|
3774
|
+
declare function resendCooldownSeconds(row: IWorkspaceInvitation, now?: Date): number;
|
|
3775
|
+
|
|
3776
|
+
/** Park a token for `orgId`. A malformed token is ignored rather than stored. */
|
|
3777
|
+
declare function parkPendingInvite(token: string, orgId: string): void;
|
|
3778
|
+
/**
|
|
3779
|
+
* The parked token for `orgId`, or null when there is none, it is older than a
|
|
3780
|
+
* day, or it belongs to another org. Does not clear: the flow clears it on a
|
|
3781
|
+
* terminal answer (accepted, declined, expired, handled), never on a network
|
|
3782
|
+
* error, so a retry stays possible.
|
|
3783
|
+
*/
|
|
3784
|
+
declare function readPendingInvite(orgId: string, now?: number): string | null;
|
|
3785
|
+
declare function clearPendingInvite(): void;
|
|
3786
|
+
|
|
3257
3787
|
/** Props passed to the custom loadingComponent render function. */
|
|
3258
3788
|
interface LoadingProps {
|
|
3259
3789
|
/** Human-readable, locale-aware message describing what's happening */
|
|
@@ -3447,6 +3977,8 @@ interface SDKUIConfig {
|
|
|
3447
3977
|
remove?: boolean;
|
|
3448
3978
|
/** Seat usage / seat pricing block above the member list. */
|
|
3449
3979
|
seatPricing?: boolean;
|
|
3980
|
+
/** The pending-invitations list (with resend and revoke) under the invite form. */
|
|
3981
|
+
invitations?: boolean;
|
|
3450
3982
|
};
|
|
3451
3983
|
/** Subscription screen — hide billing actions. */
|
|
3452
3984
|
subscription?: {
|
|
@@ -3563,6 +4095,27 @@ declare function useTranslation(): {
|
|
|
3563
4095
|
messages: SDKMessages;
|
|
3564
4096
|
};
|
|
3565
4097
|
|
|
4098
|
+
/** A consent default: what applies before the visitor has answered. */
|
|
4099
|
+
type ConsentDefault = 'granted' | 'denied';
|
|
4100
|
+
/**
|
|
4101
|
+
* A consent default that depends on where the visitor is.
|
|
4102
|
+
*
|
|
4103
|
+
* `default` covers everyone no region rule matches. Region entries are ISO
|
|
4104
|
+
* 3166-1 alpha-2 countries (`GB`), ISO 3166-2 subdivisions (`US-CA`), or `EEA`,
|
|
4105
|
+
* which expands to the current member states.
|
|
4106
|
+
*
|
|
4107
|
+
* @example The recommended setting
|
|
4108
|
+
* ```ts
|
|
4109
|
+
* { default: 'granted', regions: { denied: ['EEA', 'GB', 'CH'] } }
|
|
4110
|
+
* ```
|
|
4111
|
+
*/
|
|
4112
|
+
interface RegionalConsent {
|
|
4113
|
+
default: ConsentDefault;
|
|
4114
|
+
regions?: {
|
|
4115
|
+
denied?: string[];
|
|
4116
|
+
granted?: string[];
|
|
4117
|
+
};
|
|
4118
|
+
}
|
|
3566
4119
|
/**
|
|
3567
4120
|
* The events the SDK fires on the app's behalf.
|
|
3568
4121
|
*
|
|
@@ -3591,12 +4144,21 @@ interface TrackingOptions {
|
|
|
3591
4144
|
/** Set false to fetch nothing and render nothing. */
|
|
3592
4145
|
enabled?: boolean;
|
|
3593
4146
|
/**
|
|
3594
|
-
*
|
|
3595
|
-
*
|
|
3596
|
-
*
|
|
3597
|
-
*
|
|
4147
|
+
* The consent default, before the visitor answers.
|
|
4148
|
+
*
|
|
4149
|
+
* - `auto` (default): the client's regional default from the console, when
|
|
4150
|
+
* one is set; otherwise Consent Mode v2 denied everywhere until
|
|
4151
|
+
* `consent.set()`.
|
|
4152
|
+
* - `{ default, regions }`: a regional default set in code, which wins over
|
|
4153
|
+
* the console's. Resolved against the country the server saw.
|
|
4154
|
+
* - `granted`: the app asserting it already has a lawful basis everywhere -
|
|
4155
|
+
* their assertion, not ours.
|
|
4156
|
+
* - `denied`: nothing loads at all, not even a Consent Mode tag.
|
|
4157
|
+
*
|
|
4158
|
+
* Whichever default applies, `consent.set()` replaces it. The choice of
|
|
4159
|
+
* default, and its lawful basis, belong to the app.
|
|
3598
4160
|
*/
|
|
3599
|
-
consent?: 'auto' | 'granted' | 'denied';
|
|
4161
|
+
consent?: 'auto' | 'granted' | 'denied' | RegionalConsent;
|
|
3600
4162
|
/**
|
|
3601
4163
|
* Fire a `page_view` on SPA navigation. Turn it off when the app's GTM
|
|
3602
4164
|
* container already does it - double-counted pageviews is the single most
|
|
@@ -3774,7 +4336,7 @@ interface SaaSOSProviderProps extends IOsState {
|
|
|
3774
4336
|
}
|
|
3775
4337
|
declare const SaaSOSProvider: React__default.FC<SaaSOSProviderProps>;
|
|
3776
4338
|
|
|
3777
|
-
interface IProps$
|
|
4339
|
+
interface IProps$3 {
|
|
3778
4340
|
children: React.ReactNode;
|
|
3779
4341
|
/** Optional component/element to show while auth status is still loading. */
|
|
3780
4342
|
loadingComponent?: React.ReactNode;
|
|
@@ -3808,7 +4370,7 @@ interface IProps$2 {
|
|
|
3808
4370
|
* ```
|
|
3809
4371
|
*/
|
|
3810
4372
|
declare const WhenAuthenticated: {
|
|
3811
|
-
(props: IProps$
|
|
4373
|
+
(props: IProps$3): React$1.ReactNode;
|
|
3812
4374
|
displayName: string;
|
|
3813
4375
|
};
|
|
3814
4376
|
/**
|
|
@@ -3856,10 +4418,111 @@ declare const WhenAuthenticated: {
|
|
|
3856
4418
|
* ```
|
|
3857
4419
|
*/
|
|
3858
4420
|
declare const WhenUnauthenticated: {
|
|
3859
|
-
(props: IProps$
|
|
4421
|
+
(props: IProps$3): React$1.ReactNode;
|
|
3860
4422
|
displayName: string;
|
|
3861
4423
|
};
|
|
3862
4424
|
|
|
4425
|
+
interface PendingInvitationsProps {
|
|
4426
|
+
/** Extra classes for the root element. */
|
|
4427
|
+
className?: string;
|
|
4428
|
+
/** Heading text. Defaults to the translated title; set to null to hide. */
|
|
4429
|
+
title?: string | null;
|
|
4430
|
+
/** Sub-heading under the title. Defaults to the translated description; set to null to hide. */
|
|
4431
|
+
description?: string | null;
|
|
4432
|
+
/** Text shown when nothing is waiting. Defaults to the translated label. */
|
|
4433
|
+
emptyLabel?: string;
|
|
4434
|
+
/** Render nothing at all when nothing is waiting (for a host that has its own empty state). */
|
|
4435
|
+
hideWhenEmpty?: boolean;
|
|
4436
|
+
/** Switch to the workspace after accepting. Defaults to `true`. */
|
|
4437
|
+
switchOnAccept?: boolean;
|
|
4438
|
+
/** Called after an invitation is accepted, with the workspace joined. */
|
|
4439
|
+
onAccepted?: (workspace: IWorkspace) => void;
|
|
4440
|
+
}
|
|
4441
|
+
/**
|
|
4442
|
+
* The signed-in user's pending workspace invitations, with Accept and
|
|
4443
|
+
* Decline. Rendered by default inside the workspace switcher's empty state,
|
|
4444
|
+
* so an invite-only app's new user lands on their invitations rather than on
|
|
4445
|
+
* "No workspaces available"; place it on your own no-workspace screen too.
|
|
4446
|
+
* For a fully custom UI, use `useMyInvitations()`.
|
|
4447
|
+
*/
|
|
4448
|
+
declare function PendingInvitations({ className, title, description, emptyLabel, hideWhenEmpty, switchOnAccept, onAccepted, }: PendingInvitationsProps): React$1.JSX.Element | null;
|
|
4449
|
+
|
|
4450
|
+
interface IProps$2 {
|
|
4451
|
+
children: React__default.ReactNode;
|
|
4452
|
+
/** Optional content while the list resolves. */
|
|
4453
|
+
loadingComponent?: React__default.ReactNode;
|
|
4454
|
+
/** Optional content when nothing is waiting. */
|
|
4455
|
+
fallbackComponent?: React__default.ReactNode;
|
|
4456
|
+
}
|
|
4457
|
+
/**
|
|
4458
|
+
* Renders children only when the signed-in user has a pending workspace
|
|
4459
|
+
* invitation. The gate for an invite-only app's onboarding: show the
|
|
4460
|
+
* invitations screen when there is something to accept, the empty state
|
|
4461
|
+
* otherwise. Nothing renders while signed out.
|
|
4462
|
+
*/
|
|
4463
|
+
declare const WhenPendingInvitations: (props: IProps$2) => React__default.ReactNode;
|
|
4464
|
+
|
|
4465
|
+
interface UseMyInvitations {
|
|
4466
|
+
/** The invitations the signed-in user can act on: pending and not expired. */
|
|
4467
|
+
invitations: IWorkspaceInvitation[];
|
|
4468
|
+
/** True while the list is loading (false when signed out: there is nothing to load). */
|
|
4469
|
+
loading: boolean;
|
|
4470
|
+
/** Error message from the last list, accept or decline, if any. */
|
|
4471
|
+
error: string | null;
|
|
4472
|
+
/** The invitation id being accepted or declined, or null. */
|
|
4473
|
+
busy: string | null;
|
|
4474
|
+
/** Re-fetch the list. */
|
|
4475
|
+
refresh: () => Promise<void>;
|
|
4476
|
+
/**
|
|
4477
|
+
* Accept: joins the workspace and returns it. Null only when a second tab
|
|
4478
|
+
* accepted the same invitation a moment earlier and its membership write
|
|
4479
|
+
* is still in flight; the workspace list refreshes either way.
|
|
4480
|
+
*
|
|
4481
|
+
* Pass the invitation link's `token` if you built your own landing page from
|
|
4482
|
+
* it: the link proves the address, so an account that has not verified its
|
|
4483
|
+
* email separately is still let in.
|
|
4484
|
+
*/
|
|
4485
|
+
accept: (invitationId: string, options?: {
|
|
4486
|
+
token?: string;
|
|
4487
|
+
}) => Promise<IWorkspace | null>;
|
|
4488
|
+
/** Decline. */
|
|
4489
|
+
decline: (invitationId: string) => Promise<void>;
|
|
4490
|
+
}
|
|
4491
|
+
/**
|
|
4492
|
+
* The invitee's own invitations, across workspaces. Empty (and not loading)
|
|
4493
|
+
* while signed out; fetched once the session is authenticated and shared by
|
|
4494
|
+
* every consumer of the same org (one request per page load, not one per
|
|
4495
|
+
* component). This is the server-side truth the invite link is only a shortcut
|
|
4496
|
+
* to: a user whose link expired, or who signed in from another device, still
|
|
4497
|
+
* sees what is waiting.
|
|
4498
|
+
*/
|
|
4499
|
+
declare function useMyInvitations(): UseMyInvitations;
|
|
4500
|
+
|
|
4501
|
+
interface UseWorkspaceInvitations {
|
|
4502
|
+
/** Every invitation of the workspace, pending first, newest first within a status. */
|
|
4503
|
+
invitations: IWorkspaceInvitation[];
|
|
4504
|
+
/** The rows still pending (and billing a seat). */
|
|
4505
|
+
pendingCount: number;
|
|
4506
|
+
/** True while the list is loading. */
|
|
4507
|
+
loading: boolean;
|
|
4508
|
+
/** Error message from the last list, resend or revoke, if any. */
|
|
4509
|
+
error: string | null;
|
|
4510
|
+
/** The invitation id being resent or revoked, or null. */
|
|
4511
|
+
busy: string | null;
|
|
4512
|
+
/** Re-fetch the list. */
|
|
4513
|
+
refresh: () => Promise<void>;
|
|
4514
|
+
/** Send an invitation again. Throws the invitation error (429 carries `retryAfterSeconds`). */
|
|
4515
|
+
resend: (invitationId: string) => Promise<IWorkspaceInvitation>;
|
|
4516
|
+
/** Withdraw a pending invitation. */
|
|
4517
|
+
revoke: (invitationId: string) => Promise<void>;
|
|
4518
|
+
}
|
|
4519
|
+
/**
|
|
4520
|
+
* The admin's view of a workspace's invitations: the list, and resend and
|
|
4521
|
+
* revoke on it. Needs `MEMBERS_VIEW` for the list and `MEMBERS_INVITE` for the
|
|
4522
|
+
* actions. Pass `null` to render nothing (no request is made).
|
|
4523
|
+
*/
|
|
4524
|
+
declare function useWorkspaceInvitations(workspaceId: string | null | undefined): UseWorkspaceInvitations;
|
|
4525
|
+
|
|
3863
4526
|
/** What `signOut` accepts. */
|
|
3864
4527
|
interface SignOutOptions {
|
|
3865
4528
|
/** Revoke every session this user has, on every device, not just this one. */
|
|
@@ -4155,6 +4818,7 @@ declare function usePermissions(workspace?: WorkspaceLike | null): {
|
|
|
4155
4818
|
permissions: Set<string>;
|
|
4156
4819
|
isOwner: boolean;
|
|
4157
4820
|
role: string | null;
|
|
4821
|
+
appPermissionDefinitions: WorkspacePermissionDefinition[];
|
|
4158
4822
|
};
|
|
4159
4823
|
|
|
4160
4824
|
/** Memoized ConnectedAgentsApi instance. Recreates only when serverUrl/version change. */
|
|
@@ -4345,6 +5009,117 @@ interface SessionsProps {
|
|
|
4345
5009
|
*/
|
|
4346
5010
|
declare function Sessions({ className, title, description, showSignOut, signOutLabel, emptyLabel, }: SessionsProps): React$1.JSX.Element;
|
|
4347
5011
|
|
|
5012
|
+
/** Memoized NotificationsApi instance. Recreates only when serverUrl/version change. */
|
|
5013
|
+
declare function useNotificationsApi(): NotificationsApi;
|
|
5014
|
+
|
|
5015
|
+
interface UseNotificationsOptions {
|
|
5016
|
+
/**
|
|
5017
|
+
* Whose items: a workspace id, `'current'` for the selected workspace,
|
|
5018
|
+
* `'none'` for the account notices that belong to no workspace, or omitted
|
|
5019
|
+
* for everything the user has been sent.
|
|
5020
|
+
*/
|
|
5021
|
+
workspaceId?: NotificationScope | 'current';
|
|
5022
|
+
/** Items per page. Defaults to 20, at most 100. */
|
|
5023
|
+
pageSize?: number;
|
|
5024
|
+
/**
|
|
5025
|
+
* How often to check for new items while the tab is visible, in ms.
|
|
5026
|
+
* Defaults to 60 000; 0 turns polling off. Still runs with `live`, as the
|
|
5027
|
+
* fallback when the live connection is down.
|
|
5028
|
+
*/
|
|
5029
|
+
pollIntervalMs?: number;
|
|
5030
|
+
/**
|
|
5031
|
+
* Hear about new and changed items the moment they happen, over one shared
|
|
5032
|
+
* connection per tab. Defaults to true.
|
|
5033
|
+
*/
|
|
5034
|
+
live?: boolean;
|
|
5035
|
+
}
|
|
5036
|
+
interface UseNotifications {
|
|
5037
|
+
/** Loaded items, newest first, archived ones left out. */
|
|
5038
|
+
notifications: INotificationItem[];
|
|
5039
|
+
/** The loaded items not yet read. More may be on later pages: see `counts`. */
|
|
5040
|
+
unread: INotificationItem[];
|
|
5041
|
+
/** Server counts for the whole scope, not just what is loaded. */
|
|
5042
|
+
counts: NotificationCounts;
|
|
5043
|
+
/** True while the first page is loading. */
|
|
5044
|
+
loading: boolean;
|
|
5045
|
+
loadingMore: boolean;
|
|
5046
|
+
hasMore: boolean;
|
|
5047
|
+
/** Error message from the last load or action, if any. */
|
|
5048
|
+
error: string | null;
|
|
5049
|
+
refresh: () => Promise<void>;
|
|
5050
|
+
loadMore: () => Promise<void>;
|
|
5051
|
+
/** Read in the inbox. A no-op for an item already read. */
|
|
5052
|
+
markRead: (id: string) => Promise<void>;
|
|
5053
|
+
markUnread: (id: string) => Promise<void>;
|
|
5054
|
+
/** Out of the list; it stays in the user's history. */
|
|
5055
|
+
archive: (id: string) => Promise<void>;
|
|
5056
|
+
markAllRead: () => Promise<void>;
|
|
5057
|
+
/** The inbox was opened: clears the "new" state without reading anything. */
|
|
5058
|
+
markSeen: () => Promise<void>;
|
|
5059
|
+
}
|
|
5060
|
+
/**
|
|
5061
|
+
* The signed-in user's notification inbox: everything the app has sent them,
|
|
5062
|
+
* by email, push or both, one item per notification. Empty (and not loading)
|
|
5063
|
+
* while signed out. Shared by every consumer of the same org and scope, so a
|
|
5064
|
+
* bell and an inbox page are one request and a read in either updates both.
|
|
5065
|
+
*
|
|
5066
|
+
* Headless; `<NotificationBell />` and `<NotificationInbox />` are built on it.
|
|
5067
|
+
*/
|
|
5068
|
+
declare function useNotifications(options?: UseNotificationsOptions): UseNotifications;
|
|
5069
|
+
|
|
5070
|
+
interface NotificationInboxProps extends UseNotificationsOptions {
|
|
5071
|
+
/** Extra classes for the root element. */
|
|
5072
|
+
className?: string;
|
|
5073
|
+
/** Heading text. Defaults to the translated title; set to null to hide. */
|
|
5074
|
+
title?: string | null;
|
|
5075
|
+
/** Sub-heading under the title. Defaults to the translated description; null to hide. */
|
|
5076
|
+
description?: string | null;
|
|
5077
|
+
/** Show the All / Unread switch. Defaults to true. */
|
|
5078
|
+
showFilter?: boolean;
|
|
5079
|
+
/**
|
|
5080
|
+
* Called when an item is clicked, after it is marked read. Defaults to
|
|
5081
|
+
* opening its `link` in the current tab when it has one. Pass your
|
|
5082
|
+
* router's navigation here for an app path (`item.link` starting with
|
|
5083
|
+
* `/`) to avoid a full page load.
|
|
5084
|
+
*/
|
|
5085
|
+
onSelect?: (item: INotificationItem) => void;
|
|
5086
|
+
/** Text shown when there is nothing to list. */
|
|
5087
|
+
emptyLabel?: string;
|
|
5088
|
+
/** Mark everything seen once the inbox has shown it. Defaults to true. */
|
|
5089
|
+
markSeenOnView?: boolean;
|
|
5090
|
+
/** Tighter spacing, for a popover. */
|
|
5091
|
+
compact?: boolean;
|
|
5092
|
+
}
|
|
5093
|
+
/**
|
|
5094
|
+
* A ready-made notification inbox: everything the app has sent the signed-in
|
|
5095
|
+
* user, one item per notification however it was delivered, with read state,
|
|
5096
|
+
* archive and what each channel did. Scoped to the current user; pass
|
|
5097
|
+
* `workspaceId` for one workspace's items.
|
|
5098
|
+
*
|
|
5099
|
+
* For a fully custom UI, use the `useNotifications()` hook.
|
|
5100
|
+
*/
|
|
5101
|
+
declare function NotificationInbox({ className, title, description, showFilter, onSelect, emptyLabel, markSeenOnView, compact, ...options }: NotificationInboxProps): React$1.JSX.Element;
|
|
5102
|
+
|
|
5103
|
+
interface NotificationBellProps extends UseNotificationsOptions {
|
|
5104
|
+
/** Extra classes for the bell button. */
|
|
5105
|
+
className?: string;
|
|
5106
|
+
/** Which edge of the bell the panel lines up with. Defaults to `end`. */
|
|
5107
|
+
align?: 'start' | 'center' | 'end';
|
|
5108
|
+
/** Props for the inbox inside the panel (title, onSelect, empty text...). */
|
|
5109
|
+
inboxProps?: Omit<NotificationInboxProps, keyof UseNotificationsOptions | 'compact'>;
|
|
5110
|
+
/** Largest number the badge shows before it reads "99+". Defaults to 99. */
|
|
5111
|
+
maxCount?: number;
|
|
5112
|
+
}
|
|
5113
|
+
/**
|
|
5114
|
+
* A bell with the unread count, opening the inbox in a panel. Opening it
|
|
5115
|
+
* marks what is there as seen, which clears the badge's highlight without
|
|
5116
|
+
* reading anything; items are read when opened or clicked.
|
|
5117
|
+
*
|
|
5118
|
+
* Shares its data with any `<NotificationInbox />` or `useNotifications()`
|
|
5119
|
+
* for the same scope, so a read in one updates the other.
|
|
5120
|
+
*/
|
|
5121
|
+
declare function NotificationBell({ className, align, inboxProps, maxCount, ...options }: NotificationBellProps): React$1.JSX.Element;
|
|
5122
|
+
|
|
4348
5123
|
interface IProps {
|
|
4349
5124
|
slug: string;
|
|
4350
5125
|
children: React.ReactNode;
|
|
@@ -5314,7 +6089,10 @@ declare function useUserFeatures(): {
|
|
|
5314
6089
|
* - `deleteWorkspace(workspaceId)`: Function to delete a workspace (owner only)
|
|
5315
6090
|
* - `getWorkspace(workspaceId)`: Function to fetch a specific workspace
|
|
5316
6091
|
* - `getUsers(workspaceId)`: Function to fetch users in a workspace
|
|
5317
|
-
* - `addUser(workspaceId, email, role)`:
|
|
6092
|
+
* - `addUser(workspaceId, email, role)`: Add an EXISTING account to a workspace (404 when the address has none)
|
|
6093
|
+
* - `inviteMember(workspaceId, email, role, options?)`: Invite an email address that may have no account yet
|
|
6094
|
+
* - `listInvitations(workspaceId)`, `resendInvitation(workspaceId, id)`, `revokeInvitation(workspaceId, id)`: The admin's side of invitations
|
|
6095
|
+
* - `myInvitations()`, `acceptInvitation(id, { token? })`, `declineInvitation(id)`, `previewInvitation(token)`: The invitee's side
|
|
5318
6096
|
* - `removeUser(workspaceId, userId)`: Function to remove a user from a workspace
|
|
5319
6097
|
* - `updateUser(workspaceId, userId, config)`: Function to update a user in a workspace
|
|
5320
6098
|
* - `getProfile()`: Function to fetch current user profile
|
|
@@ -5432,6 +6210,21 @@ declare const useSaaSWorkspaces: () => {
|
|
|
5432
6210
|
permissions: Record<string, string[]>;
|
|
5433
6211
|
}) => Promise<unknown>;
|
|
5434
6212
|
updateWorkspacePermissions: (workspaceId: string, permissions: Record<string, string[]>) => Promise<unknown>;
|
|
6213
|
+
listInvitations: (workspaceId: string) => Promise<IWorkspaceInvitation[]>;
|
|
6214
|
+
inviteMember: (workspaceId: string, email: string, role: string, options?: {
|
|
6215
|
+
landingUrl?: string;
|
|
6216
|
+
}) => Promise<IWorkspaceInvitation>;
|
|
6217
|
+
resendInvitation: (workspaceId: string, invitationId: string) => Promise<IWorkspaceInvitation>;
|
|
6218
|
+
revokeInvitation: (workspaceId: string, invitationId: string) => Promise<void>;
|
|
6219
|
+
myInvitations: () => Promise<IWorkspaceInvitation[]>;
|
|
6220
|
+
acceptInvitation: (invitationId: string, options?: {
|
|
6221
|
+
token?: string;
|
|
6222
|
+
}) => Promise<{
|
|
6223
|
+
invitation: IWorkspaceInvitation;
|
|
6224
|
+
workspace: IWorkspace | null;
|
|
6225
|
+
}>;
|
|
6226
|
+
declineInvitation: (invitationId: string) => Promise<IWorkspaceInvitation>;
|
|
6227
|
+
previewInvitation: (token: string) => Promise<IWorkspaceInvitationPreview>;
|
|
5435
6228
|
workspaces: IWorkspace[];
|
|
5436
6229
|
loading: boolean;
|
|
5437
6230
|
error: string | null;
|
|
@@ -6203,7 +6996,8 @@ declare const useUsageLogs: (workspaceId: string | null | undefined, quotaSlug?:
|
|
|
6203
6996
|
|
|
6204
6997
|
/**
|
|
6205
6998
|
* Hook to get the credit balance for a workspace.
|
|
6206
|
-
* Automatically fetches when workspaceId changes
|
|
6999
|
+
* Automatically fetches when workspaceId changes, and refetches whenever
|
|
7000
|
+
* `invalidateCreditBalance()` is called (after a consume or a purchase).
|
|
6207
7001
|
*
|
|
6208
7002
|
* @param workspaceId - The workspace ID. Can be null/undefined to disable fetching.
|
|
6209
7003
|
* @returns { balance, loading, error, refetch }
|
|
@@ -6480,7 +7274,8 @@ interface SeatStatus {
|
|
|
6480
7274
|
* Must be used within SubscriptionContextProvider.
|
|
6481
7275
|
*
|
|
6482
7276
|
* @param workspace - The current workspace (needs users array, limits, billingCurrency)
|
|
6483
|
-
* @param options - Optional overrides
|
|
7277
|
+
* @param options - Optional overrides. `settingsMaxUsers` defaults to the org's
|
|
7278
|
+
* `maxWorkspaceUsers` from the SDK settings, the ceiling the server enforces.
|
|
6484
7279
|
* @returns SeatStatus — computed seat and invite information
|
|
6485
7280
|
*
|
|
6486
7281
|
* @example
|
|
@@ -6497,6 +7292,12 @@ declare function useSeatStatus(workspace: {
|
|
|
6497
7292
|
billingCurrency?: string | null;
|
|
6498
7293
|
} | null, options?: {
|
|
6499
7294
|
settingsMaxUsers?: number | null;
|
|
7295
|
+
/**
|
|
7296
|
+
* Live pending invitations. Each one holds a seat until it is answered,
|
|
7297
|
+
* and the server counts them against the ceiling, so leaving them out
|
|
7298
|
+
* offers an invite form that can only answer 402.
|
|
7299
|
+
*/
|
|
7300
|
+
pendingInvitations?: number;
|
|
6500
7301
|
}): SeatStatus;
|
|
6501
7302
|
|
|
6502
7303
|
interface BetaFormProps {
|
|
@@ -6815,5 +7616,5 @@ declare class WorkspaceSettingsManager {
|
|
|
6815
7616
|
}
|
|
6816
7617
|
declare const workspaceSettingsManager: WorkspaceSettingsManager;
|
|
6817
7618
|
|
|
6818
|
-
export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBaseBadge, SaaSOSProvider as BuildBaseProvider, CURRENCY_DISPLAY, CURRENCY_FLAG, ConnectMcpGuide, ConnectedAgents, ConnectedAgentsApi, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, Devices, DevicesApi, DunningState, EmptyState, EventEmitter, FullScreenLoader, InvoiceStatuses, LoadingState, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SectionHeader, Sessions, SessionsApi, SettingsApi, SettingsScreen, SidebarNavItem, SidebarNavSection, StatusBanner, SubscriptionContextProvider, SubscriptionItemType, SubscriptionStatus, UserApi, WhenAuthenticated, WhenCreditsAvailable, WhenCreditsExhausted, WhenCreditsLow, WhenNoSubscription, WhenNotTrialing, WhenPermission, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAuthIntent, coerceBadgeRef, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, eventEmitter, fillMcpTemplate, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, isZeroDecimalCurrency, mcpServerKey, mergeUIConfig, minorAmountToDisplay, readBBParams, resolveMaxUsers, resolvePermissions, safeRedirect, saveAuthIntent, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useConnectedAgents, useConnectedAgentsApi, useConsumeCredits, useCreateCheckoutSession, useCreditBalance, useCreditBalanceContext, useCreditPackages, useCreditTransactions, useDevices, useDevicesApi, useExpiringCredits, useFullScreenLoader, useInvoice, useInvoices, useMcpConnection, usePermissions, usePlanGroup, usePlanGroupVersions, usePublicCreditPackages, usePublicPlanGroupVersion, usePublicPlans, usePurchaseCredits, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSessions, useSessionsApi, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUIConfig, useUIVisibility, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, validateInvite, validateRedirectUrl, workspaceSettingsManager };
|
|
6819
|
-
export type { BBActionType, BBScreenType, BBStatusType, BadgeHrefOptions, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseBadgeProps, BuildBaseBadgeSize, BuildBaseBadgeTheme, BuildBaseBadgeVariant, SaaSOSProviderProps as BuildBaseProviderProps, CheckoutResult, ConnectMcpGuideProps, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DevicesProps, DunningStateType, EmptyStateProps, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConnectedAgent, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IDeviceView, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IIpInfoLite, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISessionView, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, McpClientGuide, McpConnectionConfig, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PartialSDKMessages, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SessionsProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, SignOutOptions, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UseDevices, UseSessions, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|
|
7619
|
+
export { APP_PERMISSION_FALLBACK_GROUP, ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, BuildBaseBadge, SaaSOSProvider as BuildBaseProvider, CURRENCY_DISPLAY, CURRENCY_FLAG, ConnectMcpGuide, ConnectedAgents, ConnectedAgentsApi, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, Devices, DevicesApi, DunningState, EmptyState, EventEmitter, FALLBACK_WORKSPACE_ROLE, FullScreenLoader, INVITATION_ERROR_CODE, InvoiceStatuses, LoadingState, NotificationBell, NotificationInbox, NotificationsApi, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, PendingInvitations, Permission, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SectionHeader, Sessions, SessionsApi, SettingsApi, SettingsScreen, SidebarNavItem, SidebarNavSection, StatusBanner, SubscriptionContextProvider, SubscriptionItemType, SubscriptionStatus, UserApi, WhenAuthenticated, WhenCreditsAvailable, WhenCreditsExhausted, WhenCreditsLow, WhenNoSubscription, WhenNotTrialing, WhenPendingInvitations, WhenPermission, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher, actionableInvitations, appPermissionCatalogue, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, clearAuthIntent, clearPendingInvite, coerceBadgeRef, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, eventEmitter, fillMcpTemplate, formatCents, formatMinorAmountIntl, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyDecimals, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, inviterNameOf, isInvitationActionable, isInvitationError, isInvitationLapsed, isZeroDecimalCurrency, mcpServerKey, mergeUIConfig, minorAmountToDisplay, parkPendingInvite, pickDefaultRole, readBBParams, readPendingInvite, resendCooldownSeconds, resolveMaxUsers, resolvePermissions, resolveRolePermissions, safeRedirect, saveAuthIntent, sortInvitations, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useConnectedAgents, useConnectedAgentsApi, useConsumeCredits, useCreateCheckoutSession, useCreditBalance, useCreditBalanceContext, useCreditPackages, useCreditTransactions, useDevices, useDevicesApi, useExpiringCredits, useFullScreenLoader, useInvoice, useInvoices, useMcpConnection, useMyInvitations, useNotifications, useNotificationsApi, usePermissions, usePlanGroup, usePlanGroupVersions, usePublicCreditPackages, usePublicPlanGroupVersion, usePublicPlans, usePurchaseCredits, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSessions, useSessionsApi, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUIConfig, useUIVisibility, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, useWorkspaceInvitations, validateInvite, validateRedirectUrl, workspaceIdOf, workspaceNameOf, workspaceSettingsManager };
|
|
7620
|
+
export type { BBActionType, BBScreenType, BBStatusType, BadgeHrefOptions, BetaFormData, BetaFormResponse, BillingInterval, BuildBaseBadgeProps, BuildBaseBadgeSize, BuildBaseBadgeTheme, BuildBaseBadgeVariant, SaaSOSProviderProps as BuildBaseProviderProps, CheckoutResult, ConnectMcpGuideProps, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DevicesProps, DunningStateType, EmptyStateProps, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConnectedAgent, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IDeviceView, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IIpInfoLite, INotificationItem, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISessionView, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, IWorkspaceInvitation, IWorkspaceInvitationPreview, IWorkspaceInvitationStatus, InvitationError, InvitationErrorCode, InvitationErrorFields, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, McpClientGuide, McpConnectionConfig, MyNotificationPreferences, NotificationBellProps, NotificationChannelPreference, NotificationCounts, NotificationData, NotificationEvent, NotificationInboxProps, NotificationListParams, NotificationPage, NotificationResult, NotificationScope, OnWorkspaceChangeParams, PartialSDKMessages, PendingInvitationsProps, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SessionsProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, SignOutOptions, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UseDevices, UseMyInvitations, UseNotifications, UseNotificationsOptions, UseSessions, UseWorkspaceInvitations, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceInvitationAcceptedEventData, WorkspaceInvitationDeclinedEventData, WorkspaceInvitationRevokedEventData, WorkspaceInvitationSentEventData, WorkspaceMemberPermissions, WorkspaceNotificationDefault, WorkspacePermissionDefinition, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|