@buildbase/sdk 0.0.24 → 0.0.25

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.
Files changed (131) hide show
  1. package/dist/index.esm.js +0 -1
  2. package/dist/index.js +0 -1
  3. package/package.json +3 -2
  4. package/dist/index.esm.js.map +0 -1
  5. package/dist/index.js.map +0 -1
  6. package/dist/types/api/currency-utils.d.ts +0 -44
  7. package/dist/types/api/index.d.ts +0 -12
  8. package/dist/types/api/pricing-variant-utils.d.ts +0 -66
  9. package/dist/types/api/quota-utils.d.ts +0 -24
  10. package/dist/types/api/types.d.ts +0 -495
  11. package/dist/types/components/ErrorBoundary.d.ts +0 -81
  12. package/dist/types/components/beta/BetaForm.d.ts +0 -24
  13. package/dist/types/components/beta/api.d.ts +0 -48
  14. package/dist/types/components/beta/hooks.d.ts +0 -11
  15. package/dist/types/components/beta/schema.d.ts +0 -6
  16. package/dist/types/components/beta/types.d.ts +0 -8
  17. package/dist/types/components/dropdowns/country/countries.d.ts +0 -7
  18. package/dist/types/components/dropdowns/country/selectCountry.d.ts +0 -6
  19. package/dist/types/components/dropdowns/currency/currencies.d.ts +0 -6
  20. package/dist/types/components/dropdowns/currency/selectCurrency.d.ts +0 -6
  21. package/dist/types/components/dropdowns/language/languages.d.ts +0 -6
  22. package/dist/types/components/dropdowns/language/selectLanguage.d.ts +0 -6
  23. package/dist/types/components/dropdowns/timezone/selectTimeZone.d.ts +0 -6
  24. package/dist/types/components/dropdowns/timezone/timezones.d.ts +0 -8
  25. package/dist/types/components/features/index.d.ts +0 -130
  26. package/dist/types/components/pricing/PricingPage.d.ts +0 -49
  27. package/dist/types/components/pricing/index.d.ts +0 -2
  28. package/dist/types/components/quota/index.d.ts +0 -121
  29. package/dist/types/components/subscription/index.d.ts +0 -182
  30. package/dist/types/components/ui/alert-dialog.d.ts +0 -20
  31. package/dist/types/components/ui/avatar.d.ts +0 -6
  32. package/dist/types/components/ui/button.d.ts +0 -18
  33. package/dist/types/components/ui/command-select.d.ts +0 -13
  34. package/dist/types/components/ui/command.d.ts +0 -82
  35. package/dist/types/components/ui/dialog.d.ts +0 -19
  36. package/dist/types/components/ui/form.d.ts +0 -23
  37. package/dist/types/components/ui/input.d.ts +0 -5
  38. package/dist/types/components/ui/label.d.ts +0 -5
  39. package/dist/types/components/ui/popover.d.ts +0 -6
  40. package/dist/types/components/ui/radio-group.d.ts +0 -5
  41. package/dist/types/components/ui/scroll-area.d.ts +0 -5
  42. package/dist/types/components/ui/select.d.ts +0 -11
  43. package/dist/types/components/ui/separator.d.ts +0 -4
  44. package/dist/types/components/ui/skeleton.d.ts +0 -3
  45. package/dist/types/components/ui/switch.d.ts +0 -4
  46. package/dist/types/components/user/auth.d.ts +0 -76
  47. package/dist/types/components/user/role.d.ts +0 -84
  48. package/dist/types/contexts/AuthContext/AuthContext.d.ts +0 -9
  49. package/dist/types/contexts/AuthContext/actions.d.ts +0 -12
  50. package/dist/types/contexts/AuthContext/index.d.ts +0 -4
  51. package/dist/types/contexts/AuthContext/reducer.d.ts +0 -19
  52. package/dist/types/contexts/AuthContext/types.d.ts +0 -18
  53. package/dist/types/contexts/OSContext/OSContext.d.ts +0 -9
  54. package/dist/types/contexts/OSContext/actions.d.ts +0 -11
  55. package/dist/types/contexts/OSContext/index.d.ts +0 -4
  56. package/dist/types/contexts/OSContext/reducer.d.ts +0 -11
  57. package/dist/types/contexts/OSContext/types.d.ts +0 -16
  58. package/dist/types/contexts/QuotaUsageContext/QuotaUsageContext.d.ts +0 -22
  59. package/dist/types/contexts/QuotaUsageContext/index.d.ts +0 -2
  60. package/dist/types/contexts/QuotaUsageContext/quotaUsageInvalidation.d.ts +0 -21
  61. package/dist/types/contexts/QuotaUsageContext/types.d.ts +0 -14
  62. package/dist/types/contexts/SDKContext/SDKContextProvider.d.ts +0 -18
  63. package/dist/types/contexts/SDKContext/index.d.ts +0 -2
  64. package/dist/types/contexts/SDKContext/types.d.ts +0 -12
  65. package/dist/types/contexts/SubscriptionContext/SubscriptionContext.d.ts +0 -22
  66. package/dist/types/contexts/SubscriptionContext/index.d.ts +0 -2
  67. package/dist/types/contexts/SubscriptionContext/subscriptionInvalidation.d.ts +0 -21
  68. package/dist/types/contexts/SubscriptionContext/types.d.ts +0 -14
  69. package/dist/types/contexts/WorkspaceContext/WorkspaceContext.d.ts +0 -8
  70. package/dist/types/contexts/WorkspaceContext/actions.d.ts +0 -19
  71. package/dist/types/contexts/WorkspaceContext/index.d.ts +0 -4
  72. package/dist/types/contexts/WorkspaceContext/reducer.d.ts +0 -10
  73. package/dist/types/contexts/WorkspaceContext/types.d.ts +0 -52
  74. package/dist/types/contexts/index.d.ts +0 -14
  75. package/dist/types/contexts/shared/createContext.d.ts +0 -27
  76. package/dist/types/contexts/shared/types.d.ts +0 -21
  77. package/dist/types/contexts/shared/useAppDispatch.d.ts +0 -20
  78. package/dist/types/contexts/shared/useAppSelector.d.ts +0 -26
  79. package/dist/types/contexts/shared/useSelectWithEquality.d.ts +0 -10
  80. package/dist/types/contexts/shared/utils/reducerHelpers.d.ts +0 -11
  81. package/dist/types/contexts/shared/utils/storage.d.ts +0 -25
  82. package/dist/types/hooks/use-seat-status.d.ts +0 -42
  83. package/dist/types/hooks/use-trial-status.d.ts +0 -28
  84. package/dist/types/index.d.ts +0 -39
  85. package/dist/types/lib/api-base.d.ts +0 -49
  86. package/dist/types/lib/api-client.d.ts +0 -25
  87. package/dist/types/lib/api-utils.d.ts +0 -182
  88. package/dist/types/lib/error-handler.d.ts +0 -118
  89. package/dist/types/lib/logger.d.ts +0 -27
  90. package/dist/types/lib/useAsyncEffect.d.ts +0 -29
  91. package/dist/types/lib/utils.d.ts +0 -7
  92. package/dist/types/providers/ContextConfigProvider.d.ts +0 -15
  93. package/dist/types/providers/PortalContainer.d.ts +0 -9
  94. package/dist/types/providers/SaaSOSProvider.d.ts +0 -7
  95. package/dist/types/providers/auth/api.d.ts +0 -12
  96. package/dist/types/providers/auth/hooks.d.ts +0 -75
  97. package/dist/types/providers/auth/provider.d.ts +0 -13
  98. package/dist/types/providers/auth/types.d.ts +0 -62
  99. package/dist/types/providers/auth/utils.d.ts +0 -40
  100. package/dist/types/providers/constants.d.ts +0 -3
  101. package/dist/types/providers/events/EventEmitter.d.ts +0 -81
  102. package/dist/types/providers/events/index.d.ts +0 -2
  103. package/dist/types/providers/events/types.d.ts +0 -61
  104. package/dist/types/providers/os/api.d.ts +0 -11
  105. package/dist/types/providers/os/hooks.d.ts +0 -50
  106. package/dist/types/providers/os/types.d.ts +0 -19
  107. package/dist/types/providers/types.d.ts +0 -9
  108. package/dist/types/providers/user/api.d.ts +0 -16
  109. package/dist/types/providers/user/hooks.d.ts +0 -80
  110. package/dist/types/providers/user/provider.d.ts +0 -17
  111. package/dist/types/providers/workspace/WorkspaceSettingsProvider.d.ts +0 -9
  112. package/dist/types/providers/workspace/api.d.ts +0 -155
  113. package/dist/types/providers/workspace/hooks.d.ts +0 -161
  114. package/dist/types/providers/workspace/provider.d.ts +0 -8
  115. package/dist/types/providers/workspace/settings-manager.d.ts +0 -36
  116. package/dist/types/providers/workspace/subscription-hooks.d.ts +0 -741
  117. package/dist/types/providers/workspace/types.d.ts +0 -61
  118. package/dist/types/providers/workspace/ui/SettingsDanger.d.ts +0 -6
  119. package/dist/types/providers/workspace/ui/SettingsDialog.d.ts +0 -17
  120. package/dist/types/providers/workspace/ui/SettingsFeatures.d.ts +0 -5
  121. package/dist/types/providers/workspace/ui/SettingsGeneral.d.ts +0 -6
  122. package/dist/types/providers/workspace/ui/SettingsInvoices.d.ts +0 -12
  123. package/dist/types/providers/workspace/ui/SettingsProfile.d.ts +0 -6
  124. package/dist/types/providers/workspace/ui/SettingsSubscription.d.ts +0 -6
  125. package/dist/types/providers/workspace/ui/SettingsUsage.d.ts +0 -3
  126. package/dist/types/providers/workspace/ui/SettingsUsers.d.ts +0 -6
  127. package/dist/types/providers/workspace/ui/Sidebar.d.ts +0 -10
  128. package/dist/types/providers/workspace/ui/Skeleton.d.ts +0 -1
  129. package/dist/types/providers/workspace/ui/SubscriptionDialog.d.ts +0 -21
  130. package/dist/types/providers/workspace/ui/utils.d.ts +0 -2
  131. package/dist/types/providers/workspace/utils.d.ts +0 -28
@@ -1,161 +0,0 @@
1
- import { IUser } from '../../api/types';
2
- import type { IOsConfig, IOsState } from '../os/types';
3
- import { WorkspaceApi } from './api';
4
- import { IWorkspace, IWorkspaceUser } from './types';
5
- /**
6
- * Main workspace management hook for the SDK.
7
- * Provides workspace state, CRUD operations, and user management.
8
- *
9
- * @returns An object containing:
10
- * - `workspaces`: Array of all workspaces the user has access to
11
- * - `currentWorkspace`: Currently selected workspace (null if none selected)
12
- * - `loading`: Boolean indicating if workspaces are being fetched
13
- * - `error`: Error message string (null if no error)
14
- * - `refreshing`: Boolean indicating if workspaces are being refreshed in background
15
- * - `switching`: Boolean - true when a workspace switch is in progress
16
- * - `fetchWorkspaces()`: Function to fetch all workspaces
17
- * - `refreshWorkspaces()`: Function to refresh workspaces in background (non-blocking)
18
- * - `setCurrentWorkspace(workspace)`: Function to set the current workspace (direct, no callback)
19
- * - `switchToWorkspace(workspace)`: Centralized switch - calls onWorkspaceChange first, then sets workspace
20
- * - `resetCurrentWorkspace()`: Function to clear the current workspace
21
- * - `createWorkspace(name, image?)`: Function to create a new workspace
22
- * - `updateWorkspace(workspace, data)`: Function to update a workspace
23
- * - `deleteWorkspace(workspaceId)`: Function to delete a workspace (owner only)
24
- * - `getWorkspace(workspaceId)`: Function to fetch a specific workspace
25
- * - `getUsers(workspaceId)`: Function to fetch users in a workspace
26
- * - `addUser(workspaceId, email, role)`: Function to add a user to a workspace
27
- * - `removeUser(workspaceId, userId)`: Function to remove a user from a workspace
28
- * - `updateUser(workspaceId, userId, config)`: Function to update a user in a workspace
29
- * - `getProfile()`: Function to fetch current user profile
30
- * - `updateUserProfile(config)`: Function to update current user profile
31
- * - `allFeatures`: Array of all available feature flags
32
- * - `getFeatures()`: Function to fetch all available features
33
- * - `updateFeature(workspaceId, key, value)`: Function to update a feature flag
34
- *
35
- * @example
36
- * ```tsx
37
- * function WorkspaceList() {
38
- * const { workspaces, loading, fetchWorkspaces } = useSaaSWorkspaces();
39
- *
40
- * useEffect(() => {
41
- * fetchWorkspaces();
42
- * }, [fetchWorkspaces]);
43
- *
44
- * if (loading) return <Loading />;
45
- *
46
- * return (
47
- * <ul>
48
- * {workspaces.map(ws => (
49
- * <li key={ws._id}>{ws.name}</li>
50
- * ))}
51
- * </ul>
52
- * );
53
- * }
54
- * ```
55
- *
56
- * @example
57
- * ```tsx
58
- * // Create a new workspace
59
- * function CreateWorkspace() {
60
- * const { createWorkspace } = useSaaSWorkspaces();
61
- *
62
- * const handleCreate = async () => {
63
- * try {
64
- * await createWorkspace('My Workspace', 'https://example.com/logo.png');
65
- * } catch (error) {
66
- * console.error('Failed to create workspace:', error);
67
- * }
68
- * };
69
- *
70
- * return <button onClick={handleCreate}>Create Workspace</button>;
71
- * }
72
- * ```
73
- *
74
- * @example
75
- * ```tsx
76
- * // Delete workspace (owner only)
77
- * function DeleteWorkspaceButton({ workspaceId }) {
78
- * const { deleteWorkspace } = useSaaSWorkspaces();
79
- *
80
- * const handleDelete = async () => {
81
- * if (!confirm('Are you sure?')) return;
82
- * try {
83
- * await deleteWorkspace(workspaceId);
84
- * } catch (error) {
85
- * // Error: "Only the workspace creator can delete the workspace"
86
- * alert(error.message);
87
- * }
88
- * };
89
- *
90
- * return <button onClick={handleDelete}>Delete</button>;
91
- * }
92
- * ```
93
- *
94
- * @example
95
- * ```tsx
96
- * // Edge case: Workspace removed from user's access
97
- * function WorkspaceContent() {
98
- * const { currentWorkspace, workspaces } = useSaaSWorkspaces();
99
- *
100
- * // If current workspace is not in the list, it was removed
101
- * // The hook automatically switches to first available workspace
102
- * if (!currentWorkspace) {
103
- * return <p>No workspace selected</p>;
104
- * }
105
- *
106
- * return <div>{currentWorkspace.name}</div>;
107
- * }
108
- * ```
109
- */
110
- /** Memoized WorkspaceApi instance. Recreates only when serverUrl, version, or orgId change. */
111
- export declare function useWorkspaceApi(os: IOsConfig): WorkspaceApi;
112
- /** OS state + memoized WorkspaceApi. BaseApi.ensureReady() throws if config is not set. Use when a hook needs both (e.g. subscription hooks, useSaaSWorkspaces). */
113
- export declare function useWorkspaceApiWithOs(): {
114
- os: IOsState;
115
- api: WorkspaceApi;
116
- };
117
- export declare const useSaaSWorkspaces: () => {
118
- workspaces: IWorkspace[];
119
- loading: boolean;
120
- error: string | null;
121
- fetchWorkspaces: () => Promise<void>;
122
- refreshWorkspaces: () => Promise<void>;
123
- refreshing: boolean;
124
- currentWorkspace: IWorkspace | null;
125
- setCurrentWorkspace: (ws: IWorkspace, options?: {
126
- forceEmit?: boolean;
127
- }) => void;
128
- switchToWorkspace: (ws: IWorkspace, options?: {
129
- forceEmit?: boolean;
130
- }) => Promise<void>;
131
- resetCurrentWorkspace: () => void;
132
- createWorkspace: (name: string, image?: string) => Promise<void>;
133
- allFeatures: import("./types").IWorkspaceFeature[];
134
- getFeatures: () => Promise<import("./types").IWorkspaceFeature[] | null>;
135
- updateFeature: (workspaceId: string, key: string, value: boolean) => Promise<IWorkspace>;
136
- getWorkspace: (workspaceId: string) => Promise<IWorkspace>;
137
- updateWorkspace: (ws: IWorkspace, _data: Partial<IWorkspace>) => Promise<void>;
138
- getUsers: (workspaceId: string) => Promise<IWorkspaceUser[]>;
139
- addUser: (workspaceId: string, email: string, role: string) => Promise<{
140
- userId: string;
141
- workspace: IWorkspace;
142
- message: string;
143
- }>;
144
- removeUser: (workspaceId: string, userId: string) => Promise<{
145
- userId: string;
146
- workspace: IWorkspace;
147
- message: string;
148
- }>;
149
- updateUser: (workspaceId: string, userId: string, config: Partial<IWorkspaceUser>) => Promise<{
150
- userId: string;
151
- workspace: IWorkspace;
152
- message: string;
153
- }>;
154
- getProfile: () => Promise<IUser>;
155
- updateUserProfile: (config: Partial<IUser>) => Promise<IUser>;
156
- deleteWorkspace: (workspaceId: string) => Promise<{
157
- success: boolean;
158
- }>;
159
- switching: boolean;
160
- switchingToId: string | null;
161
- };
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { IWorkspace } from './types';
3
- export declare const WorkspaceProvider: ({ children }: {
4
- children: ReactNode;
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- export declare function WorkspaceSwitcher(props: {
7
- trigger: (isLoading: boolean, currentWorkspace: IWorkspace | null) => ReactNode;
8
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,36 +0,0 @@
1
- import type { WorkspaceSettingsSection } from './ui/SettingsDialog';
2
- /**
3
- * Global settings manager for workspace settings dialog
4
- * Handles opening/closing the dialog internally
5
- */
6
- declare class WorkspaceSettingsManager {
7
- private listeners;
8
- private currentState;
9
- /**
10
- * Subscribe to settings dialog state changes
11
- */
12
- subscribe(listener: (open: boolean, section: WorkspaceSettingsSection) => void): () => void;
13
- /**
14
- * Get current state
15
- */
16
- getState(): {
17
- open: boolean;
18
- section: WorkspaceSettingsSection;
19
- };
20
- /**
21
- * Open workspace settings dialog
22
- * @param section - Optional section to open to (defaults to 'profile')
23
- */
24
- openWorkspaceSettings(section?: WorkspaceSettingsSection): void;
25
- /**
26
- * Close settings dialog
27
- */
28
- closeSettings(): void;
29
- /**
30
- * Change section without opening/closing
31
- */
32
- setSection(section: WorkspaceSettingsSection): void;
33
- private notifyListeners;
34
- }
35
- export declare const workspaceSettingsManager: WorkspaceSettingsManager;
36
- export {};