@elevasis/ui 2.34.0 → 2.35.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.js +3 -3
- package/dist/app/index.d.ts +12 -12
- package/dist/app/index.js +25 -23
- package/dist/charts/index.js +3 -5
- package/dist/chunk-26HFM4MH.js +41449 -0
- package/dist/{chunk-DTFKWZ7A.js → chunk-4U3XAWCN.js} +502 -484
- package/dist/{chunk-ND5TDV2J.js → chunk-57OZ3AEG.js} +1 -1
- package/dist/{chunk-E4WQGJNS.js → chunk-7FPLLSHN.js} +14 -1
- package/dist/{chunk-RQA2EVN3.js → chunk-AKW7KISS.js} +39 -3
- package/dist/chunk-AUDNF2Q7.js +2050 -0
- package/dist/{chunk-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
- package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
- package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
- package/dist/chunk-SIQ3P4OR.js +1764 -0
- package/dist/{chunk-RIAXZ6AH.js → chunk-VDOOGGBA.js} +1 -1
- package/dist/{chunk-3FV6HBXS.js → chunk-WF7CONXF.js} +23 -23
- package/dist/{chunk-3QXJK5IY.js → chunk-YYX7OPZQ.js} +1 -1
- package/dist/components/index.d.ts +69 -69
- package/dist/components/index.js +20 -2795
- package/dist/components/navigation/index.js +25 -5
- package/dist/execution/index.d.ts +9 -9
- package/dist/execution/index.js +1 -2
- package/dist/features/auth/index.js +23 -2
- package/dist/features/clients/index.js +20 -26
- package/dist/features/crm/index.js +20 -30
- package/dist/features/dashboard/index.d.ts +68 -68
- package/dist/features/dashboard/index.js +20 -28
- package/dist/features/delivery/index.js +20 -30
- package/dist/features/knowledge/index.js +25 -9
- package/dist/features/lead-gen/index.d.ts +9 -9
- package/dist/features/lead-gen/index.js +20 -31
- package/dist/features/monitoring/index.js +20 -30
- package/dist/features/monitoring/requests/index.js +20 -25
- package/dist/features/operations/index.d.ts +153 -153
- package/dist/features/operations/index.js +18 -37
- package/dist/features/seo/index.js +3 -4
- package/dist/features/settings/index.js +20 -27
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.js +30 -2
- package/dist/hooks/index.d.ts +85 -85
- package/dist/hooks/index.js +20 -21
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +35 -35
- package/dist/hooks/published.d.ts +85 -85
- package/dist/hooks/published.js +20 -20
- package/dist/index.css +532 -532
- package/dist/index.d.ts +9256 -5803
- package/dist/index.js +22 -26
- package/dist/knowledge/index.d.ts +21 -21
- package/dist/knowledge/index.js +8 -15
- package/dist/layout/index.js +4 -10
- package/dist/organization/index.js +27 -1
- package/dist/provider/index.d.ts +47 -21
- package/dist/provider/index.js +20 -15
- package/dist/provider/published.d.ts +15 -16
- package/dist/provider/published.js +20 -11
- package/dist/test-utils/index.js +3 -3
- package/dist/theme/index.js +2 -3
- package/dist/theme/presets/index.d.ts +28 -3
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +1 -2049
- package/dist/types/index.d.ts +68 -68
- package/dist/utils/index.d.ts +46 -46
- package/dist/utils/index.js +1 -1
- package/dist/zustand/index.d.ts +6 -6
- package/dist/zustand/index.js +0 -3
- package/package.json +5 -5
- package/dist/chunk-3AJVNMY5.js +0 -4769
- package/dist/chunk-3MEXPLWT.js +0 -265
- package/dist/chunk-3ZMAGTWF.js +0 -18
- package/dist/chunk-4O4MII5S.js +0 -4716
- package/dist/chunk-5EYJ2GIN.js +0 -122
- package/dist/chunk-7M2VOCYN.js +0 -1
- package/dist/chunk-BPQVTIUP.js +0 -105
- package/dist/chunk-BZZCNLT6.js +0 -12
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-E565XMTQ.js +0 -17
- package/dist/chunk-HRWLKKWM.js +0 -758
- package/dist/chunk-IGDYWFNE.js +0 -5198
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-IVGI4GDL.js +0 -1593
- package/dist/chunk-JFL3GRD4.js +0 -39
- package/dist/chunk-LAWLB6CT.js +0 -951
- package/dist/chunk-LGKLC5MG.js +0 -44
- package/dist/chunk-LRWTWOGP.js +0 -1778
- package/dist/chunk-MP3GPBPX.js +0 -1874
- package/dist/chunk-N55DVMAG.js +0 -14
- package/dist/chunk-NLBQTDOW.js +0 -12051
- package/dist/chunk-O6JXQ6UQ.js +0 -468
- package/dist/chunk-OBBQ2JCM.js +0 -68
- package/dist/chunk-PDHTXPSF.js +0 -12
- package/dist/chunk-PLP3NYPL.js +0 -356
- package/dist/chunk-R2XR4FCV.js +0 -48
- package/dist/chunk-R66W5UDG.js +0 -26
- package/dist/chunk-RYTEQBAO.js +0 -37
- package/dist/chunk-SDXSB3HN.js +0 -425
- package/dist/chunk-TKAYX2SP.js +0 -204
- package/dist/chunk-TUMSNGTX.js +0 -35
- package/dist/chunk-VNAZTCHA.js +0 -65
- package/dist/chunk-VNFR57DF.js +0 -87
- package/dist/chunk-VTXTZXAU.js +0 -539
- package/dist/chunk-W73ZABT6.js +0 -85
- package/dist/chunk-WU4FNWCW.js +0 -2281
- package/dist/chunk-XZGSCABI.js +0 -383
- package/dist/chunk-YNWZIWJL.js +0 -1863
- /package/dist/{chunk-2RJMVWFJ.js → chunk-GEFWMU26.js} +0 -0
- /package/dist/{chunk-22UVE3RA.js → chunk-HENXLGVD.js} +0 -0
package/dist/chunk-XZGSCABI.js
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-2RJMVWFJ.js';
|
|
2
|
-
import { useElevasisServices } from './chunk-KJ3QUBNU.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 };
|