@buildbase/sdk 0.0.1 → 0.0.3

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 (42) hide show
  1. package/dist/index.d.ts +3 -128
  2. package/dist/index.esm.js +5 -5
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +5 -5
  5. package/dist/index.js.map +1 -1
  6. package/dist/saas-os.css +1 -1
  7. package/dist/types/contexts/{AuthContext.d.ts → AuthContext/AuthContext.d.ts} +2 -2
  8. package/dist/types/contexts/AuthContext/actions.d.ts +11 -0
  9. package/dist/types/contexts/AuthContext/index.d.ts +4 -0
  10. package/dist/types/contexts/{reducers/authReducer.d.ts → AuthContext/reducer.d.ts} +3 -2
  11. package/dist/types/contexts/AuthContext/types.d.ts +16 -0
  12. package/dist/types/contexts/{OSContext.d.ts → OSContext/OSContext.d.ts} +2 -2
  13. package/dist/types/contexts/OSContext/actions.d.ts +9 -0
  14. package/dist/types/contexts/OSContext/index.d.ts +4 -0
  15. package/dist/types/contexts/{reducers/osReducer.d.ts → OSContext/reducer.d.ts} +1 -1
  16. package/dist/types/contexts/OSContext/types.d.ts +12 -0
  17. package/dist/types/contexts/SDKContext/SDKContextProvider.d.ts +18 -0
  18. package/dist/types/contexts/SDKContext/index.d.ts +2 -0
  19. package/dist/types/contexts/SDKContext/types.d.ts +12 -0
  20. package/dist/types/contexts/{WorkspaceContext.d.ts → WorkspaceContext/WorkspaceContext.d.ts} +1 -1
  21. package/dist/types/contexts/WorkspaceContext/actions.d.ts +16 -0
  22. package/dist/types/contexts/WorkspaceContext/index.d.ts +4 -0
  23. package/dist/types/contexts/{reducers/workspaceReducer.d.ts → WorkspaceContext/reducer.d.ts} +1 -1
  24. package/dist/types/contexts/{types.d.ts → WorkspaceContext/types.d.ts} +1 -32
  25. package/dist/types/contexts/index.d.ts +12 -10
  26. package/dist/types/contexts/{useAppDispatch.d.ts → shared/useAppDispatch.d.ts} +3 -1
  27. package/dist/types/contexts/{useAppSelector.d.ts → shared/useAppSelector.d.ts} +3 -3
  28. package/dist/types/index.d.ts +0 -5
  29. package/dist/types/lib/api-client.d.ts +7 -7
  30. package/dist/types/providers/PortalContainer.d.ts +3 -2
  31. package/dist/types/providers/auth/provider.d.ts +7 -2
  32. package/dist/types/providers/workspace/hooks.d.ts +1 -1
  33. package/dist/types/providers/workspace/provider.d.ts +1 -1
  34. package/dist/types/providers/workspace/ui/Skeleton.d.ts +1 -0
  35. package/package.json +12 -4
  36. package/dist/types/contexts/SDKContextProvider.d.ts +0 -15
  37. package/dist/types/contexts/actionCreators.d.ts +0 -29
  38. package/dist/types/contexts/reducers/index.d.ts +0 -3
  39. package/dist/types/hooks/use-mobile.d.ts +0 -1
  40. /package/dist/types/contexts/{createContext.d.ts → shared/createContext.d.ts} +0 -0
  41. /package/dist/types/contexts/{utils → shared/utils}/reducerHelpers.d.ts +0 -0
  42. /package/dist/types/contexts/{utils → shared/utils}/storage.d.ts +0 -0
package/dist/index.d.ts CHANGED
@@ -23,14 +23,6 @@ interface AuthSession {
23
23
  accessToken: string;
24
24
  expires: string;
25
25
  }
26
- interface IAuthState {
27
- user: AuthUser | null;
28
- session: AuthSession | null;
29
- isLoading: boolean;
30
- isAuthenticated: boolean;
31
- isRedirecting: boolean;
32
- status: AuthStatus;
33
- }
34
26
  interface IAuthConfig {
35
27
  clientId: string;
36
28
  redirectUrl: string;
@@ -158,7 +150,7 @@ interface IWorkspaceUser {
158
150
  }
159
151
 
160
152
  declare function WorkspaceSwitcher(props: {
161
- trigger: (currentWorkspace: IWorkspace | null) => ReactNode;
153
+ trigger: (isLoading: boolean, currentWorkspace: IWorkspace | null) => ReactNode;
162
154
  onWorkspaceChange: (workspace: IWorkspace) => Promise<void>;
163
155
  }): react_jsx_runtime.JSX.Element;
164
156
 
@@ -175,7 +167,7 @@ declare const useSaaSWorkspaces: () => {
175
167
  resetCurrentWorkspace: () => void;
176
168
  createWorkspace: (name: string, image: string) => Promise<void>;
177
169
  allFeatures: IWorkspaceFeature[];
178
- getFeatures: () => Promise<IWorkspaceFeature[]>;
170
+ getFeatures: () => Promise<IWorkspaceFeature[] | null>;
179
171
  updateFeature: (workspaceId: string, key: string, value: boolean) => Promise<IWorkspace>;
180
172
  getWorkspace: (workspaceId: string) => Promise<IWorkspace>;
181
173
  switching: boolean;
@@ -190,121 +182,4 @@ declare const useSaaSWorkspaces: () => {
190
182
  updateUserProfile: (config: Partial<IUser>) => Promise<IUser>;
191
183
  };
192
184
 
193
- type AuthAction = {
194
- type: 'AUTHENTICATION_STARTED';
195
- } | {
196
- type: 'AUTHENTICATION_FAILED';
197
- } | {
198
- type: 'SET_SESSION';
199
- payload: AuthSession;
200
- } | {
201
- type: 'REMOVE_SESSION';
202
- };
203
- type WorkspaceAction = {
204
- type: 'SET_WORKSPACES';
205
- payload: IWorkspace[];
206
- } | {
207
- type: 'SET_ALL_FEATURES';
208
- payload: IWorkspaceFeature[];
209
- } | {
210
- type: 'SET_CURRENT_WORKSPACE';
211
- payload: IWorkspace;
212
- } | {
213
- type: 'RESET_CURRENT_WORKSPACE';
214
- } | {
215
- type: 'SET_IS_INITIALIZED';
216
- payload: boolean;
217
- } | {
218
- type: 'SET_LOADING';
219
- payload: boolean;
220
- } | {
221
- type: 'SET_ERROR';
222
- payload: string | null;
223
- } | {
224
- type: 'SET_REFRESHING';
225
- payload: boolean;
226
- } | {
227
- type: 'SET_SWITCHING';
228
- payload: boolean;
229
- };
230
- interface WorkspaceState {
231
- workspaces: IWorkspace[];
232
- loading: boolean;
233
- error: string | null;
234
- currentWorkspace: IWorkspace | null;
235
- refreshing: boolean;
236
- switching: boolean;
237
- isInitialized: boolean;
238
- allFeatures: IWorkspaceFeature[];
239
- }
240
- type OSAction = {
241
- type: 'SET_SAAS_OS_CONFIG';
242
- payload: IOsState;
243
- } | {
244
- type: 'REMOVE_SAAS_OS_CONFIG';
245
- };
246
-
247
- /**
248
- * Combined SDK State
249
- * Represents the complete state structure across all contexts
250
- */
251
- interface SDKState {
252
- os: IOsState;
253
- auth: IAuthState;
254
- workspaces: WorkspaceState;
255
- }
256
- /**
257
- * Combined selector hook - select from all contexts at once
258
- *
259
- * @param selector Function that selects a value from the combined SDK state
260
- * @param equalityFn Optional equality function for comparison (default: Object.is)
261
- *
262
- * @example
263
- * ```tsx
264
- * // Get entire combined state
265
- * const sdk = useAppSelector();
266
- *
267
- * // Get specific context
268
- * const auth = useAppSelector(state => state.auth);
269
- * const user = useAppSelector(state => state.auth.user);
270
- *
271
- * // Get multiple fields across contexts
272
- * const { user, currentWorkspace, serverUrl } = useAppSelector(state => ({
273
- * user: state.auth.user,
274
- * currentWorkspace: state.workspaces.currentWorkspace,
275
- * serverUrl: state.os.serverUrl,
276
- * }));
277
- * ```
278
- */
279
- declare function useAppSelector<Selected = SDKState>(selector?: (state: SDKState) => Selected, equalityFn?: (a: Selected, b: Selected) => boolean): Selected;
280
-
281
- /**
282
- * Combined SDK Dispatch
283
- * Provides dispatch functions for all contexts
284
- */
285
- interface SDKDispatch {
286
- auth: (action: AuthAction) => void;
287
- os: (action: OSAction) => void;
288
- workspaces: (action: WorkspaceAction) => void;
289
- }
290
- /**
291
- * Combined dispatch hook - dispatch actions to all contexts
292
- *
293
- * @example
294
- * ```tsx
295
- * const dispatch = useAppDispatch();
296
- *
297
- * // Dispatch to auth context
298
- * dispatch.auth(authActions.setSession(session));
299
- *
300
- * // Dispatch to workspace context
301
- * dispatch.workspaces(workspaceActions.setCurrentWorkspace(workspace));
302
- *
303
- * // Dispatch to OS context
304
- * dispatch.os(osActions.setSaaSOSConfig(config));
305
- * ```
306
- */
307
- declare function useAppDispatch(): SDKDispatch;
308
-
309
- export { BetaForm, SaaSOSProvider, WhenAuthenticated, WhenRoles, WhenUnauthenticated, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceSwitcher, useAppDispatch, useAppSelector, useSaaSAuth, useSaaSWorkspaces };
310
- export type { SDKDispatch, SDKState, SaaSOSProviderProps };
185
+ export { BetaForm, SaaSOSProvider, WhenAuthenticated, WhenRoles, WhenUnauthenticated, WhenWorkspaceFeatureDisabled, WhenWorkspaceFeatureEnabled, WhenWorkspaceRoles, WorkspaceSwitcher, useSaaSAuth, useSaaSWorkspaces };