@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.
Files changed (279) hide show
  1. package/dist/CoreAuthKitInner-3J4RVQO6.js +43 -0
  2. package/dist/api/index.d.ts +7 -31
  3. package/dist/api/index.js +3 -2
  4. package/dist/auth/context.d.ts +23 -5
  5. package/dist/auth/guards/AdminGuard.d.ts +32 -0
  6. package/dist/auth/guards/AdminGuard.d.ts.map +1 -0
  7. package/dist/auth/guards/ProtectedRoute.d.ts +60 -0
  8. package/dist/auth/guards/ProtectedRoute.d.ts.map +1 -0
  9. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts +12 -0
  10. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts.map +1 -0
  11. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts +14 -0
  12. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts.map +1 -0
  13. package/dist/auth/index.d.ts +14 -171
  14. package/dist/auth/index.d.ts.map +1 -0
  15. package/dist/auth/index.js +5 -6
  16. package/dist/{chunk-FDCVFCOQ.js → chunk-2JBWPFHF.js} +23 -20
  17. package/dist/{chunk-BZTA7IIL.js → chunk-6IX5JZEH.js} +358 -4
  18. package/dist/chunk-FWZJH3TL.js +13 -0
  19. package/dist/chunk-GIFAF5ZS.js +313 -0
  20. package/dist/chunk-JGJSZ3UE.js +47 -0
  21. package/dist/chunk-JQLT6HBI.js +850 -0
  22. package/dist/{chunk-4KAG5U7A.js → chunk-L2CM2CUA.js} +0 -2
  23. package/dist/chunk-LFYO3MDC.js +58 -0
  24. package/dist/{chunk-OLD3NQLI.js → chunk-LTQAAIGE.js} +13 -17
  25. package/dist/{chunk-QQOLC46E.js → chunk-NEK6JKPW.js} +1 -1
  26. package/dist/{chunk-SITSZUFW.js → chunk-PVVQTENF.js} +1 -1
  27. package/dist/{chunk-FLJXZ7YC.js → chunk-SFF5MJEI.js} +2 -4
  28. package/dist/{chunk-EZMRFWZQ.js → chunk-U34YGJQB.js} +2 -94
  29. package/dist/{chunk-BWCC6ZJC.js → chunk-XLV6LYN2.js} +15 -60
  30. package/dist/components/index.d.ts +1 -1353
  31. package/dist/components/index.js +1 -20
  32. package/dist/components/navigation/index.d.ts +2 -32
  33. package/dist/components/navigation/index.js +1 -29
  34. package/dist/execution/index.d.ts +63 -231
  35. package/dist/execution/index.js +1 -4
  36. package/dist/graph/index.css +0 -1
  37. package/dist/graph/index.d.ts +4 -203
  38. package/dist/graph/index.js +1 -1
  39. package/dist/hooks/command-queue/index.d.ts +7 -0
  40. package/dist/hooks/command-queue/index.d.ts.map +1 -0
  41. package/dist/hooks/command-queue/useCommandQueue.d.ts +33 -0
  42. package/dist/hooks/command-queue/useCommandQueue.d.ts.map +1 -0
  43. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts +17 -0
  44. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts.map +1 -0
  45. package/dist/hooks/command-queue/useDeleteTask.d.ts +5 -0
  46. package/dist/hooks/command-queue/useDeleteTask.d.ts.map +1 -0
  47. package/dist/hooks/command-queue/usePatchTask.d.ts +6 -0
  48. package/dist/hooks/command-queue/usePatchTask.d.ts.map +1 -0
  49. package/dist/hooks/command-queue/useSubmitAction.d.ts +29 -0
  50. package/dist/hooks/command-queue/useSubmitAction.d.ts.map +1 -0
  51. package/dist/hooks/executions/index.d.ts +16 -0
  52. package/dist/hooks/executions/index.d.ts.map +1 -0
  53. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts +15 -0
  54. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts.map +1 -0
  55. package/dist/hooks/executions/useCancelExecution.d.ts +20 -0
  56. package/dist/hooks/executions/useCancelExecution.d.ts.map +1 -0
  57. package/dist/hooks/executions/useDeleteExecution.d.ts +13 -0
  58. package/dist/hooks/executions/useDeleteExecution.d.ts.map +1 -0
  59. package/dist/hooks/executions/useExecuteAsync.d.ts +21 -0
  60. package/dist/hooks/executions/useExecuteAsync.d.ts.map +1 -0
  61. package/dist/hooks/executions/useExecution.d.ts +10 -0
  62. package/dist/hooks/executions/useExecution.d.ts.map +1 -0
  63. package/dist/hooks/executions/useExecutions.d.ts +16 -0
  64. package/dist/hooks/executions/useExecutions.d.ts.map +1 -0
  65. package/dist/hooks/executions/useResourceDefinition.d.ts +9 -0
  66. package/dist/hooks/executions/useResourceDefinition.d.ts.map +1 -0
  67. package/dist/hooks/executions/useResources.d.ts +15 -0
  68. package/dist/hooks/executions/useResources.d.ts.map +1 -0
  69. package/dist/hooks/executions/useRetryExecution.d.ts +16 -0
  70. package/dist/hooks/executions/useRetryExecution.d.ts.map +1 -0
  71. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts +44 -0
  72. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts.map +1 -0
  73. package/dist/hooks/feature-access/index.d.ts +2 -0
  74. package/dist/hooks/feature-access/index.d.ts.map +1 -0
  75. package/dist/hooks/index.d.ts +11 -1927
  76. package/dist/hooks/index.d.ts.map +1 -0
  77. package/dist/hooks/index.js +5 -4
  78. package/dist/hooks/monitoring/index.d.ts +9 -0
  79. package/dist/hooks/monitoring/index.d.ts.map +1 -0
  80. package/dist/hooks/monitoring/useActivities.d.ts +52 -0
  81. package/dist/hooks/monitoring/useActivities.d.ts.map +1 -0
  82. package/dist/hooks/monitoring/useCostSummary.d.ts +7 -0
  83. package/dist/hooks/monitoring/useCostSummary.d.ts.map +1 -0
  84. package/dist/hooks/monitoring/useExecutionHealth.d.ts +10 -0
  85. package/dist/hooks/monitoring/useExecutionHealth.d.ts.map +1 -0
  86. package/dist/hooks/monitoring/useExecutionLogs.d.ts +56 -0
  87. package/dist/hooks/monitoring/useExecutionLogs.d.ts.map +1 -0
  88. package/dist/hooks/monitoring/useNotifications.d.ts +11 -0
  89. package/dist/hooks/monitoring/useNotifications.d.ts.map +1 -0
  90. package/dist/hooks/notifications/index.d.ts +8 -0
  91. package/dist/hooks/notifications/index.d.ts.map +1 -0
  92. package/dist/hooks/notifications/useMarkAllAsRead.d.ts +2 -0
  93. package/dist/hooks/notifications/useMarkAllAsRead.d.ts.map +1 -0
  94. package/dist/hooks/notifications/useMarkAsRead.d.ts +2 -0
  95. package/dist/hooks/notifications/useMarkAsRead.d.ts.map +1 -0
  96. package/dist/hooks/notifications/useNotificationCount.d.ts +8 -0
  97. package/dist/hooks/notifications/useNotificationCount.d.ts.map +1 -0
  98. package/dist/hooks/observability/index.d.ts +19 -0
  99. package/dist/hooks/observability/index.d.ts.map +1 -0
  100. package/dist/hooks/observability/useBusinessImpact.d.ts +9 -0
  101. package/dist/hooks/observability/useBusinessImpact.d.ts.map +1 -0
  102. package/dist/hooks/observability/useCostBreakdown.d.ts +10 -0
  103. package/dist/hooks/observability/useCostBreakdown.d.ts.map +1 -0
  104. package/dist/hooks/observability/useCostByModel.d.ts +3 -0
  105. package/dist/hooks/observability/useCostByModel.d.ts.map +1 -0
  106. package/dist/hooks/observability/useCostTrends.d.ts +3 -0
  107. package/dist/hooks/observability/useCostTrends.d.ts.map +1 -0
  108. package/dist/hooks/observability/useDashboardMetrics.d.ts +3 -0
  109. package/dist/hooks/observability/useDashboardMetrics.d.ts.map +1 -0
  110. package/dist/hooks/observability/useErrorAnalysis.d.ts +7 -0
  111. package/dist/hooks/observability/useErrorAnalysis.d.ts.map +1 -0
  112. package/dist/hooks/observability/useErrorDetails.d.ts +20 -0
  113. package/dist/hooks/observability/useErrorDetails.d.ts.map +1 -0
  114. package/dist/hooks/observability/useErrorDistribution.d.ts +12 -0
  115. package/dist/hooks/observability/useErrorDistribution.d.ts.map +1 -0
  116. package/dist/hooks/observability/useErrorTrends.d.ts +12 -0
  117. package/dist/hooks/observability/useErrorTrends.d.ts.map +1 -0
  118. package/dist/hooks/observability/useResolveError.d.ts +17 -0
  119. package/dist/hooks/observability/useResolveError.d.ts.map +1 -0
  120. package/dist/hooks/observability/useTopFailingResources.d.ts +13 -0
  121. package/dist/hooks/observability/useTopFailingResources.d.ts.map +1 -0
  122. package/dist/hooks/published.d.ts +19 -1652
  123. package/dist/hooks/published.d.ts.map +1 -0
  124. package/dist/hooks/published.js +369 -3
  125. package/dist/hooks/scheduling/index.d.ts +5 -0
  126. package/dist/hooks/scheduling/index.d.ts.map +1 -0
  127. package/dist/hooks/scheduling/useSchedules.d.ts +185 -0
  128. package/dist/hooks/scheduling/useSchedules.d.ts.map +1 -0
  129. package/dist/hooks/sessions/index.d.ts +8 -0
  130. package/dist/hooks/sessions/index.d.ts.map +1 -0
  131. package/dist/hooks/sessions/useSessionExecutions.d.ts +13 -0
  132. package/dist/hooks/sessions/useSessionExecutions.d.ts.map +1 -0
  133. package/dist/hooks/sessions/useSessionMessages.d.ts +7 -0
  134. package/dist/hooks/sessions/useSessionMessages.d.ts.map +1 -0
  135. package/dist/hooks/sessions/useSessions.d.ts +26 -0
  136. package/dist/hooks/sessions/useSessions.d.ts.map +1 -0
  137. package/dist/index.css +0 -118
  138. package/dist/index.d.ts +15 -7624
  139. package/dist/index.d.ts.map +1 -0
  140. package/dist/index.js +1125 -30
  141. package/dist/initialization/InitializationProvider.d.ts +48 -0
  142. package/dist/initialization/InitializationProvider.d.ts.map +1 -0
  143. package/dist/initialization/hooks/useAppInitialization.d.ts +32 -0
  144. package/dist/initialization/hooks/useAppInitialization.d.ts.map +1 -0
  145. package/dist/initialization/index.d.ts +22 -2361
  146. package/dist/initialization/index.d.ts.map +1 -0
  147. package/dist/initialization/index.js +4 -4
  148. package/dist/organization/context/OrganizationProvider.d.ts +20 -0
  149. package/dist/organization/context/OrganizationProvider.d.ts.map +1 -0
  150. package/dist/organization/hooks/useOrgInitialization.d.ts +56 -0
  151. package/dist/organization/hooks/useOrgInitialization.d.ts.map +1 -0
  152. package/dist/organization/index.d.ts +21 -283
  153. package/dist/organization/index.d.ts.map +1 -0
  154. package/dist/organization/index.js +4 -4
  155. package/dist/profile/context/ProfileProvider.d.ts +27 -0
  156. package/dist/profile/context/ProfileProvider.d.ts.map +1 -0
  157. package/dist/profile/hooks/useUserProfile.d.ts +31 -0
  158. package/dist/profile/hooks/useUserProfile.d.ts.map +1 -0
  159. package/dist/profile/index.d.ts +14 -2290
  160. package/dist/profile/index.d.ts.map +1 -0
  161. package/dist/profile/index.js +1 -1
  162. package/dist/provider/CoreAuthKitInner.d.ts +12 -0
  163. package/dist/provider/CoreAuthKitInner.d.ts.map +1 -0
  164. package/dist/provider/ElevasisCoreProvider.d.ts +39 -0
  165. package/dist/provider/ElevasisCoreProvider.d.ts.map +1 -0
  166. package/dist/provider/ElevasisServiceContext.d.ts +31 -0
  167. package/dist/provider/ElevasisServiceContext.d.ts.map +1 -0
  168. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts +2 -0
  169. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts.map +1 -0
  170. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts +2 -0
  171. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts.map +1 -0
  172. package/dist/provider/index.d.ts +7 -384
  173. package/dist/provider/index.d.ts.map +1 -0
  174. package/dist/provider/index.js +8 -9
  175. package/dist/provider/published.d.ts +9 -275
  176. package/dist/provider/published.d.ts.map +1 -0
  177. package/dist/provider/published.js +7 -8
  178. package/dist/provider/types.d.ts +190 -0
  179. package/dist/provider/types.d.ts.map +1 -0
  180. package/dist/sdk-barrel.d.ts +20 -0
  181. package/dist/sdk-barrel.d.ts.map +1 -0
  182. package/dist/supabase/index.d.ts +0 -255
  183. package/dist/supabase/index.js +2 -47
  184. package/dist/theme/cssVariables.d.ts +12 -0
  185. package/dist/theme/cssVariables.d.ts.map +1 -0
  186. package/dist/theme/index.d.ts +4 -0
  187. package/dist/theme/index.d.ts.map +1 -0
  188. package/dist/theme/presets/__tests__/getPreset.test.d.ts +2 -0
  189. package/dist/theme/presets/__tests__/getPreset.test.d.ts.map +1 -0
  190. package/dist/theme/presets/abyss.d.ts +3 -0
  191. package/dist/theme/presets/abyss.d.ts.map +1 -0
  192. package/dist/theme/presets/abyss.js +54 -0
  193. package/dist/theme/presets/aurora.d.ts +8 -0
  194. package/dist/theme/presets/aurora.d.ts.map +1 -0
  195. package/dist/theme/presets/aurora.js +59 -0
  196. package/dist/theme/presets/canopy.d.ts +3 -0
  197. package/dist/theme/presets/canopy.d.ts.map +1 -0
  198. package/dist/theme/presets/canopy.js +58 -0
  199. package/dist/theme/presets/cyber-flux.d.ts +8 -0
  200. package/dist/theme/presets/cyber-flux.d.ts.map +1 -0
  201. package/dist/theme/presets/cyber-strike.d.ts +9 -0
  202. package/dist/theme/presets/cyber-strike.d.ts.map +1 -0
  203. package/dist/theme/presets/cyber-void.d.ts +8 -0
  204. package/dist/theme/presets/cyber-void.d.ts.map +1 -0
  205. package/dist/theme/presets/cyber-volt.d.ts +8 -0
  206. package/dist/theme/presets/cyber-volt.d.ts.map +1 -0
  207. package/dist/theme/presets/default.d.ts +4 -0
  208. package/dist/theme/presets/default.d.ts.map +1 -0
  209. package/dist/theme/presets/ember.d.ts +8 -0
  210. package/dist/theme/presets/ember.d.ts.map +1 -0
  211. package/dist/theme/presets/ember.js +63 -0
  212. package/dist/theme/presets/honey.d.ts +3 -0
  213. package/dist/theme/presets/honey.d.ts.map +1 -0
  214. package/dist/theme/presets/honey.js +62 -0
  215. package/dist/theme/presets/index.d.ts +6 -0
  216. package/dist/theme/presets/index.d.ts.map +1 -0
  217. package/dist/theme/presets/midnight.d.ts +8 -0
  218. package/dist/theme/presets/midnight.d.ts.map +1 -0
  219. package/dist/theme/presets/midnight.js +68 -0
  220. package/dist/theme/presets/obsidian.d.ts +3 -0
  221. package/dist/theme/presets/obsidian.d.ts.map +1 -0
  222. package/dist/theme/presets/obsidian.js +56 -0
  223. package/dist/theme/presets/regal.d.ts +8 -0
  224. package/dist/theme/presets/regal.d.ts.map +1 -0
  225. package/dist/theme/presets/rose-gold.d.ts +8 -0
  226. package/dist/theme/presets/rose-gold.d.ts.map +1 -0
  227. package/dist/theme/presets/slate.d.ts +3 -0
  228. package/dist/theme/presets/slate.d.ts.map +1 -0
  229. package/dist/theme/presets/slate.js +56 -0
  230. package/dist/theme/presets/tactical.d.ts +8 -0
  231. package/dist/theme/presets/tactical.d.ts.map +1 -0
  232. package/dist/theme/presets/types.d.ts +26 -0
  233. package/dist/theme/presets/types.d.ts.map +1 -0
  234. package/dist/theme/presets/types.js +1 -0
  235. package/dist/utils/index.d.ts +1 -22
  236. package/dist/utils/index.js +1 -1
  237. package/package.json +67 -51
  238. package/dist/CoreAuthKitInner-KM72EYJS.js +0 -19
  239. package/dist/api/hooks/useApiClient.d.ts +0 -54
  240. package/dist/api/hooks/useApiClient.d.ts.map +0 -1
  241. package/dist/api/hooks/useApiClient.js +0 -185
  242. package/dist/chunk-3KMDHCAR.js +0 -52
  243. package/dist/chunk-6BJOYF6E.js +0 -8
  244. package/dist/chunk-BLO4SISK.js +0 -113
  245. package/dist/chunk-HUWJXLLF.js +0 -681
  246. package/dist/chunk-JVAZHVNV.js +0 -110
  247. package/dist/chunk-JYSYHVLU.js +0 -379
  248. package/dist/chunk-NE36BUGQ.js +0 -146
  249. package/dist/chunk-NIAVTSMB.js +0 -21
  250. package/dist/chunk-O3PY6B6E.js +0 -749
  251. package/dist/chunk-OXVOHOP3.js +0 -661
  252. package/dist/chunk-PCBXNHKY.js +0 -1460
  253. package/dist/chunk-PSLKGOBZ.js +0 -58
  254. package/dist/chunk-QSVZP2NU.js +0 -214
  255. package/dist/chunk-RJCA5672.js +0 -1664
  256. package/dist/chunk-TMFCNFLW.js +0 -107
  257. package/dist/chunk-TN3PU2WK.js +0 -748
  258. package/dist/chunk-W7ZBF5AA.js +0 -1
  259. package/dist/chunk-YZ6GTZXL.js +0 -48
  260. package/dist/components/command-queue/index.css +0 -53
  261. package/dist/components/command-queue/index.d.ts +0 -204
  262. package/dist/components/command-queue/index.js +0 -12
  263. package/dist/components/forms/index.d.ts +0 -56
  264. package/dist/components/forms/index.js +0 -2
  265. package/dist/components/index.css +0 -443
  266. package/dist/components/monitoring/index.d.ts +0 -66
  267. package/dist/components/monitoring/index.js +0 -2
  268. package/dist/components/notifications/index.d.ts +0 -52
  269. package/dist/components/notifications/index.js +0 -5
  270. package/dist/components/resource-definition/index.css +0 -388
  271. package/dist/components/resource-definition/index.d.ts +0 -301
  272. package/dist/components/resource-definition/index.js +0 -3
  273. package/dist/display/index.css +0 -53
  274. package/dist/display/index.d.ts +0 -606
  275. package/dist/display/index.js +0 -7
  276. package/dist/execution/index.css +0 -388
  277. package/dist/provider/index.css +0 -61
  278. /package/dist/{chunk-Q47SPRY7.js → chunk-BUZONXAW.js} +0 -0
  279. /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 { OAuthProvider } from './chunk-QSVZP2NU.js';
5
- import { InitializationProvider } from './chunk-QQOLC46E.js';
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-KM72EYJS.js').then((m) => ({ default: m.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' and 'oauth' modes are supported.`
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 = auth.mode === "authkit" ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) }) : /* @__PURE__ */ jsx(CoreOAuthInner, { auth, children: content });
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 useApiClient = useRef(createUseApiClient(defaultUseOrganizations, apiUrl)).current;
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
- return /* @__PURE__ */ jsx(Fragment, { children });
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,4 +1,4 @@
1
- import { useUserProfile } from './chunk-4KAG5U7A.js';
1
+ import { useUserProfile } from './chunk-L2CM2CUA.js';
2
2
  import { useAuthContext } from './chunk-7PLEQFHO.js';
3
3
  import { useMemo, useCallback } from 'react';
4
4
 
@@ -1,6 +1,6 @@
1
- import { OrganizationContext } from './chunk-DD3CCMCZ.js';
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-4KAG5U7A.js';
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 { OrganizationSwitcher, createOrganizationsSlice, createUseOrgInitialization, createUseOrganizations };
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
- return response.json();
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 (!isOrganizationReady) {
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, isOrganizationReady]
147
+ [apiRequest, orgInitializing, orgReady]
141
148
  );
142
149
  return {
143
150
  apiRequest,
144
151
  deferredApiRequest,
145
- isOrganizationReady,
146
- isInitializing: false
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, createUseApiClient, useApiClient, useApiClientContext };
157
+ export { ApiClientProvider, useApiClient, useApiClientContext };