@buildbase/sdk 0.0.30 → 0.0.32
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/README.md +134 -0
- package/dist/css/styles.css +1 -1
- package/dist/css/styles.d.ts +6 -0
- package/dist/data/index.d.ts +39 -0
- package/dist/data/index.js +1 -0
- package/dist/data/index.mjs +1 -0
- package/dist/index.d.ts +280 -58
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react/index.d.ts +796 -71
- package/dist/react/index.js +1 -35
- package/dist/react/index.mjs +1 -35
- package/package.json +99 -15
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import react__default, { ReactNode } from 'react';
|
|
4
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -55,9 +54,48 @@ interface IAsset extends IDocument {
|
|
|
55
54
|
creator: string | IUser;
|
|
56
55
|
}
|
|
57
56
|
type BillingInterval = 'monthly' | 'yearly' | 'quarterly';
|
|
57
|
+
/** Billing interval constants */
|
|
58
|
+
declare const BillingIntervals: {
|
|
59
|
+
readonly Monthly: "monthly";
|
|
60
|
+
readonly Yearly: "yearly";
|
|
61
|
+
readonly Quarterly: "quarterly";
|
|
62
|
+
};
|
|
63
|
+
/** Subscription status constants */
|
|
64
|
+
declare const SubscriptionStatus: {
|
|
65
|
+
readonly Active: "active";
|
|
66
|
+
readonly Trialing: "trialing";
|
|
67
|
+
readonly Canceled: "canceled";
|
|
68
|
+
readonly PastDue: "past_due";
|
|
69
|
+
readonly Paused: "paused";
|
|
70
|
+
readonly Incomplete: "incomplete";
|
|
71
|
+
readonly Unpaid: "unpaid";
|
|
72
|
+
};
|
|
73
|
+
type SubscriptionStatusType = (typeof SubscriptionStatus)[keyof typeof SubscriptionStatus];
|
|
74
|
+
/** Invoice status constants */
|
|
75
|
+
declare const InvoiceStatuses: {
|
|
76
|
+
readonly Draft: "draft";
|
|
77
|
+
readonly Open: "open";
|
|
78
|
+
readonly Paid: "paid";
|
|
79
|
+
readonly Uncollectible: "uncollectible";
|
|
80
|
+
readonly Void: "void";
|
|
81
|
+
};
|
|
82
|
+
/** Subscription item type constants */
|
|
83
|
+
declare const SubscriptionItemType: {
|
|
84
|
+
readonly Feature: "feature";
|
|
85
|
+
readonly Limit: "limit";
|
|
86
|
+
readonly Quota: "quota";
|
|
87
|
+
};
|
|
88
|
+
/** Dunning state constants */
|
|
89
|
+
declare const DunningState: {
|
|
90
|
+
readonly None: "none";
|
|
91
|
+
readonly Notified: "notified";
|
|
92
|
+
readonly Warning: "warning";
|
|
93
|
+
readonly Final: "final";
|
|
94
|
+
readonly Suspended: "suspended";
|
|
95
|
+
};
|
|
58
96
|
interface ISubscription {
|
|
59
97
|
_id: string;
|
|
60
|
-
subscriptionStatus:
|
|
98
|
+
subscriptionStatus: SubscriptionStatusType;
|
|
61
99
|
stripePriceId?: string;
|
|
62
100
|
stripeCurrentPeriodEnd?: string;
|
|
63
101
|
cancelAtPeriodEnd: boolean;
|
|
@@ -545,10 +583,19 @@ interface IWorkspaceUser {
|
|
|
545
583
|
role: string;
|
|
546
584
|
}
|
|
547
585
|
|
|
548
|
-
/**
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
586
|
+
/** Event type constants */
|
|
587
|
+
declare const SDKEvent: {
|
|
588
|
+
readonly UserCreated: "user:created";
|
|
589
|
+
readonly UserUpdated: "user:updated";
|
|
590
|
+
readonly WorkspaceChanged: "workspace:changed";
|
|
591
|
+
readonly WorkspaceUpdated: "workspace:updated";
|
|
592
|
+
readonly WorkspaceUserAdded: "workspace:user-added";
|
|
593
|
+
readonly WorkspaceUserRemoved: "workspace:user-removed";
|
|
594
|
+
readonly WorkspaceUserRoleChanged: "workspace:user-role-changed";
|
|
595
|
+
readonly WorkspaceCreated: "workspace:created";
|
|
596
|
+
readonly WorkspaceDeleted: "workspace:deleted";
|
|
597
|
+
};
|
|
598
|
+
type EventType = (typeof SDKEvent)[keyof typeof SDKEvent];
|
|
552
599
|
/**
|
|
553
600
|
* Event data types for each event
|
|
554
601
|
*/
|
|
@@ -654,6 +701,26 @@ interface IAuthCallbacks {
|
|
|
654
701
|
* ```
|
|
655
702
|
*/
|
|
656
703
|
getSession: () => Promise<string | null>;
|
|
704
|
+
/**
|
|
705
|
+
* Called when a session is missing, expired, or invalid.
|
|
706
|
+
* Use this to redirect to login, show a re-auth modal, or refresh the token.
|
|
707
|
+
*
|
|
708
|
+
* Triggers:
|
|
709
|
+
* - `getSession()` returns null on page refresh (cookie missing/expired)
|
|
710
|
+
* - `getProfile()` fails with 401 (session revoked server-side)
|
|
711
|
+
* - API call returns 401 during usage (session expired mid-session)
|
|
712
|
+
*
|
|
713
|
+
* @param reason - Why the session expired
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```ts
|
|
717
|
+
* onSessionExpired: (reason) => {
|
|
718
|
+
* console.log('Session expired:', reason);
|
|
719
|
+
* router.push('/login');
|
|
720
|
+
* }
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
onSessionExpired?: (reason: 'missing' | 'expired' | 'invalid') => void;
|
|
657
724
|
/**
|
|
658
725
|
* Event handler for User and Workspace events
|
|
659
726
|
* @param eventType - The type of event that occurred
|
|
@@ -673,12 +740,25 @@ interface OnWorkspaceChangeParams {
|
|
|
673
740
|
role: string | null;
|
|
674
741
|
}
|
|
675
742
|
|
|
743
|
+
type WorkspaceMode = 'personal' | 'platform';
|
|
676
744
|
interface ISettings {
|
|
677
745
|
workspace: {
|
|
678
746
|
roles: string[];
|
|
679
747
|
defaultRole: string;
|
|
680
748
|
maxWorkspaces: number;
|
|
681
749
|
maxWorkspaceUsers: number;
|
|
750
|
+
/** Workspace mode: 'personal' (solo) or 'platform' (multi-user, default) */
|
|
751
|
+
mode: WorkspaceMode;
|
|
752
|
+
/** Whether users can create workspaces. false = disabled, 'owner-only' = restricted */
|
|
753
|
+
canCreateWorkspace: boolean | 'owner-only';
|
|
754
|
+
/** Whether members can invite others. false = disabled, 'admin-only' = restricted */
|
|
755
|
+
canInviteMembers: boolean | 'admin-only';
|
|
756
|
+
/** Show workspace switcher in the UI */
|
|
757
|
+
showSwitcher: boolean;
|
|
758
|
+
/** Max workspaces a user can own. 0 = unlimited */
|
|
759
|
+
maxWorkspacesPerUser: number;
|
|
760
|
+
/** Auto-create workspace on first login */
|
|
761
|
+
autoCreateFirst: boolean;
|
|
682
762
|
};
|
|
683
763
|
[key: string]: any;
|
|
684
764
|
}
|
|
@@ -1033,6 +1113,41 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1033
1113
|
* @returns Usage result with consumed/included/available/overage
|
|
1034
1114
|
*/
|
|
1035
1115
|
recordUsage(workspaceId: string, request: IRecordUsageRequest): Promise<IRecordUsageResponse>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Record multiple quota usage entries in a single request.
|
|
1118
|
+
* Designed for backend-to-backend high-volume scenarios (bulk exports, batch jobs).
|
|
1119
|
+
* Max 100 items per request.
|
|
1120
|
+
*
|
|
1121
|
+
* @example
|
|
1122
|
+
* ```ts
|
|
1123
|
+
* await api.recordUsageBatch(workspaceId, {
|
|
1124
|
+
* items: [
|
|
1125
|
+
* { quotaSlug: 'images', quantity: 500, source: 'batch-export' },
|
|
1126
|
+
* { quotaSlug: 'videos', quantity: 10, source: 'batch-export' },
|
|
1127
|
+
* ]
|
|
1128
|
+
* });
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
recordUsageBatch(workspaceId: string, request: {
|
|
1132
|
+
items: Array<{
|
|
1133
|
+
quotaSlug: string;
|
|
1134
|
+
quantity: number;
|
|
1135
|
+
metadata?: Record<string, any>;
|
|
1136
|
+
source?: string;
|
|
1137
|
+
idempotencyKey?: string;
|
|
1138
|
+
}>;
|
|
1139
|
+
}): Promise<{
|
|
1140
|
+
success: boolean;
|
|
1141
|
+
total: number;
|
|
1142
|
+
succeeded: number;
|
|
1143
|
+
failed: number;
|
|
1144
|
+
results: Array<{
|
|
1145
|
+
success: boolean;
|
|
1146
|
+
quotaSlug: string;
|
|
1147
|
+
quantity: number;
|
|
1148
|
+
error?: string;
|
|
1149
|
+
}>;
|
|
1150
|
+
}>;
|
|
1036
1151
|
/**
|
|
1037
1152
|
* Get usage status for a single quota
|
|
1038
1153
|
* @param workspaceId - The workspace ID
|
|
@@ -1146,6 +1261,93 @@ declare function invalidateSubscription(): void;
|
|
|
1146
1261
|
*/
|
|
1147
1262
|
declare function invalidateQuotaUsage(): void;
|
|
1148
1263
|
|
|
1264
|
+
/**
|
|
1265
|
+
* BuildBase URL parameter utilities.
|
|
1266
|
+
*
|
|
1267
|
+
* Single URL param `bb` carries comma-separated key:value pairs.
|
|
1268
|
+
* No collision with user's own URL params.
|
|
1269
|
+
*
|
|
1270
|
+
* Format: ?bb=key:value,key:value,key:value
|
|
1271
|
+
*
|
|
1272
|
+
* Reserved keys:
|
|
1273
|
+
* screen → settings section to open (subscription, users, etc.)
|
|
1274
|
+
* ws → workspace ID to switch to
|
|
1275
|
+
* action → what triggered it (checkout, billing, invite, etc.)
|
|
1276
|
+
* status → result status (success, cancel, error)
|
|
1277
|
+
*
|
|
1278
|
+
* @example
|
|
1279
|
+
* ```ts
|
|
1280
|
+
* import { createBBUrl, readBBParams, cleanBBParams } from '@buildbase/sdk'
|
|
1281
|
+
*
|
|
1282
|
+
* // After Stripe checkout
|
|
1283
|
+
* const url = createBBUrl({ action: 'checkout', status: 'success', ws: workspaceId, screen: 'subscription' })
|
|
1284
|
+
* // → https://app.com/dashboard?bb=action:checkout,status:success,ws:65abc,screen:subscription
|
|
1285
|
+
*
|
|
1286
|
+
* // Read on page load
|
|
1287
|
+
* const params = readBBParams()
|
|
1288
|
+
* // → { action: 'checkout', status: 'success', ws: '65abc', screen: 'subscription' }
|
|
1289
|
+
*
|
|
1290
|
+
* // Clean up
|
|
1291
|
+
* cleanBBParams()
|
|
1292
|
+
* ```
|
|
1293
|
+
*/
|
|
1294
|
+
/** The single URL param name used by the SDK */
|
|
1295
|
+
declare const BB_PARAM = "bb";
|
|
1296
|
+
/**
|
|
1297
|
+
* Build a URL with BuildBase params.
|
|
1298
|
+
*
|
|
1299
|
+
* @param params - Key-value pairs to encode (screen, ws, action, status, or any custom key)
|
|
1300
|
+
* @param baseUrl - Base URL (defaults to current page)
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```ts
|
|
1304
|
+
* // Stripe checkout redirect
|
|
1305
|
+
* createBBUrl({ action: 'checkout', status: 'success', ws: workspaceId, screen: 'subscription' })
|
|
1306
|
+
*
|
|
1307
|
+
* // Direct link to settings
|
|
1308
|
+
* createBBUrl({ screen: 'users' })
|
|
1309
|
+
*
|
|
1310
|
+
* // Custom data
|
|
1311
|
+
* createBBUrl({ action: 'invite', ws: workspaceId, email: 'user@example.com' })
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
declare function createBBUrl(params: Record<string, string>, baseUrl?: string): string;
|
|
1315
|
+
/**
|
|
1316
|
+
* Build success + cancel URL pair for Stripe checkout redirects.
|
|
1317
|
+
* Both include the workspace ID and screen:subscription.
|
|
1318
|
+
*/
|
|
1319
|
+
declare function createCheckoutRedirectUrls(workspaceId: string, baseUrl?: string): {
|
|
1320
|
+
successUrl: string;
|
|
1321
|
+
cancelUrl: string;
|
|
1322
|
+
};
|
|
1323
|
+
/**
|
|
1324
|
+
* Read the `bb` param from the current URL.
|
|
1325
|
+
* Returns null if no `bb` param is present.
|
|
1326
|
+
* Returns a plain object of key-value pairs.
|
|
1327
|
+
*
|
|
1328
|
+
* Common keys: screen, ws, action, status
|
|
1329
|
+
*/
|
|
1330
|
+
declare function readBBParams(): Record<string, string> | null;
|
|
1331
|
+
/**
|
|
1332
|
+
* Remove the `bb` param from the current URL without triggering navigation.
|
|
1333
|
+
*/
|
|
1334
|
+
declare function cleanBBParams(): void;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Security utilities for the SDK.
|
|
1338
|
+
*/
|
|
1339
|
+
/**
|
|
1340
|
+
* Validate that a URL is safe to redirect to.
|
|
1341
|
+
* Prevents open redirect attacks by ensuring the URL uses https (or http on localhost).
|
|
1342
|
+
* Returns the URL if safe, or null if not.
|
|
1343
|
+
*/
|
|
1344
|
+
declare function validateRedirectUrl(url: string | null | undefined): string | null;
|
|
1345
|
+
/**
|
|
1346
|
+
* Safely redirect to a URL after validating it.
|
|
1347
|
+
* Falls back to fallbackUrl if the target URL is invalid.
|
|
1348
|
+
*/
|
|
1349
|
+
declare function safeRedirect(url: string | null | undefined, fallbackUrl?: string): void;
|
|
1350
|
+
|
|
1149
1351
|
/**
|
|
1150
1352
|
* Centralized formatting for subscription/quota display: cents, overage rates, included + overage text.
|
|
1151
1353
|
* Currency must be provided by the caller (e.g. workspace.billingCurrency, plan.currency, or selected currency).
|
|
@@ -1167,29 +1369,41 @@ declare const PLAN_CURRENCY_OPTIONS: {
|
|
|
1167
1369
|
}[];
|
|
1168
1370
|
/** Format cents as money string (e.g. 1999, "usd" -> "$19.99"). Caller must pass currency (e.g. from plan or workspace). */
|
|
1169
1371
|
declare function formatCents(cents: number, currency: string): string;
|
|
1372
|
+
/** Translatable labels for overage/quota formatting */
|
|
1373
|
+
interface OverageLabels {
|
|
1374
|
+
/** Singular unit fallback (default: "unit") */
|
|
1375
|
+
unit: string;
|
|
1376
|
+
/** Plural units fallback (default: "units") */
|
|
1377
|
+
units: string;
|
|
1378
|
+
/** "Included" label */
|
|
1379
|
+
included: string;
|
|
1380
|
+
/** "after that" separator */
|
|
1381
|
+
afterThat: string;
|
|
1382
|
+
/** "After included:" prefix when no included count */
|
|
1383
|
+
afterIncluded: string;
|
|
1384
|
+
}
|
|
1170
1385
|
/**
|
|
1171
1386
|
* Format overage rate for display. When unitSize > 1: "$1.00/1,000 units"; else "$1.00/unit".
|
|
1172
|
-
*
|
|
1387
|
+
* Pass `labels` for i18n support.
|
|
1173
1388
|
*/
|
|
1174
|
-
declare function formatOverageRate(overageCents: number | undefined, unitSize: number | undefined, currency: string): string | null;
|
|
1389
|
+
declare function formatOverageRate(overageCents: number | undefined, unitSize: number | undefined, currency: string, labels?: Partial<OverageLabels>): string | null;
|
|
1175
1390
|
/**
|
|
1176
1391
|
* Format overage rate with optional unit label for comparison/preview UIs.
|
|
1177
|
-
* e.g. formatOverageRateWithLabel(50, 1000, "video") -> "$0.50/1,000 videos"
|
|
1178
|
-
*
|
|
1179
|
-
* When unitLabel is omitted, falls back to formatOverageRate behavior.
|
|
1392
|
+
* e.g. formatOverageRateWithLabel(50, 1000, "video", "usd") -> "$0.50/1,000 videos"
|
|
1393
|
+
* Pass `labels` for i18n support. Pass `pluralUnitLabel` to avoid English "s" pluralization.
|
|
1180
1394
|
*/
|
|
1181
|
-
declare function formatOverageRateWithLabel(overageCents: number | undefined, unitSize: number | undefined, unitLabel: string | undefined, currency: string): string | null;
|
|
1395
|
+
declare function formatOverageRateWithLabel(overageCents: number | undefined, unitSize: number | undefined, unitLabel: string | undefined, currency: string, pluralUnitLabel?: string, labels?: Partial<OverageLabels>): string | null;
|
|
1182
1396
|
/**
|
|
1183
1397
|
* Get singular unit label from item name or slug (e.g. "Videos" -> "video", "reels" -> "reel").
|
|
1184
1398
|
* Used for quota display in comparison and preview.
|
|
1399
|
+
* Pass `fallback` for i18n unit fallback (default: "unit").
|
|
1185
1400
|
*/
|
|
1186
|
-
declare function getQuotaUnitLabelFromName(nameOrSlug: string): string;
|
|
1401
|
+
declare function getQuotaUnitLabelFromName(nameOrSlug: string, fallback?: string): string;
|
|
1187
1402
|
/**
|
|
1188
1403
|
* Format quota "included + overage" for display.
|
|
1189
|
-
*
|
|
1190
|
-
* Otherwise: "Included: 5, after that $0.30/image".
|
|
1404
|
+
* Pass `labels` and `pluralUnitLabel` for i18n support.
|
|
1191
1405
|
*/
|
|
1192
|
-
declare function formatQuotaIncludedOverage(included: number | undefined, overageCents: number | undefined, unitLabel: string, currency: string, unitSize?: number): string;
|
|
1406
|
+
declare function formatQuotaIncludedOverage(included: number | undefined, overageCents: number | undefined, unitLabel: string, currency: string, unitSize?: number, pluralUnitLabel?: string, labels?: Partial<OverageLabels>): string;
|
|
1193
1407
|
|
|
1194
1408
|
type QuotaDisplayValue = {
|
|
1195
1409
|
included: number;
|
|
@@ -1208,10 +1422,29 @@ interface FormatQuotaWithPriceOptions {
|
|
|
1208
1422
|
currencySymbol?: string;
|
|
1209
1423
|
/** Stripe currency code (e.g. 'usd', 'inr'). Used to resolve symbol when currencySymbol is not set. */
|
|
1210
1424
|
currency?: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* i18n labels for quota display. When provided, used instead of hardcoded English.
|
|
1427
|
+
* Callers in React components should pass translated strings from `t()`.
|
|
1428
|
+
*/
|
|
1429
|
+
labels?: QuotaLabels;
|
|
1430
|
+
}
|
|
1431
|
+
/** Translatable labels for quota formatting */
|
|
1432
|
+
interface QuotaLabels {
|
|
1433
|
+
/** e.g. "included" — appended after count */
|
|
1434
|
+
included: string;
|
|
1435
|
+
/** e.g. "then" — separator between included and price */
|
|
1436
|
+
then: string;
|
|
1211
1437
|
}
|
|
1212
1438
|
/**
|
|
1213
|
-
* Format a quota display value as "X included, then $Y.YY / unit"
|
|
1214
|
-
*
|
|
1439
|
+
* Format a quota display value as "X included, then $Y.YY / unit".
|
|
1440
|
+
* Pass `labels` for i18n support.
|
|
1441
|
+
*
|
|
1442
|
+
* @example
|
|
1443
|
+
* formatQuotaWithPrice(value, 'videos', { currency: 'inr' })
|
|
1444
|
+
* // → "1 included, then ₹1.00 / 1,000 videos"
|
|
1445
|
+
*
|
|
1446
|
+
* formatQuotaWithPrice(value, 'वीडियो', { currency: 'inr', labels: { included: 'शामिल', then: 'फिर' } })
|
|
1447
|
+
* // → "1 शामिल, फिर ₹1.00 / 1,000 वीडियो"
|
|
1215
1448
|
*/
|
|
1216
1449
|
declare function formatQuotaWithPrice(value: QuotaDisplayValue, unitName: string, options?: FormatQuotaWithPriceOptions): string;
|
|
1217
1450
|
|
|
@@ -1312,8 +1545,10 @@ interface InviteValidation {
|
|
|
1312
1545
|
canInvite: boolean;
|
|
1313
1546
|
/** Reason the invite is blocked, or null if allowed. */
|
|
1314
1547
|
blockReason: InviteBlockReason;
|
|
1315
|
-
/**
|
|
1316
|
-
|
|
1548
|
+
/** i18n key for the block message. Resolve with t(blockMessageKey, blockMessageValues). */
|
|
1549
|
+
blockMessageKey: string | null;
|
|
1550
|
+
/** Values for ICU interpolation in the block message. */
|
|
1551
|
+
blockMessageValues: Record<string, string | number> | null;
|
|
1317
1552
|
}
|
|
1318
1553
|
/**
|
|
1319
1554
|
* Validate whether a new member can be invited given current seat/user limits.
|
|
@@ -1341,41 +1576,6 @@ declare function validateInvite(opts: {
|
|
|
1341
1576
|
*/
|
|
1342
1577
|
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 var payload = event.data.json();\n var title = payload.title || 'Notification';\n var 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 var 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 (var i = 0; i < clientList.length; i++) {\n var 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";
|
|
1343
1578
|
|
|
1344
|
-
declare const countries: {
|
|
1345
|
-
value: string;
|
|
1346
|
-
flag: string;
|
|
1347
|
-
text: string;
|
|
1348
|
-
currencyCode: string;
|
|
1349
|
-
currencyIcon: string;
|
|
1350
|
-
}[];
|
|
1351
|
-
|
|
1352
|
-
declare const uniqueCurrencies: {
|
|
1353
|
-
value: string;
|
|
1354
|
-
text: string;
|
|
1355
|
-
icon: any;
|
|
1356
|
-
}[];
|
|
1357
|
-
|
|
1358
|
-
declare const languages: {
|
|
1359
|
-
value: string;
|
|
1360
|
-
label: string;
|
|
1361
|
-
flag: string;
|
|
1362
|
-
}[];
|
|
1363
|
-
|
|
1364
|
-
declare const timezones: {
|
|
1365
|
-
value: string;
|
|
1366
|
-
abbr: string;
|
|
1367
|
-
offset: number;
|
|
1368
|
-
isdst: boolean;
|
|
1369
|
-
text: string;
|
|
1370
|
-
utc: string[];
|
|
1371
|
-
}[];
|
|
1372
|
-
|
|
1373
|
-
declare const formSchema: z.ZodObject<{
|
|
1374
|
-
name: z.ZodString;
|
|
1375
|
-
email: z.ZodString;
|
|
1376
|
-
}, z.core.$strip>;
|
|
1377
|
-
type formValuesType = z.infer<typeof formSchema>;
|
|
1378
|
-
|
|
1379
1579
|
interface BetaFormData {
|
|
1380
1580
|
name?: string;
|
|
1381
1581
|
email: string;
|
|
@@ -1385,12 +1585,546 @@ interface BetaFormResponse {
|
|
|
1385
1585
|
message: string;
|
|
1386
1586
|
}
|
|
1387
1587
|
|
|
1588
|
+
/**
|
|
1589
|
+
* Type-safe translation keys for the BuildBase SDK.
|
|
1590
|
+
* All user-facing strings are defined here.
|
|
1591
|
+
*/
|
|
1592
|
+
interface SDKMessages {
|
|
1593
|
+
settings: {
|
|
1594
|
+
titles: {
|
|
1595
|
+
profile: string;
|
|
1596
|
+
general: string;
|
|
1597
|
+
users: string;
|
|
1598
|
+
subscription: string;
|
|
1599
|
+
usage: string;
|
|
1600
|
+
features: string;
|
|
1601
|
+
notifications: string;
|
|
1602
|
+
danger: string;
|
|
1603
|
+
};
|
|
1604
|
+
sidebar: {
|
|
1605
|
+
account: string;
|
|
1606
|
+
workspace: string;
|
|
1607
|
+
profile: string;
|
|
1608
|
+
general: string;
|
|
1609
|
+
users: string;
|
|
1610
|
+
subscription: string;
|
|
1611
|
+
usage: string;
|
|
1612
|
+
features: string;
|
|
1613
|
+
notifications: string;
|
|
1614
|
+
danger: string;
|
|
1615
|
+
};
|
|
1616
|
+
common: {
|
|
1617
|
+
refresh: string;
|
|
1618
|
+
refreshing: string;
|
|
1619
|
+
retry: string;
|
|
1620
|
+
retrying: string;
|
|
1621
|
+
save: string;
|
|
1622
|
+
saving: string;
|
|
1623
|
+
cancel: string;
|
|
1624
|
+
delete: string;
|
|
1625
|
+
dismiss: string;
|
|
1626
|
+
loading: string;
|
|
1627
|
+
success: string;
|
|
1628
|
+
error: string;
|
|
1629
|
+
refreshAction: string;
|
|
1630
|
+
retryAction: string;
|
|
1631
|
+
};
|
|
1632
|
+
};
|
|
1633
|
+
subscription: {
|
|
1634
|
+
managePlan: string;
|
|
1635
|
+
changePlan: string;
|
|
1636
|
+
viewPricingPlans: string;
|
|
1637
|
+
viewPlans: string;
|
|
1638
|
+
upgradePlan: string;
|
|
1639
|
+
subscribe: string;
|
|
1640
|
+
currentPlan: string;
|
|
1641
|
+
noSubscription: string;
|
|
1642
|
+
choosePlan: string;
|
|
1643
|
+
choosePlanDescription: string;
|
|
1644
|
+
planUpdateAvailable: string;
|
|
1645
|
+
updateSuccess: string;
|
|
1646
|
+
updateFailed: string;
|
|
1647
|
+
cancelTitle: string;
|
|
1648
|
+
cancelConfirm: string;
|
|
1649
|
+
cancelKeep: string;
|
|
1650
|
+
cancelButton: string;
|
|
1651
|
+
canceling: string;
|
|
1652
|
+
cancelSuccess: string;
|
|
1653
|
+
cancelNotCharged: string;
|
|
1654
|
+
cancelResumeAnytime: string;
|
|
1655
|
+
resumeTitle: string;
|
|
1656
|
+
resumeConfirm: string;
|
|
1657
|
+
resumeKeep: string;
|
|
1658
|
+
resumeButton: string;
|
|
1659
|
+
resuming: string;
|
|
1660
|
+
resumeSuccess: string;
|
|
1661
|
+
managePayment: string;
|
|
1662
|
+
openingPortal: string;
|
|
1663
|
+
viewAllPlans: string;
|
|
1664
|
+
scheduledCancellation: string;
|
|
1665
|
+
paymentPastDue: string;
|
|
1666
|
+
paymentPastDueDescription: string;
|
|
1667
|
+
subscriptionPaused: string;
|
|
1668
|
+
subscriptionPausedDescription: string;
|
|
1669
|
+
errorLoading: string;
|
|
1670
|
+
errorLoadingDescription: string;
|
|
1671
|
+
errorProcessing: string;
|
|
1672
|
+
errorCanceling: string;
|
|
1673
|
+
errorResuming: string;
|
|
1674
|
+
invalidWorkspace: string;
|
|
1675
|
+
billingInterval: {
|
|
1676
|
+
monthly: string;
|
|
1677
|
+
quarterly: string;
|
|
1678
|
+
yearly: string;
|
|
1679
|
+
perMonth: string;
|
|
1680
|
+
perQuarter: string;
|
|
1681
|
+
perYear: string;
|
|
1682
|
+
};
|
|
1683
|
+
seats: {
|
|
1684
|
+
title: string;
|
|
1685
|
+
members: string;
|
|
1686
|
+
included: string;
|
|
1687
|
+
billable: string;
|
|
1688
|
+
perExtraSeat: string;
|
|
1689
|
+
limit: string;
|
|
1690
|
+
includedSeats: string;
|
|
1691
|
+
maxSeats: string;
|
|
1692
|
+
freeWithBase: string;
|
|
1693
|
+
allIncluded: string;
|
|
1694
|
+
extra: string;
|
|
1695
|
+
unlimited: string;
|
|
1696
|
+
};
|
|
1697
|
+
items: {
|
|
1698
|
+
features: string;
|
|
1699
|
+
limits: string;
|
|
1700
|
+
quotas: string;
|
|
1701
|
+
};
|
|
1702
|
+
checkout: {
|
|
1703
|
+
upgrade: string;
|
|
1704
|
+
downgrade: string;
|
|
1705
|
+
switchTo: string;
|
|
1706
|
+
select: string;
|
|
1707
|
+
};
|
|
1708
|
+
status: {
|
|
1709
|
+
active: string;
|
|
1710
|
+
canceling: string;
|
|
1711
|
+
trial: string;
|
|
1712
|
+
canceled: string;
|
|
1713
|
+
pastDue: string;
|
|
1714
|
+
paused: string;
|
|
1715
|
+
deprecated: string;
|
|
1716
|
+
unknown: string;
|
|
1717
|
+
};
|
|
1718
|
+
plan: string;
|
|
1719
|
+
invoicesTab: string;
|
|
1720
|
+
changePlanButton: string;
|
|
1721
|
+
noPlanAssigned: string;
|
|
1722
|
+
free: string;
|
|
1723
|
+
perSeatDisplay: string;
|
|
1724
|
+
estTotalDisplay: string;
|
|
1725
|
+
nextBillingDisplay: string;
|
|
1726
|
+
membersInWorkspace: string;
|
|
1727
|
+
billingInCurrency: string;
|
|
1728
|
+
savingsPercent: string;
|
|
1729
|
+
switchToInterval: string;
|
|
1730
|
+
seatPriceDisplay: string;
|
|
1731
|
+
trialEnded: string;
|
|
1732
|
+
trialEndsIn: string;
|
|
1733
|
+
onTrial: string;
|
|
1734
|
+
upgradeToKeepAccess: string;
|
|
1735
|
+
viewInvoices: string;
|
|
1736
|
+
cancelTrial: string;
|
|
1737
|
+
dunningFinal: string;
|
|
1738
|
+
dunningSuspended: string;
|
|
1739
|
+
dunningRecovery: string;
|
|
1740
|
+
dunningSuspendedDescription: string;
|
|
1741
|
+
dunningRecoveryDescription: string;
|
|
1742
|
+
cancelEndDescription: string;
|
|
1743
|
+
cancelEndFallback: string;
|
|
1744
|
+
resumeChargeDate: string;
|
|
1745
|
+
resumeChargeFallback: string;
|
|
1746
|
+
resumeContinue: string;
|
|
1747
|
+
resumeCancelAnytime: string;
|
|
1748
|
+
retainAccess: string;
|
|
1749
|
+
retainAccessFallback: string;
|
|
1750
|
+
noPlansAvailable: string;
|
|
1751
|
+
noPlansAvailableHint: string;
|
|
1752
|
+
startTrialDescription: string;
|
|
1753
|
+
noSubscriptionDescription: string;
|
|
1754
|
+
startFreeTrial: string;
|
|
1755
|
+
};
|
|
1756
|
+
users: {
|
|
1757
|
+
title: string;
|
|
1758
|
+
adminOnly: string;
|
|
1759
|
+
inviteByEmail: string;
|
|
1760
|
+
inviteButton: string;
|
|
1761
|
+
inviting: string;
|
|
1762
|
+
inviteSuccess: string;
|
|
1763
|
+
emailRequired: string;
|
|
1764
|
+
invalidEmail: string;
|
|
1765
|
+
inviteFailed: string;
|
|
1766
|
+
seatLimitReached: string;
|
|
1767
|
+
memberLimitReached: string;
|
|
1768
|
+
role: string;
|
|
1769
|
+
you: string;
|
|
1770
|
+
owner: string;
|
|
1771
|
+
noMembers: string;
|
|
1772
|
+
extraSeatCost: string;
|
|
1773
|
+
unknownUser: string;
|
|
1774
|
+
seats: string;
|
|
1775
|
+
members: string;
|
|
1776
|
+
included: string;
|
|
1777
|
+
perExtraSeat: string;
|
|
1778
|
+
maxMembers: string;
|
|
1779
|
+
available: string;
|
|
1780
|
+
noMemberLimit: string;
|
|
1781
|
+
seatHeading: string;
|
|
1782
|
+
limitReached: string;
|
|
1783
|
+
memberCount: string;
|
|
1784
|
+
subscriptionRequired: string;
|
|
1785
|
+
seatLimitMessage: string;
|
|
1786
|
+
settingsLimitMessage: string;
|
|
1787
|
+
memberLimitMessage: string;
|
|
1788
|
+
selectRole: string;
|
|
1789
|
+
inviteAs: string;
|
|
1790
|
+
};
|
|
1791
|
+
invoices: {
|
|
1792
|
+
title: string;
|
|
1793
|
+
description: string;
|
|
1794
|
+
pay: string;
|
|
1795
|
+
view: string;
|
|
1796
|
+
viewDetails: string;
|
|
1797
|
+
download: string;
|
|
1798
|
+
errorLoading: string;
|
|
1799
|
+
noInvoices: string;
|
|
1800
|
+
noInvoicesWithSub: string;
|
|
1801
|
+
paidAmount: string;
|
|
1802
|
+
na: string;
|
|
1803
|
+
status: {
|
|
1804
|
+
draft: string;
|
|
1805
|
+
open: string;
|
|
1806
|
+
paid: string;
|
|
1807
|
+
uncollectible: string;
|
|
1808
|
+
void: string;
|
|
1809
|
+
};
|
|
1810
|
+
};
|
|
1811
|
+
usage: {
|
|
1812
|
+
title: string;
|
|
1813
|
+
description: string;
|
|
1814
|
+
totalResources: string;
|
|
1815
|
+
overallUsage: string;
|
|
1816
|
+
inOverage: string;
|
|
1817
|
+
estOverageCost: string;
|
|
1818
|
+
overageDetected: string;
|
|
1819
|
+
overageDescription: string;
|
|
1820
|
+
overageUnits: string;
|
|
1821
|
+
rate: string;
|
|
1822
|
+
billableBlocks: string;
|
|
1823
|
+
estimatedCharge: string;
|
|
1824
|
+
noData: string;
|
|
1825
|
+
noDataHint: string;
|
|
1826
|
+
used: string;
|
|
1827
|
+
remaining: string;
|
|
1828
|
+
overLimit: string;
|
|
1829
|
+
percentUsed: string;
|
|
1830
|
+
availableRemaining: string;
|
|
1831
|
+
overLimitCount: string;
|
|
1832
|
+
overageWarning: string;
|
|
1833
|
+
fullyUsed: string;
|
|
1834
|
+
renewingSoon: string;
|
|
1835
|
+
almostFull: string;
|
|
1836
|
+
overage: string;
|
|
1837
|
+
errorLoading: string;
|
|
1838
|
+
perUnit: string;
|
|
1839
|
+
perUnits: string;
|
|
1840
|
+
rateDisplay: string;
|
|
1841
|
+
resourcesExceeded: string;
|
|
1842
|
+
estOverageCharges: string;
|
|
1843
|
+
overageRateDisplay: string;
|
|
1844
|
+
resetDateDisplay: string;
|
|
1845
|
+
daysRemainingDisplay: string;
|
|
1846
|
+
};
|
|
1847
|
+
profile: {
|
|
1848
|
+
email: string;
|
|
1849
|
+
name: string;
|
|
1850
|
+
language: string;
|
|
1851
|
+
country: string;
|
|
1852
|
+
currency: string;
|
|
1853
|
+
timezone: string;
|
|
1854
|
+
profileImage: string;
|
|
1855
|
+
success: string;
|
|
1856
|
+
nameMinLength: string;
|
|
1857
|
+
save: string;
|
|
1858
|
+
reset: string;
|
|
1859
|
+
};
|
|
1860
|
+
general: {
|
|
1861
|
+
ownerOnly: string;
|
|
1862
|
+
name: string;
|
|
1863
|
+
namePlaceholder: string;
|
|
1864
|
+
nameMinLength: string;
|
|
1865
|
+
billingCurrency: string;
|
|
1866
|
+
icon: string;
|
|
1867
|
+
iconDescription: string;
|
|
1868
|
+
imageUrl: string;
|
|
1869
|
+
imageUrlPlaceholder: string;
|
|
1870
|
+
imageUrlDescription: string;
|
|
1871
|
+
previewLabel: string;
|
|
1872
|
+
success: string;
|
|
1873
|
+
chooseEmoji: string;
|
|
1874
|
+
customImageUrl: string;
|
|
1875
|
+
updateWorkspace: string;
|
|
1876
|
+
};
|
|
1877
|
+
features: {
|
|
1878
|
+
title: string;
|
|
1879
|
+
ownerOnly: string;
|
|
1880
|
+
noFeatures: string;
|
|
1881
|
+
enabled: string;
|
|
1882
|
+
disabled: string;
|
|
1883
|
+
enabling: string;
|
|
1884
|
+
disabling: string;
|
|
1885
|
+
featureSuccess: string;
|
|
1886
|
+
updateSuccess: string;
|
|
1887
|
+
actionStatus: string;
|
|
1888
|
+
};
|
|
1889
|
+
danger: {
|
|
1890
|
+
title: string;
|
|
1891
|
+
adminOnly: string;
|
|
1892
|
+
deleteWorkspace: string;
|
|
1893
|
+
deleteConfirm: string;
|
|
1894
|
+
deleteWarning: string;
|
|
1895
|
+
deleting: string;
|
|
1896
|
+
deleteDescription: string;
|
|
1897
|
+
deleteConfirmDescription: string;
|
|
1898
|
+
failedToDelete: string;
|
|
1899
|
+
};
|
|
1900
|
+
notifications: {
|
|
1901
|
+
title: string;
|
|
1902
|
+
permissionDenied: string;
|
|
1903
|
+
notSupported: string;
|
|
1904
|
+
manageDescription: string;
|
|
1905
|
+
blocked: string;
|
|
1906
|
+
blockedDescription: string;
|
|
1907
|
+
pushTitle: string;
|
|
1908
|
+
pushEnabledDescription: string;
|
|
1909
|
+
pushDisabledDescription: string;
|
|
1910
|
+
enabling: string;
|
|
1911
|
+
disabling: string;
|
|
1912
|
+
enable: string;
|
|
1913
|
+
disable: string;
|
|
1914
|
+
toggleAction: string;
|
|
1915
|
+
pushDescription: string;
|
|
1916
|
+
deviceNote: string;
|
|
1917
|
+
unblock: {
|
|
1918
|
+
firefox: {
|
|
1919
|
+
step1: string;
|
|
1920
|
+
step2: string;
|
|
1921
|
+
step3: string;
|
|
1922
|
+
step4: string;
|
|
1923
|
+
};
|
|
1924
|
+
safari: {
|
|
1925
|
+
step1: string;
|
|
1926
|
+
step2: string;
|
|
1927
|
+
step3: string;
|
|
1928
|
+
step4: string;
|
|
1929
|
+
};
|
|
1930
|
+
edge: {
|
|
1931
|
+
step1: string;
|
|
1932
|
+
step2: string;
|
|
1933
|
+
step3: string;
|
|
1934
|
+
step4: string;
|
|
1935
|
+
};
|
|
1936
|
+
chrome: {
|
|
1937
|
+
step1: string;
|
|
1938
|
+
step2: string;
|
|
1939
|
+
step3: string;
|
|
1940
|
+
step4: string;
|
|
1941
|
+
};
|
|
1942
|
+
};
|
|
1943
|
+
};
|
|
1944
|
+
quota: {
|
|
1945
|
+
includedOnly: string;
|
|
1946
|
+
includedWithOverage: string;
|
|
1947
|
+
unitFallback: string;
|
|
1948
|
+
};
|
|
1949
|
+
pricing: {
|
|
1950
|
+
title: string;
|
|
1951
|
+
description: string;
|
|
1952
|
+
currency: string;
|
|
1953
|
+
billingIn: string;
|
|
1954
|
+
noPlansCurrency: string;
|
|
1955
|
+
noPlansCurrencyHint: string;
|
|
1956
|
+
noPlans: string;
|
|
1957
|
+
free: string;
|
|
1958
|
+
included: string;
|
|
1959
|
+
save: string;
|
|
1960
|
+
current: string;
|
|
1961
|
+
processing: string;
|
|
1962
|
+
unavailable: string;
|
|
1963
|
+
selectCurrency: string;
|
|
1964
|
+
billingInterval: string;
|
|
1965
|
+
};
|
|
1966
|
+
beta: {
|
|
1967
|
+
nameLabel: string;
|
|
1968
|
+
emailLabel: string;
|
|
1969
|
+
submitText: string;
|
|
1970
|
+
submittingText: string;
|
|
1971
|
+
errorMessage: string;
|
|
1972
|
+
tryAgain: string;
|
|
1973
|
+
privacyConsent: string;
|
|
1974
|
+
privacyPolicy: string;
|
|
1975
|
+
and: string;
|
|
1976
|
+
termsOfService: string;
|
|
1977
|
+
};
|
|
1978
|
+
workspace: {
|
|
1979
|
+
switchTitle: string;
|
|
1980
|
+
switchDescription: string;
|
|
1981
|
+
notLoggedIn: string;
|
|
1982
|
+
availableWorkspaces: string;
|
|
1983
|
+
loadingWorkspaces: string;
|
|
1984
|
+
searchPlaceholder: string;
|
|
1985
|
+
noWorkspacesFound: string;
|
|
1986
|
+
noWorkspacesAvailable: string;
|
|
1987
|
+
switchTo: string;
|
|
1988
|
+
membersCount: string;
|
|
1989
|
+
createNew: string;
|
|
1990
|
+
createTitle: string;
|
|
1991
|
+
createDescription: string;
|
|
1992
|
+
workspaceName: string;
|
|
1993
|
+
workspaceNamePlaceholder: string;
|
|
1994
|
+
workspaceNameMinLength: string;
|
|
1995
|
+
workspaceIcon: string;
|
|
1996
|
+
iconDescription: string;
|
|
1997
|
+
chooseEmoji: string;
|
|
1998
|
+
customImageUrl: string;
|
|
1999
|
+
imageUrl: string;
|
|
2000
|
+
imageUrlPlaceholder: string;
|
|
2001
|
+
imageUrlDescription: string;
|
|
2002
|
+
invalidUrl: string;
|
|
2003
|
+
creating: string;
|
|
2004
|
+
createWorkspace: string;
|
|
2005
|
+
};
|
|
2006
|
+
dropdowns: {
|
|
2007
|
+
search: string;
|
|
2008
|
+
chooseOption: string;
|
|
2009
|
+
chooseCountry: string;
|
|
2010
|
+
searchCountry: string;
|
|
2011
|
+
chooseLanguage: string;
|
|
2012
|
+
searchLanguage: string;
|
|
2013
|
+
chooseCurrency: string;
|
|
2014
|
+
searchCurrency: string;
|
|
2015
|
+
chooseTimezone: string;
|
|
2016
|
+
searchTimezone: string;
|
|
2017
|
+
};
|
|
2018
|
+
push: {
|
|
2019
|
+
failedToSubscribe: string;
|
|
2020
|
+
failedToUnsubscribe: string;
|
|
2021
|
+
};
|
|
2022
|
+
errors: {
|
|
2023
|
+
networkError: string;
|
|
2024
|
+
unauthorized: string;
|
|
2025
|
+
notFound: string;
|
|
2026
|
+
generic: string;
|
|
2027
|
+
fetchPlans: string;
|
|
2028
|
+
fetchPlanGroup: string;
|
|
2029
|
+
fetchPlanGroupVersion: string;
|
|
2030
|
+
fetchPlanGroupVersions: string;
|
|
2031
|
+
fetchSubscription: string;
|
|
2032
|
+
createCheckout: string;
|
|
2033
|
+
updateSubscription: string;
|
|
2034
|
+
fetchInvoices: string;
|
|
2035
|
+
fetchInvoice: string;
|
|
2036
|
+
openBillingPortal: string;
|
|
2037
|
+
cancelSubscription: string;
|
|
2038
|
+
resumeSubscription: string;
|
|
2039
|
+
recordUsage: string;
|
|
2040
|
+
fetchQuotaUsage: string;
|
|
2041
|
+
fetchAllQuotaUsage: string;
|
|
2042
|
+
fetchUsageLogs: string;
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
/** Supported locale codes */
|
|
2046
|
+
type SDKLocale = 'en' | 'es' | 'fr' | 'de' | 'ja' | 'zh' | 'hi' | 'ar';
|
|
2047
|
+
/**
|
|
2048
|
+
* Generates a union of all valid dot-separated key paths from SDKMessages.
|
|
2049
|
+
* Supports up to 3 levels of nesting (covers all current keys).
|
|
2050
|
+
* Used to make `t()` calls compile-time safe with autocomplete.
|
|
2051
|
+
*
|
|
2052
|
+
* @example
|
|
2053
|
+
* TranslationKey → "settings.titles.profile" | "settings.common.refresh" | ...
|
|
2054
|
+
*/
|
|
2055
|
+
type Level1 = keyof SDKMessages & string;
|
|
2056
|
+
type Level2 = {
|
|
2057
|
+
[K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? `${K1}.${keyof SDKMessages[K1] & string}` : never;
|
|
2058
|
+
}[Level1];
|
|
2059
|
+
type Level3 = {
|
|
2060
|
+
[K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? {
|
|
2061
|
+
[K2 in keyof SDKMessages[K1] & string]: SDKMessages[K1][K2] extends Record<string, unknown> ? `${K1}.${K2}.${keyof SDKMessages[K1][K2] & string}` : never;
|
|
2062
|
+
}[keyof SDKMessages[K1] & string] : never;
|
|
2063
|
+
}[Level1];
|
|
2064
|
+
type Level4 = {
|
|
2065
|
+
[K1 in Level1]: SDKMessages[K1] extends Record<string, unknown> ? {
|
|
2066
|
+
[K2 in keyof SDKMessages[K1] & string]: SDKMessages[K1][K2] extends Record<string, unknown> ? {
|
|
2067
|
+
[K3 in keyof SDKMessages[K1][K2] & string]: SDKMessages[K1][K2][K3] extends Record<string, unknown> ? `${K1}.${K2}.${K3}.${keyof SDKMessages[K1][K2][K3] & string}` : never;
|
|
2068
|
+
}[keyof SDKMessages[K1][K2] & string] : never;
|
|
2069
|
+
}[keyof SDKMessages[K1] & string] : never;
|
|
2070
|
+
}[Level1];
|
|
2071
|
+
/** Union of all valid translation key paths (e.g. "settings.titles.profile") */
|
|
2072
|
+
type TranslationKey = Level2 | Level3 | Level4;
|
|
2073
|
+
|
|
2074
|
+
/** Values that can be interpolated into ICU messages */
|
|
2075
|
+
type TranslationValues = Record<string, string | number | boolean>;
|
|
2076
|
+
/** All supported locale codes */
|
|
2077
|
+
declare const SUPPORTED_LOCALES: SDKLocale[];
|
|
2078
|
+
/**
|
|
2079
|
+
* Access SDK translations. Returns a type-safe `t()` function for nested key
|
|
2080
|
+
* lookup with optional ICU MessageFormat interpolation.
|
|
2081
|
+
*
|
|
2082
|
+
* @example
|
|
2083
|
+
* ```tsx
|
|
2084
|
+
* const { t } = useTranslation();
|
|
2085
|
+
*
|
|
2086
|
+
* // Simple lookup — autocomplete and compile-time typo checking
|
|
2087
|
+
* t('settings.common.refresh') // → 'Refresh'
|
|
2088
|
+
*
|
|
2089
|
+
* // ICU interpolation with placeholders
|
|
2090
|
+
* t('usage.estOverageCharges', { amount: '$12.50' })
|
|
2091
|
+
* // → 'Estimated overage charges this period: $12.50'
|
|
2092
|
+
*
|
|
2093
|
+
* // ICU plural rules (handles Arabic's 6 forms, etc.)
|
|
2094
|
+
* t('users.memberCount', { count: 3 })
|
|
2095
|
+
* // → '3 members'
|
|
2096
|
+
* ```
|
|
2097
|
+
*/
|
|
2098
|
+
declare function useTranslation(): {
|
|
2099
|
+
t: (key: TranslationKey, values?: TranslationValues) => string;
|
|
2100
|
+
locale: SDKLocale;
|
|
2101
|
+
formattingLocale: string;
|
|
2102
|
+
dir: "rtl" | "ltr";
|
|
2103
|
+
fmtNum: (n: number) => string;
|
|
2104
|
+
fmtCents: (cents: number, currency: string) => string;
|
|
2105
|
+
messages: SDKMessages;
|
|
2106
|
+
};
|
|
2107
|
+
|
|
1388
2108
|
interface SaaSOSProviderProps extends IOsState {
|
|
1389
2109
|
children: react__default.ReactNode;
|
|
2110
|
+
/** SDK UI language. Defaults to 'en'. Supported: en, es, fr, de, ja, zh, hi, ar */
|
|
2111
|
+
locale?: SDKLocale;
|
|
1390
2112
|
}
|
|
1391
2113
|
declare const SaaSOSProvider: react__default.FC<SaaSOSProviderProps>;
|
|
1392
2114
|
|
|
1393
|
-
|
|
2115
|
+
declare const SettingsScreen: {
|
|
2116
|
+
readonly Profile: "profile";
|
|
2117
|
+
readonly General: "general";
|
|
2118
|
+
readonly Users: "users";
|
|
2119
|
+
readonly Subscription: "subscription";
|
|
2120
|
+
readonly Usage: "usage";
|
|
2121
|
+
readonly Features: "features";
|
|
2122
|
+
readonly Notifications: "notifications";
|
|
2123
|
+
readonly Danger: "danger";
|
|
2124
|
+
};
|
|
2125
|
+
type WorkspaceSettingsSection = (typeof SettingsScreen)[keyof typeof SettingsScreen];
|
|
2126
|
+
/** Set of all valid section values — used for runtime validation */
|
|
2127
|
+
declare const SETTINGS_SCREENS: Set<WorkspaceSettingsSection>;
|
|
1394
2128
|
|
|
1395
2129
|
declare function useSaaSAuth(): {
|
|
1396
2130
|
signIn: () => Promise<void>;
|
|
@@ -3039,8 +3773,10 @@ interface SeatStatus {
|
|
|
3039
3773
|
canInvite: boolean;
|
|
3040
3774
|
/** Reason the invite is blocked, or null if allowed. */
|
|
3041
3775
|
inviteBlockReason: InviteBlockReason;
|
|
3042
|
-
/**
|
|
3043
|
-
|
|
3776
|
+
/** i18n key for the block message. Resolve with t(key, values). */
|
|
3777
|
+
inviteBlockMessageKey: string | null;
|
|
3778
|
+
/** Values for ICU interpolation in the block message. */
|
|
3779
|
+
inviteBlockMessageValues: Record<string, string | number> | null;
|
|
3044
3780
|
}
|
|
3045
3781
|
/**
|
|
3046
3782
|
* Hook that computes seat status from subscription context and workspace data.
|
|
@@ -3071,24 +3807,13 @@ declare function WorkspaceSwitcher(props: {
|
|
|
3071
3807
|
trigger: (isLoading: boolean, currentWorkspace: IWorkspace | null) => ReactNode;
|
|
3072
3808
|
}): react_jsx_runtime.JSX.Element;
|
|
3073
3809
|
|
|
3074
|
-
type Language = 'en' | 'es' | 'fr' | 'de' | 'zh' | 'ja' | 'ko';
|
|
3075
|
-
interface FormText {
|
|
3076
|
-
nameLabel: string;
|
|
3077
|
-
emailLabel: string;
|
|
3078
|
-
submitText: string;
|
|
3079
|
-
submittingText: string;
|
|
3080
|
-
errorMessage: string;
|
|
3081
|
-
}
|
|
3082
3810
|
interface BetaFormProps {
|
|
3083
3811
|
onSuccess?: () => void;
|
|
3084
3812
|
onError?: (error: string) => void;
|
|
3085
3813
|
className?: string;
|
|
3086
3814
|
fieldClassName?: string;
|
|
3087
|
-
language?: Language;
|
|
3088
|
-
customTexts?: Partial<FormText>;
|
|
3089
3815
|
autoFocus?: boolean;
|
|
3090
3816
|
showSuccessMessage?: boolean;
|
|
3091
|
-
successMessageDuration?: number;
|
|
3092
3817
|
hideLogo?: boolean;
|
|
3093
3818
|
hideTitles?: boolean;
|
|
3094
3819
|
}
|
|
@@ -3176,5 +3901,5 @@ declare const PushNotificationProvider: react__default.FC<PushNotificationProvid
|
|
|
3176
3901
|
*/
|
|
3177
3902
|
declare function usePushNotifications(): PushNotificationContextValue;
|
|
3178
3903
|
|
|
3179
|
-
export { ApiVersion, AuthApi, AuthStatus, BaseApi, BetaForm, CURRENCY_DISPLAY, CURRENCY_FLAG, EventEmitter, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SaaSOSProvider, SettingsApi, SubscriptionContextProvider, UserApi, WhenAuthenticated, WhenNoSubscription, WhenNotTrialing, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher,
|
|
3180
|
-
export type { BetaFormData, BetaFormResponse,
|
|
3904
|
+
export { ApiVersion, AuthApi, AuthStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, CURRENCY_DISPLAY, CURRENCY_FLAG, DunningState, EventEmitter, InvoiceStatuses, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SettingsApi, SettingsScreen, SubscriptionContextProvider, SubscriptionItemType, SubscriptionStatus, UserApi, WhenAuthenticated, WhenNoSubscription, WhenNotTrialing, WhenQuotaAvailable, WhenQuotaExhausted, WhenQuotaOverage, WhenQuotaThreshold, WhenRoles, WhenSubscription, WhenSubscriptionToPlans, WhenTrialEnding, WhenTrialing, WhenUnauthenticated, WhenUserFeatureDisabled, WhenUserFeatureEnabled, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceApi, WorkspaceSwitcher, calculateBillableSeats, calculateSeatOverageCents, calculateTotalSubscriptionCents, cleanBBParams, createBBUrl, createCheckoutRedirectUrls, eventEmitter, formatCents, formatOverageRate, formatOverageRateWithLabel, formatQuotaIncludedOverage, formatQuotaWithPrice, getAvailableCurrenciesFromPlans, getBasePriceCents, getBillingIntervalAndCurrencyFromPriceId, getCurrencyFlag, getCurrencySymbol, getDisplayCurrency, getPerSeatPriceCents, getPricingVariant, getQuotaDisplayValue, getQuotaDisplayWithVariant, getQuotaOverageCents, getQuotaUnitLabelFromName, getSeatPricing, getStripePriceIdForInterval, invalidateQuotaUsage, invalidateSubscription, readBBParams, resolveMaxUsers, safeRedirect, useAllQuotaUsage, useBillingPortal, useCancelSubscription, useCreateCheckoutSession, useInvoice, useInvoices, usePlanGroup, usePlanGroupVersions, usePublicPlanGroupVersion, usePublicPlans, usePushNotifications, useQuotaUsageContext, useQuotaUsageStatus, useRecordUsage, useResumeSubscription, useSaaSAuth, useSaaSOs, useSaaSSettings, useSaaSWorkspaces, useSeatStatus, useSubscription, useSubscriptionContext, useSubscriptionManagement, useTranslation, useTrialStatus, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, validateInvite, validateRedirectUrl };
|
|
3905
|
+
export type { BetaFormData, BetaFormResponse, BillingInterval, CheckoutResult, EventData, EventType, FormatQuotaWithPriceOptions, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, IEventCallbacks, IInvoice, IInvoiceListResponse, IInvoiceResponse, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, InviteBlockReason, InviteValidation, InvoiceStatus, MaxUsersConfig, OnWorkspaceChangeParams, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, SDKLocale, SDKMessages, SaaSOSProviderProps, SeatStatus, SubscriptionContextValue, SubscriptionStatusType, TrialStatus, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|