@elevasis/ui 2.73.0 → 2.75.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 (97) hide show
  1. package/dist/api/index.js +3 -3
  2. package/dist/app/index.d.ts +58 -0
  3. package/dist/app/index.js +9 -10
  4. package/dist/auth/index.js +5 -6
  5. package/dist/charts/index.js +5 -6
  6. package/dist/chunk-2GIJBHZT.js +60 -0
  7. package/dist/{chunk-Z4ICFQXG.js → chunk-2ZRY3ARL.js} +1 -1
  8. package/dist/{chunk-5B2ZFO44.js → chunk-3H5DIJN7.js} +1 -1
  9. package/dist/{chunk-LZT2H2MA.js → chunk-47YJVIZE.js} +36 -43
  10. package/dist/{chunk-3TS5U5BL.js → chunk-5RH6NYZH.js} +1 -1
  11. package/dist/chunk-5SLRGUC4.js +224 -0
  12. package/dist/{chunk-JYBJMVNY.js → chunk-5VF5LPYS.js} +1 -1
  13. package/dist/{chunk-SWKAH2YM.js → chunk-6BJ5HMMC.js} +282 -553
  14. package/dist/{chunk-NI37YNRP.js → chunk-7OOFMEX6.js} +11 -5
  15. package/dist/{chunk-IBCEAVB2.js → chunk-A2SB32YV.js} +65 -5
  16. package/dist/{chunk-CJ2232PQ.js → chunk-CRPH5AAB.js} +1 -1
  17. package/dist/chunk-D3XXPCCK.js +69 -0
  18. package/dist/chunk-DMSTDZCJ.js +305 -0
  19. package/dist/chunk-DTEGVSJ6.js +645 -0
  20. package/dist/chunk-DVAOCHIF.js +165 -0
  21. package/dist/chunk-G7O4CBMC.js +231 -0
  22. package/dist/{chunk-IGBPWD6S.js → chunk-GDTK33QT.js} +5 -3
  23. package/dist/chunk-ICHDIVQO.js +54 -0
  24. package/dist/{chunk-U2H3TIHD.js → chunk-IYATYH5I.js} +2 -52
  25. package/dist/chunk-L3NBMLRN.js +49 -0
  26. package/dist/{chunk-LEPYXLJ2.js → chunk-LFLM723H.js} +1 -1
  27. package/dist/chunk-M6VAZAQW.js +45 -0
  28. package/dist/{chunk-AJOVWB47.js → chunk-MLHZUN2X.js} +6 -3
  29. package/dist/chunk-N6K2Q5BM.js +393 -0
  30. package/dist/chunk-NMHQAYZU.js +439 -0
  31. package/dist/chunk-NYIIRZSA.js +286 -0
  32. package/dist/{chunk-ETN3TTRT.js → chunk-OGHTJKBV.js} +115 -8
  33. package/dist/{chunk-M7WWRZ5Z.js → chunk-QFGNRKIE.js} +1 -78
  34. package/dist/chunk-QFS2GZMV.js +515 -0
  35. package/dist/{chunk-OCVSPAKM.js → chunk-SB3IHM5Y.js} +1150 -4346
  36. package/dist/{chunk-4CW2C5BD.js → chunk-SEYOVNS5.js} +1 -1
  37. package/dist/chunk-SN7X5N2A.js +116 -0
  38. package/dist/{chunk-PQ4B62HH.js → chunk-TX3UHDL5.js} +2 -2
  39. package/dist/chunk-VM2OWOXL.js +24 -0
  40. package/dist/{chunk-ZDKPHFTH.js → chunk-VWGCURZF.js} +5 -3
  41. package/dist/chunk-WDBNW44Z.js +49 -0
  42. package/dist/chunk-YQQ5GRUR.js +21 -0
  43. package/dist/{chunk-NHNTX6ZL.js → chunk-ZG6YJUT4.js} +3 -2
  44. package/dist/components/index.d.ts +228 -6
  45. package/dist/components/index.js +321 -35
  46. package/dist/components/navigation/index.js +6 -7
  47. package/dist/features/auth/index.d.ts +78 -2
  48. package/dist/features/auth/index.js +18 -9
  49. package/dist/features/clients/index.js +7 -7
  50. package/dist/features/content/index.d.ts +226 -5
  51. package/dist/features/content/index.js +270 -19
  52. package/dist/features/crm/index.d.ts +58 -0
  53. package/dist/features/crm/index.js +10 -8
  54. package/dist/features/dashboard/index.js +9 -8
  55. package/dist/features/delivery/index.d.ts +58 -0
  56. package/dist/features/delivery/index.js +23 -7
  57. package/dist/features/knowledge/index.js +5 -6
  58. package/dist/features/lead-gen/index.d.ts +9 -15
  59. package/dist/features/lead-gen/index.js +12 -8
  60. package/dist/features/monitoring/index.js +11 -9
  61. package/dist/features/monitoring/requests/index.js +8 -7
  62. package/dist/features/operations/index.js +15 -11
  63. package/dist/features/public-agent-chat/index.js +3 -1
  64. package/dist/features/settings/index.d.ts +66 -3
  65. package/dist/features/settings/index.js +9 -8
  66. package/dist/hooks/access/index.js +5 -6
  67. package/dist/hooks/delivery/index.d.ts +58 -0
  68. package/dist/hooks/delivery/index.js +3 -2
  69. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -1
  70. package/dist/hooks/published.d.ts +181 -5
  71. package/dist/hooks/published.js +22 -6
  72. package/dist/initialization/index.d.ts +58 -0
  73. package/dist/knowledge/index.js +167 -11
  74. package/dist/{knowledge-search-index-RZLIVWPJ.js → knowledge-search-index-6GQK55IQ.js} +1 -1
  75. package/dist/layout/index.js +8 -9
  76. package/dist/profile/index.d.ts +58 -0
  77. package/dist/provider/index.d.ts +77 -1
  78. package/dist/provider/index.js +5 -6
  79. package/dist/provider/published.d.ts +105 -1
  80. package/dist/provider/published.js +5 -6
  81. package/dist/test-utils/index.d.ts +16 -5
  82. package/dist/test-utils/index.js +17 -18
  83. package/dist/types/index.d.ts +73 -1
  84. package/dist/utils/index.d.ts +83 -3
  85. package/dist/utils/index.js +1 -1
  86. package/package.json +10 -5
  87. package/dist/chunk-6M6OLGQY.js +0 -36
  88. package/dist/chunk-MKH2KOAO.js +0 -39
  89. package/dist/hooks/index.css +0 -659
  90. package/dist/hooks/index.d.ts +0 -14073
  91. package/dist/hooks/index.js +0 -27
  92. package/dist/supabase/index.d.ts +0 -7118
  93. package/dist/supabase/index.js +0 -3
  94. package/dist/typeform/index.d.ts +0 -462
  95. package/dist/typeform/index.js +0 -2051
  96. package/dist/typeform/schemas.d.ts +0 -67
  97. package/dist/typeform/schemas.js +0 -2
@@ -0,0 +1,393 @@
1
+ import { REFETCH_INTERVAL_DASHBOARD } from './chunk-Y6I3IC45.js';
2
+ import { useElevasisServices } from './chunk-BI5VDO2K.js';
3
+ import { ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, UuidSchema } from './chunk-TVTSASST.js';
4
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
5
+ import { z } from 'zod';
6
+
7
+ var RelativeScheduleItemSchema = z.object({
8
+ offset: z.string().regex(/^[+-]\d+[dhm]$/, "Invalid offset format. Use +3d, -2h, +30m, etc."),
9
+ payload: z.record(z.string(), z.unknown()),
10
+ label: z.string().optional()
11
+ });
12
+ var AbsoluteScheduleItemSchema = z.object({
13
+ runAt: z.string().datetime({ message: "Invalid datetime format" }),
14
+ payload: z.record(z.string(), z.unknown()),
15
+ label: z.string().optional()
16
+ });
17
+ var RecurringScheduleConfigSchema = z.object({
18
+ type: z.literal("recurring"),
19
+ cron: z.string().optional(),
20
+ interval: z.enum(["daily", "weekly", "monthly"]).optional(),
21
+ time: z.string().regex(/^\d{2}:\d{2}$/, "Time must be in HH:MM format").optional(),
22
+ timezone: z.string().min(1, "Timezone is required"),
23
+ payload: z.record(z.string(), z.unknown()),
24
+ endAt: z.string().datetime().nullable().optional(),
25
+ overduePolicy: z.enum(["skip", "execute"]).optional()
26
+ }).refine((data) => data.cron || data.interval, { message: "Either cron or interval must be provided" });
27
+ var RelativeScheduleConfigSchema = z.object({
28
+ type: z.literal("relative"),
29
+ anchorAt: z.string().datetime({ message: "Invalid anchor datetime" }),
30
+ anchorLabel: z.string().optional(),
31
+ items: z.array(RelativeScheduleItemSchema).min(1, "At least one item required"),
32
+ overduePolicy: z.enum(["skip", "execute"]).optional()
33
+ });
34
+ var AbsoluteScheduleConfigSchema = z.object({
35
+ type: z.literal("absolute"),
36
+ items: z.array(AbsoluteScheduleItemSchema).min(1, "At least one item required"),
37
+ overduePolicy: z.enum(["skip", "execute"]).optional()
38
+ });
39
+ var TaskScheduleConfigSchema = z.discriminatedUnion("type", [
40
+ RecurringScheduleConfigSchema,
41
+ RelativeScheduleConfigSchema,
42
+ AbsoluteScheduleConfigSchema
43
+ ]);
44
+ var ScheduleTargetSchema = z.object({
45
+ resourceType: ResourceTypeSchema,
46
+ resourceId: NonEmptyStringSchema.max(255)
47
+ });
48
+ var OptionalOriginTrackingSchema = z.object({
49
+ originExecutionId: UuidSchema.optional(),
50
+ originResourceType: OriginResourceTypeSchema.optional(),
51
+ originResourceId: z.string().max(100).optional()
52
+ });
53
+ z.object({
54
+ organizationId: UuidSchema,
55
+ name: NonEmptyStringSchema.max(255),
56
+ description: z.string().max(1e3).optional(),
57
+ target: ScheduleTargetSchema,
58
+ scheduleConfig: TaskScheduleConfigSchema,
59
+ maxRetries: z.number().int().min(0).max(10).optional().default(3),
60
+ idempotencyKey: z.string().max(255).optional(),
61
+ metadata: z.record(z.string(), z.unknown()).optional()
62
+ }).merge(OptionalOriginTrackingSchema);
63
+ var CreateScheduleRequestSchema = z.object({
64
+ name: z.string().min(1, "Name is required").max(255),
65
+ description: z.string().max(1e3).optional(),
66
+ target: z.object({
67
+ resourceType: ResourceTypeSchema,
68
+ resourceId: z.string().min(1, "Resource ID is required").max(255)
69
+ }),
70
+ scheduleConfig: TaskScheduleConfigSchema,
71
+ maxRetries: z.number().int().min(0).max(10).optional(),
72
+ idempotencyKey: z.string().max(255).optional(),
73
+ // Origin tracking (optional)
74
+ originExecutionId: z.string().uuid().optional(),
75
+ originResourceType: OriginResourceTypeSchema.optional(),
76
+ originResourceId: z.string().max(255).optional()
77
+ });
78
+ z.object({
79
+ status: z.enum(["active", "paused", "completed", "cancelled"]).optional(),
80
+ targetResourceType: ResourceTypeSchema.optional(),
81
+ targetResourceId: z.string().optional(),
82
+ limit: z.coerce.number().int().min(1).max(100).optional().default(50),
83
+ offset: z.coerce.number().int().min(0).optional().default(0)
84
+ });
85
+ var GetScheduleParamsSchema = z.object({
86
+ id: z.string().uuid("Invalid schedule ID")
87
+ });
88
+ var UpdateAnchorRequestSchema = z.object({
89
+ anchorAt: z.string().datetime({ message: "Invalid anchor datetime format" })
90
+ });
91
+ var UpdateScheduleRequestSchema = z.object({
92
+ name: z.string().min(1, "Name cannot be empty").max(255).optional(),
93
+ description: z.string().max(1e3).nullable().optional(),
94
+ scheduleConfig: TaskScheduleConfigSchema.optional(),
95
+ maxRetries: z.number().int().min(0).max(10).optional()
96
+ }).strict().refine(
97
+ (data) => data.name !== void 0 || data.description !== void 0 || data.scheduleConfig !== void 0 || data.maxRetries !== void 0,
98
+ { message: "At least one field (name, description, scheduleConfig, maxRetries) must be provided" }
99
+ );
100
+ z.object({
101
+ schedules: z.array(
102
+ z.object({
103
+ // Required identifiers
104
+ id: z.string().uuid(),
105
+ organization_id: z.string().uuid(),
106
+ name: z.string(),
107
+ // Target
108
+ target_resource_type: z.string(),
109
+ target_resource_id: z.string(),
110
+ // Schedule definition
111
+ schedule_config: z.record(z.string(), z.unknown()),
112
+ // JSONB from database
113
+ current_step: z.number().int(),
114
+ status: z.string(),
115
+ // Scheduling state
116
+ next_run_at: z.string().nullable(),
117
+ last_run_at: z.string().nullable(),
118
+ last_execution_id: z.string().uuid().nullable(),
119
+ // Config
120
+ max_retries: z.number().int(),
121
+ retry_count: z.number().int(),
122
+ idempotency_key: z.string().nullable(),
123
+ description: z.string().nullable(),
124
+ // Origin tracking
125
+ origin_execution_id: z.string().uuid().nullable(),
126
+ origin_resource_type: z.string().nullable(),
127
+ origin_resource_id: z.string().nullable(),
128
+ // Timestamps (PostgreSQL format with microseconds)
129
+ created_at: z.string(),
130
+ updated_at: z.string()
131
+ })
132
+ ).min(1).max(100)
133
+ });
134
+ z.object({
135
+ id: z.string().uuid("Invalid schedule ID")
136
+ });
137
+ z.object({
138
+ limit: z.coerce.number().int().min(1).max(100).optional().default(20),
139
+ offset: z.coerce.number().int().min(0).optional().default(0)
140
+ });
141
+ var ScheduleResponseSchema = z.object({
142
+ id: z.string().uuid(),
143
+ organizationId: z.string().uuid(),
144
+ name: z.string(),
145
+ description: z.string().nullable(),
146
+ target: z.object({
147
+ resourceType: ResourceTypeSchema,
148
+ resourceId: z.string()
149
+ }),
150
+ scheduleConfig: TaskScheduleConfigSchema,
151
+ nextRunAt: z.string().datetime().nullable(),
152
+ currentStep: z.number().int(),
153
+ status: z.enum(["active", "paused", "completed", "cancelled"]),
154
+ lastRunAt: z.string().datetime().nullable(),
155
+ lastExecutionId: z.string().uuid().nullable(),
156
+ maxRetries: z.number().int(),
157
+ idempotencyKey: z.string().nullable(),
158
+ createdAt: z.string().datetime(),
159
+ updatedAt: z.string().datetime()
160
+ });
161
+ z.object({
162
+ schedules: z.array(ScheduleResponseSchema),
163
+ total: z.number().int(),
164
+ limit: z.number().int(),
165
+ offset: z.number().int()
166
+ });
167
+ var ExecutionHistoryItemSchema = z.object({
168
+ id: z.string().uuid(),
169
+ createdAt: z.string().datetime(),
170
+ status: z.enum(["running", "completed", "failed", "cancelled"]),
171
+ step: z.number().int().nullable(),
172
+ itemLabel: z.string().nullable(),
173
+ duration: z.number().nullable(),
174
+ // milliseconds
175
+ error: z.string().nullable()
176
+ });
177
+ z.object({
178
+ executions: z.array(ExecutionHistoryItemSchema),
179
+ total: z.number().int(),
180
+ limit: z.number().int(),
181
+ offset: z.number().int()
182
+ });
183
+ z.object({
184
+ processed: z.number().int(),
185
+ succeeded: z.number().int(),
186
+ failed: z.number().int(),
187
+ errors: z.array(
188
+ z.object({
189
+ scheduleId: z.string().uuid(),
190
+ error: z.string()
191
+ })
192
+ ).optional()
193
+ });
194
+
195
+ // src/hooks/scheduling/useScheduledTasks.ts
196
+ function useScheduledTasks(options = {}) {
197
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
198
+ return useQuery({
199
+ queryKey: ["schedules", "dashboard", workOSOrganizationId, options.status, options.targetResourceType],
200
+ queryFn: async () => {
201
+ const params = new URLSearchParams();
202
+ if (options.status) params.append("status", options.status);
203
+ if (options.targetResourceType) params.append("targetResourceType", options.targetResourceType);
204
+ const queryString = params.toString();
205
+ const response = await apiRequest(
206
+ `/task-scheduler/schedules${queryString ? `?${queryString}` : ""}`
207
+ );
208
+ return response.schedules;
209
+ },
210
+ enabled: isReady,
211
+ refetchInterval: REFETCH_INTERVAL_DASHBOARD
212
+ });
213
+ }
214
+
215
+ // src/hooks/scheduling/queryKeys.ts
216
+ var scheduleKeys = {
217
+ all: (orgId) => ["schedules", orgId],
218
+ lists: (orgId) => [...scheduleKeys.all(orgId), "list"],
219
+ list: (orgId, filters) => [...scheduleKeys.lists(orgId), filters],
220
+ details: (orgId) => [...scheduleKeys.all(orgId), "detail"],
221
+ detail: (orgId, id) => [...scheduleKeys.details(orgId), id],
222
+ executions: (orgId, id) => [...scheduleKeys.detail(orgId, id), "executions"]
223
+ };
224
+ function useListSchedules(filters) {
225
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
226
+ return useQuery({
227
+ queryKey: scheduleKeys.list(workOSOrganizationId, filters),
228
+ queryFn: async () => {
229
+ const params = new URLSearchParams();
230
+ if (filters?.status) params.set("status", filters.status);
231
+ if (filters?.targetResourceType) params.set("targetResourceType", filters.targetResourceType);
232
+ if (filters?.targetResourceId) params.set("targetResourceId", filters.targetResourceId);
233
+ if (filters?.limit) params.set("limit", String(filters.limit));
234
+ if (filters?.offset) params.set("offset", String(filters.offset));
235
+ const queryString = params.toString();
236
+ const endpoint = `/task-scheduler/schedules${queryString ? `?${queryString}` : ""}`;
237
+ return apiRequest(endpoint);
238
+ },
239
+ enabled: isReady
240
+ });
241
+ }
242
+ function useGetSchedule(id) {
243
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
244
+ return useQuery({
245
+ queryKey: scheduleKeys.detail(workOSOrganizationId, id),
246
+ queryFn: async () => {
247
+ const data = await apiRequest(`/task-scheduler/schedules/${id}`);
248
+ return data.schedule;
249
+ },
250
+ enabled: isReady && !!id
251
+ });
252
+ }
253
+ function useGetExecutionHistory(scheduleId, options) {
254
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
255
+ return useQuery({
256
+ queryKey: [...scheduleKeys.executions(workOSOrganizationId, scheduleId), options?.limit, options?.offset],
257
+ queryFn: async () => {
258
+ const params = new URLSearchParams();
259
+ if (options?.limit) params.set("limit", String(options.limit));
260
+ if (options?.offset) params.set("offset", String(options.offset));
261
+ const queryString = params.toString();
262
+ const endpoint = `/task-scheduler/schedules/${scheduleId}/executions${queryString ? `?${queryString}` : ""}`;
263
+ return apiRequest(endpoint);
264
+ },
265
+ enabled: isReady && !!scheduleId
266
+ });
267
+ }
268
+ function useCreateSchedule() {
269
+ const queryClient = useQueryClient();
270
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
271
+ return useMutation({
272
+ mutationFn: async (input) => {
273
+ const validated = CreateScheduleRequestSchema.parse(input);
274
+ const data = await apiRequest("/task-scheduler/schedules", {
275
+ method: "POST",
276
+ body: JSON.stringify(validated)
277
+ });
278
+ return data.schedule;
279
+ },
280
+ onSuccess: () => {
281
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
282
+ }
283
+ });
284
+ }
285
+ function useUpdateSchedule() {
286
+ const queryClient = useQueryClient();
287
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
288
+ return useMutation({
289
+ mutationFn: async ({ id, ...fields }) => {
290
+ GetScheduleParamsSchema.parse({ id });
291
+ const validated = UpdateScheduleRequestSchema.parse(fields);
292
+ const data = await apiRequest(`/task-scheduler/schedules/${id}`, {
293
+ method: "PATCH",
294
+ body: JSON.stringify(validated)
295
+ });
296
+ return data.schedule;
297
+ },
298
+ onSuccess: (_, variables) => {
299
+ queryClient.invalidateQueries({
300
+ queryKey: scheduleKeys.detail(workOSOrganizationId, variables.id)
301
+ });
302
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
303
+ }
304
+ });
305
+ }
306
+ function useUpdateAnchor() {
307
+ const queryClient = useQueryClient();
308
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
309
+ return useMutation({
310
+ mutationFn: async ({ id, anchorAt }) => {
311
+ GetScheduleParamsSchema.parse({ id });
312
+ UpdateAnchorRequestSchema.parse({ anchorAt });
313
+ const data = await apiRequest(`/task-scheduler/schedules/${id}/anchor`, {
314
+ method: "PATCH",
315
+ body: JSON.stringify({ anchorAt })
316
+ });
317
+ return data.schedule;
318
+ },
319
+ onSuccess: (_, variables) => {
320
+ queryClient.invalidateQueries({
321
+ queryKey: scheduleKeys.detail(workOSOrganizationId, variables.id)
322
+ });
323
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
324
+ }
325
+ });
326
+ }
327
+ function usePauseSchedule() {
328
+ const queryClient = useQueryClient();
329
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
330
+ return useMutation({
331
+ mutationFn: async (id) => {
332
+ GetScheduleParamsSchema.parse({ id });
333
+ const data = await apiRequest(`/task-scheduler/schedules/${id}/pause`, {
334
+ method: "POST"
335
+ });
336
+ return data.schedule;
337
+ },
338
+ onSuccess: (_, id) => {
339
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
340
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
341
+ }
342
+ });
343
+ }
344
+ function useResumeSchedule() {
345
+ const queryClient = useQueryClient();
346
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
347
+ return useMutation({
348
+ mutationFn: async (id) => {
349
+ GetScheduleParamsSchema.parse({ id });
350
+ const data = await apiRequest(`/task-scheduler/schedules/${id}/resume`, {
351
+ method: "POST"
352
+ });
353
+ return data.schedule;
354
+ },
355
+ onSuccess: (_, id) => {
356
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
357
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
358
+ }
359
+ });
360
+ }
361
+ function useCancelSchedule() {
362
+ const queryClient = useQueryClient();
363
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
364
+ return useMutation({
365
+ mutationFn: async (id) => {
366
+ GetScheduleParamsSchema.parse({ id });
367
+ const data = await apiRequest(`/task-scheduler/schedules/${id}/cancel`, {
368
+ method: "POST"
369
+ });
370
+ return data.schedule;
371
+ },
372
+ onSuccess: (_, id) => {
373
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
374
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
375
+ }
376
+ });
377
+ }
378
+ function useDeleteSchedule() {
379
+ const queryClient = useQueryClient();
380
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
381
+ return useMutation({
382
+ mutationFn: async (id) => {
383
+ GetScheduleParamsSchema.parse({ id });
384
+ await apiRequest(`/task-scheduler/schedules/${id}`, { method: "DELETE" });
385
+ },
386
+ onSuccess: (_, id) => {
387
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
388
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
389
+ }
390
+ });
391
+ }
392
+
393
+ export { scheduleKeys, useCancelSchedule, useCreateSchedule, useDeleteSchedule, useGetExecutionHistory, useGetSchedule, useListSchedules, usePauseSchedule, useResumeSchedule, useScheduledTasks, useUpdateAnchor, useUpdateSchedule };