@elevasis/ui 1.3.0 → 1.3.2
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/CoreAuthKitInner-3J4RVQO6.js +43 -0
- package/dist/api/index.d.ts +7 -31
- package/dist/api/index.js +3 -2
- package/dist/auth/context.d.ts +23 -5
- 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 -171
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +5 -6
- package/dist/{chunk-FDCVFCOQ.js → chunk-2JBWPFHF.js} +23 -20
- package/dist/{chunk-BZTA7IIL.js → chunk-6IX5JZEH.js} +358 -4
- package/dist/chunk-FWZJH3TL.js +13 -0
- package/dist/chunk-GIFAF5ZS.js +313 -0
- package/dist/chunk-JGJSZ3UE.js +47 -0
- package/dist/chunk-JQLT6HBI.js +850 -0
- package/dist/{chunk-4KAG5U7A.js → chunk-L2CM2CUA.js} +0 -2
- package/dist/chunk-LFYO3MDC.js +58 -0
- package/dist/{chunk-OLD3NQLI.js → chunk-LTQAAIGE.js} +13 -17
- package/dist/{chunk-QQOLC46E.js → chunk-NEK6JKPW.js} +1 -1
- package/dist/{chunk-SITSZUFW.js → chunk-PVVQTENF.js} +1 -1
- package/dist/{chunk-FLJXZ7YC.js → chunk-SFF5MJEI.js} +2 -4
- package/dist/{chunk-EZMRFWZQ.js → chunk-U34YGJQB.js} +2 -94
- package/dist/{chunk-BWCC6ZJC.js → chunk-XLV6LYN2.js} +15 -60
- 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 -1927
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -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 -1652
- package/dist/hooks/published.d.ts.map +1 -0
- package/dist/hooks/published.js +369 -3
- 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 -7624
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1125 -30
- 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 +4 -4
- 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 +4 -4
- 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/profile/index.js +1 -1
- 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 -384
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +8 -9
- package/dist/provider/published.d.ts +9 -275
- package/dist/provider/published.d.ts.map +1 -0
- package/dist/provider/published.js +7 -8
- package/dist/provider/types.d.ts +190 -0
- package/dist/provider/types.d.ts.map +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/supabase/index.js +2 -47
- package/dist/theme/cssVariables.d.ts +12 -0
- package/dist/theme/cssVariables.d.ts.map +1 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +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-strike.d.ts +9 -0
- package/dist/theme/presets/cyber-strike.d.ts.map +1 -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-volt.d.ts +8 -0
- package/dist/theme/presets/cyber-volt.d.ts.map +1 -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/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/rose-gold.d.ts +8 -0
- package/dist/theme/presets/rose-gold.d.ts.map +1 -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/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 +67 -51
- package/dist/CoreAuthKitInner-KM72EYJS.js +0 -19
- package/dist/api/hooks/useApiClient.d.ts +0 -54
- package/dist/api/hooks/useApiClient.d.ts.map +0 -1
- package/dist/api/hooks/useApiClient.js +0 -185
- 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-NIAVTSMB.js +0 -21
- package/dist/chunk-O3PY6B6E.js +0 -749
- package/dist/chunk-OXVOHOP3.js +0 -661
- package/dist/chunk-PCBXNHKY.js +0 -1460
- package/dist/chunk-PSLKGOBZ.js +0 -58
- package/dist/chunk-QSVZP2NU.js +0 -214
- package/dist/chunk-RJCA5672.js +0 -1664
- package/dist/chunk-TMFCNFLW.js +0 -107
- package/dist/chunk-TN3PU2WK.js +0 -748
- 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-Q47SPRY7.js → chunk-BUZONXAW.js} +0 -0
- /package/dist/{chunk-NXHL23JW.js → chunk-XXDDMASA.js} +0 -0
|
@@ -135,8 +135,6 @@ function useProfile() {
|
|
|
135
135
|
}
|
|
136
136
|
function ProfileProvider({ children }) {
|
|
137
137
|
const value = useUserProfile();
|
|
138
|
-
if (!value.loading && value.profile) console.log("[ProfileProvider] ready, profile:", value.profile.id);
|
|
139
|
-
if (!value.loading && value.error) console.log("[ProfileProvider] error:", value.error.message);
|
|
140
138
|
return createElement(ProfileContext.Provider, { value }, children);
|
|
141
139
|
}
|
|
142
140
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IconUser, IconExternalLink, IconPlug, IconBolt, IconGitBranch, IconBrain } from '@tabler/icons-react';
|
|
2
|
+
|
|
3
|
+
// src/utils/formatDate.ts
|
|
4
|
+
var formatDate = (dateString) => {
|
|
5
|
+
const date = new Date(dateString);
|
|
6
|
+
return date.toLocaleDateString("en-US", {
|
|
7
|
+
year: "numeric",
|
|
8
|
+
month: "long",
|
|
9
|
+
day: "numeric",
|
|
10
|
+
hour: "2-digit",
|
|
11
|
+
minute: "2-digit"
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/utils/validateEmail.ts
|
|
16
|
+
var validateEmail = (email) => {
|
|
17
|
+
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/.test(email);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ../core/src/platform/registry/resource-metadata.ts
|
|
21
|
+
var resourceTypeIconNames = {
|
|
22
|
+
agent: "IconBrain",
|
|
23
|
+
workflow: "IconGitBranch",
|
|
24
|
+
trigger: "IconBolt",
|
|
25
|
+
integration: "IconPlug",
|
|
26
|
+
external: "IconExternalLink",
|
|
27
|
+
human: "IconUser"
|
|
28
|
+
};
|
|
29
|
+
var resourceTypeColors = {
|
|
30
|
+
agent: "violet",
|
|
31
|
+
workflow: "blue",
|
|
32
|
+
trigger: "orange",
|
|
33
|
+
integration: "teal",
|
|
34
|
+
external: "gray",
|
|
35
|
+
human: "yellow"
|
|
36
|
+
};
|
|
37
|
+
function getResourceIconName(type) {
|
|
38
|
+
return resourceTypeIconNames[type];
|
|
39
|
+
}
|
|
40
|
+
function getResourceColor(type) {
|
|
41
|
+
return resourceTypeColors[type];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/utils/resource-icons.tsx
|
|
45
|
+
var iconNameToComponent = {
|
|
46
|
+
IconBrain,
|
|
47
|
+
IconGitBranch,
|
|
48
|
+
IconBolt,
|
|
49
|
+
IconPlug,
|
|
50
|
+
IconExternalLink,
|
|
51
|
+
IconUser
|
|
52
|
+
};
|
|
53
|
+
function getResourceIcon(type) {
|
|
54
|
+
const iconName = getResourceIconName(type);
|
|
55
|
+
return iconNameToComponent[iconName];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { formatDate, getResourceColor, getResourceIcon, validateEmail };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { OrganizationProvider } from './chunk-FLJXZ7YC.js';
|
|
2
|
-
import { ApiClientProvider, createUseApiClient } from './chunk-BWCC6ZJC.js';
|
|
3
1
|
import { NotificationProvider } from './chunk-TIRMFDM4.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { OrganizationProvider } from './chunk-SFF5MJEI.js';
|
|
3
|
+
import { ApiClientProvider, useApiClient } from './chunk-XLV6LYN2.js';
|
|
4
|
+
import { InitializationProvider } from './chunk-NEK6JKPW.js';
|
|
5
|
+
import { ProfileProvider } from './chunk-L2CM2CUA.js';
|
|
6
|
+
import { ElevasisServiceProvider, useElevasisServices } from './chunk-KA7LO7U5.js';
|
|
6
7
|
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
7
|
-
import { ProfileProvider } from './chunk-4KAG5U7A.js';
|
|
8
|
-
import { ElevasisServiceProvider } from './chunk-KA7LO7U5.js';
|
|
9
8
|
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
10
9
|
import { lazy, Suspense, useRef } from 'react';
|
|
11
10
|
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
12
11
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
13
12
|
|
|
14
|
-
var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-
|
|
13
|
+
var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-3J4RVQO6.js').then((m) => ({ default: m.CoreAuthKitInner })));
|
|
15
14
|
var defaultQueryClient = null;
|
|
16
15
|
function getDefaultQueryClient() {
|
|
17
16
|
if (!defaultQueryClient) {
|
|
@@ -21,7 +20,6 @@ function getDefaultQueryClient() {
|
|
|
21
20
|
}
|
|
22
21
|
return defaultQueryClient;
|
|
23
22
|
}
|
|
24
|
-
var defaultUseOrganizations = () => ({ isInitializing: false, isOrgRefreshing: false });
|
|
25
23
|
function ElevasisCoreProvider({
|
|
26
24
|
auth,
|
|
27
25
|
queryClient,
|
|
@@ -32,17 +30,14 @@ function ElevasisCoreProvider({
|
|
|
32
30
|
}) {
|
|
33
31
|
if (auth.mode === "apiKey") {
|
|
34
32
|
throw new Error(
|
|
35
|
-
`ElevasisCoreProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit'
|
|
33
|
+
`ElevasisCoreProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' mode is supported.`
|
|
36
34
|
);
|
|
37
35
|
}
|
|
38
36
|
const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
|
|
39
37
|
const content = apiUrl ? /* @__PURE__ */ jsx(CoreServiceBridge, { apiUrl, onError, notifications, children }) : children;
|
|
40
|
-
const AuthInner =
|
|
38
|
+
const AuthInner = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) });
|
|
41
39
|
return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: AuthInner });
|
|
42
40
|
}
|
|
43
|
-
function CoreOAuthInner({ auth, children }) {
|
|
44
|
-
return /* @__PURE__ */ jsx(OAuthProvider, { config: auth, children });
|
|
45
|
-
}
|
|
46
41
|
function CoreServiceBridge({
|
|
47
42
|
apiUrl,
|
|
48
43
|
onError,
|
|
@@ -69,14 +64,15 @@ function CoreServiceBridgeInner({
|
|
|
69
64
|
notifications,
|
|
70
65
|
children
|
|
71
66
|
}) {
|
|
72
|
-
const
|
|
73
|
-
const { apiRequest } = useApiClient();
|
|
67
|
+
const { apiRequest } = useApiClient(apiUrl);
|
|
74
68
|
return /* @__PURE__ */ jsx(ElevasisServiceProvider, { apiRequest, organizationId: null, isReady: false, children: /* @__PURE__ */ jsx(ProfileProvider, { children: /* @__PURE__ */ jsx(OrganizationProvider, { children: /* @__PURE__ */ jsx(OrgIdBridge, { orgIdRef, children: /* @__PURE__ */ jsx(CoreNotificationLayer, { notifications, children: /* @__PURE__ */ jsx(InitializationProvider, { children }) }) }) }) }) });
|
|
75
69
|
}
|
|
76
70
|
function OrgIdBridge({ orgIdRef, children }) {
|
|
77
|
-
const { currentWorkOSOrganizationId } = useOrganization();
|
|
71
|
+
const { currentWorkOSOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
72
|
+
const { apiRequest } = useElevasisServices();
|
|
78
73
|
orgIdRef.current = currentWorkOSOrganizationId;
|
|
79
|
-
|
|
74
|
+
const isReady = !!currentWorkOSOrganizationId && !isInitializing && !isOrgRefreshing;
|
|
75
|
+
return /* @__PURE__ */ jsx(ElevasisServiceProvider, { apiRequest, organizationId: currentWorkOSOrganizationId, isReady, children });
|
|
80
76
|
}
|
|
81
77
|
function CoreNotificationLayer({
|
|
82
78
|
notifications,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useProfile } from './chunk-L2CM2CUA.js';
|
|
1
2
|
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
2
|
-
import { useProfile } from './chunk-4KAG5U7A.js';
|
|
3
3
|
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
4
4
|
import { createContext, useContext, useMemo, useCallback, createElement } from 'react';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useProfile } from './chunk-4KAG5U7A.js';
|
|
1
|
+
import { useProfile } from './chunk-L2CM2CUA.js';
|
|
3
2
|
import { useElevasisServices } from './chunk-KA7LO7U5.js';
|
|
3
|
+
import { OrganizationContext } from './chunk-DD3CCMCZ.js';
|
|
4
4
|
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
5
5
|
import { useState, useRef, useEffect, useCallback, createElement } from 'react';
|
|
6
6
|
import { useQueryClient } from '@tanstack/react-query';
|
|
@@ -54,7 +54,6 @@ function OrganizationProvider({ children }) {
|
|
|
54
54
|
if (!selected && data.length > 0) {
|
|
55
55
|
selected = data[0];
|
|
56
56
|
}
|
|
57
|
-
console.log("[OrgProvider] selected:", selected?.organization?.workos_org_id ?? "none");
|
|
58
57
|
if (selected) {
|
|
59
58
|
applyMembership(selected);
|
|
60
59
|
}
|
|
@@ -108,7 +107,6 @@ function OrganizationProvider({ children }) {
|
|
|
108
107
|
applyMembership
|
|
109
108
|
]);
|
|
110
109
|
useEffect(() => {
|
|
111
|
-
console.log("[OrgProvider] gate:", { userId: !!user?.id, profileLoaded, initialized: hasInitializedRef.current });
|
|
112
110
|
if (!user?.id || !profileLoaded || hasInitializedRef.current) return;
|
|
113
111
|
fetchAndInitialize();
|
|
114
112
|
}, [user?.id, profileLoaded, fetchAndInitialize]);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { useUserProfile } from './chunk-
|
|
1
|
+
import { useUserProfile } from './chunk-L2CM2CUA.js';
|
|
2
2
|
import { useAuthContext } from './chunk-7PLEQFHO.js';
|
|
3
3
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
-
import { Button, Loader, Menu, Text, Badge } from '@mantine/core';
|
|
5
|
-
import { IconChevronDown, IconBuilding, IconCheck } from '@tabler/icons-react';
|
|
6
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
4
|
|
|
8
5
|
// src/organization/store/organizationsSlice.ts
|
|
9
6
|
var initialOrganizationsState = {
|
|
@@ -245,94 +242,5 @@ function createUseOrgInitialization(useOrganizations, useApiClient) {
|
|
|
245
242
|
};
|
|
246
243
|
};
|
|
247
244
|
}
|
|
248
|
-
function OrganizationSwitcher({
|
|
249
|
-
currentOrganization,
|
|
250
|
-
memberships,
|
|
251
|
-
isLoading,
|
|
252
|
-
onSwitch
|
|
253
|
-
}) {
|
|
254
|
-
const [opened, setOpened] = useState(false);
|
|
255
|
-
const [switching, setSwitching] = useState(false);
|
|
256
|
-
const otherMemberships = memberships.filter((m) => m.organizationId !== currentOrganization?.id);
|
|
257
|
-
const handleSwitch = async (workosOrgId) => {
|
|
258
|
-
setSwitching(true);
|
|
259
|
-
try {
|
|
260
|
-
await onSwitch(workosOrgId);
|
|
261
|
-
setOpened(false);
|
|
262
|
-
} catch (error) {
|
|
263
|
-
console.error("Failed to switch organization:", error);
|
|
264
|
-
} finally {
|
|
265
|
-
setSwitching(false);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
if (isLoading) {
|
|
269
|
-
return /* @__PURE__ */ jsx(Button, { variant: "light", size: "xs", disabled: true, children: /* @__PURE__ */ jsx(Loader, { size: 14 }) });
|
|
270
|
-
}
|
|
271
|
-
if (memberships.length === 0) {
|
|
272
|
-
return /* @__PURE__ */ jsx(Button, { variant: "light", size: "xs", disabled: true, children: "None" });
|
|
273
|
-
}
|
|
274
|
-
return /* @__PURE__ */ jsxs(Menu, { opened, onChange: setOpened, position: "bottom-start", withinPortal: true, children: [
|
|
275
|
-
/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(
|
|
276
|
-
Button,
|
|
277
|
-
{
|
|
278
|
-
variant: "light",
|
|
279
|
-
size: "xs",
|
|
280
|
-
leftSection: /* @__PURE__ */ jsx(IconBuilding, { size: 16 }),
|
|
281
|
-
rightSection: /* @__PURE__ */ jsx(IconChevronDown, { size: 14 }),
|
|
282
|
-
loading: switching,
|
|
283
|
-
children: /* @__PURE__ */ jsx(Text, { truncate: true, style: { maxWidth: 200 }, size: "xs", children: currentOrganization?.name || "Select Organization" })
|
|
284
|
-
}
|
|
285
|
-
) }),
|
|
286
|
-
/* @__PURE__ */ jsxs(Menu.Dropdown, { children: [
|
|
287
|
-
currentOrganization && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
288
|
-
/* @__PURE__ */ jsx(Menu.Label, { children: "Current Organization" }),
|
|
289
|
-
/* @__PURE__ */ jsx(Menu.Item, { disabled: true, rightSection: /* @__PURE__ */ jsx(IconCheck, { size: 14 }), leftSection: /* @__PURE__ */ jsx(IconBuilding, { size: 14 }), children: currentOrganization.name }),
|
|
290
|
-
otherMemberships.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
291
|
-
/* @__PURE__ */ jsx(Menu.Divider, {}),
|
|
292
|
-
/* @__PURE__ */ jsx(Menu.Label, { children: "Switch Organization" })
|
|
293
|
-
] })
|
|
294
|
-
] }),
|
|
295
|
-
otherMemberships.length > 0 && /* @__PURE__ */ jsx("div", { children: otherMemberships.map((membership, index) => /* @__PURE__ */ jsx(
|
|
296
|
-
Menu.Item,
|
|
297
|
-
{
|
|
298
|
-
leftSection: /* @__PURE__ */ jsx(IconBuilding, { size: 14 }),
|
|
299
|
-
rightSection: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: membership.role.slug }),
|
|
300
|
-
onClick: () => {
|
|
301
|
-
const workosOrgId = membership.organization?.workos_org_id;
|
|
302
|
-
if (!workosOrgId) {
|
|
303
|
-
console.error("Organization missing WorkOS ID:", membership.organization?.name);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
handleSwitch(workosOrgId);
|
|
307
|
-
},
|
|
308
|
-
disabled: switching,
|
|
309
|
-
children: membership.organization?.name || "Unknown Organization"
|
|
310
|
-
},
|
|
311
|
-
`${membership.organizationId}-${index}`
|
|
312
|
-
)) }, "other-memberships"),
|
|
313
|
-
!currentOrganization && memberships.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
314
|
-
/* @__PURE__ */ jsx(Menu.Label, { children: "Select Organization" }),
|
|
315
|
-
memberships.map((membership) => /* @__PURE__ */ jsx(
|
|
316
|
-
Menu.Item,
|
|
317
|
-
{
|
|
318
|
-
leftSection: /* @__PURE__ */ jsx(IconBuilding, { size: 14 }),
|
|
319
|
-
rightSection: /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", children: membership.role.slug }),
|
|
320
|
-
onClick: () => {
|
|
321
|
-
const workosOrgId = membership.organization?.workos_org_id;
|
|
322
|
-
if (!workosOrgId) {
|
|
323
|
-
console.error("Organization missing WorkOS ID:", membership.organization?.name);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
handleSwitch(workosOrgId);
|
|
327
|
-
},
|
|
328
|
-
disabled: switching,
|
|
329
|
-
children: membership.organization?.name || "Unknown Organization"
|
|
330
|
-
},
|
|
331
|
-
membership.organizationId
|
|
332
|
-
))
|
|
333
|
-
] })
|
|
334
|
-
] })
|
|
335
|
-
] });
|
|
336
|
-
}
|
|
337
245
|
|
|
338
|
-
export {
|
|
246
|
+
export { createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIClientError } from './chunk-4VGWQ5AN.js';
|
|
2
|
+
import { OrganizationContext } from './chunk-DD3CCMCZ.js';
|
|
2
3
|
import { createContext, useContext, useMemo, useCallback } from 'react';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
|
|
@@ -54,7 +55,6 @@ function buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleRespon
|
|
|
54
55
|
try {
|
|
55
56
|
const token = await getAccessToken();
|
|
56
57
|
const organizationId = getOrganizationId();
|
|
57
|
-
if (organizationId) console.log("[apiRequest]", endpoint, "org:", organizationId);
|
|
58
58
|
const headers = {
|
|
59
59
|
...options.body ? { "Content-Type": "application/json" } : {},
|
|
60
60
|
...token ? { Authorization: `Bearer ${token}` } : {},
|
|
@@ -74,7 +74,8 @@ function buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleRespon
|
|
|
74
74
|
if (response.status === 204) {
|
|
75
75
|
return void 0;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
const data = await response.json();
|
|
78
|
+
return data;
|
|
78
79
|
} catch (error) {
|
|
79
80
|
if (error instanceof Error && error.message.includes("No access token")) {
|
|
80
81
|
const headers = {
|
|
@@ -101,7 +102,10 @@ function buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleRespon
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
function useApiClient(apiUrl) {
|
|
104
|
-
const { getAccessToken, getOrganizationId, isOrganizationReady, onError } = useApiClientContext();
|
|
105
|
+
const { getAccessToken, getOrganizationId, isOrganizationReady: contextOrgReady, onError } = useApiClientContext();
|
|
106
|
+
const orgCtx = useContext(OrganizationContext);
|
|
107
|
+
const orgReady = orgCtx ? !!orgCtx.currentWorkOSOrganizationId && !orgCtx.isInitializing && !orgCtx.isOrgRefreshing : contextOrgReady;
|
|
108
|
+
const orgInitializing = orgCtx ? orgCtx.isInitializing || orgCtx.isOrgRefreshing : false;
|
|
105
109
|
const handleResponseError = useCallback(
|
|
106
110
|
async (endpoint, response, options) => {
|
|
107
111
|
const errorData = await response.json().catch(() => ({
|
|
@@ -132,71 +136,22 @@ function useApiClient(apiUrl) {
|
|
|
132
136
|
);
|
|
133
137
|
const deferredApiRequest = useCallback(
|
|
134
138
|
async (endpoint, options = {}) => {
|
|
135
|
-
if (
|
|
139
|
+
if (orgInitializing) {
|
|
140
|
+
throw new Error("Organization context is still initializing. Please wait.");
|
|
141
|
+
}
|
|
142
|
+
if (!orgReady) {
|
|
136
143
|
throw new Error("No organization selected. Please select an organization.");
|
|
137
144
|
}
|
|
138
145
|
return apiRequest(endpoint, options);
|
|
139
146
|
},
|
|
140
|
-
[apiRequest,
|
|
147
|
+
[apiRequest, orgInitializing, orgReady]
|
|
141
148
|
);
|
|
142
149
|
return {
|
|
143
150
|
apiRequest,
|
|
144
151
|
deferredApiRequest,
|
|
145
|
-
isOrganizationReady,
|
|
146
|
-
isInitializing:
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
function createUseApiClient(useOrganizations, apiUrl) {
|
|
150
|
-
return function useApiClientCompat() {
|
|
151
|
-
const { getAccessToken, getOrganizationId, isOrganizationReady, onError } = useApiClientContext();
|
|
152
|
-
const { isInitializing, isOrgRefreshing } = useOrganizations();
|
|
153
|
-
const handleResponseError = useCallback(
|
|
154
|
-
async (endpoint, response, options) => {
|
|
155
|
-
const errorData = await response.json().catch(() => ({
|
|
156
|
-
error: `HTTP ${response.status}`,
|
|
157
|
-
code: "INTERNAL_SERVER_ERROR"
|
|
158
|
-
}));
|
|
159
|
-
if (response.status >= 500 && onError) {
|
|
160
|
-
onError(endpoint, new Error(errorData.error), {
|
|
161
|
-
method: options.method || "GET",
|
|
162
|
-
statusCode: response.status,
|
|
163
|
-
requestId: errorData.requestId
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
throw new APIClientError(
|
|
167
|
-
errorData.error,
|
|
168
|
-
errorData.code,
|
|
169
|
-
response.status,
|
|
170
|
-
errorData.requestId,
|
|
171
|
-
errorData.fields,
|
|
172
|
-
errorData.retryAfter
|
|
173
|
-
);
|
|
174
|
-
},
|
|
175
|
-
[onError]
|
|
176
|
-
);
|
|
177
|
-
const apiRequest = useCallback(
|
|
178
|
-
(endpoint, options = {}) => buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleResponseError)(endpoint, options),
|
|
179
|
-
[getAccessToken, getOrganizationId, handleResponseError]
|
|
180
|
-
);
|
|
181
|
-
const deferredApiRequest = useCallback(
|
|
182
|
-
async (endpoint, options = {}) => {
|
|
183
|
-
if (isInitializing || isOrgRefreshing) {
|
|
184
|
-
throw new Error("Organization context is still initializing. Please wait.");
|
|
185
|
-
}
|
|
186
|
-
if (!isOrganizationReady) {
|
|
187
|
-
throw new Error("No organization selected. Please select an organization.");
|
|
188
|
-
}
|
|
189
|
-
return apiRequest(endpoint, options);
|
|
190
|
-
},
|
|
191
|
-
[apiRequest, isInitializing, isOrgRefreshing, isOrganizationReady]
|
|
192
|
-
);
|
|
193
|
-
return {
|
|
194
|
-
apiRequest,
|
|
195
|
-
deferredApiRequest,
|
|
196
|
-
isOrganizationReady,
|
|
197
|
-
isInitializing: isInitializing || isOrgRefreshing
|
|
198
|
-
};
|
|
152
|
+
isOrganizationReady: orgReady,
|
|
153
|
+
isInitializing: orgInitializing
|
|
199
154
|
};
|
|
200
155
|
}
|
|
201
156
|
|
|
202
|
-
export { ApiClientProvider,
|
|
157
|
+
export { ApiClientProvider, useApiClient, useApiClientContext };
|