@elevasis/ui 1.26.1 → 1.28.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.
- package/dist/charts/index.js +2 -2
- package/dist/{chunk-MHW43EOH.js → chunk-2IFYDILW.js} +2 -1
- package/dist/{chunk-AWT255UH.js → chunk-2IJCM3VQ.js} +37 -37
- package/dist/{chunk-4INR75ZS.js → chunk-37NT4BNV.js} +589 -65
- package/dist/chunk-5COLSYBE.js +199 -0
- package/dist/{chunk-YNGQ7U5H.js → chunk-7CJ5QBN2.js} +2 -2
- package/dist/{chunk-L3GVDMCA.js → chunk-C27LLJM6.js} +3 -195
- package/dist/chunk-C4WOXS2C.js +6646 -0
- package/dist/{chunk-RMPXGBNI.js → chunk-D25AE46Q.js} +2 -2
- package/dist/{chunk-ZVJKIJFG.js → chunk-EBCIUZVV.js} +13 -42
- package/dist/{chunk-O4UB5DQQ.js → chunk-F2J7675J.js} +1 -1
- package/dist/chunk-KLG4H5NM.js +247 -0
- package/dist/{chunk-BS4J2LAW.js → chunk-QTD5HPKD.js} +1 -1
- package/dist/chunk-S4S6K4MV.js +635 -0
- package/dist/{chunk-FEZZ3IDU.js → chunk-TXPUIHX2.js} +10 -10
- package/dist/{chunk-L4XXM55J.js → chunk-W4VYXIN7.js} +142 -3
- package/dist/{chunk-4WKWLFBZ.js → chunk-ZUJ7WMGV.js} +1 -1
- package/dist/chunk-ZXBD5SBV.js +2115 -0
- package/dist/components/index.d.ts +339 -73
- package/dist/components/index.js +840 -688
- package/dist/features/auth/index.d.ts +125 -0
- package/dist/features/auth/index.js +2 -2
- package/dist/features/dashboard/index.d.ts +28 -2
- package/dist/features/dashboard/index.js +21 -635
- package/dist/features/monitoring/index.d.ts +28 -1
- package/dist/features/monitoring/index.js +19 -529
- package/dist/features/operations/index.d.ts +57 -8
- package/dist/features/operations/index.js +25 -3760
- package/dist/features/settings/index.d.ts +153 -1
- package/dist/features/settings/index.js +19 -1438
- package/dist/hooks/index.d.ts +262 -25
- package/dist/hooks/index.js +12 -8
- package/dist/hooks/published.d.ts +137 -25
- package/dist/hooks/published.js +11 -7
- package/dist/index.d.ts +388 -99
- package/dist/index.js +12 -11
- package/dist/initialization/index.d.ts +125 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +6 -5
- package/dist/organization/index.js +1 -2
- package/dist/profile/index.d.ts +125 -0
- package/dist/provider/index.d.ts +130 -3
- package/dist/provider/index.js +10 -4
- package/dist/provider/published.d.ts +130 -3
- package/dist/provider/published.js +8 -2
- package/dist/router/context.d.ts +1 -0
- package/dist/router/index.d.ts +1 -0
- package/dist/router/index.js +1 -1
- package/dist/supabase/index.d.ts +242 -0
- package/dist/theme/index.js +2 -2
- package/dist/types/index.d.ts +126 -1
- package/package.json +1 -1
- package/dist/chunk-LR4WVA7W.js +0 -682
- package/dist/chunk-R7WLWGPO.js +0 -126
- package/dist/chunk-TCKIAHDC.js +0 -2626
- package/dist/chunk-V7XHGJQZ.js +0 -145
- package/dist/{chunk-WWEMNIHW.js → chunk-YYBM5LNJ.js} +1 -1
package/dist/chunk-V7XHGJQZ.js
DELETED
|
@@ -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';
|