@elevasis/ui 2.66.0 → 2.68.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/api/index.d.ts +1 -1
- package/dist/api/index.js +3 -3
- package/dist/app/index.d.ts +16 -15
- package/dist/app/index.js +31 -21
- package/dist/auth/index.js +10 -12
- package/dist/charts/index.js +10 -12
- package/dist/chunk-2MTP3H3A.js +425 -0
- package/dist/chunk-3KMDHCAR.js +52 -0
- package/dist/chunk-3MEXPLWT.js +265 -0
- package/dist/{chunk-XNW3O6QW.js → chunk-5NRJ2BLQ.js} +1 -1
- package/dist/chunk-75NOC536.js +2162 -0
- package/dist/chunk-76IVMVI3.js +1764 -0
- package/dist/chunk-AH52XQB7.js +1 -0
- package/dist/chunk-BZZCNLT6.js +12 -0
- package/dist/chunk-DLR4SDZW.js +51 -0
- package/dist/chunk-FK3K2VK2.js +2103 -0
- package/dist/chunk-GBXTRSAU.js +37 -0
- package/dist/chunk-HJVPVS57.js +1934 -0
- package/dist/{chunk-M535KHLW.js → chunk-JC5W55J3.js} +1 -1
- package/dist/{chunk-I7BZVVVU.js → chunk-L3HFJFYF.js} +89 -382
- package/dist/chunk-LGKLC5MG.js +44 -0
- package/dist/{chunk-4DV4ECMG.js → chunk-N7U24M2J.js} +4 -0
- package/dist/chunk-NDHMZT2G.js +383 -0
- package/dist/chunk-OOACTYRA.js +10 -0
- package/dist/chunk-PDHTXPSF.js +12 -0
- package/dist/chunk-QYI5BZKM.js +85 -0
- package/dist/{chunk-4OEVLV66.js → chunk-R6NMRXNO.js} +112 -147
- package/dist/chunk-SIVUCZXQ.js +1194 -0
- package/dist/{chunk-JFBZ6XDW.js → chunk-SNZDFCOQ.js} +3 -49
- package/dist/chunk-TGPJNKDU.js +1595 -0
- package/dist/chunk-TUMSNGTX.js +35 -0
- package/dist/chunk-TYKAKJGW.js +67 -0
- package/dist/chunk-UD657ICS.js +589 -0
- package/dist/chunk-WPIASV3H.js +194 -0
- package/dist/chunk-ZFISGKYW.js +39 -0
- package/dist/chunk-ZGCWTWBD.js +16127 -0
- package/dist/chunk-ZNKZMK2E.js +4528 -0
- package/dist/chunk-ZWS3TCQR.js +11032 -0
- package/dist/components/chat/index.js +2 -1
- package/dist/components/index.d.ts +23 -11
- package/dist/components/index.js +2773 -14
- package/dist/components/navigation/index.js +11 -12
- package/dist/features/auth/index.d.ts +0 -4
- package/dist/features/auth/index.js +12 -13
- package/dist/features/clients/index.js +14 -12
- package/dist/features/crm/index.d.ts +1371 -15
- package/dist/features/crm/index.js +15 -12
- package/dist/features/dashboard/index.d.ts +1 -2
- package/dist/features/dashboard/index.js +15 -12
- package/dist/features/delivery/index.d.ts +0 -4
- package/dist/features/delivery/index.js +15 -12
- package/dist/features/knowledge/index.js +10 -12
- package/dist/features/lead-gen/index.d.ts +35 -15
- package/dist/features/lead-gen/index.js +16 -12
- package/dist/features/monitoring/index.js +15 -12
- package/dist/features/monitoring/requests/index.js +13 -13
- package/dist/features/operations/index.d.ts +1 -2
- package/dist/features/operations/index.js +21 -12
- package/dist/features/public-agent-chat/index.js +2 -1
- package/dist/features/seo/index.js +2 -1
- package/dist/features/settings/index.d.ts +0 -4
- package/dist/features/settings/index.js +14 -12
- package/dist/hooks/access/index.js +10 -12
- package/dist/hooks/delivery/index.d.ts +0 -4
- package/dist/hooks/delivery/index.js +2 -23
- package/dist/hooks/index.d.ts +13 -7
- package/dist/hooks/index.js +10 -12
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -2
- package/dist/hooks/published.d.ts +13 -7
- package/dist/hooks/published.js +10 -12
- package/dist/initialization/index.d.ts +1 -5
- package/dist/knowledge/index.d.ts +1 -2
- package/dist/knowledge/index.js +15 -13
- package/dist/layout/index.js +14 -12
- package/dist/organization/index.d.ts +3 -3
- package/dist/organization/index.js +1 -21
- package/dist/profile/index.d.ts +0 -4
- package/dist/provider/index.d.ts +2 -7
- package/dist/provider/index.js +10 -12
- package/dist/provider/published.d.ts +2 -7
- package/dist/provider/published.js +10 -12
- package/dist/supabase/index.d.ts +0 -8
- package/dist/test-utils/index.d.ts +5 -0
- package/dist/test-utils/index.js +5 -5
- package/dist/test-utils/setup-integration.js +1 -1
- package/dist/test-utils/setup.js +1 -1
- package/dist/theme/index.js +2 -1
- package/dist/typeform/index.js +2049 -1
- package/dist/types/index.d.ts +13 -7
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-ANNM5R7S.js +0 -51404
- package/dist/chunk-AUDNF2Q7.js +0 -2050
- package/dist/index.css +0 -659
- package/dist/index.d.ts +0 -17888
- package/dist/index.js +0 -30
- package/dist/{chunk-GMXGDO3I.js → chunk-MISHPEJX.js} +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Box, Text } from '@mantine/core';
|
|
2
|
+
import { AreaChart } from '@mantine/charts';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/monitoring/ResourceHealthChart.tsx
|
|
6
|
+
function getHealthColor(successRate, hasExecutions = true) {
|
|
7
|
+
if (!hasExecutions) return "var(--mantine-color-gray-6)";
|
|
8
|
+
if (successRate >= 95) return "var(--color-success)";
|
|
9
|
+
if (successRate >= 80) return "var(--color-warning)";
|
|
10
|
+
return "var(--color-error)";
|
|
11
|
+
}
|
|
12
|
+
function ResourceHealthChart({
|
|
13
|
+
healthData,
|
|
14
|
+
hasExecutions = true,
|
|
15
|
+
width = 300,
|
|
16
|
+
height = 60
|
|
17
|
+
}) {
|
|
18
|
+
if (!healthData || healthData.trendData.length === 0) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Box, { w: width, h: height, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "No activity" }) });
|
|
20
|
+
}
|
|
21
|
+
const chartData = healthData.trendData.map((d) => ({
|
|
22
|
+
time: d.time,
|
|
23
|
+
rate: d.rate
|
|
24
|
+
}));
|
|
25
|
+
const chartColor = getHealthColor(healthData.summary.successRate, hasExecutions);
|
|
26
|
+
return /* @__PURE__ */ jsx(Box, { w: width, h: height, children: /* @__PURE__ */ jsx(
|
|
27
|
+
AreaChart,
|
|
28
|
+
{
|
|
29
|
+
h: height,
|
|
30
|
+
data: chartData,
|
|
31
|
+
dataKey: "time",
|
|
32
|
+
series: [{ name: "rate", color: chartColor }],
|
|
33
|
+
curveType: "monotone",
|
|
34
|
+
withDots: false,
|
|
35
|
+
withTooltip: false,
|
|
36
|
+
withXAxis: false,
|
|
37
|
+
withYAxis: false,
|
|
38
|
+
fillOpacity: 0.2,
|
|
39
|
+
gridAxis: "none"
|
|
40
|
+
}
|
|
41
|
+
) });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { ResourceHealthChart, getHealthColor };
|
|
@@ -19,6 +19,10 @@ var mockUseAuth = {
|
|
|
19
19
|
// to it when no account exists yet.
|
|
20
20
|
signUp: vi.fn(),
|
|
21
21
|
signOut: vi.fn(),
|
|
22
|
+
// AuthKit's useAuth also exposes switchToOrganization; components that render
|
|
23
|
+
// OrganizationSwitcher call it directly, so the default mock needs a resolved
|
|
24
|
+
// implementation rather than leaving consumers to redefine it locally.
|
|
25
|
+
switchToOrganization: vi.fn().mockResolvedValue(void 0),
|
|
22
26
|
getAccessToken: vi.fn().mockResolvedValue("mock-access-token"),
|
|
23
27
|
organizationId: "test-org-id",
|
|
24
28
|
canRecover: vi.fn(() => false)
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-L3HFJFYF.js';
|
|
2
|
+
import { useElevasisServices } from './chunk-BI5VDO2K.js';
|
|
3
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
4
|
+
import { notifications } from '@mantine/notifications';
|
|
5
|
+
|
|
6
|
+
var showInfoNotification = (message) => {
|
|
7
|
+
notifications.show({
|
|
8
|
+
title: "Info",
|
|
9
|
+
message,
|
|
10
|
+
autoClose: 5e3,
|
|
11
|
+
color: "blue",
|
|
12
|
+
position: "top-right"
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var showSuccessNotification = (message) => {
|
|
16
|
+
notifications.show({
|
|
17
|
+
title: "Action Successful",
|
|
18
|
+
message,
|
|
19
|
+
autoClose: 5e3,
|
|
20
|
+
color: "green",
|
|
21
|
+
position: "top-right"
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var showErrorNotification = (error) => {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
error = error.message;
|
|
27
|
+
}
|
|
28
|
+
notifications.show({
|
|
29
|
+
title: "Action Failed",
|
|
30
|
+
message: error,
|
|
31
|
+
autoClose: 5e3,
|
|
32
|
+
color: "red",
|
|
33
|
+
position: "top-right"
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var showWarningNotification = (message) => {
|
|
37
|
+
notifications.show({
|
|
38
|
+
title: "Warning",
|
|
39
|
+
message,
|
|
40
|
+
autoClose: 5e3,
|
|
41
|
+
color: "orange",
|
|
42
|
+
position: "top-right"
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var showApiErrorNotification = (error) => {
|
|
46
|
+
const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
|
|
47
|
+
notifications.show({
|
|
48
|
+
title: getErrorTitle(code),
|
|
49
|
+
message: formatErrorMessage(message, requestId, fields, retryAfter),
|
|
50
|
+
autoClose: retryAfter ? retryAfter * 1e3 : 5e3,
|
|
51
|
+
color: "red",
|
|
52
|
+
position: "top-right"
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var milestoneKeys = {
|
|
56
|
+
all: ["project-milestones"],
|
|
57
|
+
lists: () => [...milestoneKeys.all, "list"],
|
|
58
|
+
list: (orgId, filters) => [...milestoneKeys.all, "list", orgId, filters],
|
|
59
|
+
details: () => [...milestoneKeys.all, "detail"],
|
|
60
|
+
detail: (id) => [...milestoneKeys.all, "detail", id]
|
|
61
|
+
};
|
|
62
|
+
function useMilestones(filters = {}) {
|
|
63
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
64
|
+
return useQuery({
|
|
65
|
+
queryKey: milestoneKeys.list(workOSOrganizationId, filters),
|
|
66
|
+
queryFn: async () => {
|
|
67
|
+
const res = await apiRequest(`/projects/${filters.projectId}/milestones`);
|
|
68
|
+
return res.milestones;
|
|
69
|
+
},
|
|
70
|
+
enabled: isReady && !!filters.projectId
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function useCreateMilestone() {
|
|
74
|
+
const { apiRequest } = useElevasisServices();
|
|
75
|
+
const queryClient = useQueryClient();
|
|
76
|
+
return useMutation({
|
|
77
|
+
mutationFn: async (params) => {
|
|
78
|
+
const { project_id, ...body } = params;
|
|
79
|
+
if (!project_id) throw new Error("project_id is required to create a milestone");
|
|
80
|
+
const res = await apiRequest(`/projects/${project_id}/milestones`, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
body: JSON.stringify(body)
|
|
83
|
+
});
|
|
84
|
+
return res.milestone;
|
|
85
|
+
},
|
|
86
|
+
onSuccess: (data) => {
|
|
87
|
+
queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
|
|
88
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
89
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
90
|
+
},
|
|
91
|
+
onError: (error) => {
|
|
92
|
+
showApiErrorNotification(error);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function useUpdateMilestone() {
|
|
97
|
+
const { apiRequest } = useElevasisServices();
|
|
98
|
+
const queryClient = useQueryClient();
|
|
99
|
+
return useMutation({
|
|
100
|
+
mutationFn: async (params) => {
|
|
101
|
+
const res = await apiRequest(`/milestones/${params.id}`, {
|
|
102
|
+
method: "PATCH",
|
|
103
|
+
body: JSON.stringify(params.updates)
|
|
104
|
+
});
|
|
105
|
+
return res.milestone;
|
|
106
|
+
},
|
|
107
|
+
onSuccess: (data) => {
|
|
108
|
+
queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
|
|
109
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
110
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
111
|
+
},
|
|
112
|
+
onError: (error) => {
|
|
113
|
+
showApiErrorNotification(error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function useDeleteMilestone() {
|
|
118
|
+
const { apiRequest } = useElevasisServices();
|
|
119
|
+
const queryClient = useQueryClient();
|
|
120
|
+
return useMutation({
|
|
121
|
+
mutationFn: async (params) => {
|
|
122
|
+
await apiRequest(`/milestones/${params.id}`, {
|
|
123
|
+
method: "DELETE"
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
onSuccess: (_, params) => {
|
|
127
|
+
queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
|
|
128
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
129
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(params.projectId) });
|
|
130
|
+
},
|
|
131
|
+
onError: (error) => {
|
|
132
|
+
showApiErrorNotification(error);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
var taskKeys = {
|
|
137
|
+
all: ["project-tasks"],
|
|
138
|
+
lists: () => [...taskKeys.all, "list"],
|
|
139
|
+
list: (orgId, filters) => [...taskKeys.all, "list", orgId, filters],
|
|
140
|
+
details: () => [...taskKeys.all, "detail"],
|
|
141
|
+
detail: (id) => [...taskKeys.all, "detail", id]
|
|
142
|
+
};
|
|
143
|
+
function useTasks(filters = {}) {
|
|
144
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
145
|
+
return useQuery({
|
|
146
|
+
queryKey: taskKeys.list(workOSOrganizationId, filters),
|
|
147
|
+
queryFn: async () => {
|
|
148
|
+
const params = new URLSearchParams();
|
|
149
|
+
if (filters.status) params.set("status", filters.status);
|
|
150
|
+
if (filters.milestoneId) params.set("milestone_id", filters.milestoneId);
|
|
151
|
+
const qs = params.toString();
|
|
152
|
+
const base = `/projects/${filters.projectId}/tasks`;
|
|
153
|
+
const path = qs ? `${base}?${qs}` : base;
|
|
154
|
+
const res = await apiRequest(path);
|
|
155
|
+
return res.tasks;
|
|
156
|
+
},
|
|
157
|
+
enabled: isReady && !!filters.projectId
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function useCreateTask() {
|
|
161
|
+
const { apiRequest } = useElevasisServices();
|
|
162
|
+
const queryClient = useQueryClient();
|
|
163
|
+
return useMutation({
|
|
164
|
+
mutationFn: async (params) => {
|
|
165
|
+
const res = await apiRequest("/project-tasks", {
|
|
166
|
+
method: "POST",
|
|
167
|
+
body: JSON.stringify(params)
|
|
168
|
+
});
|
|
169
|
+
return res.task;
|
|
170
|
+
},
|
|
171
|
+
onSuccess: (data) => {
|
|
172
|
+
queryClient.invalidateQueries({ queryKey: taskKeys.all });
|
|
173
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
174
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
175
|
+
},
|
|
176
|
+
onError: (error) => {
|
|
177
|
+
showApiErrorNotification(error);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function useUpdateTask() {
|
|
182
|
+
const { apiRequest } = useElevasisServices();
|
|
183
|
+
const queryClient = useQueryClient();
|
|
184
|
+
return useMutation({
|
|
185
|
+
mutationFn: async (params) => {
|
|
186
|
+
const res = await apiRequest(`/project-tasks/${params.id}`, {
|
|
187
|
+
method: "PATCH",
|
|
188
|
+
body: JSON.stringify(params.updates)
|
|
189
|
+
});
|
|
190
|
+
return res.task;
|
|
191
|
+
},
|
|
192
|
+
onSuccess: (data) => {
|
|
193
|
+
queryClient.invalidateQueries({ queryKey: taskKeys.all });
|
|
194
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
195
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
196
|
+
},
|
|
197
|
+
onError: (error) => {
|
|
198
|
+
showApiErrorNotification(error);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function useDeleteTask() {
|
|
203
|
+
const { apiRequest } = useElevasisServices();
|
|
204
|
+
const queryClient = useQueryClient();
|
|
205
|
+
return useMutation({
|
|
206
|
+
mutationFn: async (params) => {
|
|
207
|
+
await apiRequest(`/project-tasks/${params.id}`, {
|
|
208
|
+
method: "DELETE"
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
onSuccess: (_, params) => {
|
|
212
|
+
queryClient.invalidateQueries({ queryKey: taskKeys.all });
|
|
213
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
214
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(params.projectId) });
|
|
215
|
+
},
|
|
216
|
+
onError: (error) => {
|
|
217
|
+
showApiErrorNotification(error);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
var noteKeys = {
|
|
222
|
+
all: ["project-notes"],
|
|
223
|
+
lists: () => [...noteKeys.all, "list"],
|
|
224
|
+
list: (orgId, filters) => [...noteKeys.all, "list", orgId, filters],
|
|
225
|
+
details: () => [...noteKeys.all, "detail"],
|
|
226
|
+
detail: (id) => [...noteKeys.all, "detail", id]
|
|
227
|
+
};
|
|
228
|
+
function useProjectNotes(filters = {}) {
|
|
229
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
230
|
+
return useQuery({
|
|
231
|
+
queryKey: noteKeys.list(workOSOrganizationId, filters),
|
|
232
|
+
queryFn: async () => {
|
|
233
|
+
const res = await apiRequest(`/projects/${filters.projectId}/notes`);
|
|
234
|
+
return res.notes;
|
|
235
|
+
},
|
|
236
|
+
enabled: isReady && !!filters.projectId
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function useCreateNote() {
|
|
240
|
+
const { apiRequest } = useElevasisServices();
|
|
241
|
+
const queryClient = useQueryClient();
|
|
242
|
+
return useMutation({
|
|
243
|
+
mutationFn: async (params) => {
|
|
244
|
+
const res = await apiRequest("/project-notes", {
|
|
245
|
+
method: "POST",
|
|
246
|
+
body: JSON.stringify(params)
|
|
247
|
+
});
|
|
248
|
+
return res.note;
|
|
249
|
+
},
|
|
250
|
+
onSuccess: (data) => {
|
|
251
|
+
queryClient.invalidateQueries({ queryKey: noteKeys.all });
|
|
252
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
253
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
254
|
+
},
|
|
255
|
+
onError: (error) => {
|
|
256
|
+
showApiErrorNotification(error);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/hooks/delivery/useProjects.ts
|
|
262
|
+
var projectKeys = {
|
|
263
|
+
all: ["projects"],
|
|
264
|
+
lists: () => [...projectKeys.all, "list"],
|
|
265
|
+
list: (orgId, filters) => [...projectKeys.all, "list", orgId, filters],
|
|
266
|
+
details: () => [...projectKeys.all, "detail"],
|
|
267
|
+
detail: (id) => [...projectKeys.all, "detail", id],
|
|
268
|
+
milestones: (id) => [...projectKeys.all, id, "milestones"],
|
|
269
|
+
tasks: (id) => [...projectKeys.all, id, "tasks"]
|
|
270
|
+
};
|
|
271
|
+
function useProjects(filters = {}) {
|
|
272
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
273
|
+
return useQuery({
|
|
274
|
+
queryKey: projectKeys.list(workOSOrganizationId, filters),
|
|
275
|
+
queryFn: async () => {
|
|
276
|
+
const params = new URLSearchParams();
|
|
277
|
+
if (filters.kind) params.set("kind", filters.kind);
|
|
278
|
+
const qs = params.toString();
|
|
279
|
+
const path = qs ? `/projects?${qs}` : "/projects";
|
|
280
|
+
const res = await apiRequest(path);
|
|
281
|
+
return res.projects;
|
|
282
|
+
},
|
|
283
|
+
enabled: isReady
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function useProject(id) {
|
|
287
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
288
|
+
return useQuery({
|
|
289
|
+
queryKey: [...projectKeys.detail(id), workOSOrganizationId],
|
|
290
|
+
queryFn: async () => {
|
|
291
|
+
try {
|
|
292
|
+
const res = await apiRequest(`/projects/${id}`);
|
|
293
|
+
return res.project;
|
|
294
|
+
} catch (err) {
|
|
295
|
+
if (err && typeof err === "object" && "statusCode" in err && err.statusCode === 404) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
throw err;
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
enabled: isReady && !!id
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function useProjectMilestones(projectId) {
|
|
305
|
+
const { apiRequest, isReady } = useElevasisServices();
|
|
306
|
+
return useQuery({
|
|
307
|
+
queryKey: projectKeys.milestones(projectId),
|
|
308
|
+
queryFn: async () => {
|
|
309
|
+
const res = await apiRequest(`/projects/${projectId}/milestones`);
|
|
310
|
+
return res.milestones;
|
|
311
|
+
},
|
|
312
|
+
enabled: isReady && !!projectId
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function useProjectTasks(projectId) {
|
|
316
|
+
const { apiRequest, isReady } = useElevasisServices();
|
|
317
|
+
return useQuery({
|
|
318
|
+
queryKey: projectKeys.tasks(projectId),
|
|
319
|
+
queryFn: async () => {
|
|
320
|
+
const res = await apiRequest(`/projects/${projectId}/tasks`);
|
|
321
|
+
return res.tasks;
|
|
322
|
+
},
|
|
323
|
+
enabled: isReady && !!projectId
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function useCreateProject() {
|
|
327
|
+
const { apiRequest } = useElevasisServices();
|
|
328
|
+
const queryClient = useQueryClient();
|
|
329
|
+
return useMutation({
|
|
330
|
+
mutationFn: async (params) => {
|
|
331
|
+
const res = await apiRequest("/projects", {
|
|
332
|
+
method: "POST",
|
|
333
|
+
body: JSON.stringify(params)
|
|
334
|
+
});
|
|
335
|
+
return res.project;
|
|
336
|
+
},
|
|
337
|
+
onSuccess: () => {
|
|
338
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
339
|
+
},
|
|
340
|
+
onError: (error) => {
|
|
341
|
+
showApiErrorNotification(error);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function useUpdateProject() {
|
|
346
|
+
const { apiRequest } = useElevasisServices();
|
|
347
|
+
const queryClient = useQueryClient();
|
|
348
|
+
return useMutation({
|
|
349
|
+
mutationFn: async (params) => {
|
|
350
|
+
const res = await apiRequest(`/projects/${params.id}`, {
|
|
351
|
+
method: "PATCH",
|
|
352
|
+
body: JSON.stringify(params.updates)
|
|
353
|
+
});
|
|
354
|
+
return res.project;
|
|
355
|
+
},
|
|
356
|
+
onSuccess: (data) => {
|
|
357
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
358
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.id) });
|
|
359
|
+
},
|
|
360
|
+
onError: (error) => {
|
|
361
|
+
showApiErrorNotification(error);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function useDeleteProject() {
|
|
366
|
+
const { apiRequest } = useElevasisServices();
|
|
367
|
+
const queryClient = useQueryClient();
|
|
368
|
+
return useMutation({
|
|
369
|
+
mutationFn: async (id) => {
|
|
370
|
+
await apiRequest(`/projects/${id}`, {
|
|
371
|
+
method: "DELETE"
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
onSuccess: () => {
|
|
375
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
376
|
+
},
|
|
377
|
+
onError: (error) => {
|
|
378
|
+
showApiErrorNotification(error);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export { milestoneKeys, noteKeys, projectKeys, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, taskKeys, useCreateMilestone, useCreateNote, useCreateProject, useCreateTask, useDeleteMilestone, useDeleteProject, useDeleteTask, useMilestones, useProject, useProjectMilestones, useProjectNotes, useProjectTasks, useProjects, useTasks, useUpdateMilestone, useUpdateProject, useUpdateTask };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAppearance } from './chunk-ZGCWTWBD.js';
|
|
2
|
+
import { Center } from '@mantine/core';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function SubshellLoader() {
|
|
6
|
+
const { loader } = useAppearance();
|
|
7
|
+
return /* @__PURE__ */ jsx(Center, { mih: "calc(100vh - 70px)", children: loader });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { SubshellLoader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Card, Group } from '@mantine/core';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/table/FilterBar.tsx
|
|
5
|
+
function FilterBar({ children, actions }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Group, { gap: "md", wrap: "wrap", justify: "space-between", children: [
|
|
7
|
+
/* @__PURE__ */ jsx(Group, { gap: "md", wrap: "wrap", children }),
|
|
8
|
+
/* @__PURE__ */ jsx(Group, { gap: "md", children: actions })
|
|
9
|
+
] }) });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { FilterBar };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useOptionalElevasisSystems } from './chunk-ZGCWTWBD.js';
|
|
2
|
+
import { useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
var useBreadcrumbs = (options = {}) => {
|
|
6
|
+
const { currentPath } = useRouterContext();
|
|
7
|
+
const systemContext = useOptionalElevasisSystems();
|
|
8
|
+
const { labelsByPath = {} } = options;
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
const shellModel = systemContext?.shellModel;
|
|
11
|
+
const overriddenLabel = labelsByPath[currentPath];
|
|
12
|
+
if (overriddenLabel) {
|
|
13
|
+
return [{ label: overriddenLabel, isActive: true }];
|
|
14
|
+
}
|
|
15
|
+
if (shellModel) {
|
|
16
|
+
const matchedNode = shellModel.findByPath(currentPath);
|
|
17
|
+
if (matchedNode) {
|
|
18
|
+
return shellModel.ancestorsOf(matchedNode.id).map((node, index, items) => ({
|
|
19
|
+
label: labelsByPath[node.path ?? ""] ?? node.label,
|
|
20
|
+
path: index === items.length - 1 ? void 0 : node.path,
|
|
21
|
+
isActive: index === items.length - 1
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const segments = currentPath.split("/").filter(Boolean);
|
|
26
|
+
if (segments.length === 0) {
|
|
27
|
+
return [{ label: "Dashboard", isActive: true }];
|
|
28
|
+
}
|
|
29
|
+
const breadcrumbs = [{ label: "Dashboard", path: "/" }];
|
|
30
|
+
let currentSegmentPath = "";
|
|
31
|
+
for (let i = 0; i < segments.length; i++) {
|
|
32
|
+
currentSegmentPath += `/${segments[i]}`;
|
|
33
|
+
const isLast = i === segments.length - 1;
|
|
34
|
+
const label = labelsByPath[currentSegmentPath] ?? formatSegmentLabel(segments[i]);
|
|
35
|
+
breadcrumbs.push({
|
|
36
|
+
label,
|
|
37
|
+
path: isLast ? void 0 : currentSegmentPath,
|
|
38
|
+
isActive: isLast
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return breadcrumbs;
|
|
42
|
+
}, [currentPath, systemContext, labelsByPath]);
|
|
43
|
+
};
|
|
44
|
+
function formatSegmentLabel(segment) {
|
|
45
|
+
const decodedSegment = safeDecodeURIComponent(segment);
|
|
46
|
+
const routeLabel = formatRouteIdLabel(decodedSegment);
|
|
47
|
+
if (routeLabel) return routeLabel;
|
|
48
|
+
return titleCaseSegment(decodedSegment);
|
|
49
|
+
}
|
|
50
|
+
function safeDecodeURIComponent(value) {
|
|
51
|
+
try {
|
|
52
|
+
return decodeURIComponent(value);
|
|
53
|
+
} catch {
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function formatRouteIdLabel(segment) {
|
|
58
|
+
if (segment.startsWith("group:")) {
|
|
59
|
+
const groupKey = segment.slice("group:".length);
|
|
60
|
+
return groupKey === "graph" ? "Ontology" : titleCaseSegment(groupKey);
|
|
61
|
+
}
|
|
62
|
+
if (segment.startsWith("domain:")) {
|
|
63
|
+
return titleCaseSegment(segment.slice("domain:".length));
|
|
64
|
+
}
|
|
65
|
+
if (segment.startsWith("item:")) {
|
|
66
|
+
const rest = segment.slice("item:".length);
|
|
67
|
+
const separatorIndex = rest.indexOf(":");
|
|
68
|
+
const itemId = separatorIndex === -1 ? rest : rest.slice(separatorIndex + 1);
|
|
69
|
+
return formatOntologyOrIdLabel(itemId);
|
|
70
|
+
}
|
|
71
|
+
if (segment.startsWith("ontology:")) {
|
|
72
|
+
return formatOntologyOrIdLabel(segment);
|
|
73
|
+
}
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
function formatOntologyOrIdLabel(value) {
|
|
77
|
+
const localId = value.includes("/") ? value.slice(value.lastIndexOf("/") + 1) : value;
|
|
78
|
+
const suffix = localId.includes(":") ? localId.slice(localId.lastIndexOf(":") + 1) : localId;
|
|
79
|
+
return titleCaseSegment(suffix);
|
|
80
|
+
}
|
|
81
|
+
function titleCaseSegment(segment) {
|
|
82
|
+
return segment.split("-").flatMap((part) => part.split("_")).flatMap((part) => part.split(".")).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { useBreadcrumbs };
|