@elevasis/ui 1.2.1 → 1.3.1

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 (59) hide show
  1. package/dist/CoreAuthKitInner-3J4RVQO6.js +43 -0
  2. package/dist/api/index.d.ts +32 -18
  3. package/dist/api/index.js +4 -2
  4. package/dist/auth/context.d.ts +23 -5
  5. package/dist/auth/index.d.ts +119 -30
  6. package/dist/auth/index.js +6 -3
  7. package/dist/chunk-2JBWPFHF.js +108 -0
  8. package/dist/chunk-4VGWQ5AN.js +91 -0
  9. package/dist/chunk-72HOBFMP.js +87 -0
  10. package/dist/{chunk-WNWKOCGJ.js → chunk-A3MCANC6.js} +296 -2
  11. package/dist/{chunk-JKERRYVS.js → chunk-BLO4SISK.js} +7 -3
  12. package/dist/chunk-DD3CCMCZ.js +15 -0
  13. package/dist/chunk-FWZJH3TL.js +13 -0
  14. package/dist/{chunk-GEFB5YIR.js → chunk-JBFFCZI4.js} +1 -1
  15. package/dist/chunk-JGJSZ3UE.js +47 -0
  16. package/dist/{chunk-7AI5ZYJ4.js → chunk-JVAZHVNV.js} +2 -94
  17. package/dist/{chunk-ZGHDPDTF.js → chunk-JYSYHVLU.js} +3 -3
  18. package/dist/{chunk-5UWFGBFM.js → chunk-L2CM2CUA.js} +16 -4
  19. package/dist/chunk-NEK6JKPW.js +75 -0
  20. package/dist/{chunk-J3FALDQE.js → chunk-NXHL23JW.js} +7 -13
  21. package/dist/{chunk-OUHGHTE7.js → chunk-O3PY6B6E.js} +3 -2
  22. package/dist/{chunk-YULUKCS6.js → chunk-PVVQTENF.js} +1 -1
  23. package/dist/chunk-TIRMFDM4.js +33 -0
  24. package/dist/{chunk-PYL4XW6H.js → chunk-TMFCNFLW.js} +1 -1
  25. package/dist/{chunk-S66I2PYB.js → chunk-TN3PU2WK.js} +1 -1
  26. package/dist/chunk-TYV5NJV2.js +1 -0
  27. package/dist/{chunk-B64YDSAY.js → chunk-TZPAA4RC.js} +54 -97
  28. package/dist/chunk-UMXDDEAG.js +148 -0
  29. package/dist/chunk-XLV6LYN2.js +157 -0
  30. package/dist/components/command-queue/index.js +6 -4
  31. package/dist/components/index.js +9 -7
  32. package/dist/components/notifications/index.js +4 -3
  33. package/dist/display/index.js +3 -2
  34. package/dist/hooks/index.d.ts +2630 -3
  35. package/dist/hooks/index.js +9 -5
  36. package/dist/hooks/published.d.ts +2630 -3
  37. package/dist/hooks/published.js +7 -3
  38. package/dist/index.d.ts +759 -164
  39. package/dist/index.js +24 -18
  40. package/dist/initialization/index.d.ts +49 -1
  41. package/dist/initialization/index.js +5 -2
  42. package/dist/organization/index.d.ts +61 -2
  43. package/dist/organization/index.js +5 -2
  44. package/dist/profile/index.d.ts +30 -2
  45. package/dist/profile/index.js +2 -1
  46. package/dist/provider/index.d.ts +116 -43
  47. package/dist/provider/index.js +10 -6
  48. package/dist/provider/published.d.ts +88 -28
  49. package/dist/provider/published.js +9 -4
  50. package/dist/supabase/index.js +2 -47
  51. package/dist/utils/index.js +2 -1
  52. package/package.json +15 -2
  53. package/dist/CoreAuthKitInner-KM72EYJS.js +0 -19
  54. package/dist/chunk-GDV44UWF.js +0 -138
  55. package/dist/chunk-HBRMWW6V.js +0 -43
  56. package/dist/chunk-NIAVTSMB.js +0 -21
  57. package/dist/chunk-QSVZP2NU.js +0 -214
  58. package/dist/chunk-ZQVPUAGR.js +0 -89
  59. /package/dist/{chunk-Q47SPRY7.js → chunk-RNP5R5I3.js} +0 -0
package/dist/index.js CHANGED
@@ -1,32 +1,38 @@
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-WNWKOCGJ.js';
1
+ import './chunk-TYV5NJV2.js';
2
+ export { OperationsService, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, usePaginationState, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification } from './chunk-A3MCANC6.js';
3
+ import './chunk-JGJSZ3UE.js';
3
4
  export { TanStackRouterBridge } from './chunk-LHQTTUL2.js';
4
5
  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-GEFB5YIR.js';
6
+ export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from './chunk-JBFFCZI4.js';
6
7
  import './chunk-XCYKC6OZ.js';
7
- export { createUseAppInitialization } from './chunk-YULUKCS6.js';
8
- export { UserProfileService, useUserProfile } from './chunk-5UWFGBFM.js';
9
- export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, ConfirmationInputModal, ConfirmationModal, MessageBubble } from './chunk-S66I2PYB.js';
8
+ export { createUseAppInitialization } from './chunk-PVVQTENF.js';
9
+ import './chunk-RNP5R5I3.js';
10
+ export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, ConfirmationInputModal, ConfirmationModal, MessageBubble } from './chunk-TN3PU2WK.js';
10
11
  export { ExecutionLogsTable, ResourceHealthChart, getHealthColor } from './chunk-NE36BUGQ.js';
11
12
  import './chunk-W7ZBF5AA.js';
12
- export { ActionModal, CustomModal, TaskCard, getIcon, iconMap } from './chunk-ZGHDPDTF.js';
13
- export { useCommandQueue, useCommandQueueTotals, useDeleteTask, usePatchTask, useSubmitAction } from './chunk-J3FALDQE.js';
13
+ export { ActionModal, CustomModal, TaskCard, getIcon, iconMap } from './chunk-JYSYHVLU.js';
14
+ export { useCommandQueue, useCommandQueueTotals, useDeleteTask, usePatchTask, useSubmitAction } from './chunk-NXHL23JW.js';
14
15
  export { FormFieldRenderer } from './chunk-PSLKGOBZ.js';
15
- export { NotificationBell, NotificationItem, NotificationList, NotificationPanel } from './chunk-PYL4XW6H.js';
16
- export { useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications } from './chunk-JKERRYVS.js';
16
+ export { NotificationBell, NotificationItem, NotificationList, NotificationPanel } from './chunk-TMFCNFLW.js';
17
+ export { useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications } from './chunk-BLO4SISK.js';
17
18
  export { AgentDefinitionDisplay, CollapsibleJsonSection, ConfigCard, ContractDisplay, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, ResourceDefinitionSection, ToolsListDisplay, WorkflowDefinitionDisplay, useNewKnowledgeMapLayout } from './chunk-OXVOHOP3.js';
18
19
  export { formatDuration } from './chunk-6BJOYF6E.js';
19
20
  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-OUHGHTE7.js';
21
+ 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
22
  export { StyledMarkdown } from './chunk-3KMDHCAR.js';
22
23
  import './chunk-YZ6GTZXL.js';
23
- export { ElevasisProvider, ElevasisUIProvider, createCssVariablesResolver, generateShades, getPreset, mantineThemeOverride } from './chunk-B64YDSAY.js';
24
- export { ElevasisCoreProvider } from './chunk-ZQVPUAGR.js';
25
- export { ApiClientProvider, createUseApiClient, useApiClientContext } from './chunk-GDV44UWF.js';
24
+ export { ElevasisProvider, ElevasisUIProvider, createCssVariablesResolver, generateShades, getPreset, mantineNotificationAdapter, mantineThemeOverride } from './chunk-TZPAA4RC.js';
25
+ export { ElevasisCoreProvider } from './chunk-72HOBFMP.js';
26
+ export { OrganizationProvider } from './chunk-UMXDDEAG.js';
27
+ export { ApiClientProvider, useApiClient, useApiClientContext } from './chunk-XLV6LYN2.js';
28
+ export { NotificationProvider, useNotificationAdapter } from './chunk-TIRMFDM4.js';
29
+ export { formatDate, getResourceColor, getResourceIcon, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, validateEmail } from './chunk-JVAZHVNV.js';
30
+ export { APIClientError, formatErrorMessage, getErrorInfo, getErrorTitle, isAPIClientError } from './chunk-4VGWQ5AN.js';
31
+ export { AdminGuard, ProtectedRoute, useSessionCheck as useRefocusSessionCheck, useSessionCheck } from './chunk-2JBWPFHF.js';
32
+ export { useStableAccessToken } from './chunk-FWZJH3TL.js';
33
+ export { InitializationContext, InitializationProvider, useInitialization } from './chunk-NEK6JKPW.js';
34
+ export { ProfileProvider, UserProfileService, useProfile, useUserProfile } from './chunk-L2CM2CUA.js';
35
+ export { useOrganization } from './chunk-DD3CCMCZ.js';
26
36
  export { ElevasisServiceProvider, useElevasisServices } from './chunk-KA7LO7U5.js';
27
- export { APIClientError, formatDate, formatErrorMessage, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, isAPIClientError, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, validateEmail } from './chunk-7AI5ZYJ4.js';
28
- export { useSessionCheck as useRefocusSessionCheck, useSessionCheck, useStableAccessToken } from './chunk-HBRMWW6V.js';
29
- export { WorkOSAuthBridge } from './chunk-NIAVTSMB.js';
30
- export { useOAuthContext } from './chunk-QSVZP2NU.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
- export { createUseAppInitialization };
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-YULUKCS6.js';
2
- import '../chunk-5UWFGBFM.js';
1
+ export { createUseAppInitialization } from '../chunk-PVVQTENF.js';
2
+ import '../chunk-RNP5R5I3.js';
3
+ export { InitializationContext, InitializationProvider, useInitialization } from '../chunk-NEK6JKPW.js';
4
+ import '../chunk-L2CM2CUA.js';
5
+ import '../chunk-DD3CCMCZ.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-GEFB5YIR.js';
2
- import '../chunk-5UWFGBFM.js';
1
+ export { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations } from '../chunk-JBFFCZI4.js';
2
+ import '../chunk-RNP5R5I3.js';
3
+ export { OrganizationProvider } from '../chunk-UMXDDEAG.js';
4
+ import '../chunk-L2CM2CUA.js';
5
+ export { useOrganization } from '../chunk-DD3CCMCZ.js';
3
6
  import '../chunk-KA7LO7U5.js';
4
7
  import '../chunk-7PLEQFHO.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[];
@@ -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 };
@@ -1,3 +1,4 @@
1
- export { UserProfileService, useUserProfile } from '../chunk-5UWFGBFM.js';
1
+ import '../chunk-RNP5R5I3.js';
2
+ export { ProfileProvider, UserProfileService, useProfile, useUserProfile } from '../chunk-L2CM2CUA.js';
2
3
  import '../chunk-KA7LO7U5.js';
3
4
  import '../chunk-7PLEQFHO.js';
@@ -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;
@@ -71,10 +118,10 @@ interface ElevasisThemeConfig extends ElevasisCoreThemeConfig {
71
118
  }
72
119
  /**
73
120
  * Auth configuration union.
74
- * 'authkit' (WorkOS AuthKit) and 'oauth' (WorkOS Connect) are implemented.
121
+ * 'authkit' (WorkOS AuthKit) is the supported mode.
75
122
  * 'apiKey' is defined for forward type compatibility but will throw at runtime.
76
123
  */
77
- type AuthConfig = AuthKitConfig | OAuthConfig | ApiKeyConfig;
124
+ type AuthConfig = AuthKitConfig | ApiKeyConfig;
78
125
  interface AuthKitConfig {
79
126
  mode: 'authkit';
80
127
  clientId: string;
@@ -85,25 +132,13 @@ interface AuthKitConfig {
85
132
  /** Keep refresh tokens in localStorage. Defaults to false. */
86
133
  devMode?: boolean;
87
134
  }
88
- /** OAuth config for "Sign in with Elevasis" via WorkOS Connect. */
89
- interface OAuthConfig {
90
- mode: 'oauth';
91
- clientId: string;
92
- redirectUri: string;
93
- /** Persist tokens in sessionStorage. Default is memory-only. */
94
- tokenStorage?: 'session';
95
- /** Pre-select organization in WorkOS flow. */
96
- organizationId?: string;
97
- /** Auth provider for the authorize request. Defaults to 'authkit' (hosted login UI). */
98
- provider?: 'authkit' | 'GoogleOAuth' | 'MicrosoftOAuth' | 'GitHubOAuth' | 'AppleOAuth';
99
- }
100
135
  /** Deferred -- will throw at runtime. */
101
136
  interface ApiKeyConfig {
102
137
  mode: 'apiKey';
103
138
  key: string;
104
139
  }
105
140
  interface ElevasisCoreProviderProps {
106
- /** Auth configuration. Supports 'authkit' and 'oauth' modes. */
141
+ /** Auth configuration. Supports 'authkit' mode. */
107
142
  auth: AuthConfig;
108
143
  /**
109
144
  * Elevasis core theme configuration (Mantine-free).
@@ -112,16 +147,18 @@ interface ElevasisCoreProviderProps {
112
147
  */
113
148
  theme?: ElevasisCoreThemeConfig;
114
149
  /**
115
- * Override organization ID resolution.
116
- * Command-center passes Zustand-managed org ID here.
117
- * SDK consumers typically omit this (auto-resolved from JWT/API key).
150
+ * @deprecated Organization ID is now resolved automatically via OrganizationProvider.
151
+ * This prop is accepted for backwards compatibility during migration but is no longer
152
+ * used when the full provider stack is active (apiUrl provided).
118
153
  */
119
154
  organizationId?: string | null;
120
155
  /** Custom QueryClient. If omitted, a default is created internally. */
121
156
  queryClient?: QueryClient;
122
157
  /**
123
158
  * API base URL (e.g., 'https://api.elevasis.com' or 'http://localhost:5170').
124
- * When provided, ElevasisCoreProvider composes ApiClientProvider + ElevasisServiceProvider internally.
159
+ * When provided, ElevasisCoreProvider composes the full provider stack:
160
+ * ApiClientProvider + ElevasisServiceProvider + ProfileProvider +
161
+ * OrganizationProvider + NotificationProvider + InitializationProvider.
125
162
  * When omitted, no service context is provided (theme-only mode).
126
163
  */
127
164
  apiUrl?: string;
@@ -131,11 +168,19 @@ interface ElevasisCoreProviderProps {
131
168
  */
132
169
  onError?: (endpoint: string, error: Error, details?: ApiErrorDetails) => void;
133
170
  /**
134
- * Override organization readiness check.
135
- * Defaults to `!!organizationId` if not provided.
136
- * Command-center passes `!!currentMembership` for its stricter readiness requirement.
171
+ * @deprecated Organization readiness is now managed internally by OrganizationProvider.
172
+ * Accepted for backwards compatibility but ignored when apiUrl is provided.
137
173
  */
138
174
  isOrganizationReady?: boolean;
175
+ /**
176
+ * Notification adapter for displaying success/error/info messages.
177
+ * When provided, wraps the subtree in a NotificationProvider with this adapter.
178
+ * When omitted, the console fallback adapter is used automatically.
179
+ *
180
+ * ElevasisUIProvider (Mantine variant) passes mantineNotificationAdapter here automatically.
181
+ * Headless/SDK consumers can pass a custom adapter or omit for console output.
182
+ */
183
+ notifications?: NotificationAdapter;
139
184
  /**
140
185
  * Whether to inject CSS variables, `data-elevasis-scheme` attribute, and font links.
141
186
  * Set to `false` when the consumer has its own complete design system and only
@@ -145,7 +190,7 @@ interface ElevasisCoreProviderProps {
145
190
  children: ReactNode;
146
191
  }
147
192
  interface ElevasisProviderProps {
148
- /** Auth configuration. Supports 'authkit' and 'oauth' modes. */
193
+ /** Auth configuration. Supports 'authkit' mode. */
149
194
  auth: AuthConfig;
150
195
  /**
151
196
  * Elevasis theme configuration.
@@ -154,16 +199,15 @@ interface ElevasisProviderProps {
154
199
  */
155
200
  theme?: ElevasisThemeConfig;
156
201
  /**
157
- * Override organization ID resolution.
158
- * Command-center passes Zustand-managed org ID here.
159
- * SDK consumers typically omit this (auto-resolved from JWT/API key).
202
+ * @deprecated Organization ID is now resolved automatically via OrganizationProvider.
203
+ * Accepted for backwards compatibility during migration but no longer used internally.
160
204
  */
161
205
  organizationId?: string | null;
162
206
  /** Custom QueryClient. If omitted, a default is created internally. */
163
207
  queryClient?: QueryClient;
164
208
  /**
165
209
  * API base URL (e.g., 'https://api.elevasis.com' or 'http://localhost:5170').
166
- * When provided, ElevasisProvider composes ApiClientProvider + ElevasisServiceProvider internally.
210
+ * When provided, ElevasisUIProvider composes the full provider stack via ElevasisCoreProvider.
167
211
  * When omitted, no service context is provided (theme-only mode).
168
212
  */
169
213
  apiUrl?: string;
@@ -173,9 +217,8 @@ interface ElevasisProviderProps {
173
217
  */
174
218
  onError?: (endpoint: string, error: Error, details?: ApiErrorDetails) => void;
175
219
  /**
176
- * Override organization readiness check.
177
- * Defaults to `!!organizationId` if not provided.
178
- * Command-center passes `!!currentMembership` for its stricter readiness requirement.
220
+ * @deprecated Organization readiness is now managed internally by OrganizationProvider.
221
+ * Accepted for backwards compatibility but ignored when apiUrl is provided.
179
222
  */
180
223
  isOrganizationReady?: boolean;
181
224
  children: ReactNode;
@@ -202,18 +245,19 @@ interface ElevasisServiceProviderProps {
202
245
  /**
203
246
  * UI provider for Elevasis-powered applications. Includes Mantine theme integration.
204
247
  *
205
- * Composes: MantineThemeProvider + QueryClientProvider + auth provider +
206
- * auth bridge. When apiUrl is provided, also composes
207
- * ApiClientProvider + ElevasisServiceProvider.
248
+ * A thin Mantine shell around ElevasisCoreProvider. Handles:
249
+ * - MantineProvider with theme resolution (presets, token overrides, color scheme)
250
+ * - Google Font injection for preset fonts
251
+ * - CSS variables resolver
252
+ * - Mantine notification adapter (wired into NotificationProvider automatically)
208
253
  *
209
- * Supports authkit and oauth modes. apiKey mode will throw until implemented.
254
+ * All auth, API, profile, organization, and initialization composition is
255
+ * delegated to ElevasisCoreProvider.
210
256
  *
211
257
  * @example Command-center (dogfooding)
212
258
  * ```tsx
213
259
  * <ElevasisUIProvider
214
260
  * auth={{ mode: 'authkit', clientId: '...', redirectUri: '/auth-redirect' }}
215
- * organizationId={currentWorkOSOrganizationId}
216
- * isOrganizationReady={!!currentMembership}
217
261
  * apiUrl={import.meta.env.VITE_API_SERVER}
218
262
  * onError={handleApiError}
219
263
  * queryClient={queryClient}
@@ -239,7 +283,7 @@ interface ElevasisServiceProviderProps {
239
283
  * </ElevasisUIProvider>
240
284
  * ```
241
285
  */
242
- declare function ElevasisUIProvider({ auth, theme, organizationId, queryClient, apiUrl, onError, isOrganizationReady, children }: ElevasisProviderProps): react_jsx_runtime.JSX.Element;
286
+ declare function ElevasisUIProvider({ theme, children, ...coreProps }: ElevasisProviderProps): react_jsx_runtime.JSX.Element;
243
287
  /** @deprecated Use ElevasisUIProvider instead. Alias kept for backwards compatibility. */
244
288
  declare const ElevasisProvider: typeof ElevasisUIProvider;
245
289
 
@@ -250,21 +294,36 @@ declare const ElevasisProvider: typeof ElevasisUIProvider;
250
294
  * variables, set `data-elevasis-scheme`, or load fonts. Consumers that need
251
295
  * Elevasis theming should use `ElevasisProvider` (Mantine) instead.
252
296
  *
253
- * Composes: QueryClientProvider + auth provider + auth bridge.
254
- * When apiUrl is provided, also composes ApiClientProvider + ElevasisServiceProvider.
297
+ * When `apiUrl` is provided, composes the full provider stack:
298
+ * QueryClientProvider -> AuthProvider -> ApiClientProvider ->
299
+ * ElevasisServiceProvider -> ProfileProvider -> OrganizationProvider ->
300
+ * NotificationProvider -> InitializationProvider
301
+ *
302
+ * The `notifications` prop wires a custom adapter (e.g. mantineNotificationAdapter)
303
+ * into the NotificationProvider. When omitted, the console fallback is used.
255
304
  *
256
305
  * @example Headless SDK consumer
257
306
  * ```tsx
258
307
  * <ElevasisCoreProvider
259
308
  * auth={{ mode: 'authkit', clientId: '...', redirectUri: '/' }}
260
- * theme={{ colorScheme: 'dark', preset: 'default' }}
261
309
  * apiUrl="https://api.elevasis.com"
262
310
  * >
263
311
  * <Dashboard />
264
312
  * </ElevasisCoreProvider>
265
313
  * ```
314
+ *
315
+ * @example With custom notification adapter
316
+ * ```tsx
317
+ * <ElevasisCoreProvider
318
+ * auth={{ mode: 'authkit', clientId: '...', redirectUri: '/' }}
319
+ * apiUrl="https://api.elevasis.com"
320
+ * notifications={myNotificationAdapter}
321
+ * >
322
+ * <Dashboard />
323
+ * </ElevasisCoreProvider>
324
+ * ```
266
325
  */
267
- declare function ElevasisCoreProvider({ auth, organizationId, queryClient, apiUrl, onError, isOrganizationReady, children }: ElevasisCoreProviderProps): react_jsx_runtime.JSX.Element;
326
+ declare function ElevasisCoreProvider({ auth, queryClient, apiUrl, onError, notifications, children }: ElevasisCoreProviderProps): react_jsx_runtime.JSX.Element;
268
327
 
269
328
  /**
270
329
  * Hook to access the ElevasisServiceProvider context.
@@ -295,5 +354,19 @@ declare function useElevasisServices(): ElevasisServiceContextValue;
295
354
  */
296
355
  declare function ElevasisServiceProvider({ apiRequest, organizationId, isReady, children }: ElevasisServiceProviderProps): react_jsx_runtime.JSX.Element;
297
356
 
298
- export { ElevasisCoreProvider, ElevasisProvider, ElevasisServiceProvider, ElevasisUIProvider, useElevasisServices };
299
- export type { ApiKeyConfig, AuthConfig, AuthKitConfig, ElevasisCoreProviderProps, ElevasisCoreThemeConfig, ElevasisProviderProps, ElevasisServiceContextValue, ElevasisServiceProviderProps, ElevasisThemeConfig, ElevasisTokenOverrides, OAuthConfig, PresetName, WithSchemes };
357
+ /**
358
+ * Mantine-backed notification adapter.
359
+ *
360
+ * Wraps `@mantine/notifications` with the same defaults as `notify.tsx`
361
+ * (`autoClose: 5000`, `position: 'top-right'`). The `apiError()` method
362
+ * replicates `showApiErrorNotification` behavior including retryAfter-based
363
+ * autoClose.
364
+ *
365
+ * Use this adapter in Command Center (Mantine-powered) consumers.
366
+ * Template consumers should omit the NotificationProvider and rely on the
367
+ * console fallback, or supply their own adapter.
368
+ */
369
+ declare const mantineNotificationAdapter: NotificationAdapter;
370
+
371
+ export { ElevasisCoreProvider, ElevasisProvider, ElevasisServiceProvider, ElevasisUIProvider, NotificationProvider, mantineNotificationAdapter, useElevasisServices, useNotificationAdapter };
372
+ export type { ApiKeyConfig, AuthConfig, AuthKitConfig, ElevasisCoreProviderProps, ElevasisCoreThemeConfig, ElevasisProviderProps, ElevasisServiceContextValue, ElevasisServiceProviderProps, ElevasisThemeConfig, ElevasisTokenOverrides, NotificationAdapter, PresetName, WithSchemes };
@@ -1,8 +1,12 @@
1
- export { ElevasisProvider, ElevasisUIProvider } from '../chunk-B64YDSAY.js';
2
- export { ElevasisCoreProvider } from '../chunk-ZQVPUAGR.js';
3
- import '../chunk-GDV44UWF.js';
1
+ export { ElevasisProvider, ElevasisUIProvider, mantineNotificationAdapter } from '../chunk-TZPAA4RC.js';
2
+ export { ElevasisCoreProvider } from '../chunk-72HOBFMP.js';
3
+ import '../chunk-UMXDDEAG.js';
4
+ import '../chunk-XLV6LYN2.js';
5
+ export { NotificationProvider, useNotificationAdapter } from '../chunk-TIRMFDM4.js';
6
+ import '../chunk-JVAZHVNV.js';
7
+ import '../chunk-4VGWQ5AN.js';
8
+ import '../chunk-NEK6JKPW.js';
9
+ import '../chunk-L2CM2CUA.js';
10
+ import '../chunk-DD3CCMCZ.js';
4
11
  export { ElevasisServiceProvider, useElevasisServices } from '../chunk-KA7LO7U5.js';
5
- import '../chunk-7AI5ZYJ4.js';
6
- import '../chunk-NIAVTSMB.js';
7
- import '../chunk-QSVZP2NU.js';
8
12
  import '../chunk-7PLEQFHO.js';