@buildbase/sdk 0.0.47 → 0.0.49
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 +119 -0
- package/CHANGELOG.md +42 -0
- package/README.md +198 -0
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +403 -4
- package/dist/index.mjs +1 -1
- package/dist/react/index.cjs +36 -0
- package/dist/react/index.d.ts +123 -35
- package/dist/react/index.mjs +5 -5
- package/package.json +11 -9
- package/dist/index.js +0 -1
- package/dist/react/index.js +0 -36
- /package/dist/data/{index.js → index.cjs} +0 -0
package/dist/react/index.d.ts
CHANGED
|
@@ -27,6 +27,19 @@ interface IUser extends IDocument {
|
|
|
27
27
|
currency?: string;
|
|
28
28
|
attributes?: Record<string, string | number | boolean>;
|
|
29
29
|
}
|
|
30
|
+
/** A registered passkey (WebAuthn credential) — no key material exposed. */
|
|
31
|
+
interface IPasskeySummary {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
deviceType?: string;
|
|
35
|
+
backedUp?: boolean;
|
|
36
|
+
lastUsedAt?: string;
|
|
37
|
+
createdAt?: string;
|
|
38
|
+
/** Auth domain the credential is bound to */
|
|
39
|
+
rpId?: string;
|
|
40
|
+
/** False when the org's auth domain changed and this credential can no longer be used to sign in */
|
|
41
|
+
active?: boolean;
|
|
42
|
+
}
|
|
30
43
|
interface IAsset extends IDocument {
|
|
31
44
|
_id: string;
|
|
32
45
|
createdAt: string;
|
|
@@ -1108,8 +1121,12 @@ declare abstract class BaseApi {
|
|
|
1108
1121
|
protected url(path: string): string;
|
|
1109
1122
|
/** Merge auth + custom + per-request headers. */
|
|
1110
1123
|
private buildHeaders;
|
|
1124
|
+
/** Fire the onError callback exactly once per error, regardless of call path. */
|
|
1125
|
+
private reportError;
|
|
1111
1126
|
/** Execute fetch with timeout, retries, debug logging, and error callback. */
|
|
1112
1127
|
private executeFetch;
|
|
1128
|
+
/** Internal: execute fetch against a resolved URL with timeout, retries, debug logging, and error callback. */
|
|
1129
|
+
private executeFetchUrl;
|
|
1113
1130
|
/**
|
|
1114
1131
|
* Execute request and parse JSON with handleApiResponse (throws on !response.ok).
|
|
1115
1132
|
* Use for standard JSON APIs.
|
|
@@ -1120,6 +1137,12 @@ declare abstract class BaseApi {
|
|
|
1120
1137
|
* Caller is responsible for checking response.ok and parsing body.
|
|
1121
1138
|
*/
|
|
1122
1139
|
protected fetchResponse(path: string, init?: RequestInit): Promise<Response>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Execute request against an absolute URL (bypasses baseUrl).
|
|
1142
|
+
* Useful for endpoints outside the default basePath (e.g. /auth vs /public).
|
|
1143
|
+
* Gets the same timeout, retry, header-merge, and error-callback handling as fetchResponse.
|
|
1144
|
+
*/
|
|
1145
|
+
protected fetchAbsoluteUrl(absoluteUrl: string, init?: RequestInit): Promise<Response>;
|
|
1123
1146
|
/**
|
|
1124
1147
|
* Throw an error from a failed response.
|
|
1125
1148
|
* Tries to parse JSON error body; falls back to status-based message.
|
|
@@ -1144,6 +1167,7 @@ interface AuthRequestParams {
|
|
|
1144
1167
|
success: string;
|
|
1145
1168
|
error: string;
|
|
1146
1169
|
};
|
|
1170
|
+
state?: string;
|
|
1147
1171
|
}
|
|
1148
1172
|
interface AuthRequestResponse {
|
|
1149
1173
|
success: boolean;
|
|
@@ -1158,8 +1182,8 @@ declare class AuthApi extends BaseApi {
|
|
|
1158
1182
|
});
|
|
1159
1183
|
/**
|
|
1160
1184
|
* Initiate OAuth sign-in flow. Returns redirect URL to the auth provider.
|
|
1161
|
-
*
|
|
1162
|
-
* so we
|
|
1185
|
+
* Auth endpoints sit at /api/v1/auth/ (outside the /public basePath),
|
|
1186
|
+
* so we use fetchAbsoluteUrl to get timeout, retry, and error handling via BaseApi.
|
|
1163
1187
|
*/
|
|
1164
1188
|
requestAuth(params: AuthRequestParams): Promise<AuthRequestResponse>;
|
|
1165
1189
|
/** Fetch user profile with the given session ID (used after OAuth redirect or from storage). */
|
|
@@ -1351,6 +1375,9 @@ declare class WorkspaceApi extends BaseApi {
|
|
|
1351
1375
|
getWorkspace(workspaceId: string): Promise<IWorkspace>;
|
|
1352
1376
|
getProfile(): Promise<IUser>;
|
|
1353
1377
|
updateUserProfile(config: Partial<IUser>): Promise<IUser>;
|
|
1378
|
+
getPasskeys(): Promise<IPasskeySummary[]>;
|
|
1379
|
+
renamePasskey(passkeyId: string, name: string): Promise<void>;
|
|
1380
|
+
deletePasskey(passkeyId: string): Promise<void>;
|
|
1354
1381
|
/**
|
|
1355
1382
|
* Get current subscription for a workspace
|
|
1356
1383
|
* Returns subscription details including plan, plan version, and group information
|
|
@@ -2196,9 +2223,25 @@ declare function useFullScreenLoader(): FullScreenLoaderContextValue;
|
|
|
2196
2223
|
* All user-facing strings are defined here.
|
|
2197
2224
|
*/
|
|
2198
2225
|
interface SDKMessages {
|
|
2226
|
+
security: {
|
|
2227
|
+
inactive: string;
|
|
2228
|
+
inactiveHint: string;
|
|
2229
|
+
passkeysTitle: string;
|
|
2230
|
+
passkeysDescription: string;
|
|
2231
|
+
noPasskeys: string;
|
|
2232
|
+
addHint: string;
|
|
2233
|
+
rename: string;
|
|
2234
|
+
remove: string;
|
|
2235
|
+
removeTitle: string;
|
|
2236
|
+
removeDescription: string;
|
|
2237
|
+
renamePlaceholder: string;
|
|
2238
|
+
lastUsed: string;
|
|
2239
|
+
added: string;
|
|
2240
|
+
};
|
|
2199
2241
|
settings: {
|
|
2200
2242
|
titles: {
|
|
2201
2243
|
profile: string;
|
|
2244
|
+
security: string;
|
|
2202
2245
|
general: string;
|
|
2203
2246
|
users: string;
|
|
2204
2247
|
subscription: string;
|
|
@@ -2213,6 +2256,7 @@ interface SDKMessages {
|
|
|
2213
2256
|
account: string;
|
|
2214
2257
|
workspace: string;
|
|
2215
2258
|
profile: string;
|
|
2259
|
+
security: string;
|
|
2216
2260
|
general: string;
|
|
2217
2261
|
users: string;
|
|
2218
2262
|
subscription: string;
|
|
@@ -2994,6 +3038,7 @@ declare const WhenUnauthenticated: {
|
|
|
2994
3038
|
|
|
2995
3039
|
declare const SettingsScreen: {
|
|
2996
3040
|
readonly Profile: "profile";
|
|
3041
|
+
readonly Security: "security";
|
|
2997
3042
|
readonly General: "general";
|
|
2998
3043
|
readonly Users: "users";
|
|
2999
3044
|
readonly Subscription: "subscription";
|
|
@@ -5231,37 +5276,6 @@ declare function useSeatStatus(workspace: {
|
|
|
5231
5276
|
settingsMaxUsers?: number | null;
|
|
5232
5277
|
}): SeatStatus;
|
|
5233
5278
|
|
|
5234
|
-
interface FullScreenLoaderProps {
|
|
5235
|
-
/** Content to display centered on screen. Falls back to a default spinner + message. */
|
|
5236
|
-
children?: react__default.ReactNode;
|
|
5237
|
-
/** Message shown below the default spinner (only used when no children are provided). Defaults to "Loading..." */
|
|
5238
|
-
message?: string;
|
|
5239
|
-
/** Background color of the overlay. Defaults to white (dark mode: near-black). */
|
|
5240
|
-
backgroundColor?: string;
|
|
5241
|
-
}
|
|
5242
|
-
/**
|
|
5243
|
-
* Full-screen overlay that centers its content.
|
|
5244
|
-
* Uses inline styles — works without any CSS imports.
|
|
5245
|
-
* Respects dark mode and reduced-motion preferences.
|
|
5246
|
-
*
|
|
5247
|
-
* @example Default spinner
|
|
5248
|
-
* ```tsx
|
|
5249
|
-
* <FullScreenLoader message="Signing you in..." />
|
|
5250
|
-
* ```
|
|
5251
|
-
*
|
|
5252
|
-
* @example Custom content
|
|
5253
|
-
* ```tsx
|
|
5254
|
-
* <FullScreenLoader>
|
|
5255
|
-
* <img src="/logo.svg" alt="Logo" />
|
|
5256
|
-
* <p>Loading your workspace...</p>
|
|
5257
|
-
* </FullScreenLoader>
|
|
5258
|
-
* ```
|
|
5259
|
-
*/
|
|
5260
|
-
declare const FullScreenLoader: {
|
|
5261
|
-
({ children, message, backgroundColor, }: FullScreenLoaderProps): react_jsx_runtime.JSX.Element;
|
|
5262
|
-
displayName: string;
|
|
5263
|
-
};
|
|
5264
|
-
|
|
5265
5279
|
interface BetaFormProps {
|
|
5266
5280
|
onSuccess?: () => void;
|
|
5267
5281
|
onError?: (error: string) => void;
|
|
@@ -5344,6 +5358,37 @@ interface PricingPageProps {
|
|
|
5344
5358
|
*/
|
|
5345
5359
|
declare function PricingPage({ slug, children, loadingFallback, errorFallback, redirectBaseUrl, }: PricingPageProps): react_jsx_runtime.JSX.Element;
|
|
5346
5360
|
|
|
5361
|
+
interface FullScreenLoaderProps {
|
|
5362
|
+
/** Content to display centered on screen. Falls back to a default spinner + message. */
|
|
5363
|
+
children?: react__default.ReactNode;
|
|
5364
|
+
/** Message shown below the default spinner (only used when no children are provided). Defaults to "Loading..." */
|
|
5365
|
+
message?: string;
|
|
5366
|
+
/** Background color of the overlay. Defaults to white (dark mode: near-black). */
|
|
5367
|
+
backgroundColor?: string;
|
|
5368
|
+
}
|
|
5369
|
+
/**
|
|
5370
|
+
* Full-screen overlay that centers its content.
|
|
5371
|
+
* Uses inline styles — works without any CSS imports.
|
|
5372
|
+
* Respects dark mode and reduced-motion preferences.
|
|
5373
|
+
*
|
|
5374
|
+
* @example Default spinner
|
|
5375
|
+
* ```tsx
|
|
5376
|
+
* <FullScreenLoader message="Signing you in..." />
|
|
5377
|
+
* ```
|
|
5378
|
+
*
|
|
5379
|
+
* @example Custom content
|
|
5380
|
+
* ```tsx
|
|
5381
|
+
* <FullScreenLoader>
|
|
5382
|
+
* <img src="/logo.svg" alt="Logo" />
|
|
5383
|
+
* <p>Loading your workspace...</p>
|
|
5384
|
+
* </FullScreenLoader>
|
|
5385
|
+
* ```
|
|
5386
|
+
*/
|
|
5387
|
+
declare const FullScreenLoader: {
|
|
5388
|
+
({ children, message, backgroundColor, }: FullScreenLoaderProps): react_jsx_runtime.JSX.Element;
|
|
5389
|
+
displayName: string;
|
|
5390
|
+
};
|
|
5391
|
+
|
|
5347
5392
|
declare function WorkspaceSwitcher(props: {
|
|
5348
5393
|
trigger: (isLoading: boolean, currentWorkspace: IWorkspace | null) => ReactNode;
|
|
5349
5394
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -5382,5 +5427,48 @@ declare const PushNotificationProvider: react__default.FC<PushNotificationProvid
|
|
|
5382
5427
|
*/
|
|
5383
5428
|
declare function usePushNotifications(): PushNotificationContextValue;
|
|
5384
5429
|
|
|
5385
|
-
|
|
5386
|
-
|
|
5430
|
+
interface SettingsManagerState {
|
|
5431
|
+
open: boolean;
|
|
5432
|
+
section: WorkspaceSettingsSection;
|
|
5433
|
+
/** Optional params carried from BB URL (e.g. plan selection from pricing page). Cleared on close. */
|
|
5434
|
+
params?: Record<string, string>;
|
|
5435
|
+
}
|
|
5436
|
+
/**
|
|
5437
|
+
* Global settings manager for workspace settings dialog
|
|
5438
|
+
* Handles opening/closing the dialog internally
|
|
5439
|
+
*/
|
|
5440
|
+
declare class WorkspaceSettingsManager {
|
|
5441
|
+
private listeners;
|
|
5442
|
+
private currentState;
|
|
5443
|
+
/**
|
|
5444
|
+
* Subscribe to settings dialog state changes
|
|
5445
|
+
*/
|
|
5446
|
+
subscribe(listener: (state: SettingsManagerState) => void): () => void;
|
|
5447
|
+
/**
|
|
5448
|
+
* Get current state
|
|
5449
|
+
*/
|
|
5450
|
+
getState(): SettingsManagerState;
|
|
5451
|
+
/**
|
|
5452
|
+
* Open workspace settings dialog
|
|
5453
|
+
* @param section - Optional section to open to (defaults to 'profile')
|
|
5454
|
+
* @param params - Optional params to pass to the section (e.g. plan selection from BB URL)
|
|
5455
|
+
*/
|
|
5456
|
+
openWorkspaceSettings(section?: WorkspaceSettingsSection, params?: Record<string, string>): void;
|
|
5457
|
+
/**
|
|
5458
|
+
* Close settings dialog
|
|
5459
|
+
*/
|
|
5460
|
+
closeSettings(): void;
|
|
5461
|
+
/**
|
|
5462
|
+
* Change section without opening/closing
|
|
5463
|
+
*/
|
|
5464
|
+
setSection(section: WorkspaceSettingsSection): void;
|
|
5465
|
+
/**
|
|
5466
|
+
* Clear params without changing open/section state
|
|
5467
|
+
*/
|
|
5468
|
+
clearParams(): void;
|
|
5469
|
+
private notifyListeners;
|
|
5470
|
+
}
|
|
5471
|
+
declare const workspaceSettingsManager: WorkspaceSettingsManager;
|
|
5472
|
+
|
|
5473
|
+
export { ApiVersion, AuthApi, AuthStatus, BBAction, BBScreen, BBStatus, BB_PARAM, BaseApi, BetaForm, BillingIntervals, CURRENCY_DISPLAY, CURRENCY_FLAG, CreditActionsProvider, CreditBalance, CreditBalanceContextProvider, CreditBucketSource, CreditBucketStatus, CreditStorePage, CreditTransactionType, DEFAULT_ROLE_PERMISSIONS, DunningState, EventEmitter, FullScreenLoader, InvoiceStatuses, PLAN_CURRENCY_CODES, PLAN_CURRENCY_OPTIONS, PUSH_SERVICE_WORKER_SCRIPT, Permission, PricingPage, PushApi, PushNotificationProvider, QuotaUsageContextProvider, SDKEvent, SETTINGS_SCREENS, SUPPORTED_LOCALES, SaaSOSProvider, SettingsApi, SettingsScreen, 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, readBBParams, resolveMaxUsers, resolvePermissions, safeRedirect, saveAuthIntent, useAllQuotaUsage, useBillingPortal, useCancelSubscription, 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, useUpdateSubscription, useUsageLogs, useUserAttributes, useUserFeatures, validateInvite, validateRedirectUrl, workspaceSettingsManager };
|
|
5474
|
+
export type { BBActionType, BBScreenType, BBStatusType, BetaFormData, BetaFormResponse, BillingInterval, CheckoutResult, CreditActionsDetails, CreditBalanceContextValue, CreditBalanceDetails, CreditBucketSourceType, CreditBucketStatusType, CreditStorePageDetails, CreditTransactionTypeValue, DunningStateType, EventData, EventType, FormatQuotaWithPriceOptions, FullScreenLoaderProps, GetCheckoutStripeParams, IAllQuotaUsageResponse, IBaseApiConfig, IBasePricing, IBetaConfig, ICheckoutSessionRequest, ICheckoutSessionResponse, ICheckoutStripeOptions, IConsumeCreditsRequest, IConsumeCreditsResponse, ICreditBalance, ICreditBucket, ICreditBucketsQuery, ICreditBucketsResponse, ICreditPackage, ICreditPackagePricingVariant, ICreditPurchaseRequest, ICreditPurchaseResponse, ICreditTransaction, ICreditTransactionsQuery, ICreditTransactionsResponse, IEventCallbacks, IExpiringCreditsResponse, IInvoice, IInvoiceListResponse, IInvoiceResponse, IOsConfig, IOsState, IPlan, IPlanGroup, IPlanGroupInfo, IPlanGroupLatestVersion, IPlanGroupResponse, IPlanGroupVersion, IPlanGroupVersionWithPlans, IPlanGroupVersionsResponse, IPlanVersion, IPlanVersionSummary, IPlanVersionWithPlan, IPricingVariant, IPublicCreditPackage, IPublicCreditPackagesResponse, IPublicPlanItem, IPublicPlanItemCategory, IPublicPlanVersion, IPublicPlansResponse, IQuotaByInterval, IQuotaIntervalValue, IQuotaOveragePriceIdsByInterval, IQuotaOveragesByInterval, IQuotaUsageStatus, IQuotaUsageStatusResponse, IRecordUsageRequest, IRecordUsageResponse, IStripePricesByInterval, ISubscription, ISubscriptionItem, ISubscriptionResponse, ISubscriptionUpdateRequest, ISubscriptionUpdateResponse, IUsageLogEntry, IUsageLogsQuery, IUsageLogsResponse, InviteBlockReason, InviteValidation, InvoiceStatus, InvoiceStatusType, LoadingProps, MaxUsersConfig, NotificationData, NotificationEvent, NotificationResult, OnWorkspaceChangeParams, PermissionContext, PermissionKey, PlanVersionWithPricingVariants, PricingPageDetails, PricingPageProps, QuotaDisplayValue, QuotaDisplayWithOverage, QuotaUsageContextValue, RolePermissionMap, SDKLocale, SDKMessages, SaaSOSProviderProps, SeatStatus, SettingsManagerState, SubscriptionContextValue, SubscriptionItemTypeValue, SubscriptionStatusType, TrialStatus, UserCreatedEventData, UserUpdatedEventData, WorkspaceChangedEventData, WorkspaceCreatedEventData, WorkspaceDeletedEventData, WorkspaceSettingsSection, WorkspaceUpdatedEventData, WorkspaceUserAddedEventData, WorkspaceUserRemovedEventData, WorkspaceUserRoleChangedEventData };
|