@buildbase/sdk 0.0.54 → 0.0.56
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 +8 -4
- package/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +294 -47
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +367 -88
- package/dist/index.mjs +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +332 -16
- package/dist/mcp/index.mjs +1 -1
- package/dist/react/chunks/SettingsDialog-CvoDs5eM.cjs +2 -0
- package/dist/react/chunks/SettingsDialog-VaOW2jtS.mjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-8CagFA_V.cjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-C5EgpXE0.mjs +2 -0
- package/dist/react/chunks/ar-CGbuXEeR.cjs +2 -0
- package/dist/react/chunks/ar-DnShbYvQ.mjs +2 -0
- package/dist/react/chunks/de-C3iuiLAz.mjs +2 -0
- package/dist/react/chunks/de-a1mX2rR4.cjs +2 -0
- package/dist/react/chunks/es-D4T7YE7x.cjs +2 -0
- package/dist/react/chunks/es-u9vKMeaX.mjs +2 -0
- package/dist/react/chunks/fr-Bnnz2yJZ.cjs +2 -0
- package/dist/react/chunks/fr-DjgpP202.mjs +2 -0
- package/dist/react/chunks/hi-B8Mjr8rU.cjs +2 -0
- package/dist/react/chunks/hi-Cu_9iCjb.mjs +2 -0
- package/dist/react/chunks/ja-B0eCVKdZ.cjs +2 -0
- package/dist/react/chunks/ja-DfJ5WUrG.mjs +2 -0
- package/dist/react/chunks/react-BBY-Vuzr.cjs +2 -0
- package/dist/react/chunks/react-CvU8uS25.mjs +2 -0
- package/dist/react/chunks/zh-BnPZ0j4w.cjs +2 -0
- package/dist/react/chunks/zh-JjoMmHmK.mjs +2 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +728 -142
- package/dist/react/index.mjs +1 -1
- package/docs/ARCHITECTURE.md +419 -0
- package/docs/ERROR_CODES.md +96 -0
- package/docs/MCP-AND-AGENT-READINESS.md +893 -0
- package/docs/THEMING.md +67 -0
- package/docs/UI-CONFIG.md +207 -0
- package/package.json +14 -3
- package/dist/react/chunks/SettingsDialog-B28WJsAr.cjs +0 -2
- package/dist/react/chunks/SettingsDialog-blhppbNm.mjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-BTWVX3cH.mjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-QKmwvJU1.cjs +0 -2
- package/dist/react/chunks/ar-1Z1MOGAP.mjs +0 -2
- package/dist/react/chunks/ar-VGzBv3AZ.cjs +0 -2
- package/dist/react/chunks/de-BjdDg60Y.cjs +0 -2
- package/dist/react/chunks/de-CXUItplO.mjs +0 -2
- package/dist/react/chunks/es-BBPsSZUp.cjs +0 -2
- package/dist/react/chunks/es-BTbzVutz.mjs +0 -2
- package/dist/react/chunks/fr-Cax48X_S.cjs +0 -2
- package/dist/react/chunks/fr-DPMeOQu3.mjs +0 -2
- package/dist/react/chunks/hi-BJqvpG6d.cjs +0 -2
- package/dist/react/chunks/hi-JfJx-LV7.mjs +0 -2
- package/dist/react/chunks/ja-CDGtLzTk.mjs +0 -2
- package/dist/react/chunks/ja-DvVyj5xX.cjs +0 -2
- package/dist/react/chunks/react-6QJCOE-D.cjs +0 -2
- package/dist/react/chunks/react-CC6T7Zky.mjs +0 -2
- package/dist/react/chunks/zh-BAcqxkxk.cjs +0 -2
- package/dist/react/chunks/zh-BNZ2Ooe8.mjs +0 -2
package/dist/react/index.d.ts
CHANGED
|
@@ -1012,7 +1012,7 @@ interface ISettings {
|
|
|
1012
1012
|
/** Auto-create workspace on first login */
|
|
1013
1013
|
autoCreateFirst: boolean;
|
|
1014
1014
|
};
|
|
1015
|
-
[key: string]:
|
|
1015
|
+
[key: string]: unknown;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
1018
|
/**
|
|
@@ -1026,9 +1026,14 @@ interface IOsConfig {
|
|
|
1026
1026
|
version: ApiVersion;
|
|
1027
1027
|
orgId: string;
|
|
1028
1028
|
}
|
|
1029
|
+
/** Lifecycle of the one-time org-settings fetch. */
|
|
1030
|
+
type SettingsStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
1029
1031
|
interface IOsState extends IOsConfig {
|
|
1030
1032
|
auth?: IAuthConfig;
|
|
1031
1033
|
settings?: ISettings | null;
|
|
1034
|
+
/** State of the settings fetch — lets UI wait instead of guessing with `?? true` defaults. */
|
|
1035
|
+
settingsStatus?: SettingsStatus;
|
|
1036
|
+
settingsError?: string | null;
|
|
1032
1037
|
}
|
|
1033
1038
|
|
|
1034
1039
|
/**
|
|
@@ -1091,6 +1096,7 @@ interface IBaseApiConfig {
|
|
|
1091
1096
|
* - getAuthHeaders()
|
|
1092
1097
|
* - fetchJson<T>(path, init, errorMessage): GET/POST/etc. with handleApiResponse
|
|
1093
1098
|
* - fetchResponse(path, init): raw Response for custom parsing (e.g. non-JSON or custom error handling)
|
|
1099
|
+
* - fetchUnwrapped<T>(path, init, errorMessage): fetch → throw on !ok → unwrap { success, data } envelope
|
|
1094
1100
|
*/
|
|
1095
1101
|
declare abstract class BaseApi {
|
|
1096
1102
|
protected readonly serverUrl: string;
|
|
@@ -1139,6 +1145,12 @@ declare abstract class BaseApi {
|
|
|
1139
1145
|
* Caller is responsible for checking response.ok and parsing body.
|
|
1140
1146
|
*/
|
|
1141
1147
|
protected fetchResponse(path: string, init?: RequestInit): Promise<Response>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Execute request, throw a parsed error on !response.ok, and unwrap the
|
|
1150
|
+
* `{ success, data }` envelope. Shorthand for the common
|
|
1151
|
+
* fetchResponse → throwResponseError → unwrapResponse sequence.
|
|
1152
|
+
*/
|
|
1153
|
+
protected fetchUnwrapped<T>(path: string, init?: RequestInit, errorMessage?: string): Promise<T>;
|
|
1142
1154
|
/**
|
|
1143
1155
|
* Execute request against an absolute URL (bypasses baseUrl).
|
|
1144
1156
|
* Useful for endpoints outside the default basePath (e.g. /auth vs /public).
|
|
@@ -1180,21 +1192,26 @@ interface AuthRequestParams {
|
|
|
1180
1192
|
};
|
|
1181
1193
|
state?: string;
|
|
1182
1194
|
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Unwrapped payload of a successful auth request.
|
|
1197
|
+
* ⚠️ Prior to the envelope unification this type described the raw
|
|
1198
|
+
* `{ success, data, message }` wire envelope; `requestAuth` now unwraps the
|
|
1199
|
+
* envelope like every other SDK method and resolves with the payload only.
|
|
1200
|
+
*/
|
|
1183
1201
|
interface AuthRequestResponse {
|
|
1184
|
-
|
|
1185
|
-
data: {
|
|
1186
|
-
redirectUrl: string;
|
|
1187
|
-
};
|
|
1188
|
-
message: string;
|
|
1202
|
+
redirectUrl: string;
|
|
1189
1203
|
}
|
|
1190
1204
|
declare class AuthApi extends BaseApi {
|
|
1191
1205
|
constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
|
|
1192
1206
|
sessionId?: string;
|
|
1193
1207
|
});
|
|
1194
1208
|
/**
|
|
1195
|
-
* Initiate OAuth sign-in flow.
|
|
1209
|
+
* Initiate OAuth sign-in flow. Resolves with the redirect URL to the auth provider.
|
|
1196
1210
|
* Auth endpoints sit at /api/v1/auth/ (outside the /public basePath),
|
|
1197
|
-
* so we use fetchAbsoluteUrl to get timeout, retry, and error handling via
|
|
1211
|
+
* so we use fetchAbsoluteUrl to get timeout, retry, and error handling via
|
|
1212
|
+
* BaseApi, then apply the standard throwResponseError → unwrapResponse
|
|
1213
|
+
* sequence (the fetchUnwrapped convention). Non-2xx responses and 2xx
|
|
1214
|
+
* envelopes with `success: false` both throw a structured Error.
|
|
1198
1215
|
*/
|
|
1199
1216
|
requestAuth(params: AuthRequestParams): Promise<AuthRequestResponse>;
|
|
1200
1217
|
/** Fetch user profile with the given session ID (used after OAuth redirect or from storage). */
|
|
@@ -1247,6 +1264,75 @@ declare class ConnectedAgentsApi extends BaseApi {
|
|
|
1247
1264
|
revoke(clientId: string): Promise<void>;
|
|
1248
1265
|
}
|
|
1249
1266
|
|
|
1267
|
+
/**
|
|
1268
|
+
* API client for the signed-in user's devices — the browsers/apps they have
|
|
1269
|
+
* signed in from. Session-authed (x-session-id + x-device-id), scoped to the
|
|
1270
|
+
* current user. Extends BaseApi for shared URL/auth/request handling.
|
|
1271
|
+
*
|
|
1272
|
+
* A device row is login history. Signing a device out revokes its live sessions
|
|
1273
|
+
* but keeps the row (shown as signed-out); "forget" also removes the row.
|
|
1274
|
+
*/
|
|
1275
|
+
|
|
1276
|
+
/** Coarse geo/network info resolved from the request IP (a lightweight subset). */
|
|
1277
|
+
interface IIpInfoLite {
|
|
1278
|
+
ip?: string;
|
|
1279
|
+
hostname?: string;
|
|
1280
|
+
country?: string;
|
|
1281
|
+
city?: string;
|
|
1282
|
+
region?: string;
|
|
1283
|
+
/** "lat,long" string, as provided by the IP lookup. */
|
|
1284
|
+
loc?: string;
|
|
1285
|
+
timezone?: string;
|
|
1286
|
+
}
|
|
1287
|
+
/** A device the current user has signed in from. */
|
|
1288
|
+
interface IDeviceView {
|
|
1289
|
+
/** Stable per-browser/app identifier (the `x-device-id` the client sends). */
|
|
1290
|
+
deviceId: string;
|
|
1291
|
+
/** User-editable label (falls back to a derived name). */
|
|
1292
|
+
name: string;
|
|
1293
|
+
/** IP the device was last seen from. */
|
|
1294
|
+
ip: string;
|
|
1295
|
+
/** Resolved geo/network info for `ip`, when available. */
|
|
1296
|
+
ipInfo: IIpInfoLite | null;
|
|
1297
|
+
userAgent: string;
|
|
1298
|
+
origin: string;
|
|
1299
|
+
/** Whether the user marked this device trusted (longer sessions, fewer prompts). */
|
|
1300
|
+
trusted: boolean;
|
|
1301
|
+
/** ISO string — first time this device was seen. */
|
|
1302
|
+
firstSeenAt?: string;
|
|
1303
|
+
/** ISO string — most recent activity from this device. */
|
|
1304
|
+
lastActiveAt?: string;
|
|
1305
|
+
/** True when this is the device the request came from. */
|
|
1306
|
+
current: boolean;
|
|
1307
|
+
/** Number of live sessions currently on this device. */
|
|
1308
|
+
activeSessions: number;
|
|
1309
|
+
/** Whether this device has an active push-notification subscription. */
|
|
1310
|
+
pushEnabled: boolean;
|
|
1311
|
+
}
|
|
1312
|
+
declare class DevicesApi extends BaseApi {
|
|
1313
|
+
constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
|
|
1314
|
+
sessionId?: string;
|
|
1315
|
+
});
|
|
1316
|
+
/** List the devices the current user has signed in from. */
|
|
1317
|
+
list(signal?: AbortSignal): Promise<IDeviceView[]>;
|
|
1318
|
+
/** Rename a device (its user-facing label). */
|
|
1319
|
+
rename(deviceId: string, name: string, signal?: AbortSignal): Promise<void>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Sign a device out: revoke every live session born on it. The device stays
|
|
1322
|
+
* in the list as a signed-out device. Returns the number of sessions revoked.
|
|
1323
|
+
*/
|
|
1324
|
+
signOut(deviceId: string, signal?: AbortSignal): Promise<{
|
|
1325
|
+
revokedSessions: number;
|
|
1326
|
+
}>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Forget a device: sign it out AND remove the history row entirely.
|
|
1329
|
+
* Returns the number of sessions revoked in the process.
|
|
1330
|
+
*/
|
|
1331
|
+
forget(deviceId: string, signal?: AbortSignal): Promise<{
|
|
1332
|
+
revokedSessions: number;
|
|
1333
|
+
}>;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1250
1336
|
declare class PushApi extends BaseApi {
|
|
1251
1337
|
constructor(config: Pick<IBaseApiConfig, 'serverUrl' | 'version' | 'orgId' | 'sessionId'>);
|
|
1252
1338
|
getVapidPublicKey(): Promise<{
|
|
@@ -1262,6 +1348,51 @@ declare class PushApi extends BaseApi {
|
|
|
1262
1348
|
unsubscribe(endpoint: string): Promise<void>;
|
|
1263
1349
|
}
|
|
1264
1350
|
|
|
1351
|
+
/**
|
|
1352
|
+
* API client for the signed-in user's active sessions. Session-authed
|
|
1353
|
+
* (x-session-id), scoped to the current user. Extends BaseApi for shared
|
|
1354
|
+
* URL/auth/request handling.
|
|
1355
|
+
*
|
|
1356
|
+
* The raw session id is never exposed — a session's public handle is its
|
|
1357
|
+
* mirror-row id (`ISessionView.id`), which is what `revoke` takes.
|
|
1358
|
+
* "Sign out everywhere" / "sign out current" stay on the auth logout flow.
|
|
1359
|
+
*/
|
|
1360
|
+
|
|
1361
|
+
/** One live session of the current user, joined to its device's label. */
|
|
1362
|
+
interface ISessionView {
|
|
1363
|
+
/** Public handle (mirror-row id) — NOT the raw session id. Use for `revoke`. */
|
|
1364
|
+
id: string;
|
|
1365
|
+
/** The device this session was born on. */
|
|
1366
|
+
deviceId: string;
|
|
1367
|
+
/** OAuth client id, or 'first-party' for a normal app sign-in. */
|
|
1368
|
+
clientId: string;
|
|
1369
|
+
ip: string;
|
|
1370
|
+
ipInfo: IIpInfoLite | null;
|
|
1371
|
+
userAgent: string;
|
|
1372
|
+
origin: string;
|
|
1373
|
+
/** ISO string. */
|
|
1374
|
+
createdAt?: string;
|
|
1375
|
+
/** ISO string. */
|
|
1376
|
+
lastActiveAt?: string;
|
|
1377
|
+
/** ISO string — when the session expires (reflects the org session policy). */
|
|
1378
|
+
expiresAt?: string;
|
|
1379
|
+
/** True when this is the session making the request. */
|
|
1380
|
+
current: boolean;
|
|
1381
|
+
/** The device's label only; ip/userAgent/etc. live on the session itself. */
|
|
1382
|
+
device: {
|
|
1383
|
+
name: string;
|
|
1384
|
+
} | null;
|
|
1385
|
+
}
|
|
1386
|
+
declare class SessionsApi extends BaseApi {
|
|
1387
|
+
constructor(config: Pick<IOsConfig, 'serverUrl' | 'version'> & {
|
|
1388
|
+
sessionId?: string;
|
|
1389
|
+
});
|
|
1390
|
+
/** List the current user's live sessions (each joined to its device label). */
|
|
1391
|
+
list(signal?: AbortSignal): Promise<ISessionView[]>;
|
|
1392
|
+
/** Sign out one session by its public handle (`ISessionView.id`). */
|
|
1393
|
+
revoke(id: string, signal?: AbortSignal): Promise<void>;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1265
1396
|
/**
|
|
1266
1397
|
* Centralized API client for organization (OS) settings.
|
|
1267
1398
|
* Extends BaseApi for shared URL/auth/request handling.
|
|
@@ -1345,7 +1476,7 @@ interface NotificationData {
|
|
|
1345
1476
|
push?: boolean;
|
|
1346
1477
|
};
|
|
1347
1478
|
/** Any additional merge tags available as {{key}} in the email template. */
|
|
1348
|
-
[key: string]:
|
|
1479
|
+
[key: string]: unknown;
|
|
1349
1480
|
}
|
|
1350
1481
|
/** Result of sending a notification. */
|
|
1351
1482
|
interface NotificationResult {
|
|
@@ -1376,64 +1507,64 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1376
1507
|
sessionId?: string;
|
|
1377
1508
|
onUnauthorized?: () => void;
|
|
1378
1509
|
});
|
|
1379
|
-
getWorkspaces(): Promise<IWorkspace[]>;
|
|
1510
|
+
getWorkspaces(signal?: AbortSignal): Promise<IWorkspace[]>;
|
|
1380
1511
|
createWorkspace(data: {
|
|
1381
1512
|
name: string;
|
|
1382
1513
|
image?: string;
|
|
1383
|
-
}): Promise<IWorkspace>;
|
|
1384
|
-
updateWorkspace(id: string, data: Partial<IWorkspace
|
|
1385
|
-
deleteWorkspace(id: string): Promise<{
|
|
1514
|
+
}, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1515
|
+
updateWorkspace(id: string, data: Partial<IWorkspace>, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1516
|
+
deleteWorkspace(id: string, signal?: AbortSignal): Promise<{
|
|
1386
1517
|
success: boolean;
|
|
1387
1518
|
}>;
|
|
1388
|
-
getWorkspaceUsers(workspaceId: string): Promise<IWorkspaceUser[]>;
|
|
1519
|
+
getWorkspaceUsers(workspaceId: string, signal?: AbortSignal): Promise<IWorkspaceUser[]>;
|
|
1389
1520
|
addUser(workspaceId: string, config: {
|
|
1390
1521
|
email: string;
|
|
1391
1522
|
role: string;
|
|
1392
|
-
}): Promise<{
|
|
1523
|
+
}, signal?: AbortSignal): Promise<{
|
|
1393
1524
|
userId: string;
|
|
1394
1525
|
workspace: IWorkspace;
|
|
1395
1526
|
message: string;
|
|
1396
1527
|
}>;
|
|
1397
|
-
removeUser(workspaceId: string, userId: string): Promise<{
|
|
1528
|
+
removeUser(workspaceId: string, userId: string, signal?: AbortSignal): Promise<{
|
|
1398
1529
|
userId: string;
|
|
1399
1530
|
workspace: IWorkspace;
|
|
1400
1531
|
message: string;
|
|
1401
1532
|
}>;
|
|
1402
|
-
updateUser(workspaceId: string, userId: string, data: Partial<IWorkspaceUser
|
|
1533
|
+
updateUser(workspaceId: string, userId: string, data: Partial<IWorkspaceUser>, signal?: AbortSignal): Promise<{
|
|
1403
1534
|
userId: string;
|
|
1404
1535
|
workspace: IWorkspace;
|
|
1405
1536
|
message: string;
|
|
1406
1537
|
}>;
|
|
1407
1538
|
updateSettings(data: {
|
|
1408
1539
|
permissions: Record<string, string[]>;
|
|
1409
|
-
}): Promise<any>;
|
|
1410
|
-
updateWorkspacePermissions(workspaceId: string, permissions: Record<string, string[]
|
|
1411
|
-
getFeatures(): Promise<IWorkspaceFeature[]>;
|
|
1412
|
-
updateFeature(workspaceId: string, key: string, value: boolean): Promise<IWorkspace>;
|
|
1413
|
-
getWorkspace(workspaceId: string): Promise<IWorkspace>;
|
|
1414
|
-
getProfile(): Promise<IUser>;
|
|
1415
|
-
updateUserProfile(config: Partial<IUser
|
|
1416
|
-
getPasskeys(): Promise<IPasskeySummary[]>;
|
|
1417
|
-
renamePasskey(passkeyId: string, name: string): Promise<void>;
|
|
1418
|
-
deletePasskey(passkeyId: string): Promise<void>;
|
|
1540
|
+
}, signal?: AbortSignal): Promise<any>;
|
|
1541
|
+
updateWorkspacePermissions(workspaceId: string, permissions: Record<string, string[]>, signal?: AbortSignal): Promise<any>;
|
|
1542
|
+
getFeatures(signal?: AbortSignal): Promise<IWorkspaceFeature[]>;
|
|
1543
|
+
updateFeature(workspaceId: string, key: string, value: boolean, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1544
|
+
getWorkspace(workspaceId: string, signal?: AbortSignal): Promise<IWorkspace>;
|
|
1545
|
+
getProfile(signal?: AbortSignal): Promise<IUser>;
|
|
1546
|
+
updateUserProfile(config: Partial<IUser>, signal?: AbortSignal): Promise<IUser>;
|
|
1547
|
+
getPasskeys(signal?: AbortSignal): Promise<IPasskeySummary[]>;
|
|
1548
|
+
renamePasskey(passkeyId: string, name: string, signal?: AbortSignal): Promise<void>;
|
|
1549
|
+
deletePasskey(passkeyId: string, signal?: AbortSignal): Promise<void>;
|
|
1419
1550
|
/**
|
|
1420
1551
|
* Get current subscription for a workspace
|
|
1421
1552
|
* Returns subscription details including plan, plan version, and group information
|
|
1422
1553
|
*/
|
|
1423
|
-
getCurrentSubscription(workspaceId: string): Promise<ISubscriptionResponse>;
|
|
1554
|
+
getCurrentSubscription(workspaceId: string, signal?: AbortSignal): Promise<ISubscriptionResponse>;
|
|
1424
1555
|
/**
|
|
1425
1556
|
* Get plan group for a workspace
|
|
1426
1557
|
* Returns the plan group containing the current plan if subscription exists,
|
|
1427
1558
|
* otherwise returns the latest published group
|
|
1428
1559
|
*/
|
|
1429
|
-
getPlanGroup(workspaceId: string): Promise<IPlanGroupResponse>;
|
|
1560
|
+
getPlanGroup(workspaceId: string, signal?: AbortSignal): Promise<IPlanGroupResponse>;
|
|
1430
1561
|
/**
|
|
1431
1562
|
* Get plan group for a workspace with a specific version
|
|
1432
1563
|
* @param workspaceId - The workspace ID
|
|
1433
1564
|
* @param groupVersionId - The plan group version ID to fetch
|
|
1434
1565
|
* @returns Plan group response with the specified version
|
|
1435
1566
|
*/
|
|
1436
|
-
getPlanGroupByVersion(workspaceId: string, groupVersionId: string): Promise<IPlanGroupResponse>;
|
|
1567
|
+
getPlanGroupByVersion(workspaceId: string, groupVersionId: string, signal?: AbortSignal): Promise<IPlanGroupResponse>;
|
|
1437
1568
|
/**
|
|
1438
1569
|
* Get current group version and available newer versions of the same group
|
|
1439
1570
|
* - If user has active subscription: returns their current group version + newer versions
|
|
@@ -1443,7 +1574,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1443
1574
|
* @param workspaceId - The workspace ID
|
|
1444
1575
|
* @returns Plan group versions response with currentVersion and availableVersions
|
|
1445
1576
|
*/
|
|
1446
|
-
getPlanGroupVersions(workspaceId: string): Promise<IPlanGroupVersionsResponse>;
|
|
1577
|
+
getPlanGroupVersions(workspaceId: string, signal?: AbortSignal): Promise<IPlanGroupVersionsResponse>;
|
|
1447
1578
|
/**
|
|
1448
1579
|
* Get plan group versions by slug (public, no auth required).
|
|
1449
1580
|
* Returns the latest published plan group versions for the given plan group slug.
|
|
@@ -1452,7 +1583,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1452
1583
|
* @param slug - Plan group slug (e.g. 'default', 'enterprise')
|
|
1453
1584
|
* @returns Plan group versions response with currentVersion and availableVersions
|
|
1454
1585
|
*/
|
|
1455
|
-
getPublicPlans(slug: string): Promise<IPublicPlansResponse>;
|
|
1586
|
+
getPublicPlans(slug: string, signal?: AbortSignal): Promise<IPublicPlansResponse>;
|
|
1456
1587
|
/**
|
|
1457
1588
|
* Get credit packages (public, no auth required).
|
|
1458
1589
|
* Returns active credit packages for the org with pricing info.
|
|
@@ -1460,7 +1591,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1460
1591
|
*
|
|
1461
1592
|
* @returns Credit packages with pricing variants
|
|
1462
1593
|
*/
|
|
1463
|
-
getPublicCreditPackages(): Promise<IPublicCreditPackagesResponse>;
|
|
1594
|
+
getPublicCreditPackages(signal?: AbortSignal): Promise<IPublicCreditPackagesResponse>;
|
|
1464
1595
|
/**
|
|
1465
1596
|
* Get plan group version details by ID (public, no auth required).
|
|
1466
1597
|
* Returns the full plan group version with populated plan versions.
|
|
@@ -1469,15 +1600,24 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1469
1600
|
* @param groupVersionId - The plan group version ID to fetch
|
|
1470
1601
|
* @returns Plan group version with populated plan versions
|
|
1471
1602
|
*/
|
|
1472
|
-
getPlanGroupVersion(groupVersionId: string): Promise<IPlanGroupVersion>;
|
|
1603
|
+
getPlanGroupVersion(groupVersionId: string, signal?: AbortSignal): Promise<IPlanGroupVersion>;
|
|
1473
1604
|
/**
|
|
1474
1605
|
* Create checkout session for new subscription
|
|
1475
1606
|
* @param workspaceId - The workspace ID
|
|
1476
1607
|
* @param request - Checkout session request with planVersionId and optional billing interval/URLs
|
|
1477
1608
|
* @returns Checkout session response with checkoutUrl to redirect user
|
|
1478
1609
|
*/
|
|
1479
|
-
createCheckoutSession(workspaceId: string, request: ICheckoutSessionRequest): Promise<CheckoutResult>;
|
|
1480
|
-
|
|
1610
|
+
createCheckoutSession(workspaceId: string, request: ICheckoutSessionRequest, signal?: AbortSignal): Promise<CheckoutResult>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Assign a free (freemium) plan to the workspace without a Stripe checkout.
|
|
1613
|
+
*
|
|
1614
|
+
* This endpoint's envelope carries no `data` payload — it is
|
|
1615
|
+
* `{ success, message }` — so `fetchUnwrapped` resolves with the envelope
|
|
1616
|
+
* itself (its unwrap only extracts `data` when present). On resolution
|
|
1617
|
+
* `success` is therefore always `true`: non-2xx responses and 2xx envelopes
|
|
1618
|
+
* with `success: false` both throw a structured Error.
|
|
1619
|
+
*/
|
|
1620
|
+
selectFreePlan(workspaceId: string, planVersionId: string, signal?: AbortSignal): Promise<{
|
|
1481
1621
|
success: boolean;
|
|
1482
1622
|
message: string;
|
|
1483
1623
|
}>;
|
|
@@ -1486,12 +1626,12 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1486
1626
|
* Only allows plan changes within the same plan group
|
|
1487
1627
|
* Returns checkout session if payment is required, otherwise returns subscription update response
|
|
1488
1628
|
*/
|
|
1489
|
-
updateSubscription(workspaceId: string, request: ISubscriptionUpdateRequest): Promise<ISubscriptionUpdateResponse | ICheckoutSessionResponse>;
|
|
1629
|
+
updateSubscription(workspaceId: string, request: ISubscriptionUpdateRequest, signal?: AbortSignal): Promise<ISubscriptionUpdateResponse | ICheckoutSessionResponse>;
|
|
1490
1630
|
/**
|
|
1491
1631
|
* Create a Stripe Customer Portal session for managing payment methods, invoices, etc.
|
|
1492
1632
|
* Returns the portal URL — redirect user to it.
|
|
1493
1633
|
*/
|
|
1494
|
-
createBillingPortalSession(workspaceId: string, returnUrl?: string): Promise<{
|
|
1634
|
+
createBillingPortalSession(workspaceId: string, returnUrl?: string, signal?: AbortSignal): Promise<{
|
|
1495
1635
|
url: string;
|
|
1496
1636
|
}>;
|
|
1497
1637
|
/**
|
|
@@ -1501,35 +1641,35 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1501
1641
|
* @param startingAfter - Invoice ID to start after (for pagination)
|
|
1502
1642
|
* @returns List of invoices with pagination info
|
|
1503
1643
|
*/
|
|
1504
|
-
listInvoices(workspaceId: string, limit?: number, startingAfter?: string): Promise<IInvoiceListResponse>;
|
|
1644
|
+
listInvoices(workspaceId: string, limit?: number, startingAfter?: string, signal?: AbortSignal): Promise<IInvoiceListResponse>;
|
|
1505
1645
|
/**
|
|
1506
1646
|
* Get a single invoice by ID
|
|
1507
1647
|
* @param workspaceId - The workspace ID
|
|
1508
1648
|
* @param invoiceId - The invoice ID
|
|
1509
1649
|
* @returns Invoice details
|
|
1510
1650
|
*/
|
|
1511
|
-
getInvoice(workspaceId: string, invoiceId: string): Promise<IInvoiceResponse>;
|
|
1651
|
+
getInvoice(workspaceId: string, invoiceId: string, signal?: AbortSignal): Promise<IInvoiceResponse>;
|
|
1512
1652
|
/**
|
|
1513
1653
|
* Cancel subscription at the end of the current billing period
|
|
1514
1654
|
* Sets cancelAtPeriodEnd: true - subscription remains active until period ends
|
|
1515
1655
|
* @param workspaceId - The workspace ID
|
|
1516
1656
|
* @returns Updated subscription with cancelAtPeriodEnd and stripeCurrentPeriodEnd
|
|
1517
1657
|
*/
|
|
1518
|
-
cancelSubscriptionAtPeriodEnd(workspaceId: string): Promise<ISubscriptionResponse>;
|
|
1658
|
+
cancelSubscriptionAtPeriodEnd(workspaceId: string, signal?: AbortSignal): Promise<ISubscriptionResponse>;
|
|
1519
1659
|
/**
|
|
1520
1660
|
* Resume a subscription that was scheduled for cancellation
|
|
1521
1661
|
* Sets cancelAtPeriodEnd: false - subscription will continue after period ends
|
|
1522
1662
|
* @param workspaceId - The workspace ID
|
|
1523
1663
|
* @returns Updated subscription with cancelAtPeriodEnd set to false
|
|
1524
1664
|
*/
|
|
1525
|
-
resumeSubscription(workspaceId: string): Promise<ISubscriptionResponse>;
|
|
1665
|
+
resumeSubscription(workspaceId: string, signal?: AbortSignal): Promise<ISubscriptionResponse>;
|
|
1526
1666
|
/**
|
|
1527
1667
|
* Record quota usage for a workspace
|
|
1528
1668
|
* @param workspaceId - The workspace ID
|
|
1529
1669
|
* @param request - Usage request with quotaSlug, quantity, and optional metadata/source
|
|
1530
1670
|
* @returns Usage result with consumed/included/available/overage
|
|
1531
1671
|
*/
|
|
1532
|
-
recordUsage(workspaceId: string, request: IRecordUsageRequest): Promise<IRecordUsageResponse>;
|
|
1672
|
+
recordUsage(workspaceId: string, request: IRecordUsageRequest, signal?: AbortSignal): Promise<IRecordUsageResponse>;
|
|
1533
1673
|
/**
|
|
1534
1674
|
* Record multiple quota usage entries in a single request.
|
|
1535
1675
|
* Designed for backend-to-backend high-volume scenarios (bulk exports, batch jobs).
|
|
@@ -1553,7 +1693,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1553
1693
|
source?: string;
|
|
1554
1694
|
idempotencyKey?: string;
|
|
1555
1695
|
}>;
|
|
1556
|
-
}): Promise<{
|
|
1696
|
+
}, signal?: AbortSignal): Promise<{
|
|
1557
1697
|
success: boolean;
|
|
1558
1698
|
total: number;
|
|
1559
1699
|
succeeded: number;
|
|
@@ -1571,20 +1711,20 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1571
1711
|
* @param quotaSlug - The quota slug to check
|
|
1572
1712
|
* @returns Quota usage status with consumed/included/available/overage/hasOverage
|
|
1573
1713
|
*/
|
|
1574
|
-
getQuotaUsageStatus(workspaceId: string, quotaSlug: string): Promise<IQuotaUsageStatusResponse>;
|
|
1714
|
+
getQuotaUsageStatus(workspaceId: string, quotaSlug: string, signal?: AbortSignal): Promise<IQuotaUsageStatusResponse>;
|
|
1575
1715
|
/**
|
|
1576
1716
|
* Get usage status for all quotas in the workspace's current plan
|
|
1577
1717
|
* @param workspaceId - The workspace ID
|
|
1578
1718
|
* @returns All quota usage statuses keyed by quota slug
|
|
1579
1719
|
*/
|
|
1580
|
-
getAllQuotaUsage(workspaceId: string): Promise<IAllQuotaUsageResponse>;
|
|
1720
|
+
getAllQuotaUsage(workspaceId: string, signal?: AbortSignal): Promise<IAllQuotaUsageResponse>;
|
|
1581
1721
|
/**
|
|
1582
1722
|
* Get paginated usage logs for a workspace
|
|
1583
1723
|
* @param workspaceId - The workspace ID
|
|
1584
1724
|
* @param query - Optional filters: quotaSlug, from, to, source, page, limit
|
|
1585
1725
|
* @returns Paginated usage log entries
|
|
1586
1726
|
*/
|
|
1587
|
-
getUsageLogs(workspaceId: string, query?: IUsageLogsQuery): Promise<IUsageLogsResponse>;
|
|
1727
|
+
getUsageLogs(workspaceId: string, query?: IUsageLogsQuery, signal?: AbortSignal): Promise<IUsageLogsResponse>;
|
|
1588
1728
|
/**
|
|
1589
1729
|
* Trigger a notification event for a workspace.
|
|
1590
1730
|
* Respects all notification gates (org settings, event config, workspace preferences).
|
|
@@ -1607,16 +1747,16 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1607
1747
|
* });
|
|
1608
1748
|
* ```
|
|
1609
1749
|
*/
|
|
1610
|
-
sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData): Promise<NotificationResult>;
|
|
1611
|
-
getNotificationEvents(workspaceId: string): Promise<NotificationEvent[]>;
|
|
1612
|
-
getNotificationPreferences(workspaceId: string): Promise<Record<string, {
|
|
1750
|
+
sendNotification(workspaceId: string, event: string, userId?: string, data?: NotificationData, signal?: AbortSignal): Promise<NotificationResult>;
|
|
1751
|
+
getNotificationEvents(workspaceId: string, signal?: AbortSignal): Promise<NotificationEvent[]>;
|
|
1752
|
+
getNotificationPreferences(workspaceId: string, signal?: AbortSignal): Promise<Record<string, {
|
|
1613
1753
|
email?: boolean;
|
|
1614
1754
|
push?: boolean;
|
|
1615
1755
|
}>>;
|
|
1616
1756
|
updateNotificationPreferences(workspaceId: string, preferences: Record<string, {
|
|
1617
1757
|
email?: boolean;
|
|
1618
1758
|
push?: boolean;
|
|
1619
|
-
}
|
|
1759
|
+
}>, signal?: AbortSignal): Promise<Record<string, {
|
|
1620
1760
|
email?: boolean;
|
|
1621
1761
|
push?: boolean;
|
|
1622
1762
|
}>>;
|
|
@@ -1625,7 +1765,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1625
1765
|
* @param workspaceId - The workspace ID
|
|
1626
1766
|
* @returns Credit balance with available, totalGranted, totalConsumed, totalExpired, totalRefunded
|
|
1627
1767
|
*/
|
|
1628
|
-
getCreditBalance(workspaceId: string): Promise<ICreditBalance>;
|
|
1768
|
+
getCreditBalance(workspaceId: string, signal?: AbortSignal): Promise<ICreditBalance>;
|
|
1629
1769
|
/**
|
|
1630
1770
|
* Consume credits from a workspace balance.
|
|
1631
1771
|
* Throws an error with `code: 'INSUFFICIENT_CREDITS'` and `available`/`requested` fields on 402.
|
|
@@ -1633,7 +1773,7 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1633
1773
|
* @param request - Consume request with amount, optional description, idempotencyKey, metadata
|
|
1634
1774
|
* @returns Consume result with consumed amount and balanceAfter
|
|
1635
1775
|
*/
|
|
1636
|
-
consumeCredits(workspaceId: string, request: IConsumeCreditsRequest): Promise<IConsumeCreditsResponse>;
|
|
1776
|
+
consumeCredits(workspaceId: string, request: IConsumeCreditsRequest, signal?: AbortSignal): Promise<IConsumeCreditsResponse>;
|
|
1637
1777
|
/**
|
|
1638
1778
|
* Create a Stripe checkout session for purchasing a credit package.
|
|
1639
1779
|
* Returns a checkout URL to redirect the user to.
|
|
@@ -1641,35 +1781,35 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1641
1781
|
* @param request - Purchase request with creditPackageId, successUrl, cancelUrl, optional currency
|
|
1642
1782
|
* @returns Checkout session ID and URL
|
|
1643
1783
|
*/
|
|
1644
|
-
purchaseCredits(workspaceId: string, request: ICreditPurchaseRequest): Promise<ICreditPurchaseResponse>;
|
|
1784
|
+
purchaseCredits(workspaceId: string, request: ICreditPurchaseRequest, signal?: AbortSignal): Promise<ICreditPurchaseResponse>;
|
|
1645
1785
|
/**
|
|
1646
1786
|
* List available credit packages for purchase.
|
|
1647
1787
|
* Returns active, non-archived packages sorted by sortOrder then creditAmount.
|
|
1648
1788
|
* @param workspaceId - The workspace ID
|
|
1649
1789
|
* @returns Array of credit packages
|
|
1650
1790
|
*/
|
|
1651
|
-
getCreditPackages(workspaceId: string): Promise<ICreditPackage[]>;
|
|
1791
|
+
getCreditPackages(workspaceId: string, signal?: AbortSignal): Promise<ICreditPackage[]>;
|
|
1652
1792
|
/**
|
|
1653
1793
|
* Get paginated credit transaction history.
|
|
1654
1794
|
* @param workspaceId - The workspace ID
|
|
1655
1795
|
* @param query - Optional filters: type, page, limit
|
|
1656
1796
|
* @returns Paginated credit transactions
|
|
1657
1797
|
*/
|
|
1658
|
-
getCreditTransactions(workspaceId: string, query?: ICreditTransactionsQuery): Promise<ICreditTransactionsResponse>;
|
|
1798
|
+
getCreditTransactions(workspaceId: string, query?: ICreditTransactionsQuery, signal?: AbortSignal): Promise<ICreditTransactionsResponse>;
|
|
1659
1799
|
/**
|
|
1660
1800
|
* Get paginated credit buckets.
|
|
1661
1801
|
* @param workspaceId - The workspace ID
|
|
1662
1802
|
* @param query - Optional filters: status, source, page, limit
|
|
1663
1803
|
* @returns Paginated credit buckets
|
|
1664
1804
|
*/
|
|
1665
|
-
getCreditBuckets(workspaceId: string, query?: ICreditBucketsQuery): Promise<ICreditBucketsResponse>;
|
|
1805
|
+
getCreditBuckets(workspaceId: string, query?: ICreditBucketsQuery, signal?: AbortSignal): Promise<ICreditBucketsResponse>;
|
|
1666
1806
|
/**
|
|
1667
1807
|
* Get credits expiring within N days.
|
|
1668
1808
|
* @param workspaceId - The workspace ID
|
|
1669
1809
|
* @param days - Look-ahead window in days (1-90, default 7)
|
|
1670
1810
|
* @returns Expiring credits summary with bucket list
|
|
1671
1811
|
*/
|
|
1672
|
-
getExpiringCredits(workspaceId: string, days?: number): Promise<IExpiringCreditsResponse>;
|
|
1812
|
+
getExpiringCredits(workspaceId: string, days?: number, signal?: AbortSignal): Promise<IExpiringCreditsResponse>;
|
|
1673
1813
|
}
|
|
1674
1814
|
|
|
1675
1815
|
/**
|
|
@@ -1796,6 +1936,7 @@ declare const BBAction: {
|
|
|
1796
1936
|
readonly SelectPlan: "selectPlan";
|
|
1797
1937
|
readonly CreditPurchase: "creditPurchase";
|
|
1798
1938
|
readonly OpenCreditStore: "openCreditStore";
|
|
1939
|
+
readonly OpenConnectGuide: "openConnectGuide";
|
|
1799
1940
|
readonly Invite: "invite";
|
|
1800
1941
|
};
|
|
1801
1942
|
type BBActionType = (typeof BBAction)[keyof typeof BBAction];
|
|
@@ -1953,14 +2094,33 @@ declare const PLAN_CURRENCY_OPTIONS: {
|
|
|
1953
2094
|
value: "usd" | "eur" | "gbp" | "jpy" | "cad" | "aud" | "chf" | "cny" | "hkd" | "sgd" | "inr" | "mxn" | "brl" | "nzd" | "sek" | "nok" | "dkk" | "pln" | "thb";
|
|
1954
2095
|
label: string;
|
|
1955
2096
|
}[];
|
|
2097
|
+
/**
|
|
2098
|
+
* Minor-unit digits for a currency per ISO 4217: 0 (JPY, KRW, …), 2 (most),
|
|
2099
|
+
* or 3 (KWD, BHD, …). The zero- and three-decimal sets are pinned to Stripe's
|
|
2100
|
+
* treatment (the billing backend defines amount semantics); ISK is pinned to 2
|
|
2101
|
+
* (Stripe legacy — ISO 4217 says 0). Any other code defers to the runtime's
|
|
2102
|
+
* CLDR data (IQD/LYD → 3, CLF/UYW → 4, UYI → 0), falling back to 2 for codes
|
|
2103
|
+
* unknown to Intl or malformed.
|
|
2104
|
+
*/
|
|
2105
|
+
declare function getCurrencyDecimals(currency: string | null | undefined): number;
|
|
1956
2106
|
/** True when `currency` has no minor unit (JPY, KRW, …) — amounts are whole units, not cents. */
|
|
1957
2107
|
declare function isZeroDecimalCurrency(currency: string | null | undefined): boolean;
|
|
1958
2108
|
/**
|
|
1959
2109
|
* Convert a minor-unit amount to its display number for `currency`:
|
|
1960
2110
|
* `minorAmountToDisplay(1999, 'usd')` → `"19.99"`,
|
|
1961
|
-
* `minorAmountToDisplay(1000, 'jpy')` → `"1,000"` (zero-decimal — no division)
|
|
2111
|
+
* `minorAmountToDisplay(1000, 'jpy')` → `"1,000"` (zero-decimal — no division),
|
|
2112
|
+
* `minorAmountToDisplay(12345, 'kwd')` → `"12.345"` (three-decimal — ÷1000).
|
|
1962
2113
|
*/
|
|
1963
2114
|
declare function minorAmountToDisplay(amount: number, currency: string): string;
|
|
2115
|
+
/**
|
|
2116
|
+
* Locale-aware currency formatting of a minor-unit amount via `Intl.NumberFormat`
|
|
2117
|
+
* (`(1999, 'usd', 'en-US')` → `"$19.99"`; `(1000, 'jpy', 'ja-JP')` → `"¥1,000"`;
|
|
2118
|
+
* `(12345, 'kwd')` → `"KWD 12.345"`). The divisor follows the currency's ISO 4217
|
|
2119
|
+
* minor-unit digits (see `getCurrencyDecimals`) — zero-decimal currencies are
|
|
2120
|
+
* never divided, three-decimal divide by 1000. Falls back to the symbol table
|
|
2121
|
+
* when the currency code is empty or malformed.
|
|
2122
|
+
*/
|
|
2123
|
+
declare function formatMinorAmountIntl(amount: number, currency: string, locale?: string): string;
|
|
1964
2124
|
/** Format cents as money string (e.g. 1999, "usd" -> "$19.99"; 1000, "jpy" -> "¥1,000"). Caller must pass currency (e.g. from plan or workspace). */
|
|
1965
2125
|
declare function formatCents(cents: number, currency: string): string;
|
|
1966
2126
|
/** Translatable labels for overage/quota formatting */
|
|
@@ -1980,15 +2140,16 @@ interface OverageLabels {
|
|
|
1980
2140
|
}
|
|
1981
2141
|
/**
|
|
1982
2142
|
* Format overage rate for display. When unitSize > 1: "$1.00/1,000 units"; else "$1.00/unit".
|
|
1983
|
-
* Pass `labels` for i18n support.
|
|
2143
|
+
* Pass `labels` for i18n support and `locale` to group numbers in the display locale.
|
|
1984
2144
|
*/
|
|
1985
|
-
declare function formatOverageRate(overageCents: number | undefined, unitSize: number | undefined, currency: string, labels?: Partial<OverageLabels
|
|
2145
|
+
declare function formatOverageRate(overageCents: number | undefined, unitSize: number | undefined, currency: string, labels?: Partial<OverageLabels>, locale?: string): string | null;
|
|
1986
2146
|
/**
|
|
1987
2147
|
* Format overage rate with optional unit label for comparison/preview UIs.
|
|
1988
2148
|
* e.g. formatOverageRateWithLabel(50, 1000, "video", "usd") -> "$0.50/1,000 videos"
|
|
1989
2149
|
* Pass `labels` for i18n support. Pass `pluralUnitLabel` to avoid English "s" pluralization.
|
|
2150
|
+
* Pass `locale` to group numbers in the display locale.
|
|
1990
2151
|
*/
|
|
1991
|
-
declare function formatOverageRateWithLabel(overageCents: number | undefined, unitSize: number | undefined, unitLabel: string | undefined, currency: string, pluralUnitLabel?: string, labels?: Partial<OverageLabels
|
|
2152
|
+
declare function formatOverageRateWithLabel(overageCents: number | undefined, unitSize: number | undefined, unitLabel: string | undefined, currency: string, pluralUnitLabel?: string, labels?: Partial<OverageLabels>, locale?: string): string | null;
|
|
1992
2153
|
/**
|
|
1993
2154
|
* Get singular unit label from item name or slug (e.g. "Videos" -> "video", "reels" -> "reel").
|
|
1994
2155
|
* Used for quota display in comparison and preview.
|
|
@@ -1997,9 +2158,10 @@ declare function formatOverageRateWithLabel(overageCents: number | undefined, un
|
|
|
1997
2158
|
declare function getQuotaUnitLabelFromName(nameOrSlug: string, fallback?: string): string;
|
|
1998
2159
|
/**
|
|
1999
2160
|
* Format quota "included + overage" for display.
|
|
2000
|
-
* Pass `labels` and `pluralUnitLabel` for i18n support
|
|
2161
|
+
* Pass `labels` and `pluralUnitLabel` for i18n support, and `locale` to group
|
|
2162
|
+
* numbers in the display locale.
|
|
2001
2163
|
*/
|
|
2002
|
-
declare function formatQuotaIncludedOverage(included: number | undefined, overageCents: number | undefined, unitLabel: string, currency: string, unitSize?: number, pluralUnitLabel?: string, labels?: Partial<OverageLabels>, allowOverage?: boolean): string;
|
|
2164
|
+
declare function formatQuotaIncludedOverage(included: number | undefined, overageCents: number | undefined, unitLabel: string, currency: string, unitSize?: number, pluralUnitLabel?: string, labels?: Partial<OverageLabels>, allowOverage?: boolean, locale?: string): string;
|
|
2003
2165
|
|
|
2004
2166
|
type QuotaDisplayValue = {
|
|
2005
2167
|
included: number;
|
|
@@ -2031,6 +2193,8 @@ interface QuotaLabels {
|
|
|
2031
2193
|
included: string;
|
|
2032
2194
|
/** e.g. "then" — separator between included and price */
|
|
2033
2195
|
then: string;
|
|
2196
|
+
/** e.g. "hard limit" — shown when overage is not allowed */
|
|
2197
|
+
hardLimit?: string;
|
|
2034
2198
|
}
|
|
2035
2199
|
/**
|
|
2036
2200
|
* Format a quota display value as "X included, then $Y.YY / unit".
|
|
@@ -2158,6 +2322,18 @@ declare function validateInvite(opts: {
|
|
|
2158
2322
|
requireSubscription?: boolean;
|
|
2159
2323
|
}): InviteValidation;
|
|
2160
2324
|
|
|
2325
|
+
/** Minimal workspace shape needed for ownership/role checks. Extended by `permissions.WorkspaceLike`. */
|
|
2326
|
+
interface WorkspaceLike$1 {
|
|
2327
|
+
_id: string;
|
|
2328
|
+
createdBy: string | {
|
|
2329
|
+
_id: string;
|
|
2330
|
+
} | null | undefined;
|
|
2331
|
+
users?: Array<string | {
|
|
2332
|
+
_id: string;
|
|
2333
|
+
role?: string;
|
|
2334
|
+
}>;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2161
2337
|
/**
|
|
2162
2338
|
* Role-based permission system.
|
|
2163
2339
|
* Framework-agnostic — used by both React hooks and server-side BuildBase.
|
|
@@ -2175,6 +2351,7 @@ declare function validateInvite(opts: {
|
|
|
2175
2351
|
* Both are resolved from the same role→permission map. Owner always gets all
|
|
2176
2352
|
* platform permissions + any app permissions defined in the config.
|
|
2177
2353
|
*/
|
|
2354
|
+
|
|
2178
2355
|
declare const Permission: {
|
|
2179
2356
|
readonly WORKSPACE_SETTINGS_VIEW: "workspace:settings:view";
|
|
2180
2357
|
readonly WORKSPACE_SETTINGS_EDIT: "workspace:settings:edit";
|
|
@@ -2192,15 +2369,7 @@ declare const Permission: {
|
|
|
2192
2369
|
type PermissionKey = (typeof Permission)[keyof typeof Permission];
|
|
2193
2370
|
type RolePermissionMap = Record<string, string[]>;
|
|
2194
2371
|
declare const DEFAULT_ROLE_PERMISSIONS: RolePermissionMap;
|
|
2195
|
-
interface WorkspaceLike {
|
|
2196
|
-
_id: string;
|
|
2197
|
-
createdBy: string | {
|
|
2198
|
-
_id: string;
|
|
2199
|
-
} | null | undefined;
|
|
2200
|
-
users?: Array<string | {
|
|
2201
|
-
_id: string;
|
|
2202
|
-
role?: string;
|
|
2203
|
-
}>;
|
|
2372
|
+
interface WorkspaceLike extends WorkspaceLike$1 {
|
|
2204
2373
|
permissions?: Record<string, string[]>;
|
|
2205
2374
|
}
|
|
2206
2375
|
interface SettingsLike {
|
|
@@ -2257,7 +2426,7 @@ declare function hasPermission(permission: string | string[], ctx: PermissionCon
|
|
|
2257
2426
|
*
|
|
2258
2427
|
* Or manually create `public/push-sw.js` with this content.
|
|
2259
2428
|
*/
|
|
2260
|
-
declare const PUSH_SERVICE_WORKER_SCRIPT = "\n// BuildBase Push Notification Service Worker\n// Place this file in your app's public directory (e.g. public/push-sw.js)\n\nself.addEventListener('push', function(event) {\n if (!event.data) return;\n\n try {\n const payload = event.data.json();\n const title = payload.title || 'Notification';\n const options = {\n body: payload.body || '',\n icon: payload.icon || undefined,\n badge: payload.icon || undefined,\n data: { url: payload.url, ...(payload.data || {}) },\n tag: 'buildbase-push-' + Date.now(),\n };\n\n event.waitUntil(\n self.registration.showNotification(title, options)\n );\n } catch (e) {\n console.error('[PushSW] Failed to show notification:', e);\n }\n});\n\nself.addEventListener('notificationclick', function(event) {\n event.notification.close();\n\n const url = event.notification.data && event.notification.data.url;\n if (url) {\n event.waitUntil(\n clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function(clientList) {\n for (let i = 0; i < clientList.length; i++) {\n const client = clientList[i];\n if (client.url === url && 'focus' in client) {\n return client.focus();\n }\n }\n if (clients.openWindow) {\n return clients.openWindow(url);\n }\n })\n );\n }\n});\n";
|
|
2429
|
+
declare const PUSH_SERVICE_WORKER_SCRIPT = "\n// BuildBase Push Notification Service Worker\n// Place this file in your app's public directory (e.g. public/push-sw.js)\n\nself.addEventListener('push', function(event) {\n if (!event.data) return;\n\n try {\n const payload = event.data.json();\n // i18n exception: service workers run outside the SDK's translation\n // provider, so this last-resort fallback stays English. The server should\n // always send a localized payload.title.\n const title = payload.title || 'Notification';\n const options = {\n body: payload.body || '',\n icon: payload.icon || undefined,\n badge: payload.icon || undefined,\n data: { url: payload.url, ...(payload.data || {}) },\n tag: 'buildbase-push-' + Date.now(),\n };\n\n event.waitUntil(\n self.registration.showNotification(title, options)\n );\n } catch (e) {\n console.error('[PushSW] Failed to show notification:', e);\n }\n});\n\nself.addEventListener('notificationclick', function(event) {\n event.notification.close();\n\n const url = event.notification.data && event.notification.data.url;\n if (url) {\n event.waitUntil(\n clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function(clientList) {\n for (let i = 0; i < clientList.length; i++) {\n const client = clientList[i];\n if (client.url === url && 'focus' in client) {\n return client.focus();\n }\n }\n if (clients.openWindow) {\n return clients.openWindow(url);\n }\n })\n );\n }\n});\n";
|
|
2261
2430
|
|
|
2262
2431
|
interface BetaFormData {
|
|
2263
2432
|
name?: string;
|
|
@@ -2280,6 +2449,24 @@ interface SDKMessages {
|
|
|
2280
2449
|
connectedAgentsEmpty: string;
|
|
2281
2450
|
connectedAgentsAccess: string;
|
|
2282
2451
|
connectedAgentsGranted: string;
|
|
2452
|
+
connectedAgentsLoadFailed: string;
|
|
2453
|
+
connectedAgentsRevokeFailed: string;
|
|
2454
|
+
mcpConnectAction: string;
|
|
2455
|
+
mcpGuideTitle: string;
|
|
2456
|
+
mcpGuideDescription: string;
|
|
2457
|
+
mcpServerUrlLabel: string;
|
|
2458
|
+
mcpServerUrlHint: string;
|
|
2459
|
+
mcpPromptLabel: string;
|
|
2460
|
+
mcpPromptHint: string;
|
|
2461
|
+
mcpPromptTemplate: string;
|
|
2462
|
+
mcpClientsLabel: string;
|
|
2463
|
+
mcpAddToConfigFile: string;
|
|
2464
|
+
mcpClientChatgptInstructions: string;
|
|
2465
|
+
mcpClientClaudeInstructions: string;
|
|
2466
|
+
mcpClientClineInstructions: string;
|
|
2467
|
+
mcpCopy: string;
|
|
2468
|
+
mcpCopied: string;
|
|
2469
|
+
mcpLearnMore: string;
|
|
2283
2470
|
inactive: string;
|
|
2284
2471
|
inactiveHint: string;
|
|
2285
2472
|
passkeysTitle: string;
|
|
@@ -2293,11 +2480,41 @@ interface SDKMessages {
|
|
|
2293
2480
|
renamePlaceholder: string;
|
|
2294
2481
|
lastUsed: string;
|
|
2295
2482
|
added: string;
|
|
2483
|
+
devicesTitle: string;
|
|
2484
|
+
devicesDescription: string;
|
|
2485
|
+
devicesEmpty: string;
|
|
2486
|
+
devicesLoadFailed: string;
|
|
2487
|
+
deviceCurrent: string;
|
|
2488
|
+
deviceTrusted: string;
|
|
2489
|
+
deviceActiveSessions: string;
|
|
2490
|
+
devicePushEnabled: string;
|
|
2491
|
+
deviceLastActive: string;
|
|
2492
|
+
deviceRename: string;
|
|
2493
|
+
deviceRenamePlaceholder: string;
|
|
2494
|
+
deviceRenameFailed: string;
|
|
2495
|
+
deviceSave: string;
|
|
2496
|
+
deviceCancel: string;
|
|
2497
|
+
deviceSignOut: string;
|
|
2498
|
+
deviceSignOutFailed: string;
|
|
2499
|
+
deviceForget: string;
|
|
2500
|
+
deviceForgetFailed: string;
|
|
2501
|
+
deviceForgetConfirmTitle: string;
|
|
2502
|
+
deviceForgetConfirmBody: string;
|
|
2503
|
+
sessionsTitle: string;
|
|
2504
|
+
sessionsDescription: string;
|
|
2505
|
+
sessionsEmpty: string;
|
|
2506
|
+
sessionsLoadFailed: string;
|
|
2507
|
+
sessionCurrent: string;
|
|
2508
|
+
sessionExpires: string;
|
|
2509
|
+
sessionLastActive: string;
|
|
2510
|
+
sessionSignOut: string;
|
|
2511
|
+
sessionSignOutFailed: string;
|
|
2296
2512
|
};
|
|
2297
2513
|
settings: {
|
|
2298
2514
|
titles: {
|
|
2299
2515
|
profile: string;
|
|
2300
2516
|
security: string;
|
|
2517
|
+
devices: string;
|
|
2301
2518
|
general: string;
|
|
2302
2519
|
users: string;
|
|
2303
2520
|
subscription: string;
|
|
@@ -2313,6 +2530,7 @@ interface SDKMessages {
|
|
|
2313
2530
|
workspace: string;
|
|
2314
2531
|
profile: string;
|
|
2315
2532
|
security: string;
|
|
2533
|
+
devices: string;
|
|
2316
2534
|
general: string;
|
|
2317
2535
|
users: string;
|
|
2318
2536
|
subscription: string;
|
|
@@ -2343,6 +2561,7 @@ interface SDKMessages {
|
|
|
2343
2561
|
billingManageOnly: string;
|
|
2344
2562
|
openSettings: string;
|
|
2345
2563
|
back: string;
|
|
2564
|
+
close: string;
|
|
2346
2565
|
};
|
|
2347
2566
|
};
|
|
2348
2567
|
subscription: {
|
|
@@ -2629,6 +2848,7 @@ interface SDKMessages {
|
|
|
2629
2848
|
featureSuccess: string;
|
|
2630
2849
|
updateSuccess: string;
|
|
2631
2850
|
actionStatus: string;
|
|
2851
|
+
fallbackName: string;
|
|
2632
2852
|
};
|
|
2633
2853
|
danger: {
|
|
2634
2854
|
title: string;
|
|
@@ -2849,6 +3069,7 @@ interface SDKMessages {
|
|
|
2849
3069
|
purchaseFailed: string;
|
|
2850
3070
|
errorLoading: string;
|
|
2851
3071
|
insufficientCredits: string;
|
|
3072
|
+
insufficientDetail: string;
|
|
2852
3073
|
};
|
|
2853
3074
|
loading: {
|
|
2854
3075
|
restoringSession: string;
|
|
@@ -2884,6 +3105,7 @@ interface SDKMessages {
|
|
|
2884
3105
|
fetchCreditPackages: string;
|
|
2885
3106
|
fetchCreditTransactions: string;
|
|
2886
3107
|
fetchExpiringCredits: string;
|
|
3108
|
+
fetchWorkspaces: string;
|
|
2887
3109
|
};
|
|
2888
3110
|
}
|
|
2889
3111
|
/** Supported locale codes */
|
|
@@ -2954,6 +3176,88 @@ interface FullScreenLoaderContextValue {
|
|
|
2954
3176
|
*/
|
|
2955
3177
|
declare function useFullScreenLoader(): FullScreenLoaderContextValue;
|
|
2956
3178
|
|
|
3179
|
+
/**
|
|
3180
|
+
* Setup steps for one app/tool a person can connect to the server, shown as an
|
|
3181
|
+
* expandable row in the connect guide. In `instructions` and `snippet` you can
|
|
3182
|
+
* use these placeholders, filled in at render time:
|
|
3183
|
+
* `{{url}}` (server address), `{{name}}` (display name), `{{key}}` (a short
|
|
3184
|
+
* safe id used as the key inside config files).
|
|
3185
|
+
*/
|
|
3186
|
+
interface McpClientGuide {
|
|
3187
|
+
/** Stable identifier (React key). */
|
|
3188
|
+
id: string;
|
|
3189
|
+
/** Display name shown on the row, e.g. `"Cursor"`. Not translated (proper noun). */
|
|
3190
|
+
name: string;
|
|
3191
|
+
/** Plain-language steps shown above the snippet (what to click / where to paste). */
|
|
3192
|
+
instructions?: string;
|
|
3193
|
+
/** A config snippet the person copies and pastes. Usually JSON. */
|
|
3194
|
+
snippet?: string;
|
|
3195
|
+
/** Optional button link (e.g. a one-click install deep link). */
|
|
3196
|
+
actionUrl?: string;
|
|
3197
|
+
/** Label for {@link actionUrl}. */
|
|
3198
|
+
actionLabel?: string;
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* MCP connection info passed to `SaaSOSProvider` via the `mcp` prop. Drives the
|
|
3202
|
+
* "Connect an agent" guide on the Connected Agents screen. The guide only
|
|
3203
|
+
* renders when `url` is set.
|
|
3204
|
+
*
|
|
3205
|
+
* @example
|
|
3206
|
+
* ```tsx
|
|
3207
|
+
* <SaaSOSProvider
|
|
3208
|
+
* mcp={{
|
|
3209
|
+
* url: 'https://app.example.com/api/mcp',
|
|
3210
|
+
* name: 'Acme',
|
|
3211
|
+
* docsUrl: 'https://docs.example.com/agents',
|
|
3212
|
+
* }}
|
|
3213
|
+
* >
|
|
3214
|
+
* ```
|
|
3215
|
+
*/
|
|
3216
|
+
interface McpConnectionConfig {
|
|
3217
|
+
/** MCP server endpoint URL. Required — the guide renders only when set. */
|
|
3218
|
+
url: string;
|
|
3219
|
+
/** Friendly server name used in prose and snippets. Defaults to `'app'`. */
|
|
3220
|
+
name?: string;
|
|
3221
|
+
/** "Learn more" docs link shown at the bottom of the guide. */
|
|
3222
|
+
docsUrl?: string;
|
|
3223
|
+
/**
|
|
3224
|
+
* The app/tool setup rows. When omitted, a translated built-in set covering
|
|
3225
|
+
* the major AI apps (ChatGPT, Claude, Cursor, VS Code, Windsurf, Cline) is
|
|
3226
|
+
* used. Provide your own to override or extend.
|
|
3227
|
+
*/
|
|
3228
|
+
clients?: McpClientGuide[];
|
|
3229
|
+
/**
|
|
3230
|
+
* The copy-and-paste prompt shown for chat-style AIs ("paste this to connect").
|
|
3231
|
+
* Defaults to a translated sentence; pass a string to customize (supports
|
|
3232
|
+
* `{{url}}`/`{{name}}`), or `false` (or an empty string) to hide the prompt
|
|
3233
|
+
* block entirely.
|
|
3234
|
+
*/
|
|
3235
|
+
prompt?: string | false;
|
|
3236
|
+
}
|
|
3237
|
+
/**
|
|
3238
|
+
* Fill `{{url}}` / `{{name}}` / `{{key}}` (and any extra vars) placeholders in a
|
|
3239
|
+
* guide template. Single pass, so a value that itself contains `{{…}}` text is
|
|
3240
|
+
* never re-substituted; unknown placeholders are left untouched.
|
|
3241
|
+
*
|
|
3242
|
+
* Values are inserted **verbatim** — when a template is JSON (a client
|
|
3243
|
+
* `snippet`), pass values that are already valid inside a JSON string (the
|
|
3244
|
+
* built-in snippets only interpolate the URL and the JSON-safe {@link mcpServerKey}).
|
|
3245
|
+
*/
|
|
3246
|
+
declare function fillMcpTemplate(template: string | undefined, vars: Record<string, string>): string | undefined;
|
|
3247
|
+
/**
|
|
3248
|
+
* A short, file-safe id derived from a display name — used as the `{{key}}`
|
|
3249
|
+
* (the JSON key inside config-file snippets). Always `[a-z0-9-]+`, so it is
|
|
3250
|
+
* safe to drop into JSON unescaped; falls back to `'app'` when the name has no
|
|
3251
|
+
* ASCII alphanumerics (e.g. a non-Latin name).
|
|
3252
|
+
*/
|
|
3253
|
+
declare function mcpServerKey(name: string): string;
|
|
3254
|
+
/**
|
|
3255
|
+
* The MCP connection config passed to `SaaSOSProvider`, or `null` when none was
|
|
3256
|
+
* provided. Use it to build a custom connect guide; the ready-made UI is
|
|
3257
|
+
* `<ConnectMcpGuide />` (and it's embedded in `<ConnectedAgents />`).
|
|
3258
|
+
*/
|
|
3259
|
+
declare function useMcpConnection(): McpConnectionConfig | null;
|
|
3260
|
+
|
|
2957
3261
|
/**
|
|
2958
3262
|
* Settings screen identifiers — kept in a leaf module (no component imports)
|
|
2959
3263
|
* so consumers of `SettingsScreen` don't pull the whole settings dialog
|
|
@@ -2962,6 +3266,7 @@ declare function useFullScreenLoader(): FullScreenLoaderContextValue;
|
|
|
2962
3266
|
declare const SettingsScreen: {
|
|
2963
3267
|
readonly Profile: "profile";
|
|
2964
3268
|
readonly Security: "security";
|
|
3269
|
+
readonly Devices: "devices";
|
|
2965
3270
|
readonly ConnectedAgents: "connected-agents";
|
|
2966
3271
|
readonly General: "general";
|
|
2967
3272
|
readonly Users: "users";
|
|
@@ -3010,6 +3315,19 @@ interface SDKUIConfig {
|
|
|
3010
3315
|
passkeyRename?: boolean;
|
|
3011
3316
|
passkeyDelete?: boolean;
|
|
3012
3317
|
};
|
|
3318
|
+
/** Devices & sessions screen — hide row actions and the sessions block. */
|
|
3319
|
+
devices?: {
|
|
3320
|
+
/** Rename a device. */
|
|
3321
|
+
rename?: boolean;
|
|
3322
|
+
/** Sign a device out (revoke its live sessions). */
|
|
3323
|
+
signOut?: boolean;
|
|
3324
|
+
/** Remove ("forget") a device. */
|
|
3325
|
+
forget?: boolean;
|
|
3326
|
+
/** The active-sessions list shown below the devices. */
|
|
3327
|
+
sessions?: boolean;
|
|
3328
|
+
/** Sign out an individual session (per-row action in the sessions list). */
|
|
3329
|
+
sessionSignOut?: boolean;
|
|
3330
|
+
};
|
|
3013
3331
|
/** General screen — hide workspace editing affordances. */
|
|
3014
3332
|
general?: {
|
|
3015
3333
|
nameEdit?: boolean;
|
|
@@ -3227,6 +3545,23 @@ interface SaaSOSProviderProps extends IOsState {
|
|
|
3227
3545
|
* ```
|
|
3228
3546
|
*/
|
|
3229
3547
|
ui?: SDKUIConfig;
|
|
3548
|
+
/**
|
|
3549
|
+
* MCP server connection info. When set, the Connected Agents screen shows a
|
|
3550
|
+
* "How to connect an agent" guide (copyable server URL + per-client setup
|
|
3551
|
+
* snippets). Read anywhere via `useMcpConnection()`.
|
|
3552
|
+
*
|
|
3553
|
+
* @example
|
|
3554
|
+
* ```tsx
|
|
3555
|
+
* <SaaSOSProvider
|
|
3556
|
+
* mcp={{
|
|
3557
|
+
* url: 'https://app.example.com/api/mcp',
|
|
3558
|
+
* name: 'Acme',
|
|
3559
|
+
* docsUrl: 'https://docs.example.com/agents',
|
|
3560
|
+
* }}
|
|
3561
|
+
* >
|
|
3562
|
+
* ```
|
|
3563
|
+
*/
|
|
3564
|
+
mcp?: McpConnectionConfig;
|
|
3230
3565
|
}
|
|
3231
3566
|
declare const SaaSOSProvider: React__default.FC<SaaSOSProviderProps>;
|
|
3232
3567
|
|
|
@@ -3517,16 +3852,158 @@ interface ConnectedAgentsProps {
|
|
|
3517
3852
|
disconnectLabel?: string;
|
|
3518
3853
|
/** Text shown when the user has no connected agents. Defaults to the translated label. */
|
|
3519
3854
|
emptyLabel?: string;
|
|
3855
|
+
/**
|
|
3856
|
+
* Show the "Connect an agent" action (a header button + empty-state CTA that
|
|
3857
|
+
* open the setup guide in a dialog). Defaults to `true` when an `mcp` config
|
|
3858
|
+
* is passed to `SaaSOSProvider`; set `false` to hide it even when configured.
|
|
3859
|
+
*/
|
|
3860
|
+
showConnectGuide?: boolean;
|
|
3520
3861
|
}
|
|
3521
3862
|
/**
|
|
3522
3863
|
* A ready-made "Connected agents" screen: lists the AI agents the signed-in user
|
|
3523
|
-
* has authorized to access their account, with a per-row Disconnect action.
|
|
3524
|
-
*
|
|
3525
|
-
*
|
|
3864
|
+
* has authorized to access their account, with a per-row Disconnect action. When
|
|
3865
|
+
* an `mcp` config is set on `SaaSOSProvider`, a "Connect an agent" button (header
|
|
3866
|
+
* + empty state) opens a setup-guide dialog. Session-authed and scoped to the
|
|
3867
|
+
* current user — no config beyond having the app wrapped in <SaaSOSProvider>.
|
|
3868
|
+
*
|
|
3869
|
+
* As a workspace settings screen, open it programmatically with
|
|
3870
|
+
* `openWorkspaceSettings('connected-agents')`; add `{ action: 'openConnectGuide' }`
|
|
3871
|
+
* (or `?bb=action:openConnectGuide`) to land straight on the setup dialog.
|
|
3872
|
+
*
|
|
3873
|
+
* For a fully custom UI, use the `useConnectedAgents()` hook and `<ConnectMcpGuide />`.
|
|
3874
|
+
*/
|
|
3875
|
+
declare function ConnectedAgents({ className, title, description, disconnectLabel, emptyLabel, showConnectGuide, }: ConnectedAgentsProps): react_jsx_runtime.JSX.Element;
|
|
3876
|
+
|
|
3877
|
+
interface ConnectMcpGuideProps {
|
|
3878
|
+
/**
|
|
3879
|
+
* Connection config. Defaults to the `mcp` prop passed to `SaaSOSProvider`
|
|
3880
|
+
* (via `useMcpConnection()`); pass explicitly to render a guide elsewhere.
|
|
3881
|
+
*/
|
|
3882
|
+
config?: McpConnectionConfig | null;
|
|
3883
|
+
/** Heading. Defaults to the translated title; `null` hides it. */
|
|
3884
|
+
title?: string | null;
|
|
3885
|
+
/** Sub-heading. Defaults to the translated description; `null` hides it. */
|
|
3886
|
+
description?: string | null;
|
|
3887
|
+
className?: string;
|
|
3888
|
+
}
|
|
3889
|
+
/**
|
|
3890
|
+
* A friendly "Connect an agent" guide: the server address, a copy-and-paste
|
|
3891
|
+
* prompt for chat assistants, and step-by-step setup for the major AI apps
|
|
3892
|
+
* (ChatGPT, Claude, Cursor, VS Code, Windsurf, Cline by default; override via
|
|
3893
|
+
* `config.clients`). Renders `null` when no MCP `url` is configured.
|
|
3894
|
+
*
|
|
3895
|
+
* Shown inside `<ConnectedAgents />`; also exported for standalone use.
|
|
3896
|
+
*/
|
|
3897
|
+
declare function ConnectMcpGuide({ config, title, description, className }: ConnectMcpGuideProps): react_jsx_runtime.JSX.Element | null;
|
|
3898
|
+
|
|
3899
|
+
/** Memoized DevicesApi instance. Recreates only when serverUrl/version change. */
|
|
3900
|
+
declare function useDevicesApi(): DevicesApi;
|
|
3901
|
+
|
|
3902
|
+
interface UseDevices {
|
|
3903
|
+
/** The devices the current user has signed in from (most recent first). */
|
|
3904
|
+
devices: IDeviceView[];
|
|
3905
|
+
/** True while the initial list is loading. */
|
|
3906
|
+
loading: boolean;
|
|
3907
|
+
/** Error message from the last list/mutation, if any. */
|
|
3908
|
+
error: string | null;
|
|
3909
|
+
/** The deviceId currently being mutated (rename/sign-out/forget), or null. */
|
|
3910
|
+
busyId: string | null;
|
|
3911
|
+
/** Re-fetch the list. */
|
|
3912
|
+
refresh: () => Promise<void>;
|
|
3913
|
+
/** Rename a device, then update it in place. */
|
|
3914
|
+
rename: (deviceId: string, name: string) => Promise<void>;
|
|
3915
|
+
/** Sign a device out (revoke its sessions); it stays in the list. */
|
|
3916
|
+
signOut: (deviceId: string) => Promise<void>;
|
|
3917
|
+
/** Forget a device: sign it out AND drop it from the list. */
|
|
3918
|
+
forget: (deviceId: string) => Promise<void>;
|
|
3919
|
+
}
|
|
3920
|
+
/**
|
|
3921
|
+
* Headless data + actions for a "Devices" screen. Session-authed and scoped to
|
|
3922
|
+
* the signed-in user. Wrap your UI around it, or use the ready-made
|
|
3923
|
+
* `<Devices />` component.
|
|
3924
|
+
*/
|
|
3925
|
+
declare function useDevices(): UseDevices;
|
|
3926
|
+
|
|
3927
|
+
interface DevicesProps {
|
|
3928
|
+
/** Extra classes for the root element. */
|
|
3929
|
+
className?: string;
|
|
3930
|
+
/** Heading text. Defaults to the translated title; set to null to hide. */
|
|
3931
|
+
title?: string | null;
|
|
3932
|
+
/** Sub-heading under the title. Defaults to the translated description; null to hide. */
|
|
3933
|
+
description?: string | null;
|
|
3934
|
+
/** Show the Rename action. Defaults to the `settings.devices.rename` UI config (visible). */
|
|
3935
|
+
showRename?: boolean;
|
|
3936
|
+
/** Show the Sign out action. Defaults to the `settings.devices.signOut` UI config (visible). */
|
|
3937
|
+
showSignOut?: boolean;
|
|
3938
|
+
/** Show the Remove ("forget") action. Defaults to the `settings.devices.forget` UI config (visible). */
|
|
3939
|
+
showRemove?: boolean;
|
|
3940
|
+
/** Override the Rename button label. */
|
|
3941
|
+
renameLabel?: string;
|
|
3942
|
+
/** Override the Sign out button label. */
|
|
3943
|
+
signOutLabel?: string;
|
|
3944
|
+
/** Override the Remove button label. */
|
|
3945
|
+
removeLabel?: string;
|
|
3946
|
+
/** Text shown when the user has no devices. */
|
|
3947
|
+
emptyLabel?: string;
|
|
3948
|
+
}
|
|
3949
|
+
/**
|
|
3950
|
+
* A ready-made "Devices" screen: lists the devices the signed-in user has
|
|
3951
|
+
* signed in from, with rename, sign-out (revoke a device's sessions) and remove
|
|
3952
|
+
* (also drop the row) actions. The device the request came from is badged
|
|
3953
|
+
* "This device". Session-authed and scoped to the current user — no config
|
|
3954
|
+
* beyond having the app wrapped in <SaaSOSProvider>.
|
|
3526
3955
|
*
|
|
3527
|
-
* For a fully custom UI, use the `
|
|
3956
|
+
* For a fully custom UI, use the `useDevices()` hook.
|
|
3957
|
+
*/
|
|
3958
|
+
declare function Devices({ className, title, description, showRename, showSignOut, showRemove, renameLabel, signOutLabel, removeLabel, emptyLabel, }: DevicesProps): react_jsx_runtime.JSX.Element;
|
|
3959
|
+
|
|
3960
|
+
/** Memoized SessionsApi instance. Recreates only when serverUrl/version change. */
|
|
3961
|
+
declare function useSessionsApi(): SessionsApi;
|
|
3962
|
+
|
|
3963
|
+
interface UseSessions {
|
|
3964
|
+
/** The current user's live sessions. */
|
|
3965
|
+
sessions: ISessionView[];
|
|
3966
|
+
/** True while the initial list is loading. */
|
|
3967
|
+
loading: boolean;
|
|
3968
|
+
/** Error message from the last list/revoke, if any. */
|
|
3969
|
+
error: string | null;
|
|
3970
|
+
/** The session handle currently being revoked, or null. */
|
|
3971
|
+
revoking: string | null;
|
|
3972
|
+
/** Re-fetch the list. */
|
|
3973
|
+
refresh: () => Promise<void>;
|
|
3974
|
+
/** Sign out one session by its public handle, then drop it from the list. */
|
|
3975
|
+
revoke: (id: string) => Promise<void>;
|
|
3976
|
+
}
|
|
3977
|
+
/**
|
|
3978
|
+
* Headless data + actions for an "Active sessions" screen. Session-authed and
|
|
3979
|
+
* scoped to the signed-in user. Wrap your UI around it, or use the ready-made
|
|
3980
|
+
* `<Sessions />` component.
|
|
3528
3981
|
*/
|
|
3529
|
-
declare function
|
|
3982
|
+
declare function useSessions(): UseSessions;
|
|
3983
|
+
|
|
3984
|
+
interface SessionsProps {
|
|
3985
|
+
/** Extra classes for the root element. */
|
|
3986
|
+
className?: string;
|
|
3987
|
+
/** Heading text. Defaults to the translated title; set to null to hide. */
|
|
3988
|
+
title?: string | null;
|
|
3989
|
+
/** Sub-heading under the title. Defaults to the translated description; null to hide. */
|
|
3990
|
+
description?: string | null;
|
|
3991
|
+
/** Show the per-session Sign out action. Defaults to the `settings.devices.sessionSignOut` UI config (visible). */
|
|
3992
|
+
showSignOut?: boolean;
|
|
3993
|
+
/** Override the Sign out button label. */
|
|
3994
|
+
signOutLabel?: string;
|
|
3995
|
+
/** Text shown when there are no active sessions. */
|
|
3996
|
+
emptyLabel?: string;
|
|
3997
|
+
}
|
|
3998
|
+
/**
|
|
3999
|
+
* A ready-made "Active sessions" screen: lists the signed-in user's live
|
|
4000
|
+
* sessions and lets them sign out any that isn't the current one. Session-authed
|
|
4001
|
+
* and scoped to the current user — no config beyond having the app wrapped in
|
|
4002
|
+
* <SaaSOSProvider>.
|
|
4003
|
+
*
|
|
4004
|
+
* For a fully custom UI, use the `useSessions()` hook.
|
|
4005
|
+
*/
|
|
4006
|
+
declare function Sessions({ className, title, description, showSignOut, signOutLabel, emptyLabel, }: SessionsProps): react_jsx_runtime.JSX.Element;
|
|
3530
4007
|
|
|
3531
4008
|
interface IProps {
|
|
3532
4009
|
slug: string;
|
|
@@ -3618,9 +4095,9 @@ declare const WhenWorkspaceFeatureDisabled: {
|
|
|
3618
4095
|
* ```tsx
|
|
3619
4096
|
* // Edge case: Feature not loaded yet
|
|
3620
4097
|
* function FeatureContent() {
|
|
3621
|
-
* const {
|
|
4098
|
+
* const { loading } = useUserFeatures();
|
|
3622
4099
|
*
|
|
3623
|
-
* if (
|
|
4100
|
+
* if (loading) return <Loading />;
|
|
3624
4101
|
*
|
|
3625
4102
|
* return (
|
|
3626
4103
|
* <WhenUserFeatureEnabled slug="feature-x">
|
|
@@ -4029,7 +4506,7 @@ interface CreditActionsProviderProps {
|
|
|
4029
4506
|
*
|
|
4030
4507
|
* {packages.map(pkg => (
|
|
4031
4508
|
* <button key={pkg._id} onClick={() => purchase(pkg)} disabled={purchasing}>
|
|
4032
|
-
* Buy {pkg.creditAmount} for
|
|
4509
|
+
* Buy {pkg.creditAmount} for {formatCents(pkg.pricingVariants[0]?.amount ?? 0, pkg.pricingVariants[0]?.currency ?? 'usd')}
|
|
4033
4510
|
* </button>
|
|
4034
4511
|
* ))}
|
|
4035
4512
|
* </div>
|
|
@@ -4145,7 +4622,7 @@ interface CreditStorePageProps {
|
|
|
4145
4622
|
* <div key={pkg._id}>
|
|
4146
4623
|
* <h3>{pkg.name}</h3>
|
|
4147
4624
|
* <p>{pkg.creditAmount} credits</p>
|
|
4148
|
-
* <p
|
|
4625
|
+
* <p>{formatCents(pkg.pricingVariants[0]?.amount ?? 0, pkg.pricingVariants[0]?.currency ?? 'usd')}</p>
|
|
4149
4626
|
* <button onClick={() => selectPackage(pkg._id)}>Buy</button>
|
|
4150
4627
|
* </div>
|
|
4151
4628
|
* ))}
|
|
@@ -4359,51 +4836,40 @@ declare function useSaaSOs(): IOsState;
|
|
|
4359
4836
|
* Hook to access organization settings from the OS context.
|
|
4360
4837
|
* Automatically fetches settings once when OS config is ready.
|
|
4361
4838
|
* Safe to call from multiple components — only one fetch is made.
|
|
4839
|
+
*
|
|
4840
|
+
* @returns `{ settings, loading, error, refetch }` — `loading` is true from
|
|
4841
|
+
* mount until the one-time fetch settles (so UI can wait instead of guessing
|
|
4842
|
+
* with `?? true` defaults); `error` carries the failure message; `refetch`
|
|
4843
|
+
* re-runs the fetch (deduped across components).
|
|
4362
4844
|
*/
|
|
4363
4845
|
declare function useSaaSSettings(): {
|
|
4364
4846
|
settings: ISettings | null | undefined;
|
|
4847
|
+
loading: boolean;
|
|
4848
|
+
error: string | null;
|
|
4849
|
+
refetch: (_signal?: AbortSignal) => Promise<ISettings | null>;
|
|
4365
4850
|
getSettings: (_signal?: AbortSignal) => Promise<ISettings | null>;
|
|
4366
4851
|
};
|
|
4367
4852
|
|
|
4368
|
-
interface UserContextValue {
|
|
4369
|
-
attributes: Record<string, string | number | boolean>;
|
|
4370
|
-
features: Record<string, boolean>;
|
|
4371
|
-
/** True while EITHER pipeline is loading. Prefer the per-resource flags. */
|
|
4372
|
-
isLoading: boolean;
|
|
4373
|
-
/** The first per-resource error, attributes first. Prefer the per-resource errors. */
|
|
4374
|
-
error: Error | null;
|
|
4375
|
-
/** True while attributes are loading (independent of features). */
|
|
4376
|
-
attributesLoading: boolean;
|
|
4377
|
-
/** True while features are loading (independent of attributes). */
|
|
4378
|
-
featuresLoading: boolean;
|
|
4379
|
-
/** Last attributes fetch/update error; cleared when a new attributes request starts. */
|
|
4380
|
-
attributesError: Error | null;
|
|
4381
|
-
/** Last features fetch error; cleared when a new features request starts. */
|
|
4382
|
-
featuresError: Error | null;
|
|
4383
|
-
updateAttributes: (updates: Record<string, string | number | boolean>) => Promise<IUser>;
|
|
4384
|
-
updateAttribute: (attributeKey: string, value: string | number | boolean) => Promise<IUser>;
|
|
4385
|
-
refreshAttributes: () => Promise<void>;
|
|
4386
|
-
refreshFeatures: () => Promise<void>;
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
4853
|
/**
|
|
4390
4854
|
* Hook to access user attributes from the UserProvider.
|
|
4391
4855
|
* Must be used within a UserProvider component.
|
|
4392
4856
|
*
|
|
4393
|
-
* @returns
|
|
4857
|
+
* @returns An object containing:
|
|
4394
4858
|
* - `attributes`: Record of user attribute key-value pairs
|
|
4395
|
-
* - `
|
|
4396
|
-
* - `error`:
|
|
4397
|
-
* - `
|
|
4859
|
+
* - `loading`: Boolean indicating if attributes are being loaded (attributes pipeline only)
|
|
4860
|
+
* - `error`: Last attributes fetch/update error (null if no error)
|
|
4861
|
+
* - `refetch()`: Function to manually refresh attributes
|
|
4862
|
+
* - `updateAttributes(updates)`: Function to update multiple attributes
|
|
4863
|
+
* - `updateAttribute(key, value)`: Function to update one attribute
|
|
4398
4864
|
*
|
|
4399
4865
|
* @throws {Error} If used outside of UserProvider
|
|
4400
4866
|
*
|
|
4401
4867
|
* @example
|
|
4402
4868
|
* ```tsx
|
|
4403
4869
|
* function UserProfile() {
|
|
4404
|
-
* const { attributes,
|
|
4870
|
+
* const { attributes, loading } = useUserAttributes();
|
|
4405
4871
|
*
|
|
4406
|
-
* if (
|
|
4872
|
+
* if (loading) return <Loading />;
|
|
4407
4873
|
*
|
|
4408
4874
|
* return (
|
|
4409
4875
|
* <div>
|
|
@@ -4414,16 +4880,27 @@ interface UserContextValue {
|
|
|
4414
4880
|
* }
|
|
4415
4881
|
* ```
|
|
4416
4882
|
*/
|
|
4417
|
-
declare function useUserAttributes():
|
|
4883
|
+
declare function useUserAttributes(): {
|
|
4884
|
+
attributes: Record<string, string | number | boolean>;
|
|
4885
|
+
loading: boolean;
|
|
4886
|
+
error: Error | null;
|
|
4887
|
+
refetch: () => Promise<void>;
|
|
4888
|
+
updateAttributes: (updates: Record<string, string | number | boolean>) => Promise<IUser>;
|
|
4889
|
+
updateAttribute: (attributeKey: string, value: string | number | boolean) => Promise<IUser>;
|
|
4890
|
+
/** @deprecated Use `loading` (note: this legacy flag combines BOTH pipelines). */
|
|
4891
|
+
isLoading: boolean;
|
|
4892
|
+
/** @deprecated Use `refetch`. */
|
|
4893
|
+
refreshAttributes: () => Promise<void>;
|
|
4894
|
+
};
|
|
4418
4895
|
/**
|
|
4419
4896
|
* Hook to access user feature flags from the UserProvider.
|
|
4420
4897
|
* Must be used within a UserProvider component.
|
|
4421
4898
|
*
|
|
4422
4899
|
* @returns An object containing:
|
|
4423
4900
|
* - `features`: Record of feature flag key-value pairs (boolean values)
|
|
4424
|
-
* - `
|
|
4425
|
-
* - `error`:
|
|
4426
|
-
* - `
|
|
4901
|
+
* - `loading`: Boolean indicating if features are being loaded (features pipeline only)
|
|
4902
|
+
* - `error`: Last features fetch error (null if no error)
|
|
4903
|
+
* - `refetch()`: Function to manually refresh features
|
|
4427
4904
|
* - `isFeatureEnabled(featureId)`: Function to check if a specific feature is enabled
|
|
4428
4905
|
*
|
|
4429
4906
|
* @throws {Error} If used outside of UserProvider
|
|
@@ -4431,9 +4908,9 @@ declare function useUserAttributes(): UserContextValue;
|
|
|
4431
4908
|
* @example
|
|
4432
4909
|
* ```tsx
|
|
4433
4910
|
* function FeatureContent() {
|
|
4434
|
-
* const { isFeatureEnabled,
|
|
4911
|
+
* const { isFeatureEnabled, loading } = useUserFeatures();
|
|
4435
4912
|
*
|
|
4436
|
-
* if (
|
|
4913
|
+
* if (loading) return <Loading />;
|
|
4437
4914
|
*
|
|
4438
4915
|
* if (isFeatureEnabled('premium-feature')) {
|
|
4439
4916
|
* return <PremiumFeature />;
|
|
@@ -4460,20 +4937,130 @@ declare function useUserAttributes(): UserContextValue;
|
|
|
4460
4937
|
*/
|
|
4461
4938
|
declare function useUserFeatures(): {
|
|
4462
4939
|
features: Record<string, boolean>;
|
|
4463
|
-
|
|
4940
|
+
loading: boolean;
|
|
4464
4941
|
error: Error | null;
|
|
4465
|
-
|
|
4942
|
+
refetch: () => Promise<void>;
|
|
4466
4943
|
isFeatureEnabled: (featureId: string) => boolean;
|
|
4944
|
+
/** @deprecated Use `loading`. */
|
|
4945
|
+
isLoading: boolean;
|
|
4946
|
+
/** @deprecated Use `refetch`. */
|
|
4947
|
+
refreshFeatures: () => Promise<void>;
|
|
4467
4948
|
};
|
|
4468
4949
|
|
|
4950
|
+
/**
|
|
4951
|
+
* Main workspace management hook for the SDK.
|
|
4952
|
+
* Provides workspace state, CRUD operations, and user management.
|
|
4953
|
+
*
|
|
4954
|
+
* State selection is per-consumer; the lifecycle (fetch dedup, storage
|
|
4955
|
+
* restore, switch versioning, current-workspace sync) lives in the single
|
|
4956
|
+
* `WorkspaceProvider` instance mounted by `SaaSOSProvider`, so
|
|
4957
|
+
* `onWorkspaceChange` / `workspace:changed` fire exactly once per switch no
|
|
4958
|
+
* matter how many components use this hook.
|
|
4959
|
+
*
|
|
4960
|
+
* @returns An object containing:
|
|
4961
|
+
* - `workspaces`: Array of all workspaces the user has access to
|
|
4962
|
+
* - `currentWorkspace`: Currently selected workspace (null if none selected)
|
|
4963
|
+
* - `loading`: Boolean indicating if workspaces are being fetched
|
|
4964
|
+
* - `error`: Error message string (null if no error)
|
|
4965
|
+
* - `refreshing`: Boolean indicating if workspaces are being refreshed in background
|
|
4966
|
+
* - `switching`: Boolean - true when a workspace switch is in progress
|
|
4967
|
+
* - `fetchWorkspaces()`: Function to fetch all workspaces
|
|
4968
|
+
* - `refreshWorkspaces()`: Function to refresh workspaces in background (non-blocking)
|
|
4969
|
+
* - `setCurrentWorkspace(workspace)`: Function to set the current workspace (direct, no callback)
|
|
4970
|
+
* - `switchToWorkspace(workspace)`: Centralized switch - calls onWorkspaceChange first, then sets workspace
|
|
4971
|
+
* - `resetCurrentWorkspace()`: Function to clear the current workspace
|
|
4972
|
+
* - `createWorkspace(name, image?)`: Function to create a new workspace
|
|
4973
|
+
* - `updateWorkspace(workspace, data)`: Function to update a workspace
|
|
4974
|
+
* - `deleteWorkspace(workspaceId)`: Function to delete a workspace (owner only)
|
|
4975
|
+
* - `getWorkspace(workspaceId)`: Function to fetch a specific workspace
|
|
4976
|
+
* - `getUsers(workspaceId)`: Function to fetch users in a workspace
|
|
4977
|
+
* - `addUser(workspaceId, email, role)`: Function to add a user to a workspace
|
|
4978
|
+
* - `removeUser(workspaceId, userId)`: Function to remove a user from a workspace
|
|
4979
|
+
* - `updateUser(workspaceId, userId, config)`: Function to update a user in a workspace
|
|
4980
|
+
* - `getProfile()`: Function to fetch current user profile
|
|
4981
|
+
* - `updateUserProfile(config)`: Function to update current user profile
|
|
4982
|
+
* - `allFeatures`: Array of all available feature flags
|
|
4983
|
+
* - `getFeatures()`: Function to fetch all available features
|
|
4984
|
+
* - `updateFeature(workspaceId, key, value)`: Function to update a feature flag
|
|
4985
|
+
*
|
|
4986
|
+
* @example
|
|
4987
|
+
* ```tsx
|
|
4988
|
+
* function WorkspaceList() {
|
|
4989
|
+
* const { workspaces, loading, fetchWorkspaces } = useSaaSWorkspaces();
|
|
4990
|
+
*
|
|
4991
|
+
* useEffect(() => {
|
|
4992
|
+
* fetchWorkspaces();
|
|
4993
|
+
* }, [fetchWorkspaces]);
|
|
4994
|
+
*
|
|
4995
|
+
* if (loading) return <Loading />;
|
|
4996
|
+
*
|
|
4997
|
+
* return (
|
|
4998
|
+
* <ul>
|
|
4999
|
+
* {workspaces.map(ws => (
|
|
5000
|
+
* <li key={ws._id}>{ws.name}</li>
|
|
5001
|
+
* ))}
|
|
5002
|
+
* </ul>
|
|
5003
|
+
* );
|
|
5004
|
+
* }
|
|
5005
|
+
* ```
|
|
5006
|
+
*
|
|
5007
|
+
* @example
|
|
5008
|
+
* ```tsx
|
|
5009
|
+
* // Create a new workspace
|
|
5010
|
+
* function CreateWorkspace() {
|
|
5011
|
+
* const { createWorkspace } = useSaaSWorkspaces();
|
|
5012
|
+
*
|
|
5013
|
+
* const handleCreate = async () => {
|
|
5014
|
+
* try {
|
|
5015
|
+
* await createWorkspace('My Workspace', 'https://example.com/logo.png');
|
|
5016
|
+
* } catch (error) {
|
|
5017
|
+
* console.error('Failed to create workspace:', error);
|
|
5018
|
+
* }
|
|
5019
|
+
* };
|
|
5020
|
+
*
|
|
5021
|
+
* return <button onClick={handleCreate}>Create Workspace</button>;
|
|
5022
|
+
* }
|
|
5023
|
+
* ```
|
|
5024
|
+
*
|
|
5025
|
+
* @example
|
|
5026
|
+
* ```tsx
|
|
5027
|
+
* // Delete workspace (owner only)
|
|
5028
|
+
* function DeleteWorkspaceButton({ workspaceId }) {
|
|
5029
|
+
* const { deleteWorkspace } = useSaaSWorkspaces();
|
|
5030
|
+
*
|
|
5031
|
+
* const handleDelete = async () => {
|
|
5032
|
+
* if (!confirm('Are you sure?')) return;
|
|
5033
|
+
* try {
|
|
5034
|
+
* await deleteWorkspace(workspaceId);
|
|
5035
|
+
* } catch (error) {
|
|
5036
|
+
* // Error: "Only the workspace creator can delete the workspace"
|
|
5037
|
+
* alert(error.message);
|
|
5038
|
+
* }
|
|
5039
|
+
* };
|
|
5040
|
+
*
|
|
5041
|
+
* return <button onClick={handleDelete}>Delete</button>;
|
|
5042
|
+
* }
|
|
5043
|
+
* ```
|
|
5044
|
+
*
|
|
5045
|
+
* @example
|
|
5046
|
+
* ```tsx
|
|
5047
|
+
* // Edge case: Workspace removed from user's access
|
|
5048
|
+
* function WorkspaceContent() {
|
|
5049
|
+
* const { currentWorkspace, workspaces } = useSaaSWorkspaces();
|
|
5050
|
+
*
|
|
5051
|
+
* // If current workspace is not in the list, it was removed
|
|
5052
|
+
* // The hook automatically switches to first available workspace
|
|
5053
|
+
* if (!currentWorkspace) {
|
|
5054
|
+
* return <p>No workspace selected</p>;
|
|
5055
|
+
* }
|
|
5056
|
+
*
|
|
5057
|
+
* return <div>{currentWorkspace.name}</div>;
|
|
5058
|
+
* }
|
|
5059
|
+
* ```
|
|
5060
|
+
*/
|
|
4469
5061
|
declare const useSaaSWorkspaces: () => {
|
|
4470
|
-
workspaces: IWorkspace[];
|
|
4471
|
-
loading: boolean;
|
|
4472
|
-
error: string | null;
|
|
4473
5062
|
fetchWorkspaces: () => Promise<void>;
|
|
4474
5063
|
refreshWorkspaces: () => Promise<void>;
|
|
4475
|
-
refreshing: boolean;
|
|
4476
|
-
currentWorkspace: IWorkspace | null;
|
|
4477
5064
|
setCurrentWorkspace: (ws: IWorkspace, options?: {
|
|
4478
5065
|
forceEmit?: boolean;
|
|
4479
5066
|
}) => void;
|
|
@@ -4482,25 +5069,15 @@ declare const useSaaSWorkspaces: () => {
|
|
|
4482
5069
|
}) => Promise<void>;
|
|
4483
5070
|
resetCurrentWorkspace: () => void;
|
|
4484
5071
|
createWorkspace: (name: string, image?: string) => Promise<void>;
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
updateFeature: (workspaceId: string, key: string, value: boolean) => Promise<IWorkspace>;
|
|
4488
|
-
updateWorkspaceSettings: (data: {
|
|
4489
|
-
permissions: Record<string, string[]>;
|
|
4490
|
-
}) => Promise<any>;
|
|
4491
|
-
updateWorkspacePermissions: (workspaceId: string, permissions: Record<string, string[]>) => Promise<any>;
|
|
5072
|
+
updateWorkspace: (ws: IWorkspace, data: Partial<IWorkspace>) => Promise<void>;
|
|
5073
|
+
deleteWorkspace: (workspaceId: string) => Promise<unknown>;
|
|
4492
5074
|
getWorkspace: (workspaceId: string) => Promise<IWorkspace>;
|
|
4493
|
-
updateWorkspace: (ws: IWorkspace, _data: Partial<IWorkspace>) => Promise<void>;
|
|
4494
5075
|
getUsers: (workspaceId: string) => Promise<IWorkspaceUser[]>;
|
|
4495
5076
|
addUser: (workspaceId: string, email: string, role: string) => Promise<{
|
|
4496
5077
|
userId: string;
|
|
4497
|
-
workspace: IWorkspace;
|
|
4498
|
-
message: string;
|
|
4499
5078
|
}>;
|
|
4500
5079
|
removeUser: (workspaceId: string, userId: string) => Promise<{
|
|
4501
5080
|
userId: string;
|
|
4502
|
-
workspace: IWorkspace;
|
|
4503
|
-
message: string;
|
|
4504
5081
|
}>;
|
|
4505
5082
|
updateUser: (workspaceId: string, userId: string, config: Partial<IWorkspaceUser>) => Promise<{
|
|
4506
5083
|
userId: string;
|
|
@@ -4509,9 +5086,18 @@ declare const useSaaSWorkspaces: () => {
|
|
|
4509
5086
|
}>;
|
|
4510
5087
|
getProfile: () => Promise<IUser>;
|
|
4511
5088
|
updateUserProfile: (config: Partial<IUser>) => Promise<IUser>;
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
5089
|
+
getFeatures: () => Promise<IWorkspaceFeature[] | null>;
|
|
5090
|
+
updateFeature: (workspaceId: string, key: string, value: boolean) => Promise<IWorkspace>;
|
|
5091
|
+
updateWorkspaceSettings: (data: {
|
|
5092
|
+
permissions: Record<string, string[]>;
|
|
5093
|
+
}) => Promise<unknown>;
|
|
5094
|
+
updateWorkspacePermissions: (workspaceId: string, permissions: Record<string, string[]>) => Promise<unknown>;
|
|
5095
|
+
workspaces: IWorkspace[];
|
|
5096
|
+
loading: boolean;
|
|
5097
|
+
error: string | null;
|
|
5098
|
+
refreshing: boolean;
|
|
5099
|
+
currentWorkspace: IWorkspace | null;
|
|
5100
|
+
allFeatures: IWorkspaceFeature[];
|
|
4515
5101
|
switching: boolean;
|
|
4516
5102
|
switchingToId: string | null;
|
|
4517
5103
|
};
|
|
@@ -5702,7 +6288,7 @@ declare function EmptyState({ icon, title, description, action, className }: Emp
|
|
|
5702
6288
|
interface FullScreenLoaderProps {
|
|
5703
6289
|
/** Content to display centered on screen. Falls back to a default spinner + message. */
|
|
5704
6290
|
children?: React__default.ReactNode;
|
|
5705
|
-
/** Message shown below the default spinner (only used when no children are provided). Defaults to "Loading..." */
|
|
6291
|
+
/** Message shown below the default spinner (only used when no children are provided). Defaults to the translated "Loading..." */
|
|
5706
6292
|
message?: string;
|
|
5707
6293
|
/** Background color of the overlay. Defaults to white (dark mode: near-black). */
|
|
5708
6294
|
backgroundColor?: string;
|
|
@@ -5726,7 +6312,7 @@ interface FullScreenLoaderProps {
|
|
|
5726
6312
|
* ```
|
|
5727
6313
|
*/
|
|
5728
6314
|
declare const FullScreenLoader: {
|
|
5729
|
-
({ children, message, backgroundColor, }: FullScreenLoaderProps): react_jsx_runtime.JSX.Element;
|
|
6315
|
+
({ children, message: messageProp, backgroundColor, }: FullScreenLoaderProps): react_jsx_runtime.JSX.Element;
|
|
5730
6316
|
displayName: string;
|
|
5731
6317
|
};
|
|
5732
6318
|
|
|
@@ -5915,5 +6501,5 @@ declare class WorkspaceSettingsManager {
|
|
|
5915
6501
|
}
|
|
5916
6502
|
declare const workspaceSettingsManager: WorkspaceSettingsManager;
|
|
5917
6503
|
|
|
5918
|
-
export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, CURRENCY_DISPLAY, CURRENCY_FLAG, ConnectedAgents, ConnectedAgentsApi, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, 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, 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, consumeAuthIntent, createBBUrl, createCheckoutRedirectUrls, createCreditPurchaseRedirectUrls, eventEmitter, formatCents, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, hasPermission, invalidateCreditBalance, invalidateQuotaUsage, invalidateSubscription, isZeroDecimalCurrency, mergeUIConfig, minorAmountToDisplay, readBBParams, resolveMaxUsers, resolvePermissions, safeRedirect, saveAuthIntent, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useConnectedAgents, useConnectedAgentsApi, useConsumeCredits, useCreateCheckoutSession, useCreditBalance, useCreditBalanceContext, useCreditPackages, useCreditTransactions, useExpiringCredits, useFullScreenLoader, useInvoice, useInvoices, usePermissions, usePlanGroup, usePlanGroupVersions, usePublicCreditPackages, usePublicPlanGroupVersion, usePublicPlans, usePurchaseCredits, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUIConfig, useUIVisibility, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, validateInvite, validateRedirectUrl, workspaceSettingsManager };
|
|
5919
|
-
export type { BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, CheckoutResult, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, 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, 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, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PartialSDKMessages, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|
|
6504
|
+
export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, 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, 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 };
|
|
6505
|
+
export type { BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, SaaSOSProviderProps as BuildBaseProviderProps, CheckoutResult, ConnectMcpGuideProps, ConnectedAgentsProps, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DevicesProps, DunningStateType, EmptyStateProps, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConnectedAgent, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IDeviceView, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IIpInfoLite, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, ISessionView, ISettings, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, IUser, IWorkspace, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, LoadingStateProps, MaxUsersConfig, McpClientGuide, McpConnectionConfig, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PartialSDKMessages, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RedirectValidationOptions, RolePermissionMap, SDKLocale, SDKMessages, SDKUIConfig, SaaSOSProviderProps, SeatStatus, SectionHeaderProps, SessionsProps, SettingsManagerState, SidebarNavItemProps, SidebarNavSectionProps, StatusBannerProps, StatusBannerVariant, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TranslationKey, TrialStatus, UseConnectedAgents, UseDevices, UseSessions, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|