@elevasis/ui 1.26.1 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/charts/index.js +2 -2
  2. package/dist/{chunk-AWT255UH.js → chunk-2IJCM3VQ.js} +37 -37
  3. package/dist/chunk-5COLSYBE.js +199 -0
  4. package/dist/{chunk-RMPXGBNI.js → chunk-5JSR6TL5.js} +2 -2
  5. package/dist/chunk-BAGYETKM.js +635 -0
  6. package/dist/{chunk-L3GVDMCA.js → chunk-C27LLJM6.js} +3 -195
  7. package/dist/{chunk-O4UB5DQQ.js → chunk-F2J7675J.js} +1 -1
  8. package/dist/chunk-ITCEULI5.js +238 -0
  9. package/dist/{chunk-4WKWLFBZ.js → chunk-P5EWG45B.js} +1 -1
  10. package/dist/{chunk-BS4J2LAW.js → chunk-QTD5HPKD.js} +1 -1
  11. package/dist/{chunk-ZVJKIJFG.js → chunk-RCQPWA5X.js} +13 -42
  12. package/dist/chunk-TLAIQC7B.js +6382 -0
  13. package/dist/{chunk-FEZZ3IDU.js → chunk-TXPUIHX2.js} +10 -10
  14. package/dist/{chunk-L4XXM55J.js → chunk-W4VYXIN7.js} +142 -3
  15. package/dist/chunk-WJ7W7JU4.js +2115 -0
  16. package/dist/{chunk-YNGQ7U5H.js → chunk-WLNEJ6JJ.js} +2 -2
  17. package/dist/{chunk-4INR75ZS.js → chunk-Y2SYGFRF.js} +589 -65
  18. package/dist/components/index.d.ts +333 -73
  19. package/dist/components/index.js +838 -686
  20. package/dist/features/auth/index.d.ts +125 -0
  21. package/dist/features/auth/index.js +2 -2
  22. package/dist/features/dashboard/index.d.ts +28 -2
  23. package/dist/features/dashboard/index.js +21 -635
  24. package/dist/features/monitoring/index.d.ts +28 -1
  25. package/dist/features/monitoring/index.js +19 -529
  26. package/dist/features/operations/index.d.ts +51 -8
  27. package/dist/features/operations/index.js +25 -3760
  28. package/dist/features/settings/index.d.ts +153 -1
  29. package/dist/features/settings/index.js +19 -1438
  30. package/dist/hooks/index.d.ts +262 -25
  31. package/dist/hooks/index.js +12 -8
  32. package/dist/hooks/published.d.ts +137 -25
  33. package/dist/hooks/published.js +11 -7
  34. package/dist/index.d.ts +310 -28
  35. package/dist/index.js +12 -11
  36. package/dist/initialization/index.d.ts +125 -0
  37. package/dist/layout/index.d.ts +2 -0
  38. package/dist/layout/index.js +6 -5
  39. package/dist/organization/index.js +1 -2
  40. package/dist/profile/index.d.ts +125 -0
  41. package/dist/provider/index.d.ts +48 -3
  42. package/dist/provider/index.js +10 -4
  43. package/dist/provider/published.d.ts +48 -3
  44. package/dist/provider/published.js +8 -2
  45. package/dist/supabase/index.d.ts +242 -0
  46. package/dist/theme/index.js +2 -2
  47. package/dist/types/index.d.ts +126 -1
  48. package/package.json +3 -3
  49. package/dist/chunk-LR4WVA7W.js +0 -682
  50. package/dist/chunk-R7WLWGPO.js +0 -126
  51. package/dist/chunk-TCKIAHDC.js +0 -2626
  52. package/dist/chunk-V7XHGJQZ.js +0 -145
  53. package/dist/{chunk-WWEMNIHW.js → chunk-YYBM5LNJ.js} +1 -1
@@ -1,145 +0,0 @@
1
- import { OrganizationContext } from './chunk-DD3CCMCZ.js';
2
- import { useProfile } from './chunk-QEPXAWE2.js';
3
- import { useAuthContext } from './chunk-BRJ3QZ4E.js';
4
- import { useState, useRef, useEffect, useCallback, createElement } from 'react';
5
- import { useQueryClient } from '@tanstack/react-query';
6
-
7
- function OrganizationProvider({ apiRequest, children }) {
8
- const { user, organizationId: workosOrgId } = useAuthContext();
9
- const { profile } = useProfile();
10
- const queryClient = useQueryClient();
11
- const [memberships, setMemberships] = useState([]);
12
- const [currentWorkOSOrganizationId, setCurrentWorkOSOrganizationId] = useState(null);
13
- const [currentSupabaseOrganizationId, setCurrentSupabaseOrganizationId] = useState(null);
14
- const [currentMembership, setCurrentMembership] = useState(null);
15
- const [isInitializing, setIsInitializing] = useState(true);
16
- const [isOrgRefreshing, setIsOrgRefreshing] = useState(false);
17
- const [error, setError] = useState(null);
18
- const hasInitializedRef = useRef(false);
19
- const [profileLoaded, setProfileLoaded] = useState(false);
20
- useEffect(() => {
21
- if (profile !== void 0 && profile !== null) {
22
- setProfileLoaded(true);
23
- }
24
- }, [profile]);
25
- useEffect(() => {
26
- if (!user) {
27
- setMemberships([]);
28
- setCurrentWorkOSOrganizationId(null);
29
- setCurrentSupabaseOrganizationId(null);
30
- setCurrentMembership(null);
31
- setIsInitializing(false);
32
- setIsOrgRefreshing(false);
33
- setError(null);
34
- hasInitializedRef.current = false;
35
- setProfileLoaded(false);
36
- }
37
- }, [user]);
38
- const applyMembership = useCallback((membership) => {
39
- setCurrentMembership(membership);
40
- setCurrentSupabaseOrganizationId(membership?.organization?.id ?? null);
41
- setCurrentWorkOSOrganizationId(membership?.organization?.workos_org_id ?? null);
42
- }, []);
43
- const selectOrganization = useCallback(
44
- (data) => {
45
- let selected = null;
46
- if (profile?.last_visited_org) {
47
- selected = data.find((m) => m.organizationId === profile.last_visited_org) ?? null;
48
- }
49
- if (!selected && workosOrgId) {
50
- selected = data.find((m) => m.organization?.workos_org_id === workosOrgId) ?? null;
51
- }
52
- if (!selected && data.length > 0) {
53
- selected = data[0];
54
- }
55
- if (selected) {
56
- applyMembership(selected);
57
- }
58
- },
59
- [profile?.last_visited_org, workosOrgId, applyMembership]
60
- );
61
- const fetchAndInitialize = useCallback(async () => {
62
- if (!user?.id || !profileLoaded) return;
63
- setError(null);
64
- if (memberships.length === 0) {
65
- setIsInitializing(true);
66
- } else {
67
- setIsOrgRefreshing(true);
68
- }
69
- try {
70
- const data = await apiRequest("/memberships/my-memberships");
71
- if (!Array.isArray(data)) {
72
- throw new Error("Invalid memberships response");
73
- }
74
- setMemberships(data);
75
- if (data.length === 0) {
76
- hasInitializedRef.current = true;
77
- return;
78
- }
79
- if (!currentWorkOSOrganizationId) {
80
- selectOrganization(data);
81
- } else {
82
- const stillPresent = data.find((m) => m.organization?.workos_org_id === currentWorkOSOrganizationId);
83
- if (!stillPresent) {
84
- applyMembership(data[0] ?? null);
85
- } else if (stillPresent.id !== currentMembership?.id) {
86
- applyMembership(stillPresent);
87
- }
88
- }
89
- hasInitializedRef.current = true;
90
- } catch (err) {
91
- setError(err instanceof Error ? err.message : "Failed to load organizations");
92
- } finally {
93
- setIsInitializing(false);
94
- setIsOrgRefreshing(false);
95
- }
96
- }, [
97
- user?.id,
98
- profileLoaded,
99
- memberships.length,
100
- apiRequest,
101
- currentWorkOSOrganizationId,
102
- currentMembership?.id,
103
- selectOrganization,
104
- applyMembership
105
- ]);
106
- useEffect(() => {
107
- if (!user?.id || !profileLoaded || hasInitializedRef.current) return;
108
- fetchAndInitialize();
109
- }, [user?.id, profileLoaded, fetchAndInitialize]);
110
- const switchOrganization = useCallback(
111
- (workosOrgId2) => {
112
- const target = memberships.find((m) => m.organization?.workos_org_id === workosOrgId2);
113
- if (!target) return;
114
- applyMembership(target);
115
- void queryClient.invalidateQueries();
116
- void apiRequest("/users/me", {
117
- method: "PATCH",
118
- headers: { "Content-Type": "application/json" },
119
- body: JSON.stringify({ last_visited_org: target.organizationId })
120
- }).catch((err) => {
121
- console.warn("Failed to persist last_visited_org preference:", err);
122
- });
123
- },
124
- [memberships, applyMembership, queryClient, apiRequest]
125
- );
126
- const retry = useCallback(async () => {
127
- hasInitializedRef.current = false;
128
- setError(null);
129
- await fetchAndInitialize();
130
- }, [fetchAndInitialize]);
131
- const value = {
132
- currentWorkOSOrganizationId,
133
- currentSupabaseOrganizationId,
134
- currentMembership,
135
- memberships,
136
- isInitializing,
137
- isOrgRefreshing,
138
- error,
139
- switchOrganization,
140
- retry
141
- };
142
- return createElement(OrganizationContext.Provider, { value }, children);
143
- }
144
-
145
- export { OrganizationProvider };
@@ -1,5 +1,5 @@
1
- import { topbarHeight } from './chunk-QJ2S46NI.js';
2
1
  import { useAppearance } from './chunk-QJ2KCHKX.js';
2
+ import { topbarHeight } from './chunk-QJ2S46NI.js';
3
3
  import { Title, Button } from '@mantine/core';
4
4
  import { IconAlertCircle } from '@tabler/icons-react';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';