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