@elevasis/ui 1.2.0 → 1.3.0
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/hooks/useApiClient.d.ts +54 -0
- package/dist/api/hooks/useApiClient.d.ts.map +1 -0
- package/dist/api/hooks/useApiClient.js +185 -0
- package/dist/api/index.d.ts +49 -11
- package/dist/api/index.js +3 -2
- package/dist/auth/index.d.ts +88 -2
- package/dist/auth/index.js +6 -2
- package/dist/{chunk-5UWFGBFM.js → chunk-4KAG5U7A.js} +18 -4
- package/dist/chunk-4VGWQ5AN.js +91 -0
- package/dist/{chunk-JKERRYVS.js → chunk-BLO4SISK.js} +7 -3
- package/dist/chunk-BWCC6ZJC.js +202 -0
- package/dist/{chunk-WNWKOCGJ.js → chunk-BZTA7IIL.js} +1 -1
- package/dist/chunk-DD3CCMCZ.js +15 -0
- package/dist/{chunk-GEFB5YIR.js → chunk-EZMRFWZQ.js} +1 -1
- package/dist/chunk-FDCVFCOQ.js +105 -0
- package/dist/chunk-FLJXZ7YC.js +150 -0
- package/dist/{chunk-7AI5ZYJ4.js → chunk-JVAZHVNV.js} +2 -94
- package/dist/{chunk-ZGHDPDTF.js → chunk-JYSYHVLU.js} +3 -3
- package/dist/{chunk-J3FALDQE.js → chunk-NXHL23JW.js} +7 -13
- package/dist/{chunk-OUHGHTE7.js → chunk-O3PY6B6E.js} +3 -2
- package/dist/chunk-OLD3NQLI.js +91 -0
- package/dist/{chunk-XVPEDNIM.js → chunk-PCBXNHKY.js} +325 -152
- package/dist/chunk-QQOLC46E.js +75 -0
- package/dist/{chunk-KSG4C5DD.js → chunk-QSVZP2NU.js} +2 -1
- package/dist/chunk-RNP5R5I3.js +1 -0
- package/dist/{chunk-YULUKCS6.js → chunk-SITSZUFW.js} +1 -1
- package/dist/chunk-TIRMFDM4.js +33 -0
- package/dist/{chunk-PYL4XW6H.js → chunk-TMFCNFLW.js} +1 -1
- package/dist/{chunk-S66I2PYB.js → chunk-TN3PU2WK.js} +1 -1
- package/dist/components/command-queue/index.js +6 -4
- package/dist/components/index.js +9 -7
- package/dist/components/notifications/index.js +4 -3
- package/dist/display/index.js +3 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +5 -4
- package/dist/hooks/published.d.ts +1 -1
- package/dist/hooks/published.js +4 -3
- package/dist/index.d.ts +458 -120
- package/dist/index.js +23 -17
- package/dist/initialization/index.d.ts +49 -1
- package/dist/initialization/index.js +5 -2
- package/dist/organization/index.d.ts +61 -2
- package/dist/organization/index.js +5 -2
- package/dist/profile/index.d.ts +30 -2
- package/dist/profile/index.js +2 -1
- package/dist/provider/index.d.ts +123 -30
- package/dist/provider/index.js +11 -6
- package/dist/provider/published.d.ts +96 -16
- package/dist/provider/published.js +10 -4
- package/dist/utils/index.js +2 -1
- package/package.json +17 -4
- package/dist/chunk-GDV44UWF.js +0 -138
- package/dist/chunk-HBRMWW6V.js +0 -43
- package/dist/chunk-QGEFP2EU.js +0 -399
package/dist/index.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
import './chunk-Q47SPRY7.js';
|
|
2
|
-
export { OperationsService, executionsKeys, observabilityKeys, scheduleKeys, useActivities, useActivityTrend, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule } from './chunk-
|
|
2
|
+
export { OperationsService, executionsKeys, observabilityKeys, scheduleKeys, useActivities, useActivityTrend, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule } from './chunk-BZTA7IIL.js';
|
|
3
3
|
export { TanStackRouterBridge } from './chunk-LHQTTUL2.js';
|
|
4
4
|
export { AGENT_CONSTANTS, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, CONTAINER_CONSTANTS, EmptyVisualizer, ExecutionStats, ExecutionStatusBadge, SHARED_VIZ_CONSTANTS, STATUS_COLORS, TIMELINE_CONSTANTS, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WORKFLOW_CONSTANTS, WorkflowExecutionTimeline, calculateBarPosition, getEdgeColor, getEdgeOpacity, getResourceStatusColor, getStatusColors, getStatusIcon, shouldAnimateEdge, useAgentIterationData, useExecutionPath, useMergedExecution, useReactFlowAgent, useTimelineData, useUnifiedWorkflowLayout, useWorkflowStepsLayout } from './chunk-RJCA5672.js';
|
|
5
|
-
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from './chunk-
|
|
5
|
+
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from './chunk-EZMRFWZQ.js';
|
|
6
6
|
import './chunk-XCYKC6OZ.js';
|
|
7
|
-
export { createUseAppInitialization } from './chunk-
|
|
8
|
-
|
|
9
|
-
export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, ConfirmationInputModal, ConfirmationModal, MessageBubble } from './chunk-
|
|
7
|
+
export { createUseAppInitialization } from './chunk-SITSZUFW.js';
|
|
8
|
+
import './chunk-RNP5R5I3.js';
|
|
9
|
+
export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, ConfirmationInputModal, ConfirmationModal, MessageBubble } from './chunk-TN3PU2WK.js';
|
|
10
10
|
export { ExecutionLogsTable, ResourceHealthChart, getHealthColor } from './chunk-NE36BUGQ.js';
|
|
11
11
|
import './chunk-W7ZBF5AA.js';
|
|
12
|
-
export { ActionModal, CustomModal, TaskCard, getIcon, iconMap } from './chunk-
|
|
13
|
-
export { useCommandQueue, useCommandQueueTotals, useDeleteTask, usePatchTask, useSubmitAction } from './chunk-
|
|
12
|
+
export { ActionModal, CustomModal, TaskCard, getIcon, iconMap } from './chunk-JYSYHVLU.js';
|
|
13
|
+
export { useCommandQueue, useCommandQueueTotals, useDeleteTask, usePatchTask, useSubmitAction } from './chunk-NXHL23JW.js';
|
|
14
14
|
export { FormFieldRenderer } from './chunk-PSLKGOBZ.js';
|
|
15
|
-
export { NotificationBell, NotificationItem, NotificationList, NotificationPanel } from './chunk-
|
|
16
|
-
export { useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications } from './chunk-
|
|
15
|
+
export { NotificationBell, NotificationItem, NotificationList, NotificationPanel } from './chunk-TMFCNFLW.js';
|
|
16
|
+
export { useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications } from './chunk-BLO4SISK.js';
|
|
17
17
|
export { AgentDefinitionDisplay, CollapsibleJsonSection, ConfigCard, ContractDisplay, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, ResourceDefinitionSection, ToolsListDisplay, WorkflowDefinitionDisplay, useNewKnowledgeMapLayout } from './chunk-OXVOHOP3.js';
|
|
18
18
|
export { formatDuration } from './chunk-6BJOYF6E.js';
|
|
19
19
|
export { BaseEdge, BaseNode, GRAPH_CONSTANTS, GlowingHandle, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, calculateGraphHeight, getGraphBackgroundStyles, Graph_default as graphStyles, useConnectionHighlight, useDirectedChainHighlighting, useFitViewTrigger, useGraphBackgroundStyles, useGraphHighlighting, useGraphTheme, useNodeSelection } from './chunk-HUWJXLLF.js';
|
|
20
|
-
export { APIErrorAlert, CollapsibleSection, ContextViewer, CustomSelector, DetailCardSkeleton, EmptyState, JsonViewer, ListSkeleton, NavigationButton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, TabCountBadge, TimeRangeSelector, TrendIndicator, catalogItemToResourceDefinition } from './chunk-
|
|
20
|
+
export { APIErrorAlert, CollapsibleSection, ContextViewer, CustomSelector, DetailCardSkeleton, EmptyState, JsonViewer, ListSkeleton, NavigationButton, PageNotFound, PageTitleCaption, ResourceCard, StatCard, StatCardSkeleton, StatsCardSkeleton, TabCountBadge, TimeRangeSelector, TrendIndicator, catalogItemToResourceDefinition } from './chunk-O3PY6B6E.js';
|
|
21
21
|
export { StyledMarkdown } from './chunk-3KMDHCAR.js';
|
|
22
22
|
import './chunk-YZ6GTZXL.js';
|
|
23
|
-
export { ElevasisProvider, ElevasisUIProvider, mantineThemeOverride } from './chunk-
|
|
24
|
-
export { ElevasisCoreProvider
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
23
|
+
export { ElevasisProvider, ElevasisUIProvider, createCssVariablesResolver, generateShades, getPreset, mantineNotificationAdapter, mantineThemeOverride } from './chunk-PCBXNHKY.js';
|
|
24
|
+
export { ElevasisCoreProvider } from './chunk-OLD3NQLI.js';
|
|
25
|
+
export { OrganizationProvider } from './chunk-FLJXZ7YC.js';
|
|
26
|
+
export { ApiClientProvider, createUseApiClient, useApiClient, useApiClientContext } from './chunk-BWCC6ZJC.js';
|
|
27
|
+
export { NotificationProvider, useNotificationAdapter } from './chunk-TIRMFDM4.js';
|
|
28
|
+
export { formatDate, getResourceColor, getResourceIcon, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, validateEmail } from './chunk-JVAZHVNV.js';
|
|
29
|
+
export { APIClientError, formatErrorMessage, getErrorInfo, getErrorTitle, isAPIClientError } from './chunk-4VGWQ5AN.js';
|
|
30
|
+
export { AdminGuard, ProtectedRoute, useSessionCheck as useRefocusSessionCheck, useSessionCheck, useStableAccessToken } from './chunk-FDCVFCOQ.js';
|
|
29
31
|
export { WorkOSAuthBridge } from './chunk-NIAVTSMB.js';
|
|
30
|
-
export { useOAuthContext } from './chunk-
|
|
32
|
+
export { useOAuthContext } from './chunk-QSVZP2NU.js';
|
|
33
|
+
export { InitializationContext, InitializationProvider, useInitialization } from './chunk-QQOLC46E.js';
|
|
34
|
+
export { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
35
|
+
export { ProfileProvider, UserProfileService, useProfile, useUserProfile } from './chunk-4KAG5U7A.js';
|
|
36
|
+
export { ElevasisServiceProvider, useElevasisServices } from './chunk-KA7LO7U5.js';
|
|
31
37
|
export { AuthProvider, useAuthContext } from './chunk-7PLEQFHO.js';
|
|
32
38
|
export { RouterProvider, useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
1
4
|
type Json = string | number | boolean | null | {
|
|
2
5
|
[key: string]: Json | undefined;
|
|
3
6
|
} | Json[];
|
|
@@ -2321,5 +2324,50 @@ interface AppInitializationState {
|
|
|
2321
2324
|
*/
|
|
2322
2325
|
declare function createUseAppInitialization(useOrgInitialization: () => UseOrgInitializationReturn): () => AppInitializationState;
|
|
2323
2326
|
|
|
2324
|
-
|
|
2327
|
+
declare const InitializationContext: react.Context<AppInitializationState | null>;
|
|
2328
|
+
/**
|
|
2329
|
+
* Consumes the nearest InitializationProvider.
|
|
2330
|
+
*
|
|
2331
|
+
* @throws {Error} If called outside of an InitializationProvider tree.
|
|
2332
|
+
*/
|
|
2333
|
+
declare function useInitialization(): AppInitializationState;
|
|
2334
|
+
/**
|
|
2335
|
+
* Aggregates auth, profile, and organization state into a single initialization context.
|
|
2336
|
+
*
|
|
2337
|
+
* Must be rendered inside:
|
|
2338
|
+
* - An AuthProvider (needs useAuthContext)
|
|
2339
|
+
* - A ProfileProvider (needs useProfile)
|
|
2340
|
+
* - An OrganizationProvider (needs useOrganization)
|
|
2341
|
+
*
|
|
2342
|
+
* Initialization Layers (Sequential):
|
|
2343
|
+
* 1. WorkOS Auth (useAuthContext)
|
|
2344
|
+
* 2. User Profile Sync (useProfile)
|
|
2345
|
+
* 3. Organization Context (useOrganization)
|
|
2346
|
+
*
|
|
2347
|
+
* @example
|
|
2348
|
+
* // Org-scoped pages with data queries (most common)
|
|
2349
|
+
* const { organizationReady } = useInitialization()
|
|
2350
|
+
* const { data, isLoading } = useResources()
|
|
2351
|
+
* if (!organizationReady || isLoading) return <SubshellLoader />
|
|
2352
|
+
*
|
|
2353
|
+
* @example
|
|
2354
|
+
* // Pages accessible without org (invitations, pending)
|
|
2355
|
+
* const { userReady, error } = useInitialization()
|
|
2356
|
+
* if (!userReady) return <SubshellLoader />
|
|
2357
|
+
* if (error?.layer === 'organization') {
|
|
2358
|
+
* return <PendingInvitationPage message={error.message} />
|
|
2359
|
+
* }
|
|
2360
|
+
*
|
|
2361
|
+
* @example
|
|
2362
|
+
* // Pages with error handling
|
|
2363
|
+
* const { organizationReady, error, retry } = useInitialization()
|
|
2364
|
+
* if (error?.layer === 'organization') return <NoOrgError error={error} />
|
|
2365
|
+
* if (error) return <ErrorCard error={error} onRetry={retry} />
|
|
2366
|
+
* if (!organizationReady) return <SubshellLoader />
|
|
2367
|
+
*/
|
|
2368
|
+
declare function InitializationProvider({ children }: {
|
|
2369
|
+
children: ReactNode;
|
|
2370
|
+
}): react.FunctionComponentElement<react.ProviderProps<AppInitializationState | null>>;
|
|
2371
|
+
|
|
2372
|
+
export { InitializationContext, InitializationProvider, createUseAppInitialization, useInitialization };
|
|
2325
2373
|
export type { AppInitializationState, InitializationError };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { createUseAppInitialization } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { createUseAppInitialization } from '../chunk-SITSZUFW.js';
|
|
2
|
+
import '../chunk-RNP5R5I3.js';
|
|
3
|
+
export { InitializationContext, InitializationProvider, useInitialization } from '../chunk-QQOLC46E.js';
|
|
4
|
+
import '../chunk-DD3CCMCZ.js';
|
|
5
|
+
import '../chunk-4KAG5U7A.js';
|
|
3
6
|
import '../chunk-KA7LO7U5.js';
|
|
4
7
|
import '../chunk-7PLEQFHO.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
1
3
|
import { UseBoundStore, StoreApi } from 'zustand';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
5
|
|
|
@@ -75,6 +77,63 @@ interface MembershipWithDetails extends OrganizationMembership {
|
|
|
75
77
|
config?: MembershipFeatureConfig;
|
|
76
78
|
}
|
|
77
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
|
+
|
|
78
137
|
interface OrganizationsState {
|
|
79
138
|
currentWorkOSOrganizationId: string | null;
|
|
80
139
|
currentSupabaseOrganizationId: string | null;
|
|
@@ -221,5 +280,5 @@ interface OrganizationSwitcherProps {
|
|
|
221
280
|
}
|
|
222
281
|
declare function OrganizationSwitcher({ currentOrganization, memberships, isLoading, onSwitch }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
223
282
|
|
|
224
|
-
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations };
|
|
225
|
-
export type { OrganizationsActions, OrganizationsSlice, OrganizationsState, UseApiClientReturn, UseOrgInitializationReturn, UseOrganizationsReturn };
|
|
283
|
+
export { OrganizationProvider, OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations, useOrganization };
|
|
284
|
+
export type { OrganizationContextValue, OrganizationsActions, OrganizationsSlice, OrganizationsState, UseApiClientReturn, UseOrgInitializationReturn, UseOrganizationsReturn };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from '../chunk-EZMRFWZQ.js';
|
|
2
|
+
import '../chunk-RNP5R5I3.js';
|
|
3
|
+
export { OrganizationProvider } from '../chunk-FLJXZ7YC.js';
|
|
4
|
+
export { useOrganization } from '../chunk-DD3CCMCZ.js';
|
|
5
|
+
import '../chunk-4KAG5U7A.js';
|
|
3
6
|
import '../chunk-KA7LO7U5.js';
|
|
4
7
|
import '../chunk-7PLEQFHO.js';
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
1
4
|
type Json = string | number | boolean | null | {
|
|
2
5
|
[key: string]: Json | undefined;
|
|
3
6
|
} | Json[];
|
|
@@ -2204,6 +2207,31 @@ type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables
|
|
|
2204
2207
|
|
|
2205
2208
|
type SupabaseUserProfile = Tables<'users'>;
|
|
2206
2209
|
|
|
2210
|
+
interface ProfileContextValue {
|
|
2211
|
+
profile: SupabaseUserProfile | null;
|
|
2212
|
+
loading: boolean;
|
|
2213
|
+
error: Error | null;
|
|
2214
|
+
refetch: () => Promise<void>;
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Consumes the nearest ProfileProvider.
|
|
2218
|
+
*
|
|
2219
|
+
* @throws {Error} If called outside of a ProfileProvider tree.
|
|
2220
|
+
*/
|
|
2221
|
+
declare function useProfile(): ProfileContextValue;
|
|
2222
|
+
/**
|
|
2223
|
+
* Provides shared profile state to its subtree via React Context.
|
|
2224
|
+
*
|
|
2225
|
+
* Wraps useUserProfile so that all consumers share one profile fetch
|
|
2226
|
+
* instead of each triggering an independent sync call.
|
|
2227
|
+
*
|
|
2228
|
+
* Must be rendered inside the auth and service provider layers so that
|
|
2229
|
+
* the underlying hook can access useAuthContext and useElevasisServices.
|
|
2230
|
+
*/
|
|
2231
|
+
declare function ProfileProvider({ children }: {
|
|
2232
|
+
children: ReactNode;
|
|
2233
|
+
}): react.FunctionComponentElement<react.ProviderProps<ProfileContextValue | null>>;
|
|
2234
|
+
|
|
2207
2235
|
interface UseUserProfileOptions {
|
|
2208
2236
|
/**
|
|
2209
2237
|
* Optional error handler for profile sync failures
|
|
@@ -2261,5 +2289,5 @@ declare class UserProfileService {
|
|
|
2261
2289
|
}>): Promise<SupabaseUserProfile | null>;
|
|
2262
2290
|
}
|
|
2263
2291
|
|
|
2264
|
-
export { UserProfileService, useUserProfile };
|
|
2265
|
-
export type { UseUserProfileReturn };
|
|
2292
|
+
export { ProfileProvider, UserProfileService, useProfile, useUserProfile };
|
|
2293
|
+
export type { ProfileContextValue, UseUserProfileReturn };
|
package/dist/profile/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import '../chunk-RNP5R5I3.js';
|
|
2
|
+
export { ProfileProvider, UserProfileService, useProfile, useUserProfile } from '../chunk-4KAG5U7A.js';
|
|
2
3
|
import '../chunk-KA7LO7U5.js';
|
|
3
4
|
import '../chunk-7PLEQFHO.js';
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -11,6 +11,53 @@ interface ApiErrorDetails {
|
|
|
11
11
|
requestId?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Pluggable notification adapter interface.
|
|
16
|
+
*
|
|
17
|
+
* Implement this to connect any notification library (Mantine, react-toastify, etc.)
|
|
18
|
+
* to the Elevasis UI hooks.
|
|
19
|
+
*/
|
|
20
|
+
interface NotificationAdapter {
|
|
21
|
+
success(title: string, message: string): void;
|
|
22
|
+
error(title: string, message: string): void;
|
|
23
|
+
info(title: string, message: string): void;
|
|
24
|
+
warning(title: string, message: string): void;
|
|
25
|
+
/** Formats and displays an API error using structured error-utils helpers. */
|
|
26
|
+
apiError(error: unknown): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Provides a notification adapter to all descendant components.
|
|
30
|
+
*
|
|
31
|
+
* Pass a `MantineNotificationAdapter` for Command Center, or any custom
|
|
32
|
+
* adapter for other consumers (template, tests, etc.).
|
|
33
|
+
*
|
|
34
|
+
* When omitted, hooks fall back to the console adapter automatically.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* import { NotificationProvider } from '@repo/ui/provider'
|
|
39
|
+
* import { mantineNotificationAdapter } from '@repo/ui/provider'
|
|
40
|
+
*
|
|
41
|
+
* <NotificationProvider adapter={mantineNotificationAdapter}>
|
|
42
|
+
* <App />
|
|
43
|
+
* </NotificationProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare function NotificationProvider({ adapter, children }: {
|
|
47
|
+
adapter: NotificationAdapter;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}): react_jsx_runtime.JSX.Element;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the active notification adapter.
|
|
52
|
+
*
|
|
53
|
+
* Falls back to the console adapter when used outside a NotificationProvider,
|
|
54
|
+
* so hooks remain functional in template environments without Mantine.
|
|
55
|
+
*
|
|
56
|
+
* Named `useNotificationAdapter` to avoid collision with the data-fetching
|
|
57
|
+
* `useNotifications` hook exported from `hooks/monitoring`.
|
|
58
|
+
*/
|
|
59
|
+
declare function useNotificationAdapter(): NotificationAdapter;
|
|
60
|
+
|
|
14
61
|
/** Flat + per-scheme override pattern. Flat values apply to both; `light`/`dark` win over flat. */
|
|
15
62
|
type WithSchemes<T> = T & {
|
|
16
63
|
light?: T;
|
|
@@ -94,6 +141,8 @@ interface OAuthConfig {
|
|
|
94
141
|
tokenStorage?: 'session';
|
|
95
142
|
/** Pre-select organization in WorkOS flow. */
|
|
96
143
|
organizationId?: string;
|
|
144
|
+
/** Auth provider for the authorize request. Defaults to 'authkit' (hosted login UI). */
|
|
145
|
+
provider?: 'authkit' | 'GoogleOAuth' | 'MicrosoftOAuth' | 'GitHubOAuth' | 'AppleOAuth';
|
|
97
146
|
}
|
|
98
147
|
/** Deferred -- will throw at runtime. */
|
|
99
148
|
interface ApiKeyConfig {
|
|
@@ -110,16 +159,18 @@ interface ElevasisCoreProviderProps {
|
|
|
110
159
|
*/
|
|
111
160
|
theme?: ElevasisCoreThemeConfig;
|
|
112
161
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
162
|
+
* @deprecated Organization ID is now resolved automatically via OrganizationProvider.
|
|
163
|
+
* This prop is accepted for backwards compatibility during migration but is no longer
|
|
164
|
+
* used when the full provider stack is active (apiUrl provided).
|
|
116
165
|
*/
|
|
117
166
|
organizationId?: string | null;
|
|
118
167
|
/** Custom QueryClient. If omitted, a default is created internally. */
|
|
119
168
|
queryClient?: QueryClient;
|
|
120
169
|
/**
|
|
121
170
|
* API base URL (e.g., 'https://api.elevasis.com' or 'http://localhost:5170').
|
|
122
|
-
* When provided, ElevasisCoreProvider composes
|
|
171
|
+
* When provided, ElevasisCoreProvider composes the full provider stack:
|
|
172
|
+
* ApiClientProvider + ElevasisServiceProvider + ProfileProvider +
|
|
173
|
+
* OrganizationProvider + NotificationProvider + InitializationProvider.
|
|
123
174
|
* When omitted, no service context is provided (theme-only mode).
|
|
124
175
|
*/
|
|
125
176
|
apiUrl?: string;
|
|
@@ -129,11 +180,25 @@ interface ElevasisCoreProviderProps {
|
|
|
129
180
|
*/
|
|
130
181
|
onError?: (endpoint: string, error: Error, details?: ApiErrorDetails) => void;
|
|
131
182
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* Command-center passes `!!currentMembership` for its stricter readiness requirement.
|
|
183
|
+
* @deprecated Organization readiness is now managed internally by OrganizationProvider.
|
|
184
|
+
* Accepted for backwards compatibility but ignored when apiUrl is provided.
|
|
135
185
|
*/
|
|
136
186
|
isOrganizationReady?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Notification adapter for displaying success/error/info messages.
|
|
189
|
+
* When provided, wraps the subtree in a NotificationProvider with this adapter.
|
|
190
|
+
* When omitted, the console fallback adapter is used automatically.
|
|
191
|
+
*
|
|
192
|
+
* ElevasisUIProvider (Mantine variant) passes mantineNotificationAdapter here automatically.
|
|
193
|
+
* Headless/SDK consumers can pass a custom adapter or omit for console output.
|
|
194
|
+
*/
|
|
195
|
+
notifications?: NotificationAdapter;
|
|
196
|
+
/**
|
|
197
|
+
* Whether to inject CSS variables, `data-elevasis-scheme` attribute, and font links.
|
|
198
|
+
* Set to `false` when the consumer has its own complete design system and only
|
|
199
|
+
* needs auth + API from this provider. Defaults to `true`.
|
|
200
|
+
*/
|
|
201
|
+
injectStyles?: boolean;
|
|
137
202
|
children: ReactNode;
|
|
138
203
|
}
|
|
139
204
|
interface ElevasisProviderProps {
|
|
@@ -146,16 +211,15 @@ interface ElevasisProviderProps {
|
|
|
146
211
|
*/
|
|
147
212
|
theme?: ElevasisThemeConfig;
|
|
148
213
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* SDK consumers typically omit this (auto-resolved from JWT/API key).
|
|
214
|
+
* @deprecated Organization ID is now resolved automatically via OrganizationProvider.
|
|
215
|
+
* Accepted for backwards compatibility during migration but no longer used internally.
|
|
152
216
|
*/
|
|
153
217
|
organizationId?: string | null;
|
|
154
218
|
/** Custom QueryClient. If omitted, a default is created internally. */
|
|
155
219
|
queryClient?: QueryClient;
|
|
156
220
|
/**
|
|
157
221
|
* API base URL (e.g., 'https://api.elevasis.com' or 'http://localhost:5170').
|
|
158
|
-
* When provided,
|
|
222
|
+
* When provided, ElevasisUIProvider composes the full provider stack via ElevasisCoreProvider.
|
|
159
223
|
* When omitted, no service context is provided (theme-only mode).
|
|
160
224
|
*/
|
|
161
225
|
apiUrl?: string;
|
|
@@ -165,9 +229,8 @@ interface ElevasisProviderProps {
|
|
|
165
229
|
*/
|
|
166
230
|
onError?: (endpoint: string, error: Error, details?: ApiErrorDetails) => void;
|
|
167
231
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* Command-center passes `!!currentMembership` for its stricter readiness requirement.
|
|
232
|
+
* @deprecated Organization readiness is now managed internally by OrganizationProvider.
|
|
233
|
+
* Accepted for backwards compatibility but ignored when apiUrl is provided.
|
|
171
234
|
*/
|
|
172
235
|
isOrganizationReady?: boolean;
|
|
173
236
|
children: ReactNode;
|
|
@@ -194,18 +257,19 @@ interface ElevasisServiceProviderProps {
|
|
|
194
257
|
/**
|
|
195
258
|
* UI provider for Elevasis-powered applications. Includes Mantine theme integration.
|
|
196
259
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
260
|
+
* A thin Mantine shell around ElevasisCoreProvider. Handles:
|
|
261
|
+
* - MantineProvider with theme resolution (presets, token overrides, color scheme)
|
|
262
|
+
* - Google Font injection for preset fonts
|
|
263
|
+
* - CSS variables resolver
|
|
264
|
+
* - Mantine notification adapter (wired into NotificationProvider automatically)
|
|
200
265
|
*
|
|
201
|
-
*
|
|
266
|
+
* All auth, API, profile, organization, and initialization composition is
|
|
267
|
+
* delegated to ElevasisCoreProvider.
|
|
202
268
|
*
|
|
203
269
|
* @example Command-center (dogfooding)
|
|
204
270
|
* ```tsx
|
|
205
271
|
* <ElevasisUIProvider
|
|
206
272
|
* auth={{ mode: 'authkit', clientId: '...', redirectUri: '/auth-redirect' }}
|
|
207
|
-
* organizationId={currentWorkOSOrganizationId}
|
|
208
|
-
* isOrganizationReady={!!currentMembership}
|
|
209
273
|
* apiUrl={import.meta.env.VITE_API_SERVER}
|
|
210
274
|
* onError={handleApiError}
|
|
211
275
|
* queryClient={queryClient}
|
|
@@ -231,32 +295,47 @@ interface ElevasisServiceProviderProps {
|
|
|
231
295
|
* </ElevasisUIProvider>
|
|
232
296
|
* ```
|
|
233
297
|
*/
|
|
234
|
-
declare function ElevasisUIProvider({
|
|
298
|
+
declare function ElevasisUIProvider({ theme, children, ...coreProps }: ElevasisProviderProps): react_jsx_runtime.JSX.Element;
|
|
235
299
|
/** @deprecated Use ElevasisUIProvider instead. Alias kept for backwards compatibility. */
|
|
236
300
|
declare const ElevasisProvider: typeof ElevasisUIProvider;
|
|
237
301
|
|
|
238
302
|
/**
|
|
239
303
|
* Headless root provider for Elevasis-powered applications.
|
|
240
304
|
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
305
|
+
* Pure auth + API provider with no style side-effects. Does not inject CSS
|
|
306
|
+
* variables, set `data-elevasis-scheme`, or load fonts. Consumers that need
|
|
307
|
+
* Elevasis theming should use `ElevasisProvider` (Mantine) instead.
|
|
244
308
|
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
309
|
+
* When `apiUrl` is provided, composes the full provider stack:
|
|
310
|
+
* QueryClientProvider -> AuthProvider -> ApiClientProvider ->
|
|
311
|
+
* ElevasisServiceProvider -> ProfileProvider -> OrganizationProvider ->
|
|
312
|
+
* NotificationProvider -> InitializationProvider
|
|
313
|
+
*
|
|
314
|
+
* The `notifications` prop wires a custom adapter (e.g. mantineNotificationAdapter)
|
|
315
|
+
* into the NotificationProvider. When omitted, the console fallback is used.
|
|
247
316
|
*
|
|
248
317
|
* @example Headless SDK consumer
|
|
249
318
|
* ```tsx
|
|
250
319
|
* <ElevasisCoreProvider
|
|
251
320
|
* auth={{ mode: 'authkit', clientId: '...', redirectUri: '/' }}
|
|
252
|
-
* theme={{ colorScheme: 'dark', preset: 'default' }}
|
|
253
321
|
* apiUrl="https://api.elevasis.com"
|
|
254
322
|
* >
|
|
255
323
|
* <Dashboard />
|
|
256
324
|
* </ElevasisCoreProvider>
|
|
257
325
|
* ```
|
|
326
|
+
*
|
|
327
|
+
* @example With custom notification adapter
|
|
328
|
+
* ```tsx
|
|
329
|
+
* <ElevasisCoreProvider
|
|
330
|
+
* auth={{ mode: 'authkit', clientId: '...', redirectUri: '/' }}
|
|
331
|
+
* apiUrl="https://api.elevasis.com"
|
|
332
|
+
* notifications={myNotificationAdapter}
|
|
333
|
+
* >
|
|
334
|
+
* <Dashboard />
|
|
335
|
+
* </ElevasisCoreProvider>
|
|
336
|
+
* ```
|
|
258
337
|
*/
|
|
259
|
-
declare function ElevasisCoreProvider({ auth,
|
|
338
|
+
declare function ElevasisCoreProvider({ auth, queryClient, apiUrl, onError, notifications, children }: ElevasisCoreProviderProps): react_jsx_runtime.JSX.Element;
|
|
260
339
|
|
|
261
340
|
/**
|
|
262
341
|
* Hook to access the ElevasisServiceProvider context.
|
|
@@ -287,5 +366,19 @@ declare function useElevasisServices(): ElevasisServiceContextValue;
|
|
|
287
366
|
*/
|
|
288
367
|
declare function ElevasisServiceProvider({ apiRequest, organizationId, isReady, children }: ElevasisServiceProviderProps): react_jsx_runtime.JSX.Element;
|
|
289
368
|
|
|
290
|
-
|
|
291
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Mantine-backed notification adapter.
|
|
371
|
+
*
|
|
372
|
+
* Wraps `@mantine/notifications` with the same defaults as `notify.tsx`
|
|
373
|
+
* (`autoClose: 5000`, `position: 'top-right'`). The `apiError()` method
|
|
374
|
+
* replicates `showApiErrorNotification` behavior including retryAfter-based
|
|
375
|
+
* autoClose.
|
|
376
|
+
*
|
|
377
|
+
* Use this adapter in Command Center (Mantine-powered) consumers.
|
|
378
|
+
* Template consumers should omit the NotificationProvider and rely on the
|
|
379
|
+
* console fallback, or supply their own adapter.
|
|
380
|
+
*/
|
|
381
|
+
declare const mantineNotificationAdapter: NotificationAdapter;
|
|
382
|
+
|
|
383
|
+
export { ElevasisCoreProvider, ElevasisProvider, ElevasisServiceProvider, ElevasisUIProvider, NotificationProvider, mantineNotificationAdapter, useElevasisServices, useNotificationAdapter };
|
|
384
|
+
export type { ApiKeyConfig, AuthConfig, AuthKitConfig, ElevasisCoreProviderProps, ElevasisCoreThemeConfig, ElevasisProviderProps, ElevasisServiceContextValue, ElevasisServiceProviderProps, ElevasisThemeConfig, ElevasisTokenOverrides, NotificationAdapter, OAuthConfig, PresetName, WithSchemes };
|
package/dist/provider/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export { ElevasisProvider, ElevasisUIProvider } from '../chunk-
|
|
2
|
-
export { ElevasisCoreProvider } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ElevasisProvider, ElevasisUIProvider, mantineNotificationAdapter } from '../chunk-PCBXNHKY.js';
|
|
2
|
+
export { ElevasisCoreProvider } from '../chunk-OLD3NQLI.js';
|
|
3
|
+
import '../chunk-FLJXZ7YC.js';
|
|
4
|
+
import '../chunk-BWCC6ZJC.js';
|
|
5
|
+
export { NotificationProvider, useNotificationAdapter } from '../chunk-TIRMFDM4.js';
|
|
6
|
+
import '../chunk-JVAZHVNV.js';
|
|
7
|
+
import '../chunk-4VGWQ5AN.js';
|
|
8
|
+
import '../chunk-QSVZP2NU.js';
|
|
9
|
+
import '../chunk-QQOLC46E.js';
|
|
10
|
+
import '../chunk-DD3CCMCZ.js';
|
|
11
|
+
import '../chunk-4KAG5U7A.js';
|
|
4
12
|
export { ElevasisServiceProvider, useElevasisServices } from '../chunk-KA7LO7U5.js';
|
|
5
|
-
import '../chunk-7AI5ZYJ4.js';
|
|
6
|
-
import '../chunk-NIAVTSMB.js';
|
|
7
|
-
import '../chunk-KSG4C5DD.js';
|
|
8
13
|
import '../chunk-7PLEQFHO.js';
|