@buildbase/sdk 0.0.24 → 0.0.26
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 +82 -0
- package/dist/index.d.ts +26 -1
- package/dist/index.esm.js +5 -6
- package/dist/index.js +5 -6
- package/package.json +3 -2
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/api/currency-utils.d.ts +0 -44
- package/dist/types/api/index.d.ts +0 -12
- package/dist/types/api/pricing-variant-utils.d.ts +0 -66
- package/dist/types/api/quota-utils.d.ts +0 -24
- package/dist/types/api/types.d.ts +0 -495
- package/dist/types/components/ErrorBoundary.d.ts +0 -81
- package/dist/types/components/beta/BetaForm.d.ts +0 -24
- package/dist/types/components/beta/api.d.ts +0 -48
- package/dist/types/components/beta/hooks.d.ts +0 -11
- package/dist/types/components/beta/schema.d.ts +0 -6
- package/dist/types/components/beta/types.d.ts +0 -8
- package/dist/types/components/dropdowns/country/countries.d.ts +0 -7
- package/dist/types/components/dropdowns/country/selectCountry.d.ts +0 -6
- package/dist/types/components/dropdowns/currency/currencies.d.ts +0 -6
- package/dist/types/components/dropdowns/currency/selectCurrency.d.ts +0 -6
- package/dist/types/components/dropdowns/language/languages.d.ts +0 -6
- package/dist/types/components/dropdowns/language/selectLanguage.d.ts +0 -6
- package/dist/types/components/dropdowns/timezone/selectTimeZone.d.ts +0 -6
- package/dist/types/components/dropdowns/timezone/timezones.d.ts +0 -8
- package/dist/types/components/features/index.d.ts +0 -130
- package/dist/types/components/pricing/PricingPage.d.ts +0 -49
- package/dist/types/components/pricing/index.d.ts +0 -2
- package/dist/types/components/quota/index.d.ts +0 -121
- package/dist/types/components/subscription/index.d.ts +0 -182
- package/dist/types/components/ui/alert-dialog.d.ts +0 -20
- package/dist/types/components/ui/avatar.d.ts +0 -6
- package/dist/types/components/ui/button.d.ts +0 -18
- package/dist/types/components/ui/command-select.d.ts +0 -13
- package/dist/types/components/ui/command.d.ts +0 -82
- package/dist/types/components/ui/dialog.d.ts +0 -19
- package/dist/types/components/ui/form.d.ts +0 -23
- package/dist/types/components/ui/input.d.ts +0 -5
- package/dist/types/components/ui/label.d.ts +0 -5
- package/dist/types/components/ui/popover.d.ts +0 -6
- package/dist/types/components/ui/radio-group.d.ts +0 -5
- package/dist/types/components/ui/scroll-area.d.ts +0 -5
- package/dist/types/components/ui/select.d.ts +0 -11
- package/dist/types/components/ui/separator.d.ts +0 -4
- package/dist/types/components/ui/skeleton.d.ts +0 -3
- package/dist/types/components/ui/switch.d.ts +0 -4
- package/dist/types/components/user/auth.d.ts +0 -76
- package/dist/types/components/user/role.d.ts +0 -84
- package/dist/types/contexts/AuthContext/AuthContext.d.ts +0 -9
- package/dist/types/contexts/AuthContext/actions.d.ts +0 -12
- package/dist/types/contexts/AuthContext/index.d.ts +0 -4
- package/dist/types/contexts/AuthContext/reducer.d.ts +0 -19
- package/dist/types/contexts/AuthContext/types.d.ts +0 -18
- package/dist/types/contexts/OSContext/OSContext.d.ts +0 -9
- package/dist/types/contexts/OSContext/actions.d.ts +0 -11
- package/dist/types/contexts/OSContext/index.d.ts +0 -4
- package/dist/types/contexts/OSContext/reducer.d.ts +0 -11
- package/dist/types/contexts/OSContext/types.d.ts +0 -16
- package/dist/types/contexts/QuotaUsageContext/QuotaUsageContext.d.ts +0 -22
- package/dist/types/contexts/QuotaUsageContext/index.d.ts +0 -2
- package/dist/types/contexts/QuotaUsageContext/quotaUsageInvalidation.d.ts +0 -21
- package/dist/types/contexts/QuotaUsageContext/types.d.ts +0 -14
- package/dist/types/contexts/SDKContext/SDKContextProvider.d.ts +0 -18
- package/dist/types/contexts/SDKContext/index.d.ts +0 -2
- package/dist/types/contexts/SDKContext/types.d.ts +0 -12
- package/dist/types/contexts/SubscriptionContext/SubscriptionContext.d.ts +0 -22
- package/dist/types/contexts/SubscriptionContext/index.d.ts +0 -2
- package/dist/types/contexts/SubscriptionContext/subscriptionInvalidation.d.ts +0 -21
- package/dist/types/contexts/SubscriptionContext/types.d.ts +0 -14
- package/dist/types/contexts/WorkspaceContext/WorkspaceContext.d.ts +0 -8
- package/dist/types/contexts/WorkspaceContext/actions.d.ts +0 -19
- package/dist/types/contexts/WorkspaceContext/index.d.ts +0 -4
- package/dist/types/contexts/WorkspaceContext/reducer.d.ts +0 -10
- package/dist/types/contexts/WorkspaceContext/types.d.ts +0 -52
- package/dist/types/contexts/index.d.ts +0 -14
- package/dist/types/contexts/shared/createContext.d.ts +0 -27
- package/dist/types/contexts/shared/types.d.ts +0 -21
- package/dist/types/contexts/shared/useAppDispatch.d.ts +0 -20
- package/dist/types/contexts/shared/useAppSelector.d.ts +0 -26
- package/dist/types/contexts/shared/useSelectWithEquality.d.ts +0 -10
- package/dist/types/contexts/shared/utils/reducerHelpers.d.ts +0 -11
- package/dist/types/contexts/shared/utils/storage.d.ts +0 -25
- package/dist/types/hooks/use-seat-status.d.ts +0 -42
- package/dist/types/hooks/use-trial-status.d.ts +0 -28
- package/dist/types/index.d.ts +0 -39
- package/dist/types/lib/api-base.d.ts +0 -49
- package/dist/types/lib/api-client.d.ts +0 -25
- package/dist/types/lib/api-utils.d.ts +0 -182
- package/dist/types/lib/error-handler.d.ts +0 -118
- package/dist/types/lib/logger.d.ts +0 -27
- package/dist/types/lib/useAsyncEffect.d.ts +0 -29
- package/dist/types/lib/utils.d.ts +0 -7
- package/dist/types/providers/ContextConfigProvider.d.ts +0 -15
- package/dist/types/providers/PortalContainer.d.ts +0 -9
- package/dist/types/providers/SaaSOSProvider.d.ts +0 -7
- package/dist/types/providers/auth/api.d.ts +0 -12
- package/dist/types/providers/auth/hooks.d.ts +0 -75
- package/dist/types/providers/auth/provider.d.ts +0 -13
- package/dist/types/providers/auth/types.d.ts +0 -62
- package/dist/types/providers/auth/utils.d.ts +0 -40
- package/dist/types/providers/constants.d.ts +0 -3
- package/dist/types/providers/events/EventEmitter.d.ts +0 -81
- package/dist/types/providers/events/index.d.ts +0 -2
- package/dist/types/providers/events/types.d.ts +0 -61
- package/dist/types/providers/os/api.d.ts +0 -11
- package/dist/types/providers/os/hooks.d.ts +0 -50
- package/dist/types/providers/os/types.d.ts +0 -19
- package/dist/types/providers/types.d.ts +0 -9
- package/dist/types/providers/user/api.d.ts +0 -16
- package/dist/types/providers/user/hooks.d.ts +0 -80
- package/dist/types/providers/user/provider.d.ts +0 -17
- package/dist/types/providers/workspace/WorkspaceSettingsProvider.d.ts +0 -9
- package/dist/types/providers/workspace/api.d.ts +0 -155
- package/dist/types/providers/workspace/hooks.d.ts +0 -161
- package/dist/types/providers/workspace/provider.d.ts +0 -8
- package/dist/types/providers/workspace/settings-manager.d.ts +0 -36
- package/dist/types/providers/workspace/subscription-hooks.d.ts +0 -741
- package/dist/types/providers/workspace/types.d.ts +0 -61
- package/dist/types/providers/workspace/ui/SettingsDanger.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsDialog.d.ts +0 -17
- package/dist/types/providers/workspace/ui/SettingsFeatures.d.ts +0 -5
- package/dist/types/providers/workspace/ui/SettingsGeneral.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsInvoices.d.ts +0 -12
- package/dist/types/providers/workspace/ui/SettingsProfile.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsSubscription.d.ts +0 -6
- package/dist/types/providers/workspace/ui/SettingsUsage.d.ts +0 -3
- package/dist/types/providers/workspace/ui/SettingsUsers.d.ts +0 -6
- package/dist/types/providers/workspace/ui/Sidebar.d.ts +0 -10
- package/dist/types/providers/workspace/ui/Skeleton.d.ts +0 -1
- package/dist/types/providers/workspace/ui/SubscriptionDialog.d.ts +0 -21
- package/dist/types/providers/workspace/ui/utils.d.ts +0 -2
- package/dist/types/providers/workspace/utils.d.ts +0 -28
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export interface IWorkspace {
|
|
2
|
-
_id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
image?: string;
|
|
5
|
-
workspaceId: string;
|
|
6
|
-
users: IUser[];
|
|
7
|
-
roles: string[];
|
|
8
|
-
createdBy: string | IUser;
|
|
9
|
-
features: Record<string, boolean>;
|
|
10
|
-
/**
|
|
11
|
-
* Quota usage tracking: { [quotaSlug]: number } – how much of each quota has been used.
|
|
12
|
-
*/
|
|
13
|
-
quotas?: Record<string, number>;
|
|
14
|
-
/**
|
|
15
|
-
* Subscription limits snapshot: { [limitSlug]: number | null } – synced from subscription plan.
|
|
16
|
-
* Limits are maximum values (e.g. max-users, max-workspaces). Updated when subscription is assigned/updated.
|
|
17
|
-
*/
|
|
18
|
-
limits?: Record<string, number | null>;
|
|
19
|
-
subscription?: ISubscription | string | null;
|
|
20
|
-
/** Stripe Customer ID for this workspace. */
|
|
21
|
-
stripeCustomerId?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Billing currency locked for this workspace (set on first subscription).
|
|
24
|
-
* Stripe allows one currency per customer; all future subscriptions must use this currency.
|
|
25
|
-
* When set, subscription UI only shows/uses this currency.
|
|
26
|
-
*/
|
|
27
|
-
billingCurrency?: string | null;
|
|
28
|
-
/** Workspace onboarding config. Set on creation based on org settings. SDK shows trial CTA. */
|
|
29
|
-
pendingOnboarding?: {
|
|
30
|
-
mode: 'trial';
|
|
31
|
-
planVersionId: string;
|
|
32
|
-
} | null;
|
|
33
|
-
}
|
|
34
|
-
export interface IWorkspaceFeature {
|
|
35
|
-
_id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
userManaged: boolean;
|
|
39
|
-
defaultValue: boolean;
|
|
40
|
-
slug: string;
|
|
41
|
-
category: string;
|
|
42
|
-
createdAt: Date;
|
|
43
|
-
updatedAt: Date;
|
|
44
|
-
}
|
|
45
|
-
export interface IWorkspaceUser {
|
|
46
|
-
_id: string;
|
|
47
|
-
workspace: string | IWorkspace;
|
|
48
|
-
user: string | IUser;
|
|
49
|
-
role: string;
|
|
50
|
-
}
|
|
51
|
-
export interface WorkspaceContextValue {
|
|
52
|
-
workspaces: IWorkspace[];
|
|
53
|
-
currentWorkspace: IWorkspace | null;
|
|
54
|
-
loading: boolean;
|
|
55
|
-
switchingToId: string | null;
|
|
56
|
-
refreshing: boolean;
|
|
57
|
-
error: string | null;
|
|
58
|
-
fetchWorkspaces: () => Promise<void>;
|
|
59
|
-
refreshWorkspaces: () => Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
import type { ISubscription, IUser } from '../../api/types';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IWorkspace } from '../types';
|
|
3
|
-
export type WorkspaceSettingsSection = 'profile' | 'general' | 'users' | 'subscription' | 'usage' | 'features' | 'danger';
|
|
4
|
-
export interface WorkspaceSettingsDialogProps {
|
|
5
|
-
workspace: IWorkspace;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
open?: boolean;
|
|
8
|
-
onOpenChange?: (open: boolean) => void;
|
|
9
|
-
defaultSection?: WorkspaceSettingsSection;
|
|
10
|
-
section?: WorkspaceSettingsSection;
|
|
11
|
-
onSectionChange?: (section: WorkspaceSettingsSection) => void;
|
|
12
|
-
showTrigger?: boolean;
|
|
13
|
-
trigger?: React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
declare const WorkspaceSettingsDialog: React.FC<WorkspaceSettingsDialogProps>;
|
|
16
|
-
export default WorkspaceSettingsDialog;
|
|
17
|
-
export { WorkspaceSettingsDialog };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface SettingsInvoicesProps {
|
|
3
|
-
workspaceId: string | null | undefined;
|
|
4
|
-
/** Whether the user has an active subscription */
|
|
5
|
-
hasActiveSubscription?: boolean;
|
|
6
|
-
/** Callback when user clicks View Pricing Plans (e.g., switch to Plan tab) */
|
|
7
|
-
onViewPricingPlans?: () => void;
|
|
8
|
-
/** Number of invoices to fetch (default: 20) */
|
|
9
|
-
limit?: number;
|
|
10
|
-
}
|
|
11
|
-
declare const SettingsInvoices: React.FC<SettingsInvoicesProps>;
|
|
12
|
-
export default SettingsInvoices;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IWorkspace } from '../types';
|
|
3
|
-
import type { WorkspaceSettingsSection } from './SettingsDialog';
|
|
4
|
-
interface Props {
|
|
5
|
-
workspace: IWorkspace;
|
|
6
|
-
section: WorkspaceSettingsSection;
|
|
7
|
-
setSection: (section: WorkspaceSettingsSection) => void;
|
|
8
|
-
}
|
|
9
|
-
declare const Sidebar: React.FC<Props>;
|
|
10
|
-
export default Sidebar;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function SettingSkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BillingInterval, IPlanVersionWithPlan } from '../../../api/types';
|
|
3
|
-
interface SubscriptionDialogProps {
|
|
4
|
-
open: boolean;
|
|
5
|
-
onOpenChange: (open: boolean) => void;
|
|
6
|
-
planVersions: IPlanVersionWithPlan[];
|
|
7
|
-
currentPlanVersionId?: string | null;
|
|
8
|
-
currentStripePriceId?: string | null;
|
|
9
|
-
/**
|
|
10
|
-
* When set, only this currency is allowed (workspace has existing Stripe billing; Stripe does not allow multiple currencies per customer).
|
|
11
|
-
* When null/undefined, all plan currencies are available.
|
|
12
|
-
*/
|
|
13
|
-
billingCurrency?: string | null;
|
|
14
|
-
/** Current workspace member count — used to show billable seats in the comparison table. */
|
|
15
|
-
currentMemberCount?: number;
|
|
16
|
-
/** Called when user selects a plan. Currency is optional (for display/logging only; not sent to API). */
|
|
17
|
-
onSelectPlan: (planVersionId: string, billingInterval: BillingInterval, currency?: string) => Promise<void>;
|
|
18
|
-
loading?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare const SubscriptionDialog: React.FC<SubscriptionDialogProps>;
|
|
21
|
-
export default SubscriptionDialog;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IWorkspace } from './types';
|
|
2
|
-
export declare const workspaceStorage: {
|
|
3
|
-
saveCurrentWorkspace: (workspace: IWorkspace | null) => void;
|
|
4
|
-
loadCurrentWorkspace: () => string | null;
|
|
5
|
-
clearCurrentWorkspace: () => void;
|
|
6
|
-
isWorkspaceValid: (workspaceId: string | null, availableWorkspaces: IWorkspace[]) => boolean;
|
|
7
|
-
getStorageKey: () => string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Check if a user is the owner of a workspace
|
|
11
|
-
* @param workspace - The workspace to check
|
|
12
|
-
* @param userId - The user ID to check
|
|
13
|
-
* @returns true if the user is the workspace owner, false otherwise
|
|
14
|
-
*/
|
|
15
|
-
export declare function isWorkspaceOwner(workspace: IWorkspace, userId: string | null | undefined): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get the workspace owner ID safely
|
|
18
|
-
* @param workspace - The workspace
|
|
19
|
-
* @returns The owner ID as a string, or null if not available
|
|
20
|
-
*/
|
|
21
|
-
export declare function getWorkspaceOwnerId(workspace: IWorkspace): string | null;
|
|
22
|
-
/**
|
|
23
|
-
* Type guard to safely get user role from workspace users array
|
|
24
|
-
* @param workspace - The workspace
|
|
25
|
-
* @param userId - The user ID to find
|
|
26
|
-
* @returns The user's role as a string, or null if not found
|
|
27
|
-
*/
|
|
28
|
-
export declare function getWorkspaceUserRole(workspace: IWorkspace, userId: string | null | undefined): string | null;
|