@elevasis/ui 1.3.1 → 1.3.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.
- package/dist/api/index.js +1 -1
- package/dist/auth/guards/AdminGuard.d.ts +32 -0
- package/dist/auth/guards/AdminGuard.d.ts.map +1 -0
- package/dist/auth/guards/ProtectedRoute.d.ts +60 -0
- package/dist/auth/guards/ProtectedRoute.d.ts.map +1 -0
- package/dist/auth/guards/__tests__/AdminGuard.test.d.ts +12 -0
- package/dist/auth/guards/__tests__/AdminGuard.test.d.ts.map +1 -0
- package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts +14 -0
- package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts.map +1 -0
- package/dist/auth/index.d.ts +14 -174
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-A3MCANC6.js → chunk-6IX5JZEH.js} +110 -50
- package/dist/chunk-GIFAF5ZS.js +313 -0
- package/dist/chunk-JQLT6HBI.js +850 -0
- package/dist/chunk-LFYO3MDC.js +58 -0
- package/dist/{chunk-72HOBFMP.js → chunk-LTQAAIGE.js} +3 -3
- package/dist/{chunk-JBFFCZI4.js → chunk-U34YGJQB.js} +1 -93
- package/dist/components/index.d.ts +1 -1353
- package/dist/components/index.js +1 -20
- package/dist/components/navigation/index.d.ts +2 -32
- package/dist/components/navigation/index.js +1 -29
- package/dist/execution/index.d.ts +63 -231
- package/dist/execution/index.js +1 -4
- package/dist/graph/index.css +0 -1
- package/dist/graph/index.d.ts +4 -203
- package/dist/graph/index.js +1 -1
- package/dist/hooks/command-queue/index.d.ts +7 -0
- package/dist/hooks/command-queue/index.d.ts.map +1 -0
- package/dist/hooks/command-queue/useCommandQueue.d.ts +33 -0
- package/dist/hooks/command-queue/useCommandQueue.d.ts.map +1 -0
- package/dist/hooks/command-queue/useCommandQueueTotals.d.ts +17 -0
- package/dist/hooks/command-queue/useCommandQueueTotals.d.ts.map +1 -0
- package/dist/hooks/command-queue/useDeleteTask.d.ts +5 -0
- package/dist/hooks/command-queue/useDeleteTask.d.ts.map +1 -0
- package/dist/hooks/command-queue/usePatchTask.d.ts +6 -0
- package/dist/hooks/command-queue/usePatchTask.d.ts.map +1 -0
- package/dist/hooks/command-queue/useSubmitAction.d.ts +29 -0
- package/dist/hooks/command-queue/useSubmitAction.d.ts.map +1 -0
- package/dist/hooks/executions/index.d.ts +16 -0
- package/dist/hooks/executions/index.d.ts.map +1 -0
- package/dist/hooks/executions/useBulkDeleteExecutions.d.ts +15 -0
- package/dist/hooks/executions/useBulkDeleteExecutions.d.ts.map +1 -0
- package/dist/hooks/executions/useCancelExecution.d.ts +20 -0
- package/dist/hooks/executions/useCancelExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useDeleteExecution.d.ts +13 -0
- package/dist/hooks/executions/useDeleteExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useExecuteAsync.d.ts +21 -0
- package/dist/hooks/executions/useExecuteAsync.d.ts.map +1 -0
- package/dist/hooks/executions/useExecution.d.ts +10 -0
- package/dist/hooks/executions/useExecution.d.ts.map +1 -0
- package/dist/hooks/executions/useExecutions.d.ts +16 -0
- package/dist/hooks/executions/useExecutions.d.ts.map +1 -0
- package/dist/hooks/executions/useResourceDefinition.d.ts +9 -0
- package/dist/hooks/executions/useResourceDefinition.d.ts.map +1 -0
- package/dist/hooks/executions/useResources.d.ts +15 -0
- package/dist/hooks/executions/useResources.d.ts.map +1 -0
- package/dist/hooks/executions/useRetryExecution.d.ts +16 -0
- package/dist/hooks/executions/useRetryExecution.d.ts.map +1 -0
- package/dist/hooks/feature-access/createUseFeatureAccess.d.ts +44 -0
- package/dist/hooks/feature-access/createUseFeatureAccess.d.ts.map +1 -0
- package/dist/hooks/feature-access/index.d.ts +2 -0
- package/dist/hooks/feature-access/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +11 -4554
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -4
- package/dist/hooks/monitoring/index.d.ts +9 -0
- package/dist/hooks/monitoring/index.d.ts.map +1 -0
- package/dist/hooks/monitoring/useActivities.d.ts +52 -0
- package/dist/hooks/monitoring/useActivities.d.ts.map +1 -0
- package/dist/hooks/monitoring/useCostSummary.d.ts +7 -0
- package/dist/hooks/monitoring/useCostSummary.d.ts.map +1 -0
- package/dist/hooks/monitoring/useExecutionHealth.d.ts +10 -0
- package/dist/hooks/monitoring/useExecutionHealth.d.ts.map +1 -0
- package/dist/hooks/monitoring/useExecutionLogs.d.ts +56 -0
- package/dist/hooks/monitoring/useExecutionLogs.d.ts.map +1 -0
- package/dist/hooks/monitoring/useNotifications.d.ts +11 -0
- package/dist/hooks/monitoring/useNotifications.d.ts.map +1 -0
- package/dist/hooks/notifications/index.d.ts +8 -0
- package/dist/hooks/notifications/index.d.ts.map +1 -0
- package/dist/hooks/notifications/useMarkAllAsRead.d.ts +2 -0
- package/dist/hooks/notifications/useMarkAllAsRead.d.ts.map +1 -0
- package/dist/hooks/notifications/useMarkAsRead.d.ts +2 -0
- package/dist/hooks/notifications/useMarkAsRead.d.ts.map +1 -0
- package/dist/hooks/notifications/useNotificationCount.d.ts +8 -0
- package/dist/hooks/notifications/useNotificationCount.d.ts.map +1 -0
- package/dist/hooks/observability/index.d.ts +19 -0
- package/dist/hooks/observability/index.d.ts.map +1 -0
- package/dist/hooks/observability/useBusinessImpact.d.ts +9 -0
- package/dist/hooks/observability/useBusinessImpact.d.ts.map +1 -0
- package/dist/hooks/observability/useCostBreakdown.d.ts +10 -0
- package/dist/hooks/observability/useCostBreakdown.d.ts.map +1 -0
- package/dist/hooks/observability/useCostByModel.d.ts +3 -0
- package/dist/hooks/observability/useCostByModel.d.ts.map +1 -0
- package/dist/hooks/observability/useCostTrends.d.ts +3 -0
- package/dist/hooks/observability/useCostTrends.d.ts.map +1 -0
- package/dist/hooks/observability/useDashboardMetrics.d.ts +3 -0
- package/dist/hooks/observability/useDashboardMetrics.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorAnalysis.d.ts +7 -0
- package/dist/hooks/observability/useErrorAnalysis.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorDetails.d.ts +20 -0
- package/dist/hooks/observability/useErrorDetails.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorDistribution.d.ts +12 -0
- package/dist/hooks/observability/useErrorDistribution.d.ts.map +1 -0
- package/dist/hooks/observability/useErrorTrends.d.ts +12 -0
- package/dist/hooks/observability/useErrorTrends.d.ts.map +1 -0
- package/dist/hooks/observability/useResolveError.d.ts +17 -0
- package/dist/hooks/observability/useResolveError.d.ts.map +1 -0
- package/dist/hooks/observability/useTopFailingResources.d.ts +13 -0
- package/dist/hooks/observability/useTopFailingResources.d.ts.map +1 -0
- package/dist/hooks/published.d.ts +19 -4279
- package/dist/hooks/published.d.ts.map +1 -0
- package/dist/hooks/published.js +367 -4
- package/dist/hooks/scheduling/index.d.ts +5 -0
- package/dist/hooks/scheduling/index.d.ts.map +1 -0
- package/dist/hooks/scheduling/useSchedules.d.ts +185 -0
- package/dist/hooks/scheduling/useSchedules.d.ts.map +1 -0
- package/dist/hooks/sessions/index.d.ts +8 -0
- package/dist/hooks/sessions/index.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessionExecutions.d.ts +13 -0
- package/dist/hooks/sessions/useSessionExecutions.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessionMessages.d.ts +7 -0
- package/dist/hooks/sessions/useSessionMessages.d.ts.map +1 -0
- package/dist/hooks/sessions/useSessions.d.ts +26 -0
- package/dist/hooks/sessions/useSessions.d.ts.map +1 -0
- package/dist/index.css +0 -118
- package/dist/index.d.ts +15 -7889
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1119 -24
- package/dist/initialization/InitializationProvider.d.ts +48 -0
- package/dist/initialization/InitializationProvider.d.ts.map +1 -0
- package/dist/initialization/hooks/useAppInitialization.d.ts +32 -0
- package/dist/initialization/hooks/useAppInitialization.d.ts.map +1 -0
- package/dist/initialization/index.d.ts +22 -2361
- package/dist/initialization/index.d.ts.map +1 -0
- package/dist/initialization/index.js +1 -1
- package/dist/organization/context/OrganizationProvider.d.ts +20 -0
- package/dist/organization/context/OrganizationProvider.d.ts.map +1 -0
- package/dist/organization/hooks/useOrgInitialization.d.ts +56 -0
- package/dist/organization/hooks/useOrgInitialization.d.ts.map +1 -0
- package/dist/organization/index.d.ts +21 -283
- package/dist/organization/index.d.ts.map +1 -0
- package/dist/organization/index.js +3 -3
- package/dist/profile/context/ProfileProvider.d.ts +27 -0
- package/dist/profile/context/ProfileProvider.d.ts.map +1 -0
- package/dist/profile/hooks/useUserProfile.d.ts +31 -0
- package/dist/profile/hooks/useUserProfile.d.ts.map +1 -0
- package/dist/profile/index.d.ts +14 -2290
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/provider/CoreAuthKitInner.d.ts +12 -0
- package/dist/provider/CoreAuthKitInner.d.ts.map +1 -0
- package/dist/provider/ElevasisCoreProvider.d.ts +39 -0
- package/dist/provider/ElevasisCoreProvider.d.ts.map +1 -0
- package/dist/provider/ElevasisServiceContext.d.ts +31 -0
- package/dist/provider/ElevasisServiceContext.d.ts.map +1 -0
- package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts +2 -0
- package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts.map +1 -0
- package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts +2 -0
- package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts.map +1 -0
- package/dist/provider/index.d.ts +7 -372
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +3 -12
- package/dist/provider/published.d.ts +9 -263
- package/dist/provider/published.d.ts.map +1 -0
- package/dist/provider/published.js +5 -5
- package/dist/provider/types.d.ts +143 -0
- package/dist/provider/types.d.ts.map +1 -0
- package/dist/provider/types.js +1 -0
- package/dist/sdk-barrel.d.ts +20 -0
- package/dist/sdk-barrel.d.ts.map +1 -0
- package/dist/supabase/index.d.ts +0 -255
- package/dist/theme/cssVariables.d.ts +12 -0
- package/dist/theme/cssVariables.d.ts.map +1 -0
- package/dist/theme/cssVariables.js +93 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/presets/__tests__/getPreset.test.d.ts +2 -0
- package/dist/theme/presets/__tests__/getPreset.test.d.ts.map +1 -0
- package/dist/theme/presets/abyss.d.ts +3 -0
- package/dist/theme/presets/abyss.d.ts.map +1 -0
- package/dist/theme/presets/abyss.js +54 -0
- package/dist/theme/presets/aurora.d.ts +8 -0
- package/dist/theme/presets/aurora.d.ts.map +1 -0
- package/dist/theme/presets/aurora.js +59 -0
- package/dist/theme/presets/canopy.d.ts +3 -0
- package/dist/theme/presets/canopy.d.ts.map +1 -0
- package/dist/theme/presets/canopy.js +58 -0
- package/dist/theme/presets/cyber-flux.d.ts +8 -0
- package/dist/theme/presets/cyber-flux.d.ts.map +1 -0
- package/dist/theme/presets/cyber-flux.js +66 -0
- package/dist/theme/presets/cyber-strike.d.ts +9 -0
- package/dist/theme/presets/cyber-strike.d.ts.map +1 -0
- package/dist/theme/presets/cyber-strike.js +62 -0
- package/dist/theme/presets/cyber-void.d.ts +8 -0
- package/dist/theme/presets/cyber-void.d.ts.map +1 -0
- package/dist/theme/presets/cyber-void.js +62 -0
- package/dist/theme/presets/cyber-volt.d.ts +8 -0
- package/dist/theme/presets/cyber-volt.d.ts.map +1 -0
- package/dist/theme/presets/cyber-volt.js +66 -0
- package/dist/theme/presets/default.d.ts +4 -0
- package/dist/theme/presets/default.d.ts.map +1 -0
- package/dist/theme/presets/ember.d.ts +8 -0
- package/dist/theme/presets/ember.d.ts.map +1 -0
- package/dist/theme/presets/ember.js +63 -0
- package/dist/theme/presets/honey.d.ts +3 -0
- package/dist/theme/presets/honey.d.ts.map +1 -0
- package/dist/theme/presets/honey.js +62 -0
- package/dist/theme/presets/index.d.ts +6 -0
- package/dist/theme/presets/index.d.ts.map +1 -0
- package/dist/theme/presets/index.js +39 -0
- package/dist/theme/presets/midnight.d.ts +8 -0
- package/dist/theme/presets/midnight.d.ts.map +1 -0
- package/dist/theme/presets/midnight.js +68 -0
- package/dist/theme/presets/obsidian.d.ts +3 -0
- package/dist/theme/presets/obsidian.d.ts.map +1 -0
- package/dist/theme/presets/obsidian.js +56 -0
- package/dist/theme/presets/regal.d.ts +8 -0
- package/dist/theme/presets/regal.d.ts.map +1 -0
- package/dist/theme/presets/regal.js +63 -0
- package/dist/theme/presets/rose-gold.d.ts +8 -0
- package/dist/theme/presets/rose-gold.d.ts.map +1 -0
- package/dist/theme/presets/rose-gold.js +63 -0
- package/dist/theme/presets/slate.d.ts +3 -0
- package/dist/theme/presets/slate.d.ts.map +1 -0
- package/dist/theme/presets/slate.js +56 -0
- package/dist/theme/presets/tactical.d.ts +8 -0
- package/dist/theme/presets/tactical.d.ts.map +1 -0
- package/dist/theme/presets/tactical.js +57 -0
- package/dist/theme/presets/types.d.ts +26 -0
- package/dist/theme/presets/types.d.ts.map +1 -0
- package/dist/theme/presets/types.js +1 -0
- package/dist/utils/index.d.ts +1 -22
- package/dist/utils/index.js +1 -1
- package/package.json +4 -52
- package/dist/chunk-3KMDHCAR.js +0 -52
- package/dist/chunk-6BJOYF6E.js +0 -8
- package/dist/chunk-BLO4SISK.js +0 -113
- package/dist/chunk-HUWJXLLF.js +0 -681
- package/dist/chunk-JVAZHVNV.js +0 -110
- package/dist/chunk-JYSYHVLU.js +0 -379
- package/dist/chunk-NE36BUGQ.js +0 -146
- package/dist/chunk-O3PY6B6E.js +0 -749
- package/dist/chunk-OXVOHOP3.js +0 -661
- package/dist/chunk-PSLKGOBZ.js +0 -58
- package/dist/chunk-RJCA5672.js +0 -1664
- package/dist/chunk-TMFCNFLW.js +0 -107
- package/dist/chunk-TN3PU2WK.js +0 -748
- package/dist/chunk-TZPAA4RC.js +0 -1461
- package/dist/chunk-W7ZBF5AA.js +0 -1
- package/dist/chunk-YZ6GTZXL.js +0 -48
- package/dist/components/command-queue/index.css +0 -53
- package/dist/components/command-queue/index.d.ts +0 -204
- package/dist/components/command-queue/index.js +0 -12
- package/dist/components/forms/index.d.ts +0 -56
- package/dist/components/forms/index.js +0 -2
- package/dist/components/index.css +0 -443
- package/dist/components/monitoring/index.d.ts +0 -66
- package/dist/components/monitoring/index.js +0 -2
- package/dist/components/notifications/index.d.ts +0 -52
- package/dist/components/notifications/index.js +0 -5
- package/dist/components/resource-definition/index.css +0 -388
- package/dist/components/resource-definition/index.d.ts +0 -301
- package/dist/components/resource-definition/index.js +0 -3
- package/dist/display/index.css +0 -53
- package/dist/display/index.d.ts +0 -606
- package/dist/display/index.js +0 -7
- package/dist/execution/index.css +0 -388
- package/dist/provider/index.css +0 -61
- package/dist/{chunk-TYV5NJV2.js → chunk-BUZONXAW.js} +0 -0
- package/dist/{chunk-UMXDDEAG.js → chunk-SFF5MJEI.js} +1 -1
- /package/dist/{chunk-NXHL23JW.js → chunk-XXDDMASA.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initialization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAE3G;;;;;GAKG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -2,6 +2,6 @@ export { createUseAppInitialization } from '../chunk-PVVQTENF.js';
|
|
|
2
2
|
import '../chunk-RNP5R5I3.js';
|
|
3
3
|
export { InitializationContext, InitializationProvider, useInitialization } from '../chunk-NEK6JKPW.js';
|
|
4
4
|
import '../chunk-L2CM2CUA.js';
|
|
5
|
-
import '../chunk-DD3CCMCZ.js';
|
|
6
5
|
import '../chunk-KA7LO7U5.js';
|
|
6
|
+
import '../chunk-DD3CCMCZ.js';
|
|
7
7
|
import '../chunk-7PLEQFHO.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type OrganizationContextValue } from './OrganizationContext';
|
|
3
|
+
/**
|
|
4
|
+
* Provides organization state to its subtree via React Context.
|
|
5
|
+
*
|
|
6
|
+
* Must be rendered inside:
|
|
7
|
+
* - ElevasisServiceProvider (needs apiRequest)
|
|
8
|
+
* - ProfileProvider (needs useProfile for last_visited_org preference)
|
|
9
|
+
* - A TanStack QueryClientProvider (needs useQueryClient for cache invalidation)
|
|
10
|
+
*
|
|
11
|
+
* Behaviors:
|
|
12
|
+
* - Fetches all memberships for the authenticated user via GET /memberships/my-memberships
|
|
13
|
+
* - Selects the active org by priority: saved preference > WorkOS org ID > first membership
|
|
14
|
+
* - Persists org switches to PATCH /users/me { last_visited_org }
|
|
15
|
+
* - Clears all state when the user signs out (user becomes null)
|
|
16
|
+
*/
|
|
17
|
+
export declare function OrganizationProvider({ children }: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}): import("react").FunctionComponentElement<import("react").ProviderProps<OrganizationContextValue | null>>;
|
|
20
|
+
//# sourceMappingURL=OrganizationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrganizationProvider.d.ts","sourceRoot":"","sources":["../../../src/organization/context/OrganizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAM/F,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAE1F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4GAuNzE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { MembershipWithDetails } from '@repo/core';
|
|
2
|
+
/**
|
|
3
|
+
* Type for the useOrganizations hook return value
|
|
4
|
+
*/
|
|
5
|
+
export interface UseOrganizationsReturn {
|
|
6
|
+
currentWorkOSOrganizationId: string | null;
|
|
7
|
+
currentMembership: MembershipWithDetails | null;
|
|
8
|
+
setCurrentWorkOSOrganizationId: (id: string | null) => void;
|
|
9
|
+
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
10
|
+
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
11
|
+
setOrganizationsLoading: (loading: boolean) => void;
|
|
12
|
+
setOrganizationsError: (error: string | null) => void;
|
|
13
|
+
organizations: {
|
|
14
|
+
isInitializing: boolean;
|
|
15
|
+
isOrgRefreshing: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type for the useApiClient hook return value
|
|
21
|
+
*/
|
|
22
|
+
export interface UseApiClientReturn {
|
|
23
|
+
apiRequest: <T = unknown>(path: string, options?: RequestInit) => Promise<T>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Return type for useOrgInitialization hook
|
|
27
|
+
*/
|
|
28
|
+
export interface UseOrgInitializationReturn {
|
|
29
|
+
memberships: MembershipWithDetails[];
|
|
30
|
+
isInitializing: boolean;
|
|
31
|
+
isLoading: boolean;
|
|
32
|
+
isInitialized: boolean;
|
|
33
|
+
error: string | null;
|
|
34
|
+
currentOrganization: MembershipWithDetails['organization'] | null;
|
|
35
|
+
retry: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create a useOrgInitialization hook for your app.
|
|
39
|
+
*
|
|
40
|
+
* Usage in app:
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { createUseOrgInitialization } from '@repo/ui/organization'
|
|
43
|
+
* import { useOrganizations } from './hooks/useOrganizations'
|
|
44
|
+
* import { useApiClient } from './api/hooks/useApiClient'
|
|
45
|
+
*
|
|
46
|
+
* export const useOrgInitialization = createUseOrgInitialization(
|
|
47
|
+
* useOrganizations,
|
|
48
|
+
* useApiClient
|
|
49
|
+
* )
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* This pattern allows the shared package to provide the hook logic
|
|
53
|
+
* while each app provides its own hook instances.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createUseOrgInitialization(useOrganizations: () => UseOrganizationsReturn, useApiClient: () => UseApiClientReturn): () => UseOrgInitializationReturn;
|
|
56
|
+
//# sourceMappingURL=useOrgInitialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOrgInitialization.d.ts","sourceRoot":"","sources":["../../../src/organization/hooks/useOrgInitialization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEvD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C,iBAAiB,EAAE,qBAAqB,GAAG,IAAI,CAAA;IAC/C,8BAA8B,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC3D,oBAAoB,EAAE,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,KAAK,IAAI,CAAA;IACxE,4BAA4B,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7D,uBAAuB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACnD,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACrD,aAAa,EAAE;QACb,cAAc,EAAE,OAAO,CAAA;QACvB,eAAe,EAAE,OAAO,CAAA;QACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KACrB,CAAA;CACF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAC7E;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,qBAAqB,EAAE,CAAA;IACpC,cAAc,EAAE,OAAO,CAAA;IACvB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,mBAAmB,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,IAAI,CAAA;IACjE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CACxC,gBAAgB,EAAE,MAAM,sBAAsB,EAC9C,YAAY,EAAE,MAAM,kBAAkB,GACrC,MAAM,0BAA0B,CA6NlC"}
|
|
@@ -1,284 +1,22 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { UseBoundStore, StoreApi } from 'zustand';
|
|
4
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
|
-
* Multi-tenancy
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
calibration?: boolean;
|
|
29
|
-
seo?: boolean;
|
|
30
|
-
};
|
|
31
|
-
training?: {
|
|
32
|
-
allowed_course_groups?: CourseGroup[];
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Per-user-per-org config (stored in org_memberships.config)
|
|
37
|
-
* Overrides org-level feature config for specific users
|
|
38
|
-
*/
|
|
39
|
-
type MembershipFeatureConfig = OrgFeatureConfig;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Organization Membership types based on WorkOS API
|
|
43
|
-
*/
|
|
44
|
-
interface OrganizationMembership {
|
|
45
|
-
object: 'organization_membership';
|
|
46
|
-
id: string;
|
|
47
|
-
userId: string;
|
|
48
|
-
organizationId: string;
|
|
49
|
-
role: {
|
|
50
|
-
slug: string;
|
|
51
|
-
};
|
|
52
|
-
status: 'active' | 'inactive';
|
|
53
|
-
createdAt: string;
|
|
54
|
-
updatedAt: string;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Extended membership with user and organization details for UI
|
|
58
|
-
*/
|
|
59
|
-
interface MembershipWithDetails extends OrganizationMembership {
|
|
60
|
-
user?: {
|
|
61
|
-
id: string;
|
|
62
|
-
email: string;
|
|
63
|
-
firstName?: string;
|
|
64
|
-
lastName?: string;
|
|
65
|
-
profilePictureUrl?: string;
|
|
66
|
-
};
|
|
67
|
-
organization?: {
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
|
-
workos_org_id: string;
|
|
71
|
-
primaryDomain?: string;
|
|
72
|
-
is_test?: boolean;
|
|
73
|
-
status?: string;
|
|
74
|
-
metadata?: Record<string, unknown>;
|
|
75
|
-
config?: OrgFeatureConfig;
|
|
76
|
-
};
|
|
77
|
-
config?: MembershipFeatureConfig;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The value exposed by OrganizationProvider to all consumers.
|
|
82
|
-
*/
|
|
83
|
-
interface OrganizationContextValue {
|
|
84
|
-
/** WorkOS organization ID of the currently selected organization. */
|
|
85
|
-
currentWorkOSOrganizationId: string | null;
|
|
86
|
-
/** Supabase (UUID) organization ID of the currently selected organization. */
|
|
87
|
-
currentSupabaseOrganizationId: string | null;
|
|
88
|
-
/** Full membership record for the currently selected organization. */
|
|
89
|
-
currentMembership: MembershipWithDetails | null;
|
|
90
|
-
/** All memberships for the authenticated user. */
|
|
91
|
-
memberships: MembershipWithDetails[];
|
|
92
|
-
/** True while the initial membership list is being fetched. */
|
|
93
|
-
isInitializing: boolean;
|
|
94
|
-
/** True while a subsequent org switch / refresh is in flight. */
|
|
95
|
-
isOrgRefreshing: boolean;
|
|
96
|
-
/** Error message if the membership fetch or org switch failed. */
|
|
97
|
-
error: string | null;
|
|
98
|
-
/**
|
|
99
|
-
* Switch the active organization.
|
|
100
|
-
*
|
|
101
|
-
* Persists the selection to `last_visited_org` on the user profile and
|
|
102
|
-
* invalidates all org-scoped TanStack Query cache entries.
|
|
103
|
-
*
|
|
104
|
-
* @param workosOrgId - WorkOS organization ID to switch to.
|
|
105
|
-
*/
|
|
106
|
-
switchOrganization: (workosOrgId: string) => void;
|
|
107
|
-
/**
|
|
108
|
-
* Re-fetch memberships and retry org selection after an error.
|
|
109
|
-
*/
|
|
110
|
-
retry: () => Promise<void>;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Consumes the nearest OrganizationProvider.
|
|
114
|
-
*
|
|
115
|
-
* @throws {Error} If called outside of an OrganizationProvider tree.
|
|
116
|
-
*/
|
|
117
|
-
declare function useOrganization(): OrganizationContextValue;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Provides organization state to its subtree via React Context.
|
|
121
|
-
*
|
|
122
|
-
* Must be rendered inside:
|
|
123
|
-
* - ElevasisServiceProvider (needs apiRequest)
|
|
124
|
-
* - ProfileProvider (needs useProfile for last_visited_org preference)
|
|
125
|
-
* - A TanStack QueryClientProvider (needs useQueryClient for cache invalidation)
|
|
126
|
-
*
|
|
127
|
-
* Behaviors:
|
|
128
|
-
* - Fetches all memberships for the authenticated user via GET /memberships/my-memberships
|
|
129
|
-
* - Selects the active org by priority: saved preference > WorkOS org ID > first membership
|
|
130
|
-
* - Persists org switches to PATCH /users/me { last_visited_org }
|
|
131
|
-
* - Clears all state when the user signs out (user becomes null)
|
|
132
|
-
*/
|
|
133
|
-
declare function OrganizationProvider({ children }: {
|
|
134
|
-
children: ReactNode;
|
|
135
|
-
}): react.FunctionComponentElement<react.ProviderProps<OrganizationContextValue | null>>;
|
|
136
|
-
|
|
137
|
-
interface OrganizationsState {
|
|
138
|
-
currentWorkOSOrganizationId: string | null;
|
|
139
|
-
currentSupabaseOrganizationId: string | null;
|
|
140
|
-
currentMembership: MembershipWithDetails | null;
|
|
141
|
-
isInitializing: boolean;
|
|
142
|
-
isOrgRefreshing: boolean;
|
|
143
|
-
error: string | null;
|
|
144
|
-
}
|
|
145
|
-
interface OrganizationsActions {
|
|
146
|
-
setCurrentWorkOSOrganizationId: (workOSorgId: string | null) => void;
|
|
147
|
-
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
148
|
-
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
149
|
-
setOrganizationsLoading: (loading: boolean) => void;
|
|
150
|
-
setOrganizationsError: (error: string | null) => void;
|
|
151
|
-
}
|
|
152
|
-
interface OrganizationsSlice extends OrganizationsActions {
|
|
153
|
-
organizations: OrganizationsState;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Type for Zustand's immer set function.
|
|
158
|
-
* This is a simplified version that works with immer middleware.
|
|
159
|
-
* The replace parameter uses false | undefined to match Zustand's type for immer mutation support.
|
|
160
|
-
*/
|
|
161
|
-
type ImmerSet<T> = (partial: T | Partial<T> | ((state: T) => void), replace?: false | undefined, action?: string) => void;
|
|
162
|
-
/**
|
|
163
|
-
* Creates the organizations slice for Zustand store.
|
|
164
|
-
*
|
|
165
|
-
* Usage in app:
|
|
166
|
-
* ```typescript
|
|
167
|
-
* import { createOrganizationsSlice } from '@repo/ui/organization'
|
|
168
|
-
*
|
|
169
|
-
* // Define AppState that extends OrganizationsSlice
|
|
170
|
-
* interface AppState extends OrganizationsSlice {
|
|
171
|
-
* // other slices...
|
|
172
|
-
* }
|
|
173
|
-
*
|
|
174
|
-
* // Pass the slice creator to your store
|
|
175
|
-
* const useAppStore = create<AppState>()(
|
|
176
|
-
* devtools(
|
|
177
|
-
* immer((...a) => ({
|
|
178
|
-
* ...createOrganizationsSlice(...a),
|
|
179
|
-
* // other slices...
|
|
180
|
-
* }))
|
|
181
|
-
* )
|
|
182
|
-
* )
|
|
183
|
-
* ```
|
|
184
|
-
*
|
|
185
|
-
* Note: The slice creator accepts set/get/store from any Zustand store
|
|
186
|
-
* that extends OrganizationsSlice. It returns the slice state and actions.
|
|
187
|
-
*/
|
|
188
|
-
declare const createOrganizationsSlice: <TAppState extends OrganizationsSlice>(set: ImmerSet<TAppState>, _get: () => TAppState, _store: unknown) => OrganizationsSlice;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Factory function to create a useOrganizations hook for your app's store.
|
|
192
|
-
*
|
|
193
|
-
* Usage in app:
|
|
194
|
-
* ```typescript
|
|
195
|
-
* import { createUseOrganizations } from '@repo/ui/organization'
|
|
196
|
-
* import { useAppStore } from './zustand/store'
|
|
197
|
-
*
|
|
198
|
-
* export const useOrganizations = createUseOrganizations(useAppStore)
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* This pattern allows the shared package to provide the hook logic
|
|
202
|
-
* while each app provides its own store instance.
|
|
203
|
-
*/
|
|
204
|
-
declare function createUseOrganizations<TStore extends OrganizationsSlice>(useStore: UseBoundStore<StoreApi<TStore>>): () => {
|
|
205
|
-
setCurrentWorkOSOrganizationId: (workOSorgId: string | null) => void;
|
|
206
|
-
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
207
|
-
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
208
|
-
setOrganizationsLoading: (loading: boolean) => void;
|
|
209
|
-
setOrganizationsError: (error: string | null) => void;
|
|
210
|
-
organizations: OrganizationsState;
|
|
211
|
-
currentWorkOSOrganizationId: string | null;
|
|
212
|
-
currentSupabaseOrganizationId: string | null;
|
|
213
|
-
currentMembership: MembershipWithDetails | null;
|
|
214
|
-
isInitializing: boolean;
|
|
215
|
-
isOrgRefreshing: boolean;
|
|
216
|
-
error: string | null;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Type for the useOrganizations hook return value
|
|
221
|
-
*/
|
|
222
|
-
interface UseOrganizationsReturn {
|
|
223
|
-
currentWorkOSOrganizationId: string | null;
|
|
224
|
-
currentMembership: MembershipWithDetails | null;
|
|
225
|
-
setCurrentWorkOSOrganizationId: (id: string | null) => void;
|
|
226
|
-
setCurrentMembership: (membership: MembershipWithDetails | null) => void;
|
|
227
|
-
setOrganizationsInitializing: (initializing: boolean) => void;
|
|
228
|
-
setOrganizationsLoading: (loading: boolean) => void;
|
|
229
|
-
setOrganizationsError: (error: string | null) => void;
|
|
230
|
-
organizations: {
|
|
231
|
-
isInitializing: boolean;
|
|
232
|
-
isOrgRefreshing: boolean;
|
|
233
|
-
error: string | null;
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Type for the useApiClient hook return value
|
|
238
|
-
*/
|
|
239
|
-
interface UseApiClientReturn {
|
|
240
|
-
apiRequest: <T = unknown>(path: string, options?: RequestInit) => Promise<T>;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Return type for useOrgInitialization hook
|
|
244
|
-
*/
|
|
245
|
-
interface UseOrgInitializationReturn {
|
|
246
|
-
memberships: MembershipWithDetails[];
|
|
247
|
-
isInitializing: boolean;
|
|
248
|
-
isLoading: boolean;
|
|
249
|
-
isInitialized: boolean;
|
|
250
|
-
error: string | null;
|
|
251
|
-
currentOrganization: MembershipWithDetails['organization'] | null;
|
|
252
|
-
retry: () => Promise<void>;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Factory function to create a useOrgInitialization hook for your app.
|
|
256
|
-
*
|
|
257
|
-
* Usage in app:
|
|
258
|
-
* ```typescript
|
|
259
|
-
* import { createUseOrgInitialization } from '@repo/ui/organization'
|
|
260
|
-
* import { useOrganizations } from './hooks/useOrganizations'
|
|
261
|
-
* import { useApiClient } from './api/hooks/useApiClient'
|
|
262
|
-
*
|
|
263
|
-
* export const useOrgInitialization = createUseOrgInitialization(
|
|
264
|
-
* useOrganizations,
|
|
265
|
-
* useApiClient
|
|
266
|
-
* )
|
|
267
|
-
* ```
|
|
268
|
-
*
|
|
269
|
-
* This pattern allows the shared package to provide the hook logic
|
|
270
|
-
* while each app provides its own hook instances.
|
|
271
|
-
*/
|
|
272
|
-
declare function createUseOrgInitialization(useOrganizations: () => UseOrganizationsReturn, useApiClient: () => UseApiClientReturn): () => UseOrgInitializationReturn;
|
|
273
|
-
|
|
274
|
-
type Organization = NonNullable<MembershipWithDetails['organization']>;
|
|
275
|
-
interface OrganizationSwitcherProps {
|
|
276
|
-
currentOrganization: Organization | undefined;
|
|
277
|
-
memberships: MembershipWithDetails[];
|
|
278
|
-
isLoading: boolean;
|
|
279
|
-
onSwitch: (workosOrgId: string) => Promise<void>;
|
|
280
|
-
}
|
|
281
|
-
declare function OrganizationSwitcher({ currentOrganization, memberships, isLoading, onSwitch }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
282
|
-
|
|
283
|
-
export { OrganizationProvider, OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations, useOrganization };
|
|
284
|
-
export type { OrganizationContextValue, OrganizationsActions, OrganizationsSlice, OrganizationsState, UseApiClientReturn, UseOrgInitializationReturn, UseOrganizationsReturn };
|
|
2
|
+
* Organization module - Multi-tenancy concerns
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - OrganizationProvider: Context provider that internalizes org state (replaces Zustand slice)
|
|
6
|
+
* - useOrganization: Hook for consuming OrganizationProvider context
|
|
7
|
+
* - OrganizationContextValue: Value type exposed by OrganizationProvider
|
|
8
|
+
* - OrganizationsState, OrganizationsActions, OrganizationsSlice: Store types (legacy)
|
|
9
|
+
* - createOrganizationsSlice: Zustand slice creator for organization state (legacy)
|
|
10
|
+
* - createUseOrganizations: Factory to create useOrganizations hook for app's store (deprecated)
|
|
11
|
+
* - createUseOrgInitialization: Factory to create useOrgInitialization hook (deprecated)
|
|
12
|
+
* - OrganizationSwitcher: Component for switching organizations
|
|
13
|
+
*/
|
|
14
|
+
export { OrganizationProvider } from './context/OrganizationProvider';
|
|
15
|
+
export { useOrganization } from './context/OrganizationContext';
|
|
16
|
+
export type { OrganizationContextValue } from './context/OrganizationContext';
|
|
17
|
+
export * from './store/types';
|
|
18
|
+
export { createOrganizationsSlice } from './store/organizationsSlice';
|
|
19
|
+
export { createUseOrganizations } from './hooks/useOrganizations';
|
|
20
|
+
export { createUseOrgInitialization } from './hooks/useOrgInitialization';
|
|
21
|
+
export type { UseOrganizationsReturn, UseApiClientReturn, UseOrgInitializationReturn } from './hooks/useOrgInitialization';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAG7E,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from '../chunk-U34YGJQB.js';
|
|
2
2
|
import '../chunk-RNP5R5I3.js';
|
|
3
|
-
export { OrganizationProvider } from '../chunk-
|
|
3
|
+
export { OrganizationProvider } from '../chunk-SFF5MJEI.js';
|
|
4
4
|
import '../chunk-L2CM2CUA.js';
|
|
5
|
-
export { useOrganization } from '../chunk-DD3CCMCZ.js';
|
|
6
5
|
import '../chunk-KA7LO7U5.js';
|
|
6
|
+
export { useOrganization } from '../chunk-DD3CCMCZ.js';
|
|
7
7
|
import '../chunk-7PLEQFHO.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SupabaseUserProfile } from '@repo/core';
|
|
3
|
+
export interface ProfileContextValue {
|
|
4
|
+
profile: SupabaseUserProfile | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
refetch: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Consumes the nearest ProfileProvider.
|
|
11
|
+
*
|
|
12
|
+
* @throws {Error} If called outside of a ProfileProvider tree.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useProfile(): ProfileContextValue;
|
|
15
|
+
/**
|
|
16
|
+
* Provides shared profile state to its subtree via React Context.
|
|
17
|
+
*
|
|
18
|
+
* Wraps useUserProfile so that all consumers share one profile fetch
|
|
19
|
+
* instead of each triggering an independent sync call.
|
|
20
|
+
*
|
|
21
|
+
* Must be rendered inside the auth and service provider layers so that
|
|
22
|
+
* the underlying hook can access useAuthContext and useElevasisServices.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ProfileProvider({ children }: {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react").FunctionComponentElement<import("react").ProviderProps<ProfileContextValue | null>>;
|
|
27
|
+
//# sourceMappingURL=ProfileProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileProvider.d.ts","sourceRoot":"","sources":["../../../src/profile/context/ProfileProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAA;AAEhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAID;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,mBAAmB,CAShD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,uGAGpE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SupabaseUserProfile } from '@repo/core';
|
|
2
|
+
interface UseUserProfileOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Optional error handler for profile sync failures
|
|
5
|
+
* If not provided, errors are logged to console
|
|
6
|
+
*/
|
|
7
|
+
onError?: (context: {
|
|
8
|
+
phase: 'profile-sync';
|
|
9
|
+
userId?: string;
|
|
10
|
+
}, error: Error) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface UseUserProfileReturn {
|
|
13
|
+
profile: SupabaseUserProfile | null;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: Error | null;
|
|
16
|
+
refetch: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hook for managing user profile data with automatic WorkOS -> Supabase sync
|
|
20
|
+
*
|
|
21
|
+
* This hook:
|
|
22
|
+
* 1. Automatically syncs WorkOS user data to Supabase on authentication
|
|
23
|
+
* 2. Provides access to the user's Supabase profile data
|
|
24
|
+
* 3. Handles loading states and errors
|
|
25
|
+
* 4. Includes a refetch function for manual updates
|
|
26
|
+
*
|
|
27
|
+
* @param options - Optional configuration including error handler
|
|
28
|
+
*/
|
|
29
|
+
export declare const useUserProfile: (options?: UseUserProfileOptions) => UseUserProfileReturn;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=useUserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserProfile.d.ts","sourceRoot":"","sources":["../../../src/profile/hooks/useUserProfile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACtF;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,qBAAqB,KAAG,oBAyEhE,CAAA"}
|