@elevasis/ui 1.24.3 → 1.25.1
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-H3MU3WTM.js → chunk-7JJCGPYD.js} +2 -2
- package/dist/{chunk-TQBM3OEW.js → chunk-BS4J2LAW.js} +1 -1
- package/dist/{chunk-JR2C4XAN.js → chunk-CYXZHBP4.js} +202 -295
- package/dist/{chunk-ZDKC3V7C.js → chunk-EFPFPCP2.js} +57 -58
- package/dist/{chunk-OH74INP2.js → chunk-FEZZ3IDU.js} +434 -314
- package/dist/{chunk-JTUX5FDC.js → chunk-FURGQSSG.js} +374 -2
- package/dist/{chunk-IAZT3VO6.js → chunk-G25YWGUL.js} +4 -1
- package/dist/{chunk-QDO6NF2I.js → chunk-GQCQDCLJ.js} +380 -63
- package/dist/{chunk-CTF6FS2M.js → chunk-L3GVDMCA.js} +211 -1
- package/dist/{chunk-BGTZFEKR.js → chunk-LHNPRLSA.js} +6 -252
- package/dist/{chunk-VMMNFRAO.js → chunk-QNABH7YG.js} +3 -3
- package/dist/{chunk-WY5IJI37.js → chunk-QUL3XRLS.js} +3 -3
- package/dist/{chunk-TML32XBW.js → chunk-RMPXGBNI.js} +2 -2
- package/dist/{chunk-UG5565XQ.js → chunk-US4JUSI3.js} +3 -3
- package/dist/components/index.d.ts +3005 -192
- package/dist/components/index.js +1541 -26
- package/dist/features/auth/index.d.ts +108 -9
- package/dist/features/dashboard/index.js +8 -8
- package/dist/features/monitoring/index.js +9 -9
- package/dist/features/operations/index.d.ts +8 -2
- package/dist/features/operations/index.js +53 -56
- package/dist/features/settings/index.d.ts +108 -9
- package/dist/features/settings/index.js +28 -11
- package/dist/hooks/index.d.ts +3279 -185
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/published.d.ts +345 -11
- package/dist/hooks/published.js +4 -4
- package/dist/index.d.ts +3285 -187
- package/dist/index.js +6 -6
- package/dist/initialization/index.d.ts +108 -9
- package/dist/layout/index.d.ts +60 -3
- package/dist/layout/index.js +2 -2
- package/dist/profile/index.d.ts +108 -9
- package/dist/provider/index.d.ts +6 -2
- package/dist/provider/index.js +3 -3
- package/dist/provider/published.d.ts +6 -2
- package/dist/supabase/index.d.ts +210 -18
- package/dist/theme/index.d.ts +6 -2
- package/dist/theme/index.js +3 -3
- package/dist/types/index.d.ts +143 -10
- package/package.json +1 -1
|
@@ -2670,6 +2670,114 @@ var calibrationKeys = {
|
|
|
2670
2670
|
run: (org, runId) => [...calibrationKeys.all, "run", org, runId],
|
|
2671
2671
|
runFull: (org, runId) => [...calibrationKeys.all, "run-full", org, runId]
|
|
2672
2672
|
};
|
|
2673
|
+
function useAllCalibrationProjects() {
|
|
2674
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2675
|
+
return useQuery({
|
|
2676
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none"),
|
|
2677
|
+
queryFn: async () => {
|
|
2678
|
+
const response = await apiRequest("/calibration/projects");
|
|
2679
|
+
return response.projects;
|
|
2680
|
+
},
|
|
2681
|
+
enabled: isReady && !!organizationId
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
function useCalibrationProjects(resourceId, resourceType) {
|
|
2685
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2686
|
+
return useQuery({
|
|
2687
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", resourceId, resourceType),
|
|
2688
|
+
queryFn: async () => {
|
|
2689
|
+
const response = await apiRequest(
|
|
2690
|
+
`/calibration/projects?resourceId=${resourceId}&resourceType=${resourceType}`
|
|
2691
|
+
);
|
|
2692
|
+
return response.projects;
|
|
2693
|
+
},
|
|
2694
|
+
enabled: isReady && !!resourceId && !!resourceType && !!organizationId
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
function useCalibrationProject(projectId) {
|
|
2698
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2699
|
+
return useQuery({
|
|
2700
|
+
queryKey: calibrationKeys.project(organizationId ?? "none", projectId),
|
|
2701
|
+
queryFn: async () => {
|
|
2702
|
+
const response = await apiRequest(`/calibration/projects/${projectId}`);
|
|
2703
|
+
return response.project;
|
|
2704
|
+
},
|
|
2705
|
+
enabled: isReady && !!projectId && !!organizationId
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
function useCreateProject() {
|
|
2709
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
2710
|
+
const queryClient = useQueryClient();
|
|
2711
|
+
return useMutation({
|
|
2712
|
+
mutationFn: async (input) => {
|
|
2713
|
+
const response = await apiRequest("/calibration/projects", {
|
|
2714
|
+
method: "POST",
|
|
2715
|
+
body: JSON.stringify(input)
|
|
2716
|
+
});
|
|
2717
|
+
return response.project;
|
|
2718
|
+
},
|
|
2719
|
+
onSuccess: (data) => {
|
|
2720
|
+
queryClient.invalidateQueries({
|
|
2721
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2722
|
+
});
|
|
2723
|
+
queryClient.invalidateQueries({
|
|
2724
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2725
|
+
});
|
|
2726
|
+
},
|
|
2727
|
+
onError: (error) => {
|
|
2728
|
+
showApiErrorNotification(error);
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
function useUpdateProject() {
|
|
2733
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
2734
|
+
const queryClient = useQueryClient();
|
|
2735
|
+
return useMutation({
|
|
2736
|
+
mutationFn: async ({
|
|
2737
|
+
id,
|
|
2738
|
+
...input
|
|
2739
|
+
}) => {
|
|
2740
|
+
const response = await apiRequest(`/calibration/projects/${id}`, {
|
|
2741
|
+
method: "PATCH",
|
|
2742
|
+
body: JSON.stringify(input)
|
|
2743
|
+
});
|
|
2744
|
+
return response.project;
|
|
2745
|
+
},
|
|
2746
|
+
onSuccess: (data) => {
|
|
2747
|
+
queryClient.invalidateQueries({
|
|
2748
|
+
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2749
|
+
});
|
|
2750
|
+
queryClient.invalidateQueries({
|
|
2751
|
+
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2752
|
+
});
|
|
2753
|
+
queryClient.invalidateQueries({
|
|
2754
|
+
queryKey: calibrationKeys.project(organizationId ?? "none", data.id)
|
|
2755
|
+
});
|
|
2756
|
+
},
|
|
2757
|
+
onError: (error) => {
|
|
2758
|
+
showApiErrorNotification(error);
|
|
2759
|
+
}
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
function useDeleteProject() {
|
|
2763
|
+
const { apiRequest } = useElevasisServices();
|
|
2764
|
+
const queryClient = useQueryClient();
|
|
2765
|
+
return useMutation({
|
|
2766
|
+
mutationFn: async (id) => {
|
|
2767
|
+
await apiRequest(`/calibration/projects/${id}`, {
|
|
2768
|
+
method: "DELETE"
|
|
2769
|
+
});
|
|
2770
|
+
},
|
|
2771
|
+
onSuccess: () => {
|
|
2772
|
+
queryClient.invalidateQueries({
|
|
2773
|
+
queryKey: calibrationKeys.all
|
|
2774
|
+
});
|
|
2775
|
+
},
|
|
2776
|
+
onError: (error) => {
|
|
2777
|
+
showApiErrorNotification(error);
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2673
2781
|
function useCalibrationRuns(projectId) {
|
|
2674
2782
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
2675
2783
|
return useQuery({
|
|
@@ -2899,110 +3007,319 @@ function useCalibrationSSE({ runId, manager, apiUrl, enabled = true }) {
|
|
|
2899
3007
|
reset
|
|
2900
3008
|
};
|
|
2901
3009
|
}
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
const
|
|
3010
|
+
function useDealDetail(acqDealId) {
|
|
3011
|
+
const supabase = useSupabase();
|
|
3012
|
+
const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
3013
|
+
const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
|
|
2906
3014
|
return useQuery({
|
|
2907
|
-
queryKey:
|
|
3015
|
+
queryKey: [...dealKeys.detail(acqDealId), organizationId],
|
|
2908
3016
|
queryFn: async () => {
|
|
2909
|
-
|
|
2910
|
-
|
|
3017
|
+
if (!organizationId || !acqDealId) return null;
|
|
3018
|
+
const { data, error } = await supabase.from("acq_deals").select(
|
|
3019
|
+
`
|
|
3020
|
+
*,
|
|
3021
|
+
contact:acq_contacts(
|
|
3022
|
+
id,
|
|
3023
|
+
first_name,
|
|
3024
|
+
last_name,
|
|
3025
|
+
email,
|
|
3026
|
+
title,
|
|
3027
|
+
headline,
|
|
3028
|
+
linkedin_url,
|
|
3029
|
+
pipeline_status,
|
|
3030
|
+
enrichment_data,
|
|
3031
|
+
company:acq_companies(
|
|
3032
|
+
id,
|
|
3033
|
+
name,
|
|
3034
|
+
domain,
|
|
3035
|
+
website,
|
|
3036
|
+
linkedin_url,
|
|
3037
|
+
segment,
|
|
3038
|
+
category,
|
|
3039
|
+
num_employees
|
|
3040
|
+
)
|
|
3041
|
+
)
|
|
3042
|
+
`
|
|
3043
|
+
).eq("id", acqDealId).eq("organization_id", organizationId).single();
|
|
3044
|
+
if (error) {
|
|
3045
|
+
if (error.code === "PGRST116") return null;
|
|
3046
|
+
throw error;
|
|
3047
|
+
}
|
|
3048
|
+
return data;
|
|
2911
3049
|
},
|
|
2912
|
-
enabled: isReady && !!
|
|
3050
|
+
enabled: isReady && !!acqDealId
|
|
2913
3051
|
});
|
|
2914
3052
|
}
|
|
2915
|
-
function
|
|
2916
|
-
const
|
|
3053
|
+
function useSyncDealStage() {
|
|
3054
|
+
const supabase = useSupabase();
|
|
3055
|
+
const queryClient = useQueryClient();
|
|
3056
|
+
const { currentSupabaseOrganizationId: organizationId } = useOrganization();
|
|
3057
|
+
return useMutation({
|
|
3058
|
+
mutationFn: async ({ dealId, stage }) => {
|
|
3059
|
+
if (!organizationId) throw new Error("No organization context");
|
|
3060
|
+
const { error } = await supabase.from("acq_deals").update({ cached_stage: stage }).eq("id", dealId).eq("organization_id", organizationId);
|
|
3061
|
+
if (error) throw error;
|
|
3062
|
+
},
|
|
3063
|
+
onError: (error) => {
|
|
3064
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
3065
|
+
showApiErrorNotification(error);
|
|
3066
|
+
}
|
|
3067
|
+
});
|
|
3068
|
+
}
|
|
3069
|
+
var dealNoteKeys = {
|
|
3070
|
+
all: ["dealNotes"],
|
|
3071
|
+
list: (organizationId, dealId) => ["dealNotes", organizationId, dealId]
|
|
3072
|
+
};
|
|
3073
|
+
function useDealNotes(dealId) {
|
|
3074
|
+
const supabase = useSupabase();
|
|
3075
|
+
const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
3076
|
+
const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
|
|
2917
3077
|
return useQuery({
|
|
2918
|
-
queryKey:
|
|
3078
|
+
queryKey: dealNoteKeys.list(organizationId, dealId),
|
|
2919
3079
|
queryFn: async () => {
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
);
|
|
2923
|
-
return
|
|
3080
|
+
if (!organizationId || !dealId) return [];
|
|
3081
|
+
const { data, error } = await supabase.from("acq_deal_notes").select("*").eq("deal_id", dealId).eq("organization_id", organizationId).order("created_at", { ascending: false });
|
|
3082
|
+
if (error) throw error;
|
|
3083
|
+
return (data || []).map((row) => ({
|
|
3084
|
+
id: row.id,
|
|
3085
|
+
dealId: row.deal_id,
|
|
3086
|
+
organizationId: row.organization_id,
|
|
3087
|
+
authorUserId: row.author_user_id,
|
|
3088
|
+
body: row.body,
|
|
3089
|
+
createdAt: row.created_at,
|
|
3090
|
+
updatedAt: row.updated_at
|
|
3091
|
+
}));
|
|
2924
3092
|
},
|
|
2925
|
-
enabled: isReady && !!
|
|
3093
|
+
enabled: isReady && !!dealId
|
|
2926
3094
|
});
|
|
2927
3095
|
}
|
|
2928
|
-
function
|
|
2929
|
-
const
|
|
3096
|
+
function useCreateDealNote() {
|
|
3097
|
+
const supabase = useSupabase();
|
|
3098
|
+
const queryClient = useQueryClient();
|
|
3099
|
+
const { currentSupabaseOrganizationId: organizationId } = useOrganization();
|
|
3100
|
+
return useMutation({
|
|
3101
|
+
mutationFn: async ({ dealId, body, authorUserId }) => {
|
|
3102
|
+
if (!organizationId) throw new Error("No organization context");
|
|
3103
|
+
const { data, error } = await supabase.from("acq_deal_notes").insert({
|
|
3104
|
+
deal_id: dealId,
|
|
3105
|
+
organization_id: organizationId,
|
|
3106
|
+
body,
|
|
3107
|
+
author_user_id: authorUserId ?? null
|
|
3108
|
+
}).select().single();
|
|
3109
|
+
if (error) throw error;
|
|
3110
|
+
return {
|
|
3111
|
+
id: data.id,
|
|
3112
|
+
dealId: data.deal_id,
|
|
3113
|
+
organizationId: data.organization_id,
|
|
3114
|
+
authorUserId: data.author_user_id,
|
|
3115
|
+
body: data.body,
|
|
3116
|
+
createdAt: data.created_at,
|
|
3117
|
+
updatedAt: data.updated_at
|
|
3118
|
+
};
|
|
3119
|
+
},
|
|
3120
|
+
onSuccess: (_, variables) => {
|
|
3121
|
+
queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
|
|
3122
|
+
showSuccessNotification("Note added");
|
|
3123
|
+
},
|
|
3124
|
+
onError: (error) => {
|
|
3125
|
+
showApiErrorNotification(error);
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
var dealTaskKeys = {
|
|
3130
|
+
all: ["deal-tasks"],
|
|
3131
|
+
list: (orgId, dealId) => ["deal-tasks", orgId, dealId],
|
|
3132
|
+
due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
|
|
3133
|
+
};
|
|
3134
|
+
function transformTaskRow(row) {
|
|
3135
|
+
return {
|
|
3136
|
+
id: row.id,
|
|
3137
|
+
organizationId: row.organization_id,
|
|
3138
|
+
dealId: row.deal_id,
|
|
3139
|
+
title: row.title,
|
|
3140
|
+
description: row.description,
|
|
3141
|
+
kind: row.kind,
|
|
3142
|
+
dueAt: row.due_at,
|
|
3143
|
+
assigneeUserId: row.assignee_user_id,
|
|
3144
|
+
completedAt: row.completed_at,
|
|
3145
|
+
completedByUserId: row.completed_by_user_id,
|
|
3146
|
+
createdAt: row.created_at,
|
|
3147
|
+
updatedAt: row.updated_at,
|
|
3148
|
+
createdByUserId: row.created_by_user_id
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
function useDealTasks(dealId) {
|
|
3152
|
+
const supabase = useSupabase();
|
|
3153
|
+
const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
3154
|
+
const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
|
|
2930
3155
|
return useQuery({
|
|
2931
|
-
queryKey:
|
|
3156
|
+
queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
|
|
2932
3157
|
queryFn: async () => {
|
|
2933
|
-
|
|
2934
|
-
|
|
3158
|
+
if (!organizationId || !dealId) return [];
|
|
3159
|
+
const { data, error } = await supabase.from("acq_deal_tasks").select("*").eq("deal_id", dealId).eq("organization_id", organizationId).order("due_at", { ascending: true, nullsFirst: false });
|
|
3160
|
+
if (error) throw error;
|
|
3161
|
+
return (data || []).map(transformTaskRow);
|
|
2935
3162
|
},
|
|
2936
|
-
enabled: isReady && !!
|
|
3163
|
+
enabled: isReady && !!dealId
|
|
2937
3164
|
});
|
|
2938
3165
|
}
|
|
2939
|
-
function
|
|
2940
|
-
const
|
|
3166
|
+
function useDealTasksDue(opts) {
|
|
3167
|
+
const supabase = useSupabase();
|
|
3168
|
+
const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
3169
|
+
const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
|
|
3170
|
+
const window = opts?.window ?? "today_and_overdue";
|
|
3171
|
+
const assigneeUserId = opts?.assigneeUserId ?? null;
|
|
3172
|
+
return useQuery({
|
|
3173
|
+
queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
|
|
3174
|
+
queryFn: async () => {
|
|
3175
|
+
if (!organizationId) return [];
|
|
3176
|
+
const now = /* @__PURE__ */ new Date();
|
|
3177
|
+
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).toISOString();
|
|
3178
|
+
const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).toISOString();
|
|
3179
|
+
let query = supabase.from("acq_deal_tasks").select("*").eq("organization_id", organizationId).is("completed_at", null);
|
|
3180
|
+
if (window === "overdue") {
|
|
3181
|
+
query = query.lt("due_at", todayStart);
|
|
3182
|
+
} else if (window === "today") {
|
|
3183
|
+
query = query.gte("due_at", todayStart).lt("due_at", todayEnd);
|
|
3184
|
+
} else if (window === "today_and_overdue") {
|
|
3185
|
+
query = query.lt("due_at", todayEnd);
|
|
3186
|
+
} else if (window === "upcoming") {
|
|
3187
|
+
query = query.gte("due_at", todayEnd);
|
|
3188
|
+
}
|
|
3189
|
+
if (assigneeUserId !== null) {
|
|
3190
|
+
query = query.eq("assignee_user_id", assigneeUserId);
|
|
3191
|
+
}
|
|
3192
|
+
query = query.order("due_at", { ascending: true, nullsFirst: false });
|
|
3193
|
+
const { data, error } = await query;
|
|
3194
|
+
if (error) throw error;
|
|
3195
|
+
return (data || []).map(transformTaskRow);
|
|
3196
|
+
},
|
|
3197
|
+
enabled: isReady
|
|
3198
|
+
});
|
|
3199
|
+
}
|
|
3200
|
+
function useCreateDealTask() {
|
|
3201
|
+
const supabase = useSupabase();
|
|
3202
|
+
const { currentSupabaseOrganizationId: organizationId } = useOrganization();
|
|
2941
3203
|
const queryClient = useQueryClient();
|
|
2942
3204
|
return useMutation({
|
|
2943
|
-
mutationFn: async (
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
3205
|
+
mutationFn: async (params) => {
|
|
3206
|
+
if (!organizationId) throw new Error("No organization context");
|
|
3207
|
+
const { data, error } = await supabase.from("acq_deal_tasks").insert({
|
|
3208
|
+
deal_id: params.dealId,
|
|
3209
|
+
organization_id: organizationId,
|
|
3210
|
+
title: params.title,
|
|
3211
|
+
description: params.description ?? null,
|
|
3212
|
+
kind: params.kind ?? "other",
|
|
3213
|
+
due_at: params.dueAt ?? null,
|
|
3214
|
+
assignee_user_id: params.assigneeUserId ?? null,
|
|
3215
|
+
created_by_user_id: params.createdByUserId ?? null
|
|
3216
|
+
}).select().single();
|
|
3217
|
+
if (error) throw error;
|
|
3218
|
+
return transformTaskRow(data);
|
|
2949
3219
|
},
|
|
2950
|
-
onSuccess: (
|
|
2951
|
-
queryClient.invalidateQueries({
|
|
2952
|
-
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2953
|
-
});
|
|
3220
|
+
onSuccess: (_, variables) => {
|
|
3221
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2954
3222
|
queryClient.invalidateQueries({
|
|
2955
|
-
|
|
3223
|
+
predicate: (query) => query.queryKey[0] === "deal-tasks-due"
|
|
2956
3224
|
});
|
|
3225
|
+
showSuccessNotification("Task created");
|
|
2957
3226
|
},
|
|
2958
3227
|
onError: (error) => {
|
|
2959
3228
|
showApiErrorNotification(error);
|
|
2960
3229
|
}
|
|
2961
3230
|
});
|
|
2962
3231
|
}
|
|
2963
|
-
function
|
|
2964
|
-
const
|
|
3232
|
+
function useCompleteDealTask() {
|
|
3233
|
+
const supabase = useSupabase();
|
|
3234
|
+
const { currentSupabaseOrganizationId: organizationId } = useOrganization();
|
|
2965
3235
|
const queryClient = useQueryClient();
|
|
2966
3236
|
return useMutation({
|
|
2967
|
-
mutationFn: async ({
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
return response.project;
|
|
3237
|
+
mutationFn: async ({ taskId, completedByUserId }) => {
|
|
3238
|
+
if (!organizationId) throw new Error("No organization context");
|
|
3239
|
+
const { data, error } = await supabase.from("acq_deal_tasks").update({
|
|
3240
|
+
completed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3241
|
+
completed_by_user_id: completedByUserId ?? null
|
|
3242
|
+
}).eq("id", taskId).eq("organization_id", organizationId).select().single();
|
|
3243
|
+
if (error) throw error;
|
|
3244
|
+
return transformTaskRow(data);
|
|
2976
3245
|
},
|
|
2977
|
-
onSuccess: (
|
|
2978
|
-
queryClient.invalidateQueries({
|
|
2979
|
-
queryKey: calibrationKeys.projects(organizationId ?? "none")
|
|
2980
|
-
});
|
|
2981
|
-
queryClient.invalidateQueries({
|
|
2982
|
-
queryKey: calibrationKeys.projectsByResource(organizationId ?? "none", data.resourceId, data.resourceType)
|
|
2983
|
-
});
|
|
3246
|
+
onSuccess: (_, variables) => {
|
|
3247
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2984
3248
|
queryClient.invalidateQueries({
|
|
2985
|
-
|
|
3249
|
+
predicate: (query) => query.queryKey[0] === "deal-tasks-due"
|
|
2986
3250
|
});
|
|
3251
|
+
showSuccessNotification("Task completed");
|
|
2987
3252
|
},
|
|
2988
3253
|
onError: (error) => {
|
|
2989
3254
|
showApiErrorNotification(error);
|
|
2990
3255
|
}
|
|
2991
3256
|
});
|
|
2992
3257
|
}
|
|
2993
|
-
function
|
|
3258
|
+
function useBatchTelemetry() {
|
|
3259
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3260
|
+
return useQuery({
|
|
3261
|
+
queryKey: ["acq-batch-telemetry", organizationId],
|
|
3262
|
+
queryFn: () => apiRequest("/acquisition/batches/telemetry"),
|
|
3263
|
+
enabled: isReady
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
// src/hooks/acquisition/useDeals.ts
|
|
3268
|
+
var dealKeys = {
|
|
3269
|
+
all: ["acq-deals"],
|
|
3270
|
+
lists: () => [...dealKeys.all, "list"],
|
|
3271
|
+
list: (orgId, filters) => [...dealKeys.all, "list", orgId, filters],
|
|
3272
|
+
details: () => [...dealKeys.all, "detail"],
|
|
3273
|
+
detail: (id) => [...dealKeys.all, "detail", id]
|
|
3274
|
+
};
|
|
3275
|
+
function useDeals(filters = {}) {
|
|
3276
|
+
const supabase = useSupabase();
|
|
3277
|
+
const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
|
|
3278
|
+
const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
|
|
3279
|
+
return useQuery({
|
|
3280
|
+
queryKey: dealKeys.list(organizationId, filters),
|
|
3281
|
+
queryFn: async () => {
|
|
3282
|
+
if (!organizationId) return [];
|
|
3283
|
+
let query = supabase.from("acq_deals").select(
|
|
3284
|
+
`
|
|
3285
|
+
*,
|
|
3286
|
+
contact:acq_contacts(
|
|
3287
|
+
id,
|
|
3288
|
+
first_name,
|
|
3289
|
+
last_name,
|
|
3290
|
+
email,
|
|
3291
|
+
title,
|
|
3292
|
+
company:acq_companies(
|
|
3293
|
+
id,
|
|
3294
|
+
name,
|
|
3295
|
+
domain
|
|
3296
|
+
)
|
|
3297
|
+
)
|
|
3298
|
+
`
|
|
3299
|
+
).eq("organization_id", organizationId);
|
|
3300
|
+
if (filters.stage) {
|
|
3301
|
+
query = query.eq("cached_stage", filters.stage);
|
|
3302
|
+
}
|
|
3303
|
+
if (filters.search) {
|
|
3304
|
+
query = query.ilike("contact_email", `%${filters.search}%`);
|
|
3305
|
+
}
|
|
3306
|
+
query = query.order("updated_at", { ascending: false });
|
|
3307
|
+
const { data, error } = await query;
|
|
3308
|
+
if (error) throw error;
|
|
3309
|
+
return data || [];
|
|
3310
|
+
},
|
|
3311
|
+
enabled: isReady
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
function useDeleteDeal() {
|
|
2994
3315
|
const { apiRequest } = useElevasisServices();
|
|
2995
3316
|
const queryClient = useQueryClient();
|
|
2996
3317
|
return useMutation({
|
|
2997
|
-
mutationFn: async (
|
|
2998
|
-
await apiRequest(`/
|
|
2999
|
-
method: "DELETE"
|
|
3000
|
-
});
|
|
3318
|
+
mutationFn: async (dealId) => {
|
|
3319
|
+
await apiRequest(`/deals/${dealId}`, { method: "DELETE" });
|
|
3001
3320
|
},
|
|
3002
3321
|
onSuccess: () => {
|
|
3003
|
-
queryClient.invalidateQueries({
|
|
3004
|
-
queryKey: calibrationKeys.all
|
|
3005
|
-
});
|
|
3322
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
3006
3323
|
},
|
|
3007
3324
|
onError: (error) => {
|
|
3008
3325
|
showApiErrorNotification(error);
|
|
@@ -3010,4 +3327,4 @@ function useDeleteProject() {
|
|
|
3010
3327
|
});
|
|
3011
3328
|
}
|
|
3012
3329
|
|
|
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 };
|
|
3330
|
+
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 };
|