@elevasis/ui 1.25.0 → 1.26.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-7RS6VTAV.js → chunk-4INR75ZS.js} +3 -3
- package/dist/{chunk-RIL2CDFE.js → chunk-4WKWLFBZ.js} +3 -3
- package/dist/{chunk-US4JUSI3.js → chunk-JHVKGZ2P.js} +1 -1
- package/dist/{chunk-3EVTCVKR.js → chunk-LR4WVA7W.js} +2 -2
- package/dist/{chunk-G25YWGUL.js → chunk-MCA6LOGM.js} +1 -1
- package/dist/{chunk-QNABH7YG.js → chunk-O4UB5DQQ.js} +2 -2
- package/dist/{chunk-HYYI4ZFT.js → chunk-TCKIAHDC.js} +4 -4
- package/dist/{chunk-R565P6XC.js → chunk-YNGQ7U5H.js} +86 -516
- package/dist/{chunk-QDO6NF2I.js → chunk-ZVJKIJFG.js} +264 -69
- package/dist/components/index.d.ts +15 -15
- package/dist/components/index.js +40 -114
- package/dist/features/dashboard/index.js +5 -6
- package/dist/features/monitoring/index.js +6 -7
- package/dist/features/operations/index.js +7 -8
- package/dist/features/settings/index.js +4 -5
- package/dist/hooks/index.d.ts +67 -82
- package/dist/hooks/index.js +2 -3
- package/dist/hooks/published.d.ts +234 -5
- package/dist/hooks/published.js +1 -2
- package/dist/index.d.ts +67 -82
- package/dist/index.js +2 -3
- package/dist/supabase/index.js +47 -2
- package/dist/types/index.d.ts +35 -1
- package/package.json +1 -1
- package/dist/chunk-NJJ3NQ7B.js +0 -47
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { useSupabase } from './chunk-NJJ3NQ7B.js';
|
|
2
1
|
import { getTimeRangeDates, observabilityKeys } from './chunk-LXHZYSMQ.js';
|
|
3
2
|
import { GRAPH_CONSTANTS } from './chunk-F6RBK7NJ.js';
|
|
4
3
|
import { useNotificationAdapter } from './chunk-R7WLWGPO.js';
|
|
5
4
|
import { HTTP_HEADERS } from './chunk-NVOCKXUQ.js';
|
|
6
|
-
import { STALE_TIME_MONITORING, REFETCH_INTERVAL_DASHBOARD, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, getErrorInfo, formatErrorMessage, getErrorTitle, STALE_TIME_DEFAULT, STALE_TIME_ADMIN } from './chunk-IOKL7BKE.js';
|
|
5
|
+
import { STALE_TIME_MONITORING, REFETCH_INTERVAL_DASHBOARD, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, getErrorInfo, formatErrorMessage, getErrorTitle, STALE_TIME_DEFAULT, STALE_TIME_ADMIN, APIClientError } from './chunk-IOKL7BKE.js';
|
|
7
6
|
import { useStableAccessToken } from './chunk-ALA56RGZ.js';
|
|
8
7
|
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
9
8
|
import { useElevasisServices } from './chunk-QEPXAWE2.js';
|
|
@@ -682,6 +681,9 @@ z.object({
|
|
|
682
681
|
message: z.string().trim().min(1).max(1e3),
|
|
683
682
|
actionUrl: z.string().url().optional()
|
|
684
683
|
}).strict();
|
|
684
|
+
z.object({
|
|
685
|
+
ids: z.array(UuidSchema).min(1).max(500)
|
|
686
|
+
}).strict();
|
|
685
687
|
|
|
686
688
|
// src/hooks/monitoring/useNotifications.ts
|
|
687
689
|
function useNotifications({ limit = 20, offset = 0 } = {}) {
|
|
@@ -998,15 +1000,18 @@ function useWarningNotification() {
|
|
|
998
1000
|
const adapter = useNotificationAdapter();
|
|
999
1001
|
return useCallback((title, message) => adapter.warning(title, message), [adapter]);
|
|
1000
1002
|
}
|
|
1001
|
-
function useBatchDelete(
|
|
1002
|
-
const
|
|
1003
|
+
function useBatchDelete(invalidateQueryKeys) {
|
|
1004
|
+
const { apiRequest } = useElevasisServices();
|
|
1003
1005
|
const queryClient = useQueryClient();
|
|
1004
1006
|
const adapter = useNotificationAdapter();
|
|
1005
1007
|
return useMutation({
|
|
1006
1008
|
mutationFn: async (ids) => {
|
|
1007
1009
|
if (ids.length === 0) return;
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
+
const body = { ids };
|
|
1011
|
+
await apiRequest("/notifications/batch", {
|
|
1012
|
+
method: "DELETE",
|
|
1013
|
+
body: JSON.stringify(body)
|
|
1014
|
+
});
|
|
1010
1015
|
},
|
|
1011
1016
|
onSuccess: () => {
|
|
1012
1017
|
for (const key of invalidateQueryKeys) {
|
|
@@ -2670,6 +2675,114 @@ var calibrationKeys = {
|
|
|
2670
2675
|
run: (org, runId) => [...calibrationKeys.all, "run", org, runId],
|
|
2671
2676
|
runFull: (org, runId) => [...calibrationKeys.all, "run-full", org, runId]
|
|
2672
2677
|
};
|
|
2678
|
+
function useAllCalibrationProjects() {
|
|
2679
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2680
|
+
return useQuery({
|
|
2681
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none"),
|
|
2682
|
+
queryFn: async () => {
|
|
2683
|
+
const response = await apiRequest("/calibration/projects");
|
|
2684
|
+
return response.projects;
|
|
2685
|
+
},
|
|
2686
|
+
enabled: isReady && !!organizationId
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
function useCalibrationProjects(resourceId, resourceType) {
|
|
2690
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2691
|
+
return useQuery({
|
|
2692
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", resourceId, resourceType),
|
|
2693
|
+
queryFn: async () => {
|
|
2694
|
+
const response = await apiRequest(
|
|
2695
|
+
`/calibration/projects?resourceId=${resourceId}&resourceType=${resourceType}`
|
|
2696
|
+
);
|
|
2697
|
+
return response.projects;
|
|
2698
|
+
},
|
|
2699
|
+
enabled: isReady && !!resourceId && !!resourceType && !!organizationId
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
function useCalibrationProject(projectId) {
|
|
2703
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2704
|
+
return useQuery({
|
|
2705
|
+
queryKey: calibrationKeys.project(organizationId ?? "none", projectId),
|
|
2706
|
+
queryFn: async () => {
|
|
2707
|
+
const response = await apiRequest(`/calibration/projects/${projectId}`);
|
|
2708
|
+
return response.project;
|
|
2709
|
+
},
|
|
2710
|
+
enabled: isReady && !!projectId && !!organizationId
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
function useCreateProject() {
|
|
2714
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
2715
|
+
const queryClient = useQueryClient();
|
|
2716
|
+
return useMutation({
|
|
2717
|
+
mutationFn: async (input) => {
|
|
2718
|
+
const response = await apiRequest("/calibration/projects", {
|
|
2719
|
+
method: "POST",
|
|
2720
|
+
body: JSON.stringify(input)
|
|
2721
|
+
});
|
|
2722
|
+
return response.project;
|
|
2723
|
+
},
|
|
2724
|
+
onSuccess: (data) => {
|
|
2725
|
+
queryClient.invalidateQueries({
|
|
2726
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2727
|
+
});
|
|
2728
|
+
queryClient.invalidateQueries({
|
|
2729
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2730
|
+
});
|
|
2731
|
+
},
|
|
2732
|
+
onError: (error) => {
|
|
2733
|
+
showApiErrorNotification(error);
|
|
2734
|
+
}
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
function useUpdateProject() {
|
|
2738
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
2739
|
+
const queryClient = useQueryClient();
|
|
2740
|
+
return useMutation({
|
|
2741
|
+
mutationFn: async ({
|
|
2742
|
+
id,
|
|
2743
|
+
...input
|
|
2744
|
+
}) => {
|
|
2745
|
+
const response = await apiRequest(`/calibration/projects/${id}`, {
|
|
2746
|
+
method: "PATCH",
|
|
2747
|
+
body: JSON.stringify(input)
|
|
2748
|
+
});
|
|
2749
|
+
return response.project;
|
|
2750
|
+
},
|
|
2751
|
+
onSuccess: (data) => {
|
|
2752
|
+
queryClient.invalidateQueries({
|
|
2753
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2754
|
+
});
|
|
2755
|
+
queryClient.invalidateQueries({
|
|
2756
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2757
|
+
});
|
|
2758
|
+
queryClient.invalidateQueries({
|
|
2759
|
+
queryKey: calibrationKeys.project(organizationId ?? "none", data.id)
|
|
2760
|
+
});
|
|
2761
|
+
},
|
|
2762
|
+
onError: (error) => {
|
|
2763
|
+
showApiErrorNotification(error);
|
|
2764
|
+
}
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2767
|
+
function useDeleteProject() {
|
|
2768
|
+
const { apiRequest } = useElevasisServices();
|
|
2769
|
+
const queryClient = useQueryClient();
|
|
2770
|
+
return useMutation({
|
|
2771
|
+
mutationFn: async (id) => {
|
|
2772
|
+
await apiRequest(`/calibration/projects/${id}`, {
|
|
2773
|
+
method: "DELETE"
|
|
2774
|
+
});
|
|
2775
|
+
},
|
|
2776
|
+
onSuccess: () => {
|
|
2777
|
+
queryClient.invalidateQueries({
|
|
2778
|
+
queryKey: calibrationKeys.all
|
|
2779
|
+
});
|
|
2780
|
+
},
|
|
2781
|
+
onError: (error) => {
|
|
2782
|
+
showApiErrorNotification(error);
|
|
2783
|
+
}
|
|
2784
|
+
});
|
|
2785
|
+
}
|
|
2673
2786
|
function useCalibrationRuns(projectId) {
|
|
2674
2787
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2675
2788
|
return useQuery({
|
|
@@ -2899,110 +3012,192 @@ function useCalibrationSSE({ runId, manager, apiUrl, enabled = true }) {
|
|
|
2899
3012
|
reset
|
|
2900
3013
|
};
|
|
2901
3014
|
}
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
function useAllCalibrationProjects() {
|
|
2905
|
-
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
3015
|
+
function useDealDetail(acqDealId) {
|
|
3016
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2906
3017
|
return useQuery({
|
|
2907
|
-
queryKey:
|
|
3018
|
+
queryKey: ["deal-detail", organizationId, acqDealId],
|
|
2908
3019
|
queryFn: async () => {
|
|
2909
|
-
|
|
2910
|
-
|
|
3020
|
+
if (!acqDealId) return null;
|
|
3021
|
+
try {
|
|
3022
|
+
return await apiRequest(`/deals/${acqDealId}`);
|
|
3023
|
+
} catch (err) {
|
|
3024
|
+
if (err instanceof APIClientError && err.statusCode === 404) return null;
|
|
3025
|
+
throw err;
|
|
3026
|
+
}
|
|
2911
3027
|
},
|
|
2912
|
-
enabled: isReady && !!
|
|
3028
|
+
enabled: isReady && !!acqDealId
|
|
2913
3029
|
});
|
|
2914
3030
|
}
|
|
2915
|
-
function
|
|
2916
|
-
const { apiRequest, organizationId
|
|
3031
|
+
function useSyncDealStage() {
|
|
3032
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3033
|
+
const queryClient = useQueryClient();
|
|
3034
|
+
return useMutation({
|
|
3035
|
+
mutationFn: async ({ dealId, stage }) => {
|
|
3036
|
+
await apiRequest(`/deals/${dealId}/sync-stage`, {
|
|
3037
|
+
method: "PATCH",
|
|
3038
|
+
body: JSON.stringify({ stage })
|
|
3039
|
+
});
|
|
3040
|
+
},
|
|
3041
|
+
onSuccess: (_, variables) => {
|
|
3042
|
+
queryClient.invalidateQueries({ queryKey: ["deals", organizationId] });
|
|
3043
|
+
queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
|
|
3044
|
+
},
|
|
3045
|
+
onError: (error) => {
|
|
3046
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
3047
|
+
showApiErrorNotification(error);
|
|
3048
|
+
}
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
var dealNoteKeys = {
|
|
3052
|
+
all: ["deal-notes"],
|
|
3053
|
+
list: (organizationId, dealId) => ["deal-notes", organizationId, dealId]
|
|
3054
|
+
};
|
|
3055
|
+
function useDealNotes(dealId) {
|
|
3056
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2917
3057
|
return useQuery({
|
|
2918
|
-
queryKey:
|
|
3058
|
+
queryKey: dealNoteKeys.list(organizationId, dealId),
|
|
2919
3059
|
queryFn: async () => {
|
|
2920
|
-
|
|
2921
|
-
`/calibration/projects?resourceId=${resourceId}&resourceType=${resourceType}`
|
|
2922
|
-
);
|
|
2923
|
-
return response.projects;
|
|
3060
|
+
return apiRequest(`/deals/${dealId}/notes`);
|
|
2924
3061
|
},
|
|
2925
|
-
enabled: isReady && !!
|
|
3062
|
+
enabled: isReady && !!dealId
|
|
2926
3063
|
});
|
|
2927
3064
|
}
|
|
2928
|
-
function
|
|
2929
|
-
const { apiRequest, organizationId
|
|
3065
|
+
function useCreateDealNote() {
|
|
3066
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3067
|
+
const queryClient = useQueryClient();
|
|
3068
|
+
return useMutation({
|
|
3069
|
+
mutationFn: async ({ dealId, body }) => {
|
|
3070
|
+
return apiRequest(`/deals/${dealId}/notes`, {
|
|
3071
|
+
method: "POST",
|
|
3072
|
+
body: JSON.stringify({ body })
|
|
3073
|
+
});
|
|
3074
|
+
},
|
|
3075
|
+
onSuccess: (_, variables) => {
|
|
3076
|
+
queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
|
|
3077
|
+
queryClient.invalidateQueries({ queryKey: ["recent-crm-activity", organizationId] });
|
|
3078
|
+
showSuccessNotification("Note added");
|
|
3079
|
+
},
|
|
3080
|
+
onError: (error) => {
|
|
3081
|
+
showApiErrorNotification(error);
|
|
3082
|
+
}
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
var dealTaskKeys = {
|
|
3086
|
+
all: ["deal-tasks"],
|
|
3087
|
+
list: (orgId, dealId) => ["deal-tasks", orgId, dealId],
|
|
3088
|
+
due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
|
|
3089
|
+
};
|
|
3090
|
+
function useDealTasks(dealId) {
|
|
3091
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2930
3092
|
return useQuery({
|
|
2931
|
-
queryKey:
|
|
3093
|
+
queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
|
|
2932
3094
|
queryFn: async () => {
|
|
2933
|
-
|
|
2934
|
-
return response.project;
|
|
3095
|
+
return apiRequest(`/deals/${dealId}/tasks`);
|
|
2935
3096
|
},
|
|
2936
|
-
enabled: isReady && !!
|
|
3097
|
+
enabled: isReady && !!dealId
|
|
2937
3098
|
});
|
|
2938
3099
|
}
|
|
2939
|
-
function
|
|
3100
|
+
function useDealTasksDue(opts) {
|
|
3101
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3102
|
+
const window = opts?.window ?? "today_and_overdue";
|
|
3103
|
+
const assigneeUserId = opts?.assigneeUserId ?? null;
|
|
3104
|
+
return useQuery({
|
|
3105
|
+
queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
|
|
3106
|
+
queryFn: async () => {
|
|
3107
|
+
const params = new URLSearchParams({ window });
|
|
3108
|
+
if (assigneeUserId) params.set("assigneeUserId", assigneeUserId);
|
|
3109
|
+
return apiRequest(`/deals/tasks/due?${params.toString()}`);
|
|
3110
|
+
},
|
|
3111
|
+
enabled: isReady
|
|
3112
|
+
});
|
|
3113
|
+
}
|
|
3114
|
+
function useCreateDealTask() {
|
|
2940
3115
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
2941
3116
|
const queryClient = useQueryClient();
|
|
2942
3117
|
return useMutation({
|
|
2943
|
-
mutationFn: async (
|
|
2944
|
-
const
|
|
3118
|
+
mutationFn: async (params) => {
|
|
3119
|
+
const { dealId, ...body } = params;
|
|
3120
|
+
return apiRequest(`/deals/${dealId}/tasks`, {
|
|
2945
3121
|
method: "POST",
|
|
2946
|
-
body: JSON.stringify(
|
|
3122
|
+
body: JSON.stringify({
|
|
3123
|
+
title: body.title,
|
|
3124
|
+
description: body.description ?? null,
|
|
3125
|
+
kind: body.kind ?? "other",
|
|
3126
|
+
dueAt: body.dueAt ?? null,
|
|
3127
|
+
assigneeUserId: body.assigneeUserId ?? null
|
|
3128
|
+
})
|
|
2947
3129
|
});
|
|
2948
|
-
return response.project;
|
|
2949
3130
|
},
|
|
2950
|
-
onSuccess: (
|
|
2951
|
-
queryClient.invalidateQueries({
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
queryClient.invalidateQueries({
|
|
2955
|
-
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2956
|
-
});
|
|
3131
|
+
onSuccess: (_, variables) => {
|
|
3132
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
3133
|
+
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
3134
|
+
showSuccessNotification("Task created");
|
|
2957
3135
|
},
|
|
2958
3136
|
onError: (error) => {
|
|
2959
3137
|
showApiErrorNotification(error);
|
|
2960
3138
|
}
|
|
2961
3139
|
});
|
|
2962
3140
|
}
|
|
2963
|
-
function
|
|
3141
|
+
function useCompleteDealTask() {
|
|
2964
3142
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
2965
3143
|
const queryClient = useQueryClient();
|
|
2966
3144
|
return useMutation({
|
|
2967
|
-
mutationFn: async ({
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
}) => {
|
|
2971
|
-
const response = await apiRequest(`/calibration/projects/${id}`, {
|
|
2972
|
-
method: "PATCH",
|
|
2973
|
-
body: JSON.stringify(input)
|
|
3145
|
+
mutationFn: async ({ taskId, dealId }) => {
|
|
3146
|
+
return apiRequest(`/deals/${dealId}/tasks/${taskId}/complete`, {
|
|
3147
|
+
method: "PATCH"
|
|
2974
3148
|
});
|
|
2975
|
-
return response.project;
|
|
2976
3149
|
},
|
|
2977
|
-
onSuccess: (
|
|
2978
|
-
queryClient.invalidateQueries({
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
queryClient.invalidateQueries({
|
|
2982
|
-
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2983
|
-
});
|
|
2984
|
-
queryClient.invalidateQueries({
|
|
2985
|
-
queryKey: calibrationKeys.project(organizationId ?? "none", data.id)
|
|
2986
|
-
});
|
|
3150
|
+
onSuccess: (_, variables) => {
|
|
3151
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
3152
|
+
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
3153
|
+
showSuccessNotification("Task completed");
|
|
2987
3154
|
},
|
|
2988
3155
|
onError: (error) => {
|
|
2989
3156
|
showApiErrorNotification(error);
|
|
2990
3157
|
}
|
|
2991
3158
|
});
|
|
2992
3159
|
}
|
|
2993
|
-
function
|
|
2994
|
-
const { apiRequest } = useElevasisServices();
|
|
3160
|
+
function useBatchTelemetry() {
|
|
3161
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3162
|
+
return useQuery({
|
|
3163
|
+
queryKey: ["acq-batch-telemetry", organizationId],
|
|
3164
|
+
queryFn: () => apiRequest("/acquisition/batches/telemetry"),
|
|
3165
|
+
enabled: isReady
|
|
3166
|
+
});
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
// src/hooks/acquisition/useDeals.ts
|
|
3170
|
+
var dealKeys = {
|
|
3171
|
+
all: ["deals"],
|
|
3172
|
+
lists: () => [...dealKeys.all, "list"],
|
|
3173
|
+
list: (orgId, filters) => [...dealKeys.all, "list", orgId, filters],
|
|
3174
|
+
details: () => [...dealKeys.all, "detail"],
|
|
3175
|
+
detail: (id) => [...dealKeys.all, "detail", id]
|
|
3176
|
+
};
|
|
3177
|
+
function useDeals(filters = {}) {
|
|
3178
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3179
|
+
return useQuery({
|
|
3180
|
+
queryKey: dealKeys.list(organizationId, filters),
|
|
3181
|
+
queryFn: async () => {
|
|
3182
|
+
const params = new URLSearchParams();
|
|
3183
|
+
if (filters.stage) params.set("stage", filters.stage);
|
|
3184
|
+
if (filters.search) params.set("search", filters.search);
|
|
3185
|
+
const qs = params.toString();
|
|
3186
|
+
const data = await apiRequest(`/deals${qs ? `?${qs}` : ""}`);
|
|
3187
|
+
return data;
|
|
3188
|
+
},
|
|
3189
|
+
enabled: isReady
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
function useDeleteDeal() {
|
|
3193
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
2995
3194
|
const queryClient = useQueryClient();
|
|
2996
3195
|
return useMutation({
|
|
2997
|
-
mutationFn: async (
|
|
2998
|
-
await apiRequest(`/
|
|
2999
|
-
method: "DELETE"
|
|
3000
|
-
});
|
|
3196
|
+
mutationFn: async (dealId) => {
|
|
3197
|
+
await apiRequest(`/deals/${dealId}`, { method: "DELETE" });
|
|
3001
3198
|
},
|
|
3002
3199
|
onSuccess: () => {
|
|
3003
|
-
queryClient.invalidateQueries({
|
|
3004
|
-
queryKey: calibrationKeys.all
|
|
3005
|
-
});
|
|
3200
|
+
queryClient.invalidateQueries({ queryKey: ["deals", organizationId] });
|
|
3006
3201
|
},
|
|
3007
3202
|
onError: (error) => {
|
|
3008
3203
|
showApiErrorNotification(error);
|
|
@@ -3010,4 +3205,4 @@ function useDeleteProject() {
|
|
|
3010
3205
|
});
|
|
3011
3206
|
}
|
|
3012
3207
|
|
|
3013
|
-
export { CredentialNameSchema, OperationsService, UuidSchema, calibrationKeys, createUseFeatureAccess, executionsKeys, isSessionCapable, operationsKeys, scheduleKeys, sessionsKeys, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, sortData, useActivities, useActivityTrend, useAllCalibrationProjects, useArchiveSession, useArchivedLogs, useBatchDelete, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCalibrationProject, useCalibrationProjects, useCalibrationRun, useCalibrationRunFull, useCalibrationRuns, useCalibrationSSE, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateProject, useCreateRun, useCreateSchedule, useCreateSession, useDashboardMetrics, useDeleteExecution, useDeleteProject, useDeleteRun, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeploymentDocs, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecuteRun, useExecuteWorkflow, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGradeRun, useGraphStats, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useRecentExecutionsByResource, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResources, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTestNotification, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateProject, useUpdateSchedule, useWarningNotification };
|
|
3208
|
+
export { CredentialNameSchema, OperationsService, UuidSchema, calibrationKeys, createUseFeatureAccess, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, isSessionCapable, operationsKeys, scheduleKeys, sessionsKeys, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, sortData, useActivities, useActivityTrend, useAllCalibrationProjects, useArchiveSession, useArchivedLogs, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCalibrationProject, useCalibrationProjects, useCalibrationRun, useCalibrationRunFull, useCalibrationRuns, useCalibrationSSE, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompleteDealTask, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateDealNote, useCreateDealTask, useCreateProject, useCreateRun, useCreateSchedule, useCreateSession, useDashboardMetrics, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDeleteDeal, useDeleteExecution, useDeleteProject, useDeleteRun, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeploymentDocs, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecuteRun, useExecuteWorkflow, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGradeRun, useGraphStats, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useRecentExecutionsByResource, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResources, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useSubmitAction, useSuccessNotification, useSyncDealStage, useTableSelection, useTableSort, useTestNotification, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateProject, useUpdateSchedule, useWarningNotification };
|
|
@@ -8365,26 +8365,26 @@ declare function useCrmQuickMetrics(): {
|
|
|
8365
8365
|
error: unknown;
|
|
8366
8366
|
};
|
|
8367
8367
|
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
stage?: DealStage | null;
|
|
8378
|
-
}
|
|
8368
|
+
// ---------------------------------------------------------------------------
|
|
8369
|
+
// Response schemas (no .strict() — forward-compatible)
|
|
8370
|
+
// ---------------------------------------------------------------------------
|
|
8371
|
+
|
|
8372
|
+
declare const GetRecentActivityResponseSchema = z.object({
|
|
8373
|
+
entries: z.array(RecentActivityEntrySchema)
|
|
8374
|
+
})
|
|
8375
|
+
type GetRecentActivityResponse = z.infer<typeof GetRecentActivityResponseSchema>
|
|
8376
|
+
|
|
8379
8377
|
/**
|
|
8380
|
-
*
|
|
8381
|
-
*
|
|
8382
|
-
*
|
|
8378
|
+
* Returns the most recent CRM activity entries (notes + stage changes + deal
|
|
8379
|
+
* creations) for the current organization, aggregated server-side.
|
|
8380
|
+
*
|
|
8381
|
+
* Replaces the previous client-side aggregation that joined acq_deal_notes
|
|
8382
|
+
* with useDeals(). Server now owns the join via GET /api/crm/recent-activity.
|
|
8383
8383
|
*/
|
|
8384
8384
|
declare function useRecentCrmActivity(opts?: {
|
|
8385
8385
|
limit?: number;
|
|
8386
8386
|
}): {
|
|
8387
|
-
data:
|
|
8387
|
+
data: GetRecentActivityResponse['entries'];
|
|
8388
8388
|
isLoading: boolean;
|
|
8389
8389
|
error: unknown;
|
|
8390
8390
|
};
|