@elevasis/ui 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/index.js +2 -2
- package/dist/{chunk-ABUDMATM.js → chunk-66VY5EMV.js} +4 -4
- package/dist/{chunk-2TDZBYXI.js → chunk-A2AZY5SF.js} +1 -1
- package/dist/{chunk-FNWWVX5N.js → chunk-B6FIIEFO.js} +245 -86
- package/dist/{chunk-MJ6YV2B5.js → chunk-DDZMBNTY.js} +1 -1
- package/dist/{chunk-R7GKX4HW.js → chunk-EY322HXF.js} +175 -78
- package/dist/{chunk-JU6UB4YA.js → chunk-FM6LSZ45.js} +3 -3
- package/dist/{chunk-OCCZRPER.js → chunk-I3LQGLUC.js} +1 -1
- package/dist/{chunk-MDO4UCEJ.js → chunk-LT33DSMO.js} +45 -80
- package/dist/{chunk-TP5NMF6K.js → chunk-P6TC4K7I.js} +3 -3
- package/dist/{chunk-TTP62HWW.js → chunk-SQPM2QDH.js} +7 -13
- package/dist/{chunk-S6CYH4RI.js → chunk-SS2UVUSG.js} +27 -5
- package/dist/{chunk-MUZIYL5Q.js → chunk-UA36WILN.js} +83 -310
- package/dist/{chunk-OXWQQCDR.js → chunk-WP3IYOVJ.js} +226 -211
- package/dist/components/index.d.ts +9 -4
- package/dist/components/index.js +32 -18
- package/dist/features/crm/index.js +5 -5
- package/dist/features/dashboard/index.js +6 -6
- package/dist/features/delivery/index.js +5 -5
- package/dist/features/lead-gen/index.d.ts +152 -16
- package/dist/features/lead-gen/index.js +9 -9
- package/dist/features/monitoring/index.js +7 -7
- package/dist/features/monitoring/requests/index.js +4 -4
- package/dist/features/operations/index.d.ts +1 -0
- package/dist/features/operations/index.js +8 -8
- package/dist/features/settings/index.js +5 -5
- package/dist/hooks/index.d.ts +359 -46
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/published.d.ts +359 -46
- package/dist/hooks/published.js +4 -4
- package/dist/index.d.ts +359 -46
- package/dist/index.js +4 -4
- package/dist/provider/index.js +3 -3
- package/dist/provider/published.js +2 -2
- package/dist/types/index.d.ts +12 -6
- package/dist/zustand/index.js +2 -2
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { useSupabase } from './chunk-BRXELOHC.js';
|
|
|
2
2
|
import { observabilityKeys } from './chunk-QSTH6T77.js';
|
|
3
3
|
import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-GRGRBWIO.js';
|
|
4
4
|
import { GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
|
|
5
|
-
import { useOptionalElevasisFeatures } from './chunk-
|
|
5
|
+
import { useOptionalElevasisFeatures } from './chunk-A2AZY5SF.js';
|
|
6
6
|
import { useNotificationAdapter } from './chunk-P3TFNFZS.js';
|
|
7
7
|
import { HTTP_HEADERS } from './chunk-VDM6DQES.js';
|
|
8
8
|
import { UuidSchema, ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, CredentialNameSchema, REFETCH_INTERVAL_DASHBOARD, getTimeRangeDates, STALE_TIME_MONITORING, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, STALE_TIME_DEFAULT, STALE_TIME_ADMIN, APIClientError, GC_TIME_MEDIUM, GC_TIME_SHORT } from './chunk-GCBWGGI6.js';
|
|
@@ -24,16 +24,14 @@ var executionsKeys = {
|
|
|
24
24
|
all: ["executions"],
|
|
25
25
|
resources: (orgId) => [...executionsKeys.all, "resources", orgId],
|
|
26
26
|
resourceDefinition: (orgId, resourceId) => [...executionsKeys.all, "definition", orgId, resourceId],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
executions: (orgId, resourceId) => [...executionsKeys.all, "list", orgId, resourceId],
|
|
27
|
+
executionsListBase: (orgId, resourceId) => [...executionsKeys.all, "list", orgId, resourceId],
|
|
28
|
+
executions: (orgId, resourceId, resourceStatus, limit, offset) => [...executionsKeys.executionsListBase(orgId, resourceId), resourceStatus ?? "all", limit ?? null, offset ?? 0],
|
|
30
29
|
execution: (orgId, resourceId, executionId) => [...executionsKeys.all, "execution", orgId, resourceId, executionId]
|
|
31
30
|
};
|
|
32
|
-
function useExecutions(resourceId, resourceStatus, limit) {
|
|
31
|
+
function useExecutions(resourceId, resourceStatus, limit, offset) {
|
|
33
32
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
34
33
|
return useQuery({
|
|
35
|
-
|
|
36
|
-
queryKey: executionsKeys.executions(organizationId, resourceId),
|
|
34
|
+
queryKey: executionsKeys.executions(organizationId, resourceId, resourceStatus, limit, offset),
|
|
37
35
|
queryFn: async () => {
|
|
38
36
|
const params = new URLSearchParams();
|
|
39
37
|
if (resourceStatus && resourceStatus !== "all") {
|
|
@@ -42,6 +40,9 @@ function useExecutions(resourceId, resourceStatus, limit) {
|
|
|
42
40
|
if (limit) {
|
|
43
41
|
params.set("limit", String(limit));
|
|
44
42
|
}
|
|
43
|
+
if (offset !== void 0) {
|
|
44
|
+
params.set("offset", String(offset));
|
|
45
|
+
}
|
|
45
46
|
const queryString = params.toString();
|
|
46
47
|
const endpoint = `/execution-engine/executions/${resourceId}${queryString ? `?${queryString}` : ""}`;
|
|
47
48
|
return apiRequest(endpoint);
|
|
@@ -75,7 +76,7 @@ function useExecuteAsync() {
|
|
|
75
76
|
},
|
|
76
77
|
onSuccess: (data) => {
|
|
77
78
|
queryClient.invalidateQueries({
|
|
78
|
-
queryKey: executionsKeys.
|
|
79
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
});
|
|
@@ -93,7 +94,7 @@ function useRetryExecution() {
|
|
|
93
94
|
},
|
|
94
95
|
onSuccess: (data) => {
|
|
95
96
|
queryClient.invalidateQueries({
|
|
96
|
-
queryKey: executionsKeys.
|
|
97
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
});
|
|
@@ -114,7 +115,7 @@ function useCancelExecution() {
|
|
|
114
115
|
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
115
116
|
});
|
|
116
117
|
queryClient.invalidateQueries({
|
|
117
|
-
queryKey: executionsKeys.
|
|
118
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
});
|
|
@@ -134,7 +135,7 @@ function useDeleteExecution() {
|
|
|
134
135
|
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
135
136
|
});
|
|
136
137
|
queryClient.invalidateQueries({
|
|
137
|
-
queryKey: executionsKeys.
|
|
138
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
});
|
|
@@ -161,7 +162,7 @@ function useBulkDeleteExecutions() {
|
|
|
161
162
|
},
|
|
162
163
|
onSuccess: (data) => {
|
|
163
164
|
queryClient.invalidateQueries({
|
|
164
|
-
queryKey: executionsKeys.
|
|
165
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
});
|
|
@@ -828,7 +829,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
|
|
|
828
829
|
return updated;
|
|
829
830
|
});
|
|
830
831
|
queryClient.invalidateQueries({
|
|
831
|
-
queryKey: executionsKeys.
|
|
832
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
832
833
|
});
|
|
833
834
|
}
|
|
834
835
|
break;
|
|
@@ -845,7 +846,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
|
|
|
845
846
|
return updated;
|
|
846
847
|
});
|
|
847
848
|
queryClient.invalidateQueries({
|
|
848
|
-
queryKey: executionsKeys.
|
|
849
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
849
850
|
});
|
|
850
851
|
queryClient.invalidateQueries({
|
|
851
852
|
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
@@ -2181,12 +2182,15 @@ function useCommandQueue({
|
|
|
2181
2182
|
if (limit !== void 0) params.set("limit", String(limit));
|
|
2182
2183
|
if (offset !== void 0) params.set("offset", String(offset));
|
|
2183
2184
|
const response = await apiRequest(`/command-queue?${params.toString()}`);
|
|
2184
|
-
return
|
|
2185
|
-
...
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2185
|
+
return {
|
|
2186
|
+
...response,
|
|
2187
|
+
tasks: response.tasks.map((task) => ({
|
|
2188
|
+
...task,
|
|
2189
|
+
createdAt: new Date(task.createdAt),
|
|
2190
|
+
completedAt: task.completedAt ? new Date(task.completedAt) : void 0,
|
|
2191
|
+
expiresAt: task.expiresAt ? new Date(task.expiresAt) : void 0
|
|
2192
|
+
}))
|
|
2193
|
+
};
|
|
2190
2194
|
},
|
|
2191
2195
|
enabled: isReady
|
|
2192
2196
|
});
|
|
@@ -2215,7 +2219,10 @@ function useSubmitAction() {
|
|
|
2215
2219
|
if (data) {
|
|
2216
2220
|
queryClient.setQueryData(
|
|
2217
2221
|
queryKey,
|
|
2218
|
-
(old) => old
|
|
2222
|
+
(old) => old ? {
|
|
2223
|
+
...old,
|
|
2224
|
+
tasks: old.tasks.map((task) => task.id === taskId ? { ...task, status: "processing" } : task)
|
|
2225
|
+
} : old
|
|
2219
2226
|
);
|
|
2220
2227
|
}
|
|
2221
2228
|
}
|
|
@@ -2250,7 +2257,18 @@ function useDeleteTask() {
|
|
|
2250
2257
|
for (const [queryKey, data] of queries) {
|
|
2251
2258
|
previousData.set(queryKey, data);
|
|
2252
2259
|
if (data) {
|
|
2253
|
-
queryClient.setQueryData(
|
|
2260
|
+
queryClient.setQueryData(
|
|
2261
|
+
queryKey,
|
|
2262
|
+
(old) => old ? (() => {
|
|
2263
|
+
const hadTask = old.tasks.some((task) => task.id === taskId);
|
|
2264
|
+
if (!hadTask) return old;
|
|
2265
|
+
return {
|
|
2266
|
+
...old,
|
|
2267
|
+
tasks: old.tasks.filter((task) => task.id !== taskId),
|
|
2268
|
+
total: Math.max(old.total - 1, 0)
|
|
2269
|
+
};
|
|
2270
|
+
})() : old
|
|
2271
|
+
);
|
|
2254
2272
|
}
|
|
2255
2273
|
}
|
|
2256
2274
|
return { previousData };
|
|
@@ -2270,7 +2288,7 @@ function useDeleteTask() {
|
|
|
2270
2288
|
});
|
|
2271
2289
|
}
|
|
2272
2290
|
function useCommandQueueTotals({
|
|
2273
|
-
timeRange = "
|
|
2291
|
+
timeRange = "30d",
|
|
2274
2292
|
priorityMin,
|
|
2275
2293
|
priorityMax,
|
|
2276
2294
|
status
|
|
@@ -2313,7 +2331,10 @@ function usePatchTask() {
|
|
|
2313
2331
|
};
|
|
2314
2332
|
queryClient.setQueriesData(
|
|
2315
2333
|
{ queryKey: ["command-queue", "list"] },
|
|
2316
|
-
(old) => old
|
|
2334
|
+
(old) => old ? {
|
|
2335
|
+
...old,
|
|
2336
|
+
tasks: old.tasks.map((t) => t.id === deserialized.id ? { ...t, ...deserialized } : t)
|
|
2337
|
+
} : old
|
|
2317
2338
|
);
|
|
2318
2339
|
},
|
|
2319
2340
|
onError: (error) => {
|
|
@@ -2385,6 +2406,7 @@ function useExecutionPanelState({
|
|
|
2385
2406
|
manager,
|
|
2386
2407
|
apiUrl,
|
|
2387
2408
|
limit,
|
|
2409
|
+
offset,
|
|
2388
2410
|
onConnectionStatus,
|
|
2389
2411
|
selectedId: controlledSelectedId,
|
|
2390
2412
|
onSelectedIdChange
|
|
@@ -2393,7 +2415,7 @@ function useExecutionPanelState({
|
|
|
2393
2415
|
const navigate = useNavigate();
|
|
2394
2416
|
const { organizationId } = useElevasisServices();
|
|
2395
2417
|
const [resourceStatusFilter, setResourceStatusFilter] = useState("all");
|
|
2396
|
-
const { data: executionsData, isLoading, isFetched } = useExecutions(resourceId, resourceStatusFilter, limit);
|
|
2418
|
+
const { data: executionsData, isLoading, isFetched } = useExecutions(resourceId, resourceStatusFilter, limit, offset);
|
|
2397
2419
|
const { liveExecutions, connected, runningCount, streamingLogs } = useExecutionLogSSE(resourceId, manager, apiUrl);
|
|
2398
2420
|
const isControlled = controlledSelectedId !== void 0;
|
|
2399
2421
|
const search = useSearch({ strict: false });
|
|
@@ -2413,6 +2435,7 @@ function useExecutionPanelState({
|
|
|
2413
2435
|
[isControlled, navigate, onSelectedIdChange]
|
|
2414
2436
|
);
|
|
2415
2437
|
const executions = executionsData?.executions || [];
|
|
2438
|
+
const total = executionsData?.total ?? executions.length;
|
|
2416
2439
|
const prevExecutionCountRef = useRef(0);
|
|
2417
2440
|
const prevNewestIdRef = useRef(void 0);
|
|
2418
2441
|
const prevResourceIdRef = useRef(resourceId);
|
|
@@ -2465,6 +2488,7 @@ function useExecutionPanelState({
|
|
|
2465
2488
|
}, [connected, runningCount, onConnectionStatus]);
|
|
2466
2489
|
return {
|
|
2467
2490
|
executions,
|
|
2491
|
+
total,
|
|
2468
2492
|
isLoading,
|
|
2469
2493
|
isFetched,
|
|
2470
2494
|
selectedId,
|
|
@@ -2497,7 +2521,7 @@ function useCommandViewData() {
|
|
|
2497
2521
|
staleTime: STALE_TIME_DEFAULT
|
|
2498
2522
|
});
|
|
2499
2523
|
}
|
|
2500
|
-
function useCommandViewStats(timeRange = "
|
|
2524
|
+
function useCommandViewStats(timeRange = "30d", options) {
|
|
2501
2525
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2502
2526
|
return useQuery({
|
|
2503
2527
|
queryKey: ["command-view-stats", organizationId, timeRange],
|
|
@@ -2741,13 +2765,19 @@ function useResourceErrors({ resourceId, timeRange, hasFailures }) {
|
|
|
2741
2765
|
staleTime: STALE_TIME_ADMIN
|
|
2742
2766
|
});
|
|
2743
2767
|
}
|
|
2744
|
-
function useResourceExecutions({
|
|
2768
|
+
function useResourceExecutions({
|
|
2769
|
+
resourceId,
|
|
2770
|
+
timeRange,
|
|
2771
|
+
page = 1,
|
|
2772
|
+
limit = 10,
|
|
2773
|
+
enabled = true
|
|
2774
|
+
}) {
|
|
2745
2775
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2746
2776
|
return useQuery({
|
|
2747
|
-
queryKey: ["resource-executions", organizationId, resourceId, timeRange],
|
|
2777
|
+
queryKey: ["resource-executions", organizationId, resourceId, timeRange, page, limit],
|
|
2748
2778
|
queryFn: async () => {
|
|
2749
2779
|
return apiRequest(
|
|
2750
|
-
`/command-view/resource-executions?resourceId=${resourceId}&timeRange=${timeRange}`
|
|
2780
|
+
`/command-view/resource-executions?resourceId=${resourceId}&timeRange=${timeRange}&page=${page}&limit=${limit}`
|
|
2751
2781
|
);
|
|
2752
2782
|
},
|
|
2753
2783
|
// Only fetch when: org ready, resource selected, and enabled
|
|
@@ -3111,7 +3141,8 @@ function useSyncDealStage() {
|
|
|
3111
3141
|
});
|
|
3112
3142
|
},
|
|
3113
3143
|
onSuccess: (_, variables) => {
|
|
3114
|
-
queryClient.invalidateQueries({ queryKey:
|
|
3144
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
|
|
3145
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
|
|
3115
3146
|
queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
|
|
3116
3147
|
},
|
|
3117
3148
|
onError: (error) => {
|
|
@@ -3354,6 +3385,7 @@ function useDeleteList() {
|
|
|
3354
3385
|
var companyKeys = {
|
|
3355
3386
|
all: ["acquisition-companies"],
|
|
3356
3387
|
list: (organizationId, filters) => [...companyKeys.all, "list", organizationId, filters],
|
|
3388
|
+
facets: (organizationId) => [...companyKeys.all, "facets", organizationId],
|
|
3357
3389
|
detail: (organizationId, companyId) => [...companyKeys.all, "detail", organizationId, companyId]
|
|
3358
3390
|
};
|
|
3359
3391
|
function buildQueryString(params) {
|
|
@@ -3378,25 +3410,24 @@ function useCompanies(filters = {}) {
|
|
|
3378
3410
|
segment: filters.segment,
|
|
3379
3411
|
category: filters.category,
|
|
3380
3412
|
batchId: filters.batchId,
|
|
3381
|
-
status: filters.status
|
|
3413
|
+
status: filters.status,
|
|
3414
|
+
includeAll: filters.includeAll,
|
|
3415
|
+
limit: filters.limit,
|
|
3416
|
+
offset: filters.offset
|
|
3382
3417
|
});
|
|
3383
|
-
|
|
3384
|
-
apiRequest(`/acquisition/companies${queryString}`),
|
|
3385
|
-
apiRequest("/acquisition/contacts?limit=5000&offset=0")
|
|
3386
|
-
]);
|
|
3387
|
-
const contactCountByCompanyId = /* @__PURE__ */ new Map();
|
|
3388
|
-
for (const contact of contacts.data) {
|
|
3389
|
-
if (!contact.companyId) continue;
|
|
3390
|
-
contactCountByCompanyId.set(contact.companyId, (contactCountByCompanyId.get(contact.companyId) ?? 0) + 1);
|
|
3391
|
-
}
|
|
3392
|
-
return companies.map((company) => ({
|
|
3393
|
-
...company,
|
|
3394
|
-
contactCount: contactCountByCompanyId.get(company.id) ?? 0
|
|
3395
|
-
}));
|
|
3418
|
+
return apiRequest(`/acquisition/companies${queryString}`);
|
|
3396
3419
|
},
|
|
3397
3420
|
enabled: isReady && !!organizationId
|
|
3398
3421
|
});
|
|
3399
3422
|
}
|
|
3423
|
+
function useCompanyFacets() {
|
|
3424
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3425
|
+
return useQuery({
|
|
3426
|
+
queryKey: companyKeys.facets(organizationId),
|
|
3427
|
+
queryFn: () => apiRequest("/acquisition/companies/facets"),
|
|
3428
|
+
enabled: isReady && !!organizationId
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3400
3431
|
function useCompany(companyId) {
|
|
3401
3432
|
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3402
3433
|
return useQuery({
|
|
@@ -3497,21 +3528,10 @@ function useContacts(filters = {}) {
|
|
|
3497
3528
|
openingLineIsNull: filters.openingLineIsNull,
|
|
3498
3529
|
batchId: filters.batchId,
|
|
3499
3530
|
contactStatus: filters.contactStatus,
|
|
3500
|
-
limit: filters.limit
|
|
3501
|
-
offset: filters.offset
|
|
3531
|
+
limit: filters.limit,
|
|
3532
|
+
offset: filters.offset
|
|
3502
3533
|
});
|
|
3503
|
-
|
|
3504
|
-
apiRequest(`/acquisition/contacts${queryString}`),
|
|
3505
|
-
apiRequest("/acquisition/companies?includeAll=true")
|
|
3506
|
-
]);
|
|
3507
|
-
const companyById = /* @__PURE__ */ new Map();
|
|
3508
|
-
for (const company of companies) {
|
|
3509
|
-
companyById.set(company.id, company);
|
|
3510
|
-
}
|
|
3511
|
-
return contacts.data.map((contact) => ({
|
|
3512
|
-
...contact,
|
|
3513
|
-
company: contact.companyId ? companyById.get(contact.companyId) ?? null : null
|
|
3514
|
-
}));
|
|
3534
|
+
return apiRequest(`/acquisition/contacts${queryString}`);
|
|
3515
3535
|
},
|
|
3516
3536
|
enabled: isReady && !!organizationId
|
|
3517
3537
|
});
|
|
@@ -3522,16 +3542,7 @@ function useContact(contactId) {
|
|
|
3522
3542
|
queryKey: contactKeys.detail(organizationId, contactId),
|
|
3523
3543
|
queryFn: async () => {
|
|
3524
3544
|
if (!contactId) return null;
|
|
3525
|
-
|
|
3526
|
-
const companies = await apiRequest("/acquisition/companies?includeAll=true");
|
|
3527
|
-
const companyById = /* @__PURE__ */ new Map();
|
|
3528
|
-
for (const company of companies) {
|
|
3529
|
-
companyById.set(company.id, company);
|
|
3530
|
-
}
|
|
3531
|
-
return {
|
|
3532
|
-
...contact,
|
|
3533
|
-
company: contact.companyId ? companyById.get(contact.companyId) ?? null : null
|
|
3534
|
-
};
|
|
3545
|
+
return apiRequest(`/acquisition/contacts/${contactId}`);
|
|
3535
3546
|
},
|
|
3536
3547
|
enabled: isReady && !!organizationId && !!contactId
|
|
3537
3548
|
});
|
|
@@ -3716,27 +3727,110 @@ function useListWebhookEndpoints() {
|
|
|
3716
3727
|
}
|
|
3717
3728
|
|
|
3718
3729
|
// src/hooks/acquisition/useDeals.ts
|
|
3730
|
+
var DEFAULT_DEALS_LIMIT = 50;
|
|
3731
|
+
var DEFAULT_DEALS_OFFSET = 0;
|
|
3732
|
+
var DEFAULT_LOOKUP_LIMIT = 10;
|
|
3733
|
+
function normalizeSearch(search) {
|
|
3734
|
+
const trimmed = search?.trim();
|
|
3735
|
+
return trimmed ? trimmed : void 0;
|
|
3736
|
+
}
|
|
3737
|
+
function normalizeDealFilters(filters = {}) {
|
|
3738
|
+
return {
|
|
3739
|
+
...filters,
|
|
3740
|
+
search: normalizeSearch(filters.search),
|
|
3741
|
+
limit: filters.limit ?? DEFAULT_DEALS_LIMIT,
|
|
3742
|
+
offset: filters.offset ?? DEFAULT_DEALS_OFFSET
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
function normalizeLookupFilters(filters = {}) {
|
|
3746
|
+
return {
|
|
3747
|
+
...filters,
|
|
3748
|
+
search: normalizeSearch(filters.search),
|
|
3749
|
+
limit: filters.limit ?? DEFAULT_LOOKUP_LIMIT
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3719
3752
|
var dealKeys = {
|
|
3720
3753
|
all: ["deals"],
|
|
3721
3754
|
lists: () => [...dealKeys.all, "list"],
|
|
3722
3755
|
list: (orgId, filters) => [...dealKeys.all, "list", orgId, filters],
|
|
3756
|
+
summaries: () => [...dealKeys.all, "summary"],
|
|
3757
|
+
summary: (orgId) => [...dealKeys.all, "summary", orgId],
|
|
3758
|
+
lookups: () => [...dealKeys.all, "lookup"],
|
|
3759
|
+
lookup: (orgId, filters) => [...dealKeys.all, "lookup", orgId, filters],
|
|
3723
3760
|
details: () => [...dealKeys.all, "detail"],
|
|
3724
3761
|
detail: (id) => [...dealKeys.all, "detail", id]
|
|
3725
3762
|
};
|
|
3726
3763
|
function useDeals(filters = {}) {
|
|
3727
3764
|
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3728
|
-
|
|
3729
|
-
|
|
3765
|
+
const normalizedFilters = normalizeDealFilters(filters);
|
|
3766
|
+
const query = useQuery({
|
|
3767
|
+
queryKey: dealKeys.list(organizationId, normalizedFilters),
|
|
3730
3768
|
queryFn: async () => {
|
|
3731
3769
|
const params = new URLSearchParams();
|
|
3732
|
-
if (
|
|
3733
|
-
if (
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
return
|
|
3770
|
+
if (normalizedFilters.stage) params.set("stage", normalizedFilters.stage);
|
|
3771
|
+
if (normalizedFilters.search) params.set("search", normalizedFilters.search);
|
|
3772
|
+
params.set("limit", String(normalizedFilters.limit));
|
|
3773
|
+
params.set("offset", String(normalizedFilters.offset));
|
|
3774
|
+
return apiRequest(`/deals?${params.toString()}`);
|
|
3737
3775
|
},
|
|
3738
3776
|
enabled: isReady
|
|
3739
3777
|
});
|
|
3778
|
+
const response = query.data;
|
|
3779
|
+
return {
|
|
3780
|
+
dataUpdatedAt: query.dataUpdatedAt,
|
|
3781
|
+
error: query.error,
|
|
3782
|
+
errorUpdatedAt: query.errorUpdatedAt,
|
|
3783
|
+
failureCount: query.failureCount,
|
|
3784
|
+
failureReason: query.failureReason,
|
|
3785
|
+
fetchStatus: query.fetchStatus,
|
|
3786
|
+
isError: query.isError,
|
|
3787
|
+
isFetched: query.isFetched,
|
|
3788
|
+
isFetchedAfterMount: query.isFetchedAfterMount,
|
|
3789
|
+
isFetching: query.isFetching,
|
|
3790
|
+
isInitialLoading: query.isInitialLoading,
|
|
3791
|
+
isLoading: query.isLoading,
|
|
3792
|
+
isLoadingError: query.isLoadingError,
|
|
3793
|
+
isPaused: query.isPaused,
|
|
3794
|
+
isPending: query.isPending,
|
|
3795
|
+
isPlaceholderData: query.isPlaceholderData,
|
|
3796
|
+
isRefetchError: query.isRefetchError,
|
|
3797
|
+
isRefetching: query.isRefetching,
|
|
3798
|
+
isRefetchStale: query.isStale,
|
|
3799
|
+
isSuccess: query.isSuccess,
|
|
3800
|
+
refetch: query.refetch,
|
|
3801
|
+
status: query.status,
|
|
3802
|
+
data: response?.data ?? [],
|
|
3803
|
+
response,
|
|
3804
|
+
total: response?.total ?? 0,
|
|
3805
|
+
limit: response?.limit ?? normalizedFilters.limit,
|
|
3806
|
+
offset: response?.offset ?? normalizedFilters.offset,
|
|
3807
|
+
hasNextPage: (response?.offset ?? normalizedFilters.offset) + (response?.data.length ?? 0) < (response?.total ?? 0),
|
|
3808
|
+
hasPreviousPage: (response?.offset ?? normalizedFilters.offset) > 0
|
|
3809
|
+
};
|
|
3810
|
+
}
|
|
3811
|
+
function useDealsSummary() {
|
|
3812
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3813
|
+
return useQuery({
|
|
3814
|
+
queryKey: dealKeys.summary(organizationId),
|
|
3815
|
+
queryFn: async () => {
|
|
3816
|
+
return apiRequest("/deals/summary");
|
|
3817
|
+
},
|
|
3818
|
+
enabled: isReady
|
|
3819
|
+
});
|
|
3820
|
+
}
|
|
3821
|
+
function useDealsLookup(filters = {}, options) {
|
|
3822
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3823
|
+
const normalizedFilters = normalizeLookupFilters(filters);
|
|
3824
|
+
return useQuery({
|
|
3825
|
+
queryKey: dealKeys.lookup(organizationId, normalizedFilters),
|
|
3826
|
+
queryFn: async () => {
|
|
3827
|
+
const params = new URLSearchParams();
|
|
3828
|
+
if (normalizedFilters.search) params.set("search", normalizedFilters.search);
|
|
3829
|
+
params.set("limit", String(normalizedFilters.limit));
|
|
3830
|
+
return apiRequest(`/deals/lookup?${params.toString()}`);
|
|
3831
|
+
},
|
|
3832
|
+
enabled: isReady && (options?.enabled ?? true)
|
|
3833
|
+
});
|
|
3740
3834
|
}
|
|
3741
3835
|
function useDeleteDeal() {
|
|
3742
3836
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
@@ -3745,8 +3839,11 @@ function useDeleteDeal() {
|
|
|
3745
3839
|
mutationFn: async (dealId) => {
|
|
3746
3840
|
await apiRequest(`/deals/${dealId}`, { method: "DELETE" });
|
|
3747
3841
|
},
|
|
3748
|
-
onSuccess: () => {
|
|
3749
|
-
queryClient.
|
|
3842
|
+
onSuccess: (_, dealId) => {
|
|
3843
|
+
queryClient.removeQueries({ queryKey: ["deal-detail", organizationId, dealId], exact: true });
|
|
3844
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
|
|
3845
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
|
|
3846
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.lookups() });
|
|
3750
3847
|
},
|
|
3751
3848
|
onError: (error) => {
|
|
3752
3849
|
showApiErrorNotification(error);
|
|
@@ -4300,4 +4397,4 @@ function useProjectRealtime(projectId) {
|
|
|
4300
4397
|
});
|
|
4301
4398
|
}
|
|
4302
4399
|
|
|
4303
|
-
export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, isSessionCapable, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useList, useListApiKeys, useListDeployments, useListExecutions, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSyncDealStage, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
|
|
4400
|
+
export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, isSessionCapable, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useList, useListApiKeys, useListDeployments, useListExecutions, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSyncDealStage, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-
|
|
2
|
-
import { useResourcesHealth } from './chunk-
|
|
3
|
-
import { CardHeader, EmptyState } from './chunk-
|
|
1
|
+
import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-DDZMBNTY.js';
|
|
2
|
+
import { useResourcesHealth } from './chunk-EY322HXF.js';
|
|
3
|
+
import { CardHeader, EmptyState } from './chunk-SQPM2QDH.js';
|
|
4
4
|
import { getTimeRangeDates, formatBucketTime } from './chunk-GCBWGGI6.js';
|
|
5
5
|
import { Paper, Center, Loader, Group } from '@mantine/core';
|
|
6
6
|
import { IconActivity, IconChartBar } from '@tabler/icons-react';
|