@elevasis/ui 2.72.0 → 2.74.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 (100) hide show
  1. package/dist/api/index.js +3 -3
  2. package/dist/app/index.d.ts +172 -20
  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-2454MK7P.js → chunk-2MRRDF32.js} +115 -8
  8. package/dist/chunk-3LOKYZJC.js +231 -0
  9. package/dist/chunk-3QHX4ZKV.js +224 -0
  10. package/dist/chunk-43LC6XAX.js +69 -0
  11. package/dist/chunk-4M2BSHVT.js +116 -0
  12. package/dist/{chunk-SV4M2BUI.js → chunk-4MXNHJTA.js} +111 -46
  13. package/dist/{chunk-LEQGGX2U.js → chunk-5A6KCFS5.js} +36 -43
  14. package/dist/{chunk-KIDZXZM5.js → chunk-6JN2TLV2.js} +1480 -4200
  15. package/dist/{chunk-UZ5JO5TK.js → chunk-7ARBBELS.js} +1 -1
  16. package/dist/{chunk-DJWIIPKW.js → chunk-7RJ7P6S6.js} +6 -3
  17. package/dist/chunk-ARAFQBNI.js +515 -0
  18. package/dist/{chunk-DKVGO6RJ.js → chunk-BA3AZJUR.js} +1 -1
  19. package/dist/chunk-BRTGCFBH.js +305 -0
  20. package/dist/{chunk-7ESZKTQG.js → chunk-CQPULKKL.js} +5 -3
  21. package/dist/chunk-CRA7WQZH.js +49 -0
  22. package/dist/{chunk-XZIOCB5D.js → chunk-DCQKTDIG.js} +2 -52
  23. package/dist/{chunk-A3JHFZDP.js → chunk-E6YGA5WH.js} +1 -1
  24. package/dist/chunk-FA7LMNQO.js +439 -0
  25. package/dist/chunk-FZSG6M6W.js +45 -0
  26. package/dist/chunk-GDOR57D7.js +165 -0
  27. package/dist/{chunk-RRS2QR3W.js → chunk-GO4XJ5D4.js} +1 -1
  28. package/dist/chunk-GPQQGQGT.js +645 -0
  29. package/dist/chunk-HYQOGRWG.js +54 -0
  30. package/dist/{chunk-LCHL5SM2.js → chunk-LN4UW6S4.js} +1 -1
  31. package/dist/chunk-N6K2Q5BM.js +393 -0
  32. package/dist/{chunk-Z2W5VNN3.js → chunk-O32UQ26A.js} +3 -2
  33. package/dist/{chunk-M7WWRZ5Z.js → chunk-QFGNRKIE.js} +1 -78
  34. package/dist/{chunk-Q3O3WY7Q.js → chunk-R5UGIFYU.js} +74 -18
  35. package/dist/{chunk-753MKWFV.js → chunk-RFNJ2PTO.js} +1 -1
  36. package/dist/chunk-VM2OWOXL.js +24 -0
  37. package/dist/{chunk-ZBXCEWKF.js → chunk-W2QRBQQA.js} +5 -3
  38. package/dist/chunk-WDBNW44Z.js +49 -0
  39. package/dist/{chunk-IXBRUIYI.js → chunk-WZU3MCKI.js} +1 -1
  40. package/dist/chunk-YQQ5GRUR.js +21 -0
  41. package/dist/{chunk-IMZTRDY2.js → chunk-ZFA56VSR.js} +2 -2
  42. package/dist/{chunk-AFBFSXP3.js → chunk-ZWI62BQ6.js} +7 -4
  43. package/dist/chunk-ZYNVCWDZ.js +286 -0
  44. package/dist/components/index.d.ts +490 -22
  45. package/dist/components/index.js +335 -35
  46. package/dist/components/navigation/index.js +6 -7
  47. package/dist/features/auth/index.d.ts +154 -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 +718 -34
  51. package/dist/features/content/index.js +1345 -51
  52. package/dist/features/crm/index.d.ts +172 -20
  53. package/dist/features/crm/index.js +10 -8
  54. package/dist/features/dashboard/index.d.ts +19 -10
  55. package/dist/features/dashboard/index.js +9 -8
  56. package/dist/features/delivery/index.d.ts +134 -0
  57. package/dist/features/delivery/index.js +23 -7
  58. package/dist/features/knowledge/index.js +5 -6
  59. package/dist/features/lead-gen/index.d.ts +47 -35
  60. package/dist/features/lead-gen/index.js +12 -8
  61. package/dist/features/monitoring/index.js +11 -9
  62. package/dist/features/monitoring/requests/index.js +8 -7
  63. package/dist/features/operations/index.d.ts +38 -20
  64. package/dist/features/operations/index.js +15 -11
  65. package/dist/features/public-agent-chat/index.js +3 -1
  66. package/dist/features/settings/index.d.ts +134 -0
  67. package/dist/features/settings/index.js +9 -8
  68. package/dist/hooks/access/index.js +5 -6
  69. package/dist/hooks/delivery/index.d.ts +134 -0
  70. package/dist/hooks/delivery/index.js +3 -2
  71. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +20 -11
  72. package/dist/hooks/published.d.ts +1421 -29
  73. package/dist/hooks/published.js +22 -6
  74. package/dist/initialization/index.d.ts +134 -0
  75. package/dist/knowledge/index.d.ts +38 -20
  76. package/dist/knowledge/index.js +167 -11
  77. package/dist/{knowledge-search-index-RZLIVWPJ.js → knowledge-search-index-6GQK55IQ.js} +1 -1
  78. package/dist/layout/index.js +8 -9
  79. package/dist/profile/index.d.ts +134 -0
  80. package/dist/provider/index.d.ts +191 -21
  81. package/dist/provider/index.js +5 -6
  82. package/dist/provider/published.d.ts +219 -21
  83. package/dist/provider/published.js +5 -6
  84. package/dist/test-utils/index.d.ts +16 -5
  85. package/dist/test-utils/index.js +17 -18
  86. package/dist/types/index.d.ts +184 -14
  87. package/dist/utils/index.d.ts +102 -13
  88. package/dist/utils/index.js +1 -1
  89. package/package.json +7 -6
  90. package/dist/chunk-6M6OLGQY.js +0 -36
  91. package/dist/chunk-MKH2KOAO.js +0 -39
  92. package/dist/hooks/index.css +0 -659
  93. package/dist/hooks/index.d.ts +0 -12853
  94. package/dist/hooks/index.js +0 -27
  95. package/dist/supabase/index.d.ts +0 -6969
  96. package/dist/supabase/index.js +0 -3
  97. package/dist/typeform/index.d.ts +0 -462
  98. package/dist/typeform/index.js +0 -2051
  99. package/dist/typeform/schemas.d.ts +0 -67
  100. 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 };
@@ -1,5 +1,5 @@
1
1
  import { OrganizationContext } from './chunk-DD3CCMCZ.js';
2
- import { APIClientError } from './chunk-Q3O3WY7Q.js';
2
+ import { APIClientError } from './chunk-R5UGIFYU.js';
3
3
  import { createContext, useContext, useMemo, useCallback } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
@@ -124,7 +124,8 @@ function useApiClient(apiUrl) {
124
124
  response.status,
125
125
  errorData.requestId,
126
126
  errorData.fields,
127
- errorData.retryAfter
127
+ errorData.retryAfter,
128
+ errorData.details
128
129
  );
129
130
  },
130
131
  [onError]
@@ -1,6 +1,3 @@
1
- import { UuidSchema } from './chunk-TVTSASST.js';
2
- import { z } from 'zod';
3
-
4
1
  // src/hooks/sessions/mergeSessionMessages.ts
5
2
  function canonicalize(value) {
6
3
  if (Array.isArray(value)) {
@@ -45,80 +42,6 @@ function mergeSessionMessages(historyMessages, liveMessages) {
45
42
  return (a.messageIndex ?? 0) - (b.messageIndex ?? 0);
46
43
  });
47
44
  }
48
- var SessionIdParamSchema = z.object({
49
- sessionId: UuidSchema
50
- }).strict();
51
- var ExecutionIdParamsSchema = z.object({
52
- sessionId: UuidSchema,
53
- executionId: UuidSchema
54
- }).strict();
55
- var CreateSessionSchema = z.object({
56
- resourceId: z.string().min(1).max(100),
57
- userId: UuidSchema.optional(),
58
- metadata: z.any().optional()
59
- }).strict();
60
- z.object({
61
- input: z.unknown().refine(
62
- (val) => {
63
- let text;
64
- if (typeof val === "string") {
65
- text = val;
66
- } else if (val && typeof val === "object" && "message" in val) {
67
- text = String(val.message);
68
- } else {
69
- text = JSON.stringify(val);
70
- }
71
- return text.length > 0 && text.length <= 1e5;
72
- },
73
- { message: "Input must be between 1 and 100,000 characters" }
74
- ),
75
- metadata: z.any().optional()
76
- }).strict();
77
- z.object({
78
- userId: UuidSchema.optional(),
79
- resourceId: z.string().optional(),
80
- limit: z.coerce.number().int().min(1).max(100).default(20)
81
- }).strict();
82
- z.object({
83
- limit: z.coerce.number().int().min(1).max(100).default(100),
84
- cursor: z.coerce.number().int().min(0).optional()
85
- }).strict();
86
- var WebSocketSessionTurnSchema = z.object({
87
- type: z.literal("session:turn"),
88
- input: z.unknown().refine(
89
- (val) => {
90
- let text;
91
- if (typeof val === "string") {
92
- text = val;
93
- } else if (val && typeof val === "object" && "message" in val) {
94
- text = String(val.message);
95
- } else {
96
- text = JSON.stringify(val) || "";
97
- }
98
- return text && text.length > 0 && text.length <= 1e5;
99
- },
100
- { message: "Input must be between 1 and 100,000 characters" }
101
- )
102
- }).strict();
103
- var NotificationCategorySchema = z.enum(["info", "queue", "alert", "error", "system"]);
104
- var GetNotificationsQuerySchema = z.object({
105
- limit: z.coerce.number().int().min(1).max(100).default(50),
106
- offset: z.coerce.number().int().min(0).default(0)
107
- });
108
- var MarkAsReadParamsSchema = z.object({
109
- id: UuidSchema
110
- });
111
- z.object({
112
- userId: UuidSchema,
113
- organizationId: UuidSchema,
114
- category: NotificationCategorySchema,
115
- title: z.string().trim().min(1).max(200),
116
- message: z.string().trim().min(1).max(1e3),
117
- actionUrl: z.string().url().optional()
118
- }).strict();
119
- z.object({
120
- ids: z.array(UuidSchema).min(1).max(500)
121
- }).strict();
122
45
 
123
46
  // src/hooks/sessions/sessionWebSocketUtils.ts
124
47
  var liveTempMessageCounter = 0;
@@ -156,4 +79,4 @@ function getWebSocketBaseUrl(apiUrl) {
156
79
  return `${protocol}//${url.host}`;
157
80
  }
158
81
 
159
- export { CreateSessionSchema, ExecutionIdParamsSchema, GetNotificationsQuerySchema, MarkAsReadParamsSchema, SessionIdParamSchema, WebSocketSessionTurnSchema, createLiveTempMessageIdentity, formatMessageEvent, getWebSocketBaseUrl, mergeSessionMessages };
82
+ export { createLiveTempMessageIdentity, formatMessageEvent, getWebSocketBaseUrl, mergeSessionMessages };
@@ -64,7 +64,16 @@ var APIClientError = class extends Error {
64
64
  requestId;
65
65
  fields;
66
66
  retryAfter;
67
- constructor(message, code, statusCode, requestId, fields, retryAfter) {
67
+ /**
68
+ * Structured detail payload carried on `APIErrorResponse.details`
69
+ * (`packages/core/src/platform/api/types.ts`). Deliberately typed as a
70
+ * general bag rather than narrowed to any one error family — CONFLICT
71
+ * linked-row counts, SERVICE_UNAVAILABLE readiness payloads, and future
72
+ * error shapes all flow through the same field. Use a shape-specific
73
+ * accessor (e.g. `getSystemReadinessServerErrorDetails`) to narrow it.
74
+ */
75
+ details;
76
+ constructor(message, code, statusCode, requestId, fields, retryAfter, details) {
68
77
  super(message);
69
78
  this.name = "APIClientError";
70
79
  this.code = code;
@@ -72,11 +81,21 @@ var APIClientError = class extends Error {
72
81
  this.requestId = requestId;
73
82
  this.fields = fields;
74
83
  this.retryAfter = retryAfter;
84
+ this.details = details;
75
85
  }
76
86
  };
77
87
  function isAPIClientError(error) {
78
88
  return error instanceof APIClientError;
79
89
  }
90
+ function isSystemReadinessErrorDetails(details) {
91
+ if (!details || typeof details !== "object") return false;
92
+ const candidate = details;
93
+ return typeof candidate.systemPath === "string" && typeof candidate.interfaceKey === "string" && typeof candidate.readinessCode === "string" && Array.isArray(candidate.issues);
94
+ }
95
+ function getSystemReadinessServerErrorDetails(error) {
96
+ if (!isAPIClientError(error)) return void 0;
97
+ return isSystemReadinessErrorDetails(error.details) ? error.details : void 0;
98
+ }
80
99
  function getErrorInfo(error) {
81
100
  if (isAPIClientError(error)) {
82
101
  return {
@@ -512,44 +531,64 @@ var OntologyRecordBaseSchema = z.object({
512
531
  }).passthrough();
513
532
  var OntologyObjectTypeSchema = OntologyRecordBaseSchema.extend({
514
533
  properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
515
- storage: z.record(z.string(), z.unknown()).optional()
516
- });
534
+ storage: z.record(z.string(), z.unknown()).optional(),
535
+ // Carried by the legacy entity projection (`addLegacyEntityProjections`); not
536
+ // authored directly, but a real key an authored record must not collide with.
537
+ rowSchema: z.string().trim().min(1).optional(),
538
+ stateCatalogId: z.string().trim().min(1).optional()
539
+ }).strict();
517
540
  var OntologyLinkTypeSchema = OntologyRecordBaseSchema.extend({
518
541
  from: OntologyIdSchema,
519
542
  to: OntologyIdSchema,
520
543
  cardinality: z.string().trim().min(1).max(80).optional(),
521
544
  via: z.string().trim().min(1).max(255).optional()
522
- });
545
+ }).strict();
523
546
  var OntologyActionTypeSchema = OntologyRecordBaseSchema.extend({
524
547
  actsOn: OntologyReferenceListSchema,
525
548
  input: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
526
- effects: z.array(z.record(z.string(), z.unknown())).optional()
527
- });
549
+ effects: z.array(z.record(z.string(), z.unknown())).optional(),
550
+ resourceId: z.string().trim().min(1).optional(),
551
+ invocations: z.array(z.unknown()).optional(),
552
+ lifecycle: z.string().trim().min(1).optional(),
553
+ // Carried by the legacy action projection (`addLegacyActionProjections`); not
554
+ // authored directly, but a real key an authored record must not collide with.
555
+ legacyActionId: z.string().trim().min(1).optional()
556
+ }).strict();
528
557
  var OntologyCatalogTypeSchema = OntologyRecordBaseSchema.extend({
529
558
  kind: z.string().trim().min(1).max(120).optional(),
530
559
  appliesTo: OntologyIdSchema.optional(),
531
- entries: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
532
- });
560
+ entries: z.record(z.string().trim().min(1).max(200), z.unknown()).optional(),
561
+ // Carried by lead-gen's legacy stage-catalog projection
562
+ // (`createLeadGenStageCatalog`); not authored directly, but a real key an
563
+ // authored record must not collide with.
564
+ legacyCatalogKey: z.string().trim().min(1).optional(),
565
+ // Carried in live tenant configs (Elevasis, `nirvana-marketing`, and the
566
+ // `_template` scaffold all author these on `sales.crm:catalog/crm.pipeline`)
567
+ // as a cross-reference to the pre-ontology CRM pipeline key/entity id. No
568
+ // code currently reads them back — do not silently normalize them away.
569
+ legacyPipelineKey: z.string().trim().min(1).optional(),
570
+ legacyEntityKey: z.string().trim().min(1).optional()
571
+ }).strict();
533
572
  var OntologyEventTypeSchema = OntologyRecordBaseSchema.extend({
534
573
  payload: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
535
- });
574
+ }).strict();
536
575
  var OntologyInterfaceTypeSchema = OntologyRecordBaseSchema.extend({
537
576
  properties: z.record(z.string().trim().min(1).max(200), z.unknown()).optional()
538
- });
577
+ }).strict();
539
578
  var OntologyValueTypeSchema = OntologyRecordBaseSchema.extend({
540
579
  primitive: z.string().trim().min(1).max(120).optional()
541
- });
580
+ }).strict();
542
581
  var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
543
582
  valueType: OntologyIdSchema.optional(),
544
583
  searchable: z.boolean().optional(),
545
584
  pii: z.boolean().optional()
546
- });
585
+ }).strict();
547
586
  var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
548
587
  members: OntologyReferenceListSchema
549
- });
588
+ }).strict();
550
589
  var OntologyEndpointTypeSchema = OntologyRecordBaseSchema.extend({
551
590
  route: z.string().trim().min(1).max(500).optional()
552
- });
591
+ }).strict();
553
592
  var OntologyScopeSchema = z.object({
554
593
  objectTypes: z.record(OntologyIdSchema, OntologyObjectTypeSchema).default({}).optional(),
555
594
  linkTypes: z.record(OntologyIdSchema, OntologyLinkTypeSchema).default({}).optional(),
@@ -842,7 +881,19 @@ function resolveReadinessInterfaceMarker(model, systemPath, interfaceKey) {
842
881
 
843
882
  // ../core/src/organization-model/domains/systems.ts
844
883
  var SystemKindSchema = z.enum(["product", "operational", "platform", "diagnostic"]).meta({ label: "System kind", color: "blue" });
845
- var SystemLifecycleSchema = z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({ label: "Lifecycle", color: "teal" });
884
+ var SystemLifecycleSchema = z.enum(["draft", "beta", "active", "deprecated", "archived"]).meta({
885
+ label: "Lifecycle",
886
+ color: "teal"
887
+ });
888
+ function systemLifecycleAllowsAccess(lifecycle, ctx) {
889
+ if (lifecycle === "active") return true;
890
+ if (lifecycle === "beta") return ctx.betaAccessEnabled === true || ctx.isDevelopment === true;
891
+ return false;
892
+ }
893
+ function isSystemLifecycleVisible(lifecycle, enabled) {
894
+ if (enabled === false) return false;
895
+ return lifecycle !== "draft" && lifecycle !== "deprecated" && lifecycle !== "archived";
896
+ }
846
897
  var SystemIdSchema = ModelIdSchema;
847
898
  var SystemPathSchema = z.string().trim().min(1).regex(
848
899
  /^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)*$/,
@@ -968,8 +1019,13 @@ var SystemEntrySchema = z.object({
968
1019
  parentSystemId: SystemIdSchema.optional(),
969
1020
  /** Optional UI presence. Systems without UI omit this. */
970
1021
  ui: SystemUiSchema.optional(),
971
- /** Canonical lifecycle state. `beta` is what gates a System to dev-mode viewers. */
972
- lifecycle: SystemLifecycleSchema.optional(),
1022
+ /**
1023
+ * Canonical lifecycle state. `beta` is what gates a System to dev-mode
1024
+ * viewers. Defaults to `active` (not `.optional()`) so an omitted field
1025
+ * never reaches a consumer as `undefined` -- see `isSystemLifecycleVisible`
1026
+ * and `systemLifecycleAllowsAccess` above.
1027
+ */
1028
+ lifecycle: SystemLifecycleSchema.default("active"),
973
1029
  /** Optional role responsible for this system. */
974
1030
  responsibleRoleId: ModelIdSchema.meta({ ref: "role" }).optional(),
975
1031
  /** Optional knowledge nodes that govern this system. */
@@ -1448,4 +1504,4 @@ function setupBrowserMocks() {
1448
1504
  setupResizeObserver();
1449
1505
  }
1450
1506
 
1451
- export { APIClientError, API_URL, ActionInvocationSchema, ActionSchema, ActionsDomainSchema, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DescriptionSchema, EntitiesDomainSchema, EntitySchema, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, IconNameSchema, JsonValueSchema, LIMIT_ACTIVITY_FEED, LabelSchema, ModelIdSchema, NodeIdStringSchema, OAUTH_FLOW_TIMEOUT, OntologyIdSchema, OntologyScopeSchema, PAGE_SIZE_DEFAULT, PathSchema, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, SYSTEM_INTERFACE_PROFILES, SystemEntrySchema, SystemIdSchema, SystemInterfaceRefSchema, SystemLifecycleSchema, SystemPathSchema, SystemsDomainSchema, addReadinessIssue, ancestorsOf, childrenOf, compileOrganizationOntology, computeInterfaceReadiness, defaultPathFor, devOnlyFor, findById, findByPath, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatInterfaceIdentity, formatOntologyId, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getResourcesForSystem, getSystem, getSystemAncestors, isAPIClientError, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, parentOf, parseOntologyId, registerBuiltInReadinessProfile, registerReadinessInterfaceMarker, requireCatalogReadiness, requireContractReadiness, requireScopedBinding, resolveSystemConfig, resourceBindingIds, restoreConsole, setupBrowserMocks, suppressKnownWarnings, topLevel, validateEmail };
1507
+ export { APIClientError, API_URL, ActionInvocationSchema, ActionSchema, ActionsDomainSchema, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, DEFAULT_ONTOLOGY_SCOPE, DEFAULT_ORGANIZATION_MODEL_ACTIONS, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, DescriptionSchema, EntitiesDomainSchema, EntitySchema, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, IconNameSchema, JsonValueSchema, LIMIT_ACTIVITY_FEED, LabelSchema, ModelIdSchema, NodeIdStringSchema, OAUTH_FLOW_TIMEOUT, OntologyIdSchema, OntologyScopeSchema, PAGE_SIZE_DEFAULT, PathSchema, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, SYSTEM_INTERFACE_PROFILES, SystemEntrySchema, SystemIdSchema, SystemInterfaceRefSchema, SystemLifecycleSchema, SystemPathSchema, SystemsDomainSchema, addReadinessIssue, ancestorsOf, childrenOf, compileOrganizationOntology, computeInterfaceReadiness, defaultPathFor, devOnlyFor, findById, findByPath, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatInterfaceIdentity, formatOntologyId, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getResourcesForSystem, getSystem, getSystemAncestors, getSystemReadinessServerErrorDetails, isAPIClientError, isSystemLifecycleVisible, listAllSystems, listResolvedOntologyRecords, ontologyGraphNodeId, parentOf, parseOntologyId, registerBuiltInReadinessProfile, registerReadinessInterfaceMarker, requireCatalogReadiness, requireContractReadiness, requireScopedBinding, resolveSystemConfig, resourceBindingIds, restoreConsole, setupBrowserMocks, suppressKnownWarnings, systemLifecycleAllowsAccess, topLevel, validateEmail };
@@ -1,4 +1,4 @@
1
- import { GC_TIME_LONG, STALE_TIME_DEFAULT } from './chunk-Q3O3WY7Q.js';
1
+ import { GC_TIME_LONG, STALE_TIME_DEFAULT } from './chunk-R5UGIFYU.js';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
 
4
4
  function createElevasisQueryClient(options = {}) {