@elevasis/ui 2.10.2 → 2.11.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/app/index.js +2 -2
- package/dist/{chunk-TSX4I3NW.js → chunk-23PZ57GB.js} +1 -1
- package/dist/{chunk-6PNHW4X2.js → chunk-24UMQV5B.js} +51 -95
- package/dist/chunk-3ZMAGTWF.js +18 -0
- package/dist/{chunk-WHQXDETX.js → chunk-AQDBRRZD.js} +124 -5
- package/dist/{chunk-CLXMNMIS.js → chunk-BDENEI4Q.js} +536 -39
- package/dist/{chunk-GJVGV7QZ.js → chunk-BLQLWIOW.js} +276 -5
- package/dist/chunk-BRXELOHC.js +47 -0
- package/dist/{chunk-YQLE5HR5.js → chunk-BSCTPKXM.js} +2 -2
- package/dist/{chunk-LPSBID5V.js → chunk-DJBORKTR.js} +1 -1
- package/dist/{chunk-E3IFHX6A.js → chunk-DOFVHWAP.js} +483 -321
- package/dist/{chunk-XA34RETF.js → chunk-GHIPBT5V.js} +1 -14
- package/dist/{chunk-KYOF6NYW.js → chunk-KDAOCM66.js} +1 -1
- package/dist/{chunk-CYT4PORT.js → chunk-L34DFR2K.js} +7 -51
- package/dist/{chunk-AT5XCBTU.js → chunk-TNOIOBYI.js} +2 -2
- package/dist/{chunk-M6ZZ2FW5.js → chunk-XYSMBMAR.js} +3 -3
- package/dist/components/index.d.ts +69 -3
- package/dist/components/index.js +20 -18
- package/dist/execution/index.js +2 -1
- package/dist/features/crm/index.d.ts +7 -2
- package/dist/features/crm/index.js +6 -4
- package/dist/features/dashboard/index.js +7 -5
- package/dist/features/delivery/index.d.ts +14 -1
- package/dist/features/delivery/index.js +6 -4
- package/dist/features/lead-gen/index.js +10 -8
- package/dist/features/monitoring/index.js +8 -6
- package/dist/features/operations/index.js +9 -7
- package/dist/features/settings/index.js +7 -5
- package/dist/hooks/index.d.ts +230 -51
- package/dist/hooks/index.js +5 -3
- package/dist/hooks/published.d.ts +230 -51
- package/dist/hooks/published.js +5 -3
- package/dist/index.d.ts +191 -22
- package/dist/index.js +7 -5
- package/dist/provider/index.js +2 -2
- package/dist/supabase/index.js +2 -47
- package/dist/theme/index.js +2 -2
- package/dist/zustand/index.d.ts +0 -4
- package/dist/zustand/index.js +0 -10
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getTimeRangeDates, observabilityKeys } from './chunk-LXHZYSMQ.js';
|
|
2
|
+
import { useSupabase } from './chunk-BRXELOHC.js';
|
|
2
3
|
import { GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
|
|
3
4
|
import { useNotificationAdapter } from './chunk-R7WLWGPO.js';
|
|
4
5
|
import { HTTP_HEADERS } from './chunk-NVOCKXUQ.js';
|
|
@@ -9,7 +10,7 @@ import { useElevasisServices } from './chunk-QEPXAWE2.js';
|
|
|
9
10
|
import { useAuthContext } from './chunk-BRJ3QZ4E.js';
|
|
10
11
|
import { useQuery, useQueryClient, useMutation, useQueries } from '@tanstack/react-query';
|
|
11
12
|
import { z } from 'zod';
|
|
12
|
-
import { useState, useCallback,
|
|
13
|
+
import { useState, useCallback, useId, useRef, useEffect, useMemo } from 'react';
|
|
13
14
|
import { useNavigate, useSearch } from '@tanstack/react-router';
|
|
14
15
|
import { create } from 'zustand';
|
|
15
16
|
import { persist } from 'zustand/middleware';
|
|
@@ -393,21 +394,25 @@ function useArchivedLogs(executionId) {
|
|
|
393
394
|
}, [executionId, apiRequest, isLoading]);
|
|
394
395
|
return { logs, isLoading, error, fetch };
|
|
395
396
|
}
|
|
396
|
-
function
|
|
397
|
+
function useExecuteResource(options) {
|
|
397
398
|
const mutation = useExecuteAsync();
|
|
398
399
|
const execute = useCallback(
|
|
399
|
-
async (
|
|
400
|
-
|
|
401
|
-
if (
|
|
402
|
-
|
|
400
|
+
async (input) => {
|
|
401
|
+
let validatedInput = input;
|
|
402
|
+
if (options.schema) {
|
|
403
|
+
const parsed = options.schema.safeParse(input);
|
|
404
|
+
if (!parsed.success) {
|
|
405
|
+
throw new Error(`Invalid input for resource "${options.resourceId}": ${parsed.error.message}`);
|
|
406
|
+
}
|
|
407
|
+
validatedInput = parsed.data;
|
|
403
408
|
}
|
|
404
409
|
return mutation.mutateAsync({
|
|
405
|
-
resourceId:
|
|
406
|
-
resourceType:
|
|
407
|
-
input:
|
|
410
|
+
resourceId: options.resourceId,
|
|
411
|
+
resourceType: options.resourceType,
|
|
412
|
+
input: validatedInput
|
|
408
413
|
});
|
|
409
414
|
},
|
|
410
|
-
[mutation, options.schema]
|
|
415
|
+
[mutation, options.resourceId, options.resourceType, options.schema]
|
|
411
416
|
);
|
|
412
417
|
return {
|
|
413
418
|
execute,
|
|
@@ -420,34 +425,6 @@ function useExecuteWorkflow(options) {
|
|
|
420
425
|
reset: mutation.reset
|
|
421
426
|
};
|
|
422
427
|
}
|
|
423
|
-
function useScheduledTasks(options = {}) {
|
|
424
|
-
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
425
|
-
return useQuery({
|
|
426
|
-
queryKey: ["schedules", "dashboard", organizationId, options.status, options.targetResourceType],
|
|
427
|
-
queryFn: async () => {
|
|
428
|
-
const params = new URLSearchParams();
|
|
429
|
-
if (options.status) params.append("status", options.status);
|
|
430
|
-
if (options.targetResourceType) params.append("targetResourceType", options.targetResourceType);
|
|
431
|
-
const queryString = params.toString();
|
|
432
|
-
const response = await apiRequest(
|
|
433
|
-
`/task-scheduler/schedules${queryString ? `?${queryString}` : ""}`
|
|
434
|
-
);
|
|
435
|
-
return response.schedules;
|
|
436
|
-
},
|
|
437
|
-
enabled: isReady,
|
|
438
|
-
refetchInterval: REFETCH_INTERVAL_DASHBOARD
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// src/hooks/scheduling/queryKeys.ts
|
|
443
|
-
var scheduleKeys = {
|
|
444
|
-
all: (orgId) => ["schedules", orgId],
|
|
445
|
-
lists: (orgId) => [...scheduleKeys.all(orgId), "list"],
|
|
446
|
-
list: (orgId, filters) => [...scheduleKeys.lists(orgId), filters],
|
|
447
|
-
details: (orgId) => [...scheduleKeys.all(orgId), "detail"],
|
|
448
|
-
detail: (orgId, id) => [...scheduleKeys.details(orgId), id],
|
|
449
|
-
executions: (orgId, id) => [...scheduleKeys.detail(orgId, id), "executions"]
|
|
450
|
-
};
|
|
451
428
|
|
|
452
429
|
// ../core/src/auth/multi-tenancy/memberships/membership.ts
|
|
453
430
|
function transformMembershipToTableRow(membership) {
|
|
@@ -769,7 +746,208 @@ var CredentialSchemas = {
|
|
|
769
746
|
DecryptResponse: DecryptCredentialResponseSchema
|
|
770
747
|
};
|
|
771
748
|
|
|
772
|
-
// src/hooks/
|
|
749
|
+
// src/hooks/operations/shared/queryKeys.ts
|
|
750
|
+
var operationsKeys = {
|
|
751
|
+
all: ["operations"],
|
|
752
|
+
// Individual resource types (kept for CC-specific features)
|
|
753
|
+
workflows: (org) => [...operationsKeys.all, "workflows", org],
|
|
754
|
+
workflowDetails: (org) => [...operationsKeys.workflows(org), "details"],
|
|
755
|
+
workflow: (id, org) => [...operationsKeys.workflows(org), id],
|
|
756
|
+
agents: (org) => [...operationsKeys.all, "agents", org],
|
|
757
|
+
agentDetails: (org) => [...operationsKeys.agents(org), "details"],
|
|
758
|
+
agent: (id, org) => [...operationsKeys.agents(org), id],
|
|
759
|
+
sessions: (org, params) => [...operationsKeys.all, "sessions", org, params],
|
|
760
|
+
session: (org, sessionId) => [...operationsKeys.all, "session", org, sessionId]
|
|
761
|
+
};
|
|
762
|
+
function useSSEConnection({
|
|
763
|
+
manager,
|
|
764
|
+
connectionKey,
|
|
765
|
+
url,
|
|
766
|
+
enabled = true,
|
|
767
|
+
headers,
|
|
768
|
+
onmessage,
|
|
769
|
+
onopen,
|
|
770
|
+
onerror,
|
|
771
|
+
onclose
|
|
772
|
+
}) {
|
|
773
|
+
const [connected, setConnected] = useState(false);
|
|
774
|
+
const [error, setError] = useState(null);
|
|
775
|
+
const getAccessToken = useStableAccessToken();
|
|
776
|
+
const subscriberId = useId();
|
|
777
|
+
const onmessageRef = useRef(onmessage);
|
|
778
|
+
const onopenRef = useRef(onopen);
|
|
779
|
+
const onerrorRef = useRef(onerror);
|
|
780
|
+
const oncloseRef = useRef(onclose);
|
|
781
|
+
const headersRef = useRef(headers);
|
|
782
|
+
onmessageRef.current = onmessage;
|
|
783
|
+
onopenRef.current = onopen;
|
|
784
|
+
onerrorRef.current = onerror;
|
|
785
|
+
oncloseRef.current = onclose;
|
|
786
|
+
headersRef.current = headers;
|
|
787
|
+
useEffect(() => {
|
|
788
|
+
if (!enabled) return;
|
|
789
|
+
const unsubscribe = manager.subscribe(connectionKey, subscriberId, {
|
|
790
|
+
url,
|
|
791
|
+
getToken: getAccessToken,
|
|
792
|
+
headers: headersRef.current ?? {},
|
|
793
|
+
onopen(response) {
|
|
794
|
+
if (response.ok) {
|
|
795
|
+
setConnected(true);
|
|
796
|
+
setError(null);
|
|
797
|
+
}
|
|
798
|
+
const customError = onopenRef.current?.(response);
|
|
799
|
+
if (customError) setError(customError);
|
|
800
|
+
},
|
|
801
|
+
onmessage(event) {
|
|
802
|
+
if (!event.data || event.data.trim() === "") return;
|
|
803
|
+
onmessageRef.current(event.data);
|
|
804
|
+
},
|
|
805
|
+
onerror(err) {
|
|
806
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
807
|
+
setConnected(false);
|
|
808
|
+
setError(msg);
|
|
809
|
+
onerrorRef.current?.(err instanceof Error ? err : new Error(msg));
|
|
810
|
+
},
|
|
811
|
+
onclose() {
|
|
812
|
+
setConnected(false);
|
|
813
|
+
oncloseRef.current?.();
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
return () => {
|
|
817
|
+
unsubscribe();
|
|
818
|
+
setConnected(false);
|
|
819
|
+
setError(null);
|
|
820
|
+
};
|
|
821
|
+
}, [enabled, connectionKey, url, subscriberId, getAccessToken, manager]);
|
|
822
|
+
return { connected, error };
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// src/hooks/operations/shared/useExecutionLogSSE.ts
|
|
826
|
+
function useExecutionLogSSE(resourceId, manager, apiUrl) {
|
|
827
|
+
const queryClient = useQueryClient();
|
|
828
|
+
const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
|
|
829
|
+
const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
|
|
830
|
+
const { isReady: isOrganizationReady, organizationId } = useElevasisServices();
|
|
831
|
+
const { currentMembership } = useOrganization();
|
|
832
|
+
const currentWorkOSOrganizationId = currentMembership?.organization?.workos_org_id;
|
|
833
|
+
const sseUrl = `${apiUrl}/api/execution-engine/sse/${resourceId}`;
|
|
834
|
+
const headers = useMemo(() => {
|
|
835
|
+
const h = {};
|
|
836
|
+
if (currentWorkOSOrganizationId) h[HTTP_HEADERS.WORKOS_ORGANIZATION_ID] = currentWorkOSOrganizationId;
|
|
837
|
+
return h;
|
|
838
|
+
}, [currentWorkOSOrganizationId]);
|
|
839
|
+
const handleMessage = useCallback(
|
|
840
|
+
(data) => {
|
|
841
|
+
try {
|
|
842
|
+
const event = JSON.parse(data);
|
|
843
|
+
switch (event.type) {
|
|
844
|
+
case "connected":
|
|
845
|
+
break;
|
|
846
|
+
case "new-execution":
|
|
847
|
+
if (event.executionId) {
|
|
848
|
+
setLiveExecutions((prev) => {
|
|
849
|
+
const updated = new Set(prev);
|
|
850
|
+
updated.add(event.executionId);
|
|
851
|
+
return updated;
|
|
852
|
+
});
|
|
853
|
+
queryClient.invalidateQueries({
|
|
854
|
+
queryKey: executionsKeys.executions(organizationId, resourceId)
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
break;
|
|
858
|
+
case "execution-complete":
|
|
859
|
+
if (event.executionId) {
|
|
860
|
+
setLiveExecutions((prev) => {
|
|
861
|
+
const updated = new Set(prev);
|
|
862
|
+
updated.delete(event.executionId);
|
|
863
|
+
return updated;
|
|
864
|
+
});
|
|
865
|
+
setStreamingLogs((prev) => {
|
|
866
|
+
const updated = new Map(prev);
|
|
867
|
+
updated.delete(event.executionId);
|
|
868
|
+
return updated;
|
|
869
|
+
});
|
|
870
|
+
queryClient.invalidateQueries({
|
|
871
|
+
queryKey: executionsKeys.executions(organizationId, resourceId)
|
|
872
|
+
});
|
|
873
|
+
queryClient.invalidateQueries({
|
|
874
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
break;
|
|
878
|
+
case "log":
|
|
879
|
+
if (event.executionId) {
|
|
880
|
+
if (event.data?.log) {
|
|
881
|
+
setStreamingLogs((prev) => {
|
|
882
|
+
const updated = new Map(prev);
|
|
883
|
+
const existing = updated.get(event.executionId) || [];
|
|
884
|
+
updated.set(event.executionId, [...existing, event.data.log]);
|
|
885
|
+
return updated;
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
queryClient.invalidateQueries({
|
|
889
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
} catch {
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
[organizationId, resourceId, queryClient]
|
|
898
|
+
);
|
|
899
|
+
const { connected, error } = useSSEConnection({
|
|
900
|
+
manager,
|
|
901
|
+
connectionKey: `resource-${resourceId}`,
|
|
902
|
+
url: sseUrl,
|
|
903
|
+
enabled: !!resourceId && !!organizationId && isOrganizationReady,
|
|
904
|
+
headers,
|
|
905
|
+
onmessage: handleMessage,
|
|
906
|
+
onopen: (response) => response.status === 403 ? "Organization access denied" : void 0
|
|
907
|
+
});
|
|
908
|
+
useEffect(() => {
|
|
909
|
+
return () => {
|
|
910
|
+
setLiveExecutions(/* @__PURE__ */ new Set());
|
|
911
|
+
setStreamingLogs(/* @__PURE__ */ new Map());
|
|
912
|
+
};
|
|
913
|
+
}, [resourceId, organizationId, isOrganizationReady]);
|
|
914
|
+
return {
|
|
915
|
+
liveExecutions,
|
|
916
|
+
connected,
|
|
917
|
+
error,
|
|
918
|
+
runningCount: liveExecutions.size,
|
|
919
|
+
isLive: (executionId) => liveExecutions.has(executionId),
|
|
920
|
+
streamingLogs
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function useScheduledTasks(options = {}) {
|
|
924
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
925
|
+
return useQuery({
|
|
926
|
+
queryKey: ["schedules", "dashboard", organizationId, options.status, options.targetResourceType],
|
|
927
|
+
queryFn: async () => {
|
|
928
|
+
const params = new URLSearchParams();
|
|
929
|
+
if (options.status) params.append("status", options.status);
|
|
930
|
+
if (options.targetResourceType) params.append("targetResourceType", options.targetResourceType);
|
|
931
|
+
const queryString = params.toString();
|
|
932
|
+
const response = await apiRequest(
|
|
933
|
+
`/task-scheduler/schedules${queryString ? `?${queryString}` : ""}`
|
|
934
|
+
);
|
|
935
|
+
return response.schedules;
|
|
936
|
+
},
|
|
937
|
+
enabled: isReady,
|
|
938
|
+
refetchInterval: REFETCH_INTERVAL_DASHBOARD
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// src/hooks/scheduling/queryKeys.ts
|
|
943
|
+
var scheduleKeys = {
|
|
944
|
+
all: (orgId) => ["schedules", orgId],
|
|
945
|
+
lists: (orgId) => [...scheduleKeys.all(orgId), "list"],
|
|
946
|
+
list: (orgId, filters) => [...scheduleKeys.lists(orgId), filters],
|
|
947
|
+
details: (orgId) => [...scheduleKeys.all(orgId), "detail"],
|
|
948
|
+
detail: (orgId, id) => [...scheduleKeys.details(orgId), id],
|
|
949
|
+
executions: (orgId, id) => [...scheduleKeys.detail(orgId, id), "executions"]
|
|
950
|
+
};
|
|
773
951
|
function useListSchedules(filters) {
|
|
774
952
|
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
775
953
|
return useQuery({
|
|
@@ -938,6 +1116,53 @@ function useDeleteSchedule() {
|
|
|
938
1116
|
}
|
|
939
1117
|
});
|
|
940
1118
|
}
|
|
1119
|
+
function useActivitiesRealtime(organizationId, enabled) {
|
|
1120
|
+
const queryClient = useQueryClient();
|
|
1121
|
+
const supabase = useSupabase();
|
|
1122
|
+
useEffect(() => {
|
|
1123
|
+
if (!enabled || !organizationId) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
const channel = supabase.channel(`activities-realtime-${organizationId}`).on(
|
|
1127
|
+
"postgres_changes",
|
|
1128
|
+
{
|
|
1129
|
+
event: "INSERT",
|
|
1130
|
+
schema: "public",
|
|
1131
|
+
table: "activities",
|
|
1132
|
+
filter: `organization_id=eq.${organizationId}`
|
|
1133
|
+
},
|
|
1134
|
+
() => {
|
|
1135
|
+
queryClient.invalidateQueries({ queryKey: ["activities"] });
|
|
1136
|
+
}
|
|
1137
|
+
).subscribe();
|
|
1138
|
+
return () => {
|
|
1139
|
+
void supabase.removeChannel(channel);
|
|
1140
|
+
};
|
|
1141
|
+
}, [organizationId, enabled, queryClient, supabase]);
|
|
1142
|
+
}
|
|
1143
|
+
var projectActivityKeys = {
|
|
1144
|
+
all: ["project-activities"],
|
|
1145
|
+
list: (projectId) => [...projectActivityKeys.all, "list", projectId]
|
|
1146
|
+
};
|
|
1147
|
+
function useProjectActivities(projectId, enabled = true) {
|
|
1148
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
1149
|
+
return useQuery({
|
|
1150
|
+
queryKey: [...projectActivityKeys.list(projectId), organizationId],
|
|
1151
|
+
queryFn: async () => {
|
|
1152
|
+
const params = new URLSearchParams();
|
|
1153
|
+
params.set("entityType", "project");
|
|
1154
|
+
params.set("entityId", projectId);
|
|
1155
|
+
params.set("limit", "50");
|
|
1156
|
+
const res = await apiRequest(`/activities?${params.toString()}`);
|
|
1157
|
+
return res.activities.map((activity) => ({
|
|
1158
|
+
...activity,
|
|
1159
|
+
occurredAt: new Date(activity.occurredAt),
|
|
1160
|
+
createdAt: new Date(activity.createdAt)
|
|
1161
|
+
}));
|
|
1162
|
+
},
|
|
1163
|
+
enabled: isReady && !!projectId && enabled
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
941
1166
|
function useActivityTrend(params = {}) {
|
|
942
1167
|
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
943
1168
|
return useQuery({
|
|
@@ -1594,68 +1819,6 @@ function useSortedData(data, defaultColumn, accessors, defaultDirection = "desc"
|
|
|
1594
1819
|
const sorted = useMemo(() => sortData(data, sort, accessors), [data, sort, accessors]);
|
|
1595
1820
|
return { sorted, sort, toggleSort };
|
|
1596
1821
|
}
|
|
1597
|
-
function useSSEConnection({
|
|
1598
|
-
manager,
|
|
1599
|
-
connectionKey,
|
|
1600
|
-
url,
|
|
1601
|
-
enabled = true,
|
|
1602
|
-
headers,
|
|
1603
|
-
onmessage,
|
|
1604
|
-
onopen,
|
|
1605
|
-
onerror,
|
|
1606
|
-
onclose
|
|
1607
|
-
}) {
|
|
1608
|
-
const [connected, setConnected] = useState(false);
|
|
1609
|
-
const [error, setError] = useState(null);
|
|
1610
|
-
const getAccessToken = useStableAccessToken();
|
|
1611
|
-
const subscriberId = useId();
|
|
1612
|
-
const onmessageRef = useRef(onmessage);
|
|
1613
|
-
const onopenRef = useRef(onopen);
|
|
1614
|
-
const onerrorRef = useRef(onerror);
|
|
1615
|
-
const oncloseRef = useRef(onclose);
|
|
1616
|
-
const headersRef = useRef(headers);
|
|
1617
|
-
onmessageRef.current = onmessage;
|
|
1618
|
-
onopenRef.current = onopen;
|
|
1619
|
-
onerrorRef.current = onerror;
|
|
1620
|
-
oncloseRef.current = onclose;
|
|
1621
|
-
headersRef.current = headers;
|
|
1622
|
-
useEffect(() => {
|
|
1623
|
-
if (!enabled) return;
|
|
1624
|
-
const unsubscribe = manager.subscribe(connectionKey, subscriberId, {
|
|
1625
|
-
url,
|
|
1626
|
-
getToken: getAccessToken,
|
|
1627
|
-
headers: headersRef.current ?? {},
|
|
1628
|
-
onopen(response) {
|
|
1629
|
-
if (response.ok) {
|
|
1630
|
-
setConnected(true);
|
|
1631
|
-
setError(null);
|
|
1632
|
-
}
|
|
1633
|
-
const customError = onopenRef.current?.(response);
|
|
1634
|
-
if (customError) setError(customError);
|
|
1635
|
-
},
|
|
1636
|
-
onmessage(event) {
|
|
1637
|
-
if (!event.data || event.data.trim() === "") return;
|
|
1638
|
-
onmessageRef.current(event.data);
|
|
1639
|
-
},
|
|
1640
|
-
onerror(err) {
|
|
1641
|
-
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
1642
|
-
setConnected(false);
|
|
1643
|
-
setError(msg);
|
|
1644
|
-
onerrorRef.current?.(err instanceof Error ? err : new Error(msg));
|
|
1645
|
-
},
|
|
1646
|
-
onclose() {
|
|
1647
|
-
setConnected(false);
|
|
1648
|
-
oncloseRef.current?.();
|
|
1649
|
-
}
|
|
1650
|
-
});
|
|
1651
|
-
return () => {
|
|
1652
|
-
unsubscribe();
|
|
1653
|
-
setConnected(false);
|
|
1654
|
-
setError(null);
|
|
1655
|
-
};
|
|
1656
|
-
}, [enabled, connectionKey, url, subscriberId, getAccessToken, manager]);
|
|
1657
|
-
return { connected, error };
|
|
1658
|
-
}
|
|
1659
1822
|
|
|
1660
1823
|
// src/hooks/sessions/queryKeys.ts
|
|
1661
1824
|
var sessionsKeys = {
|
|
@@ -2164,124 +2327,13 @@ function usePatchTask() {
|
|
|
2164
2327
|
};
|
|
2165
2328
|
queryClient.setQueriesData(
|
|
2166
2329
|
{ queryKey: ["command-queue", "list"] },
|
|
2167
|
-
(old) => old?.map((t) => t.id === deserialized.id ? { ...t, ...deserialized } : t)
|
|
2168
|
-
);
|
|
2169
|
-
},
|
|
2170
|
-
onError: (error) => {
|
|
2171
|
-
notify.apiError(error);
|
|
2172
|
-
}
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
// src/hooks/operations/shared/queryKeys.ts
|
|
2177
|
-
var operationsKeys = {
|
|
2178
|
-
all: ["operations"],
|
|
2179
|
-
// Individual resource types (kept for CC-specific features)
|
|
2180
|
-
workflows: (org) => [...operationsKeys.all, "workflows", org],
|
|
2181
|
-
workflowDetails: (org) => [...operationsKeys.workflows(org), "details"],
|
|
2182
|
-
workflow: (id, org) => [...operationsKeys.workflows(org), id],
|
|
2183
|
-
agents: (org) => [...operationsKeys.all, "agents", org],
|
|
2184
|
-
agentDetails: (org) => [...operationsKeys.agents(org), "details"],
|
|
2185
|
-
agent: (id, org) => [...operationsKeys.agents(org), id],
|
|
2186
|
-
sessions: (org, params) => [...operationsKeys.all, "sessions", org, params],
|
|
2187
|
-
session: (org, sessionId) => [...operationsKeys.all, "session", org, sessionId]
|
|
2188
|
-
};
|
|
2189
|
-
function useExecutionLogSSE(resourceId, manager, apiUrl) {
|
|
2190
|
-
const queryClient = useQueryClient();
|
|
2191
|
-
const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
|
|
2192
|
-
const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
|
|
2193
|
-
const { isReady: isOrganizationReady, organizationId } = useElevasisServices();
|
|
2194
|
-
const { currentMembership } = useOrganization();
|
|
2195
|
-
const currentWorkOSOrganizationId = currentMembership?.organization?.workos_org_id;
|
|
2196
|
-
const sseUrl = `${apiUrl}/api/execution-engine/sse/${resourceId}`;
|
|
2197
|
-
const headers = useMemo(() => {
|
|
2198
|
-
const h = {};
|
|
2199
|
-
if (currentWorkOSOrganizationId) h[HTTP_HEADERS.WORKOS_ORGANIZATION_ID] = currentWorkOSOrganizationId;
|
|
2200
|
-
return h;
|
|
2201
|
-
}, [currentWorkOSOrganizationId]);
|
|
2202
|
-
const handleMessage = useCallback(
|
|
2203
|
-
(data) => {
|
|
2204
|
-
try {
|
|
2205
|
-
const event = JSON.parse(data);
|
|
2206
|
-
switch (event.type) {
|
|
2207
|
-
case "connected":
|
|
2208
|
-
break;
|
|
2209
|
-
case "new-execution":
|
|
2210
|
-
if (event.executionId) {
|
|
2211
|
-
setLiveExecutions((prev) => {
|
|
2212
|
-
const updated = new Set(prev);
|
|
2213
|
-
updated.add(event.executionId);
|
|
2214
|
-
return updated;
|
|
2215
|
-
});
|
|
2216
|
-
queryClient.invalidateQueries({
|
|
2217
|
-
queryKey: executionsKeys.executions(organizationId, resourceId)
|
|
2218
|
-
});
|
|
2219
|
-
}
|
|
2220
|
-
break;
|
|
2221
|
-
case "execution-complete":
|
|
2222
|
-
if (event.executionId) {
|
|
2223
|
-
setLiveExecutions((prev) => {
|
|
2224
|
-
const updated = new Set(prev);
|
|
2225
|
-
updated.delete(event.executionId);
|
|
2226
|
-
return updated;
|
|
2227
|
-
});
|
|
2228
|
-
setStreamingLogs((prev) => {
|
|
2229
|
-
const updated = new Map(prev);
|
|
2230
|
-
updated.delete(event.executionId);
|
|
2231
|
-
return updated;
|
|
2232
|
-
});
|
|
2233
|
-
queryClient.invalidateQueries({
|
|
2234
|
-
queryKey: executionsKeys.executions(organizationId, resourceId)
|
|
2235
|
-
});
|
|
2236
|
-
queryClient.invalidateQueries({
|
|
2237
|
-
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
break;
|
|
2241
|
-
case "log":
|
|
2242
|
-
if (event.executionId) {
|
|
2243
|
-
if (event.data?.log) {
|
|
2244
|
-
setStreamingLogs((prev) => {
|
|
2245
|
-
const updated = new Map(prev);
|
|
2246
|
-
const existing = updated.get(event.executionId) || [];
|
|
2247
|
-
updated.set(event.executionId, [...existing, event.data.log]);
|
|
2248
|
-
return updated;
|
|
2249
|
-
});
|
|
2250
|
-
}
|
|
2251
|
-
queryClient.invalidateQueries({
|
|
2252
|
-
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
break;
|
|
2256
|
-
}
|
|
2257
|
-
} catch {
|
|
2258
|
-
}
|
|
2259
|
-
},
|
|
2260
|
-
[organizationId, resourceId, queryClient]
|
|
2261
|
-
);
|
|
2262
|
-
const { connected, error } = useSSEConnection({
|
|
2263
|
-
manager,
|
|
2264
|
-
connectionKey: `resource-${resourceId}`,
|
|
2265
|
-
url: sseUrl,
|
|
2266
|
-
enabled: !!resourceId && !!organizationId && isOrganizationReady,
|
|
2267
|
-
headers,
|
|
2268
|
-
onmessage: handleMessage,
|
|
2269
|
-
onopen: (response) => response.status === 403 ? "Organization access denied" : void 0
|
|
2270
|
-
});
|
|
2271
|
-
useEffect(() => {
|
|
2272
|
-
return () => {
|
|
2273
|
-
setLiveExecutions(/* @__PURE__ */ new Set());
|
|
2274
|
-
setStreamingLogs(/* @__PURE__ */ new Map());
|
|
2275
|
-
};
|
|
2276
|
-
}, [resourceId, organizationId, isOrganizationReady]);
|
|
2277
|
-
return {
|
|
2278
|
-
liveExecutions,
|
|
2279
|
-
connected,
|
|
2280
|
-
error,
|
|
2281
|
-
runningCount: liveExecutions.size,
|
|
2282
|
-
isLive: (executionId) => liveExecutions.has(executionId),
|
|
2283
|
-
streamingLogs
|
|
2284
|
-
};
|
|
2330
|
+
(old) => old?.map((t) => t.id === deserialized.id ? { ...t, ...deserialized } : t)
|
|
2331
|
+
);
|
|
2332
|
+
},
|
|
2333
|
+
onError: (error) => {
|
|
2334
|
+
notify.apiError(error);
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2285
2337
|
}
|
|
2286
2338
|
function useExecutionPanelState({
|
|
2287
2339
|
resourceId,
|
|
@@ -3340,6 +3392,8 @@ function useDeleteList() {
|
|
|
3340
3392
|
}
|
|
3341
3393
|
});
|
|
3342
3394
|
}
|
|
3395
|
+
|
|
3396
|
+
// src/hooks/acquisition/useCompanies.ts
|
|
3343
3397
|
var companyKeys = {
|
|
3344
3398
|
all: ["acquisition-companies"],
|
|
3345
3399
|
list: (organizationId, filters) => [...companyKeys.all, "list", organizationId, filters],
|
|
@@ -3589,6 +3643,126 @@ function useDeleteContacts() {
|
|
|
3589
3643
|
}
|
|
3590
3644
|
});
|
|
3591
3645
|
}
|
|
3646
|
+
var projectKeys = {
|
|
3647
|
+
all: ["projects"],
|
|
3648
|
+
lists: () => [...projectKeys.all, "list"],
|
|
3649
|
+
list: (orgId, filters) => [...projectKeys.all, "list", orgId, filters],
|
|
3650
|
+
details: () => [...projectKeys.all, "detail"],
|
|
3651
|
+
detail: (id) => [...projectKeys.all, "detail", id],
|
|
3652
|
+
milestones: (id) => [...projectKeys.all, id, "milestones"],
|
|
3653
|
+
tasks: (id) => [...projectKeys.all, id, "tasks"]
|
|
3654
|
+
};
|
|
3655
|
+
function useProjects(filters = {}) {
|
|
3656
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3657
|
+
return useQuery({
|
|
3658
|
+
queryKey: projectKeys.list(organizationId, filters),
|
|
3659
|
+
queryFn: async () => {
|
|
3660
|
+
const params = new URLSearchParams();
|
|
3661
|
+
if (filters.kind) params.set("kind", filters.kind);
|
|
3662
|
+
const qs = params.toString();
|
|
3663
|
+
const path = qs ? `/projects?${qs}` : "/projects";
|
|
3664
|
+
const res = await apiRequest(path);
|
|
3665
|
+
return res.projects;
|
|
3666
|
+
},
|
|
3667
|
+
enabled: isReady
|
|
3668
|
+
});
|
|
3669
|
+
}
|
|
3670
|
+
function useProject(id) {
|
|
3671
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3672
|
+
return useQuery({
|
|
3673
|
+
queryKey: [...projectKeys.detail(id), organizationId],
|
|
3674
|
+
queryFn: async () => {
|
|
3675
|
+
try {
|
|
3676
|
+
const res = await apiRequest(`/projects/${id}`);
|
|
3677
|
+
return res.project;
|
|
3678
|
+
} catch (err) {
|
|
3679
|
+
if (err && typeof err === "object" && "statusCode" in err && err.statusCode === 404) {
|
|
3680
|
+
return null;
|
|
3681
|
+
}
|
|
3682
|
+
throw err;
|
|
3683
|
+
}
|
|
3684
|
+
},
|
|
3685
|
+
enabled: isReady && !!id
|
|
3686
|
+
});
|
|
3687
|
+
}
|
|
3688
|
+
function useProjectMilestones(projectId) {
|
|
3689
|
+
const { apiRequest, isReady } = useElevasisServices();
|
|
3690
|
+
return useQuery({
|
|
3691
|
+
queryKey: projectKeys.milestones(projectId),
|
|
3692
|
+
queryFn: async () => {
|
|
3693
|
+
const res = await apiRequest(`/projects/${projectId}/milestones`);
|
|
3694
|
+
return res.milestones;
|
|
3695
|
+
},
|
|
3696
|
+
enabled: isReady && !!projectId
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
function useProjectTasks(projectId) {
|
|
3700
|
+
const { apiRequest, isReady } = useElevasisServices();
|
|
3701
|
+
return useQuery({
|
|
3702
|
+
queryKey: projectKeys.tasks(projectId),
|
|
3703
|
+
queryFn: async () => {
|
|
3704
|
+
const res = await apiRequest(`/projects/${projectId}/tasks`);
|
|
3705
|
+
return res.tasks;
|
|
3706
|
+
},
|
|
3707
|
+
enabled: isReady && !!projectId
|
|
3708
|
+
});
|
|
3709
|
+
}
|
|
3710
|
+
function useCreateProject() {
|
|
3711
|
+
const { apiRequest } = useElevasisServices();
|
|
3712
|
+
const queryClient = useQueryClient();
|
|
3713
|
+
return useMutation({
|
|
3714
|
+
mutationFn: async (params) => {
|
|
3715
|
+
const res = await apiRequest("/projects", {
|
|
3716
|
+
method: "POST",
|
|
3717
|
+
body: JSON.stringify(params)
|
|
3718
|
+
});
|
|
3719
|
+
return res.project;
|
|
3720
|
+
},
|
|
3721
|
+
onSuccess: () => {
|
|
3722
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
3723
|
+
},
|
|
3724
|
+
onError: (error) => {
|
|
3725
|
+
showApiErrorNotification(error);
|
|
3726
|
+
}
|
|
3727
|
+
});
|
|
3728
|
+
}
|
|
3729
|
+
function useUpdateProject() {
|
|
3730
|
+
const { apiRequest } = useElevasisServices();
|
|
3731
|
+
const queryClient = useQueryClient();
|
|
3732
|
+
return useMutation({
|
|
3733
|
+
mutationFn: async (params) => {
|
|
3734
|
+
const res = await apiRequest(`/projects/${params.id}`, {
|
|
3735
|
+
method: "PATCH",
|
|
3736
|
+
body: JSON.stringify(params.updates)
|
|
3737
|
+
});
|
|
3738
|
+
return res.project;
|
|
3739
|
+
},
|
|
3740
|
+
onSuccess: (data) => {
|
|
3741
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
3742
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.id) });
|
|
3743
|
+
},
|
|
3744
|
+
onError: (error) => {
|
|
3745
|
+
showApiErrorNotification(error);
|
|
3746
|
+
}
|
|
3747
|
+
});
|
|
3748
|
+
}
|
|
3749
|
+
function useDeleteProject() {
|
|
3750
|
+
const { apiRequest } = useElevasisServices();
|
|
3751
|
+
const queryClient = useQueryClient();
|
|
3752
|
+
return useMutation({
|
|
3753
|
+
mutationFn: async (id) => {
|
|
3754
|
+
await apiRequest(`/projects/${id}`, {
|
|
3755
|
+
method: "DELETE"
|
|
3756
|
+
});
|
|
3757
|
+
},
|
|
3758
|
+
onSuccess: () => {
|
|
3759
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
3760
|
+
},
|
|
3761
|
+
onError: (error) => {
|
|
3762
|
+
showApiErrorNotification(error);
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3592
3766
|
|
|
3593
3767
|
// src/hooks/settings/webhooks/webhookEndpointService.ts
|
|
3594
3768
|
var WebhookEndpointService = class {
|
|
@@ -4223,101 +4397,107 @@ function useOrganizationMembers(organizationId, params) {
|
|
|
4223
4397
|
refetchOnWindowFocus: false
|
|
4224
4398
|
});
|
|
4225
4399
|
}
|
|
4226
|
-
var
|
|
4227
|
-
all: ["
|
|
4228
|
-
lists: () => [...
|
|
4229
|
-
list: (orgId, filters) => [...
|
|
4230
|
-
details: () => [...
|
|
4231
|
-
detail: (id) => [...
|
|
4400
|
+
var noteKeys = {
|
|
4401
|
+
all: ["project-notes"],
|
|
4402
|
+
lists: () => [...noteKeys.all, "list"],
|
|
4403
|
+
list: (orgId, filters) => [...noteKeys.all, "list", orgId, filters],
|
|
4404
|
+
details: () => [...noteKeys.all, "detail"],
|
|
4405
|
+
detail: (id) => [...noteKeys.all, "detail", id]
|
|
4232
4406
|
};
|
|
4233
|
-
function
|
|
4234
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
4235
|
-
return useQuery({
|
|
4236
|
-
queryKey: projectKeys.list(organizationId, filters),
|
|
4237
|
-
queryFn: async () => {
|
|
4238
|
-
const params = new URLSearchParams();
|
|
4239
|
-
if (filters.kind) params.set("kind", filters.kind);
|
|
4240
|
-
const qs = params.toString();
|
|
4241
|
-
const path = qs ? `/projects?${qs}` : "/projects";
|
|
4242
|
-
const res = await apiRequest(path);
|
|
4243
|
-
return res.projects;
|
|
4244
|
-
},
|
|
4245
|
-
enabled: isReady
|
|
4246
|
-
});
|
|
4247
|
-
}
|
|
4248
|
-
function useProject(id) {
|
|
4407
|
+
function useProjectNotes(filters = {}) {
|
|
4249
4408
|
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
4250
4409
|
return useQuery({
|
|
4251
|
-
queryKey:
|
|
4410
|
+
queryKey: noteKeys.list(organizationId, filters),
|
|
4252
4411
|
queryFn: async () => {
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
return res.project;
|
|
4256
|
-
} catch (err) {
|
|
4257
|
-
if (err && typeof err === "object" && "statusCode" in err && err.statusCode === 404) {
|
|
4258
|
-
return null;
|
|
4259
|
-
}
|
|
4260
|
-
throw err;
|
|
4261
|
-
}
|
|
4412
|
+
const res = await apiRequest(`/projects/${filters.projectId}/notes`);
|
|
4413
|
+
return res.notes;
|
|
4262
4414
|
},
|
|
4263
|
-
enabled: isReady && !!
|
|
4415
|
+
enabled: isReady && !!filters.projectId
|
|
4264
4416
|
});
|
|
4265
4417
|
}
|
|
4266
|
-
function
|
|
4418
|
+
function useCreateNote() {
|
|
4267
4419
|
const { apiRequest } = useElevasisServices();
|
|
4268
4420
|
const queryClient = useQueryClient();
|
|
4269
4421
|
return useMutation({
|
|
4270
4422
|
mutationFn: async (params) => {
|
|
4271
|
-
const res = await apiRequest("/
|
|
4423
|
+
const res = await apiRequest("/project-notes", {
|
|
4272
4424
|
method: "POST",
|
|
4273
4425
|
body: JSON.stringify(params)
|
|
4274
4426
|
});
|
|
4275
|
-
return res.
|
|
4276
|
-
},
|
|
4277
|
-
onSuccess: () => {
|
|
4278
|
-
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
4279
|
-
},
|
|
4280
|
-
onError: (error) => {
|
|
4281
|
-
showApiErrorNotification(error);
|
|
4282
|
-
}
|
|
4283
|
-
});
|
|
4284
|
-
}
|
|
4285
|
-
function useUpdateProject() {
|
|
4286
|
-
const { apiRequest } = useElevasisServices();
|
|
4287
|
-
const queryClient = useQueryClient();
|
|
4288
|
-
return useMutation({
|
|
4289
|
-
mutationFn: async (params) => {
|
|
4290
|
-
const res = await apiRequest(`/projects/${params.id}`, {
|
|
4291
|
-
method: "PATCH",
|
|
4292
|
-
body: JSON.stringify(params.updates)
|
|
4293
|
-
});
|
|
4294
|
-
return res.project;
|
|
4427
|
+
return res.note;
|
|
4295
4428
|
},
|
|
4296
4429
|
onSuccess: (data) => {
|
|
4430
|
+
queryClient.invalidateQueries({ queryKey: noteKeys.all });
|
|
4297
4431
|
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
4298
|
-
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.
|
|
4432
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
4299
4433
|
},
|
|
4300
4434
|
onError: (error) => {
|
|
4301
4435
|
showApiErrorNotification(error);
|
|
4302
4436
|
}
|
|
4303
4437
|
});
|
|
4304
4438
|
}
|
|
4305
|
-
|
|
4306
|
-
|
|
4439
|
+
|
|
4440
|
+
// src/hooks/projects/useProjectRealtime.ts
|
|
4441
|
+
function useProjectRealtime(projectId) {
|
|
4307
4442
|
const queryClient = useQueryClient();
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
});
|
|
4313
|
-
},
|
|
4314
|
-
onSuccess: () => {
|
|
4315
|
-
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
4316
|
-
},
|
|
4317
|
-
onError: (error) => {
|
|
4318
|
-
showApiErrorNotification(error);
|
|
4443
|
+
const supabase = useSupabase();
|
|
4444
|
+
useEffect(() => {
|
|
4445
|
+
if (!projectId) {
|
|
4446
|
+
return;
|
|
4319
4447
|
}
|
|
4320
|
-
|
|
4448
|
+
const channel = supabase.channel(`project-realtime-${projectId}`).on(
|
|
4449
|
+
"postgres_changes",
|
|
4450
|
+
{
|
|
4451
|
+
event: "*",
|
|
4452
|
+
schema: "public",
|
|
4453
|
+
table: "prj_projects",
|
|
4454
|
+
filter: `id=eq.${projectId}`
|
|
4455
|
+
},
|
|
4456
|
+
() => {
|
|
4457
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(projectId) });
|
|
4458
|
+
queryClient.invalidateQueries({ queryKey: projectActivityKeys.list(projectId) });
|
|
4459
|
+
}
|
|
4460
|
+
).on(
|
|
4461
|
+
"postgres_changes",
|
|
4462
|
+
{
|
|
4463
|
+
event: "*",
|
|
4464
|
+
schema: "public",
|
|
4465
|
+
table: "prj_milestones",
|
|
4466
|
+
filter: `project_id=eq.${projectId}`
|
|
4467
|
+
},
|
|
4468
|
+
() => {
|
|
4469
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.milestones(projectId) });
|
|
4470
|
+
queryClient.invalidateQueries({ queryKey: projectActivityKeys.list(projectId) });
|
|
4471
|
+
}
|
|
4472
|
+
).on(
|
|
4473
|
+
"postgres_changes",
|
|
4474
|
+
{
|
|
4475
|
+
event: "*",
|
|
4476
|
+
schema: "public",
|
|
4477
|
+
table: "prj_tasks",
|
|
4478
|
+
filter: `project_id=eq.${projectId}`
|
|
4479
|
+
},
|
|
4480
|
+
() => {
|
|
4481
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.tasks(projectId) });
|
|
4482
|
+
queryClient.invalidateQueries({ queryKey: projectActivityKeys.list(projectId) });
|
|
4483
|
+
}
|
|
4484
|
+
).on(
|
|
4485
|
+
"postgres_changes",
|
|
4486
|
+
{
|
|
4487
|
+
event: "*",
|
|
4488
|
+
schema: "public",
|
|
4489
|
+
table: "prj_notes",
|
|
4490
|
+
filter: `project_id=eq.${projectId}`
|
|
4491
|
+
},
|
|
4492
|
+
() => {
|
|
4493
|
+
queryClient.invalidateQueries({ queryKey: noteKeys.all });
|
|
4494
|
+
queryClient.invalidateQueries({ queryKey: projectActivityKeys.list(projectId) });
|
|
4495
|
+
}
|
|
4496
|
+
).subscribe();
|
|
4497
|
+
return () => {
|
|
4498
|
+
void supabase.removeChannel(channel);
|
|
4499
|
+
};
|
|
4500
|
+
}, [projectId, queryClient, supabase]);
|
|
4321
4501
|
}
|
|
4322
4502
|
var milestoneKeys = {
|
|
4323
4503
|
all: ["project-milestones"],
|
|
@@ -4424,58 +4604,40 @@ function useTasks(filters = {}) {
|
|
|
4424
4604
|
enabled: isReady && !!filters.projectId
|
|
4425
4605
|
});
|
|
4426
4606
|
}
|
|
4427
|
-
function
|
|
4607
|
+
function useCreateTask() {
|
|
4428
4608
|
const { apiRequest } = useElevasisServices();
|
|
4429
4609
|
const queryClient = useQueryClient();
|
|
4430
4610
|
return useMutation({
|
|
4431
4611
|
mutationFn: async (params) => {
|
|
4432
|
-
await apiRequest(
|
|
4433
|
-
method: "
|
|
4612
|
+
const res = await apiRequest("/project-tasks", {
|
|
4613
|
+
method: "POST",
|
|
4614
|
+
body: JSON.stringify(params)
|
|
4434
4615
|
});
|
|
4616
|
+
return res.task;
|
|
4435
4617
|
},
|
|
4436
|
-
onSuccess: (
|
|
4618
|
+
onSuccess: (data) => {
|
|
4437
4619
|
queryClient.invalidateQueries({ queryKey: taskKeys.all });
|
|
4438
4620
|
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
4439
|
-
queryClient.invalidateQueries({ queryKey: projectKeys.detail(
|
|
4621
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.project_id) });
|
|
4440
4622
|
},
|
|
4441
4623
|
onError: (error) => {
|
|
4442
4624
|
showApiErrorNotification(error);
|
|
4443
4625
|
}
|
|
4444
4626
|
});
|
|
4445
4627
|
}
|
|
4446
|
-
|
|
4447
|
-
all: ["project-notes"],
|
|
4448
|
-
lists: () => [...noteKeys.all, "list"],
|
|
4449
|
-
list: (orgId, filters) => [...noteKeys.all, "list", orgId, filters],
|
|
4450
|
-
details: () => [...noteKeys.all, "detail"],
|
|
4451
|
-
detail: (id) => [...noteKeys.all, "detail", id]
|
|
4452
|
-
};
|
|
4453
|
-
function useProjectNotes(filters = {}) {
|
|
4454
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
4455
|
-
return useQuery({
|
|
4456
|
-
queryKey: noteKeys.list(organizationId, filters),
|
|
4457
|
-
queryFn: async () => {
|
|
4458
|
-
const res = await apiRequest(`/projects/${filters.projectId}/notes`);
|
|
4459
|
-
return res.notes;
|
|
4460
|
-
},
|
|
4461
|
-
enabled: isReady && !!filters.projectId
|
|
4462
|
-
});
|
|
4463
|
-
}
|
|
4464
|
-
function useCreateNote() {
|
|
4628
|
+
function useDeleteTask2() {
|
|
4465
4629
|
const { apiRequest } = useElevasisServices();
|
|
4466
4630
|
const queryClient = useQueryClient();
|
|
4467
4631
|
return useMutation({
|
|
4468
4632
|
mutationFn: async (params) => {
|
|
4469
|
-
|
|
4470
|
-
method: "
|
|
4471
|
-
body: JSON.stringify(params)
|
|
4633
|
+
await apiRequest(`/project-tasks/${params.id}`, {
|
|
4634
|
+
method: "DELETE"
|
|
4472
4635
|
});
|
|
4473
|
-
return res.note;
|
|
4474
4636
|
},
|
|
4475
|
-
onSuccess: (
|
|
4476
|
-
queryClient.invalidateQueries({ queryKey:
|
|
4637
|
+
onSuccess: (_, params) => {
|
|
4638
|
+
queryClient.invalidateQueries({ queryKey: taskKeys.all });
|
|
4477
4639
|
queryClient.invalidateQueries({ queryKey: projectKeys.all });
|
|
4478
|
-
queryClient.invalidateQueries({ queryKey: projectKeys.detail(
|
|
4640
|
+
queryClient.invalidateQueries({ queryKey: projectKeys.detail(params.projectId) });
|
|
4479
4641
|
},
|
|
4480
4642
|
onError: (error) => {
|
|
4481
4643
|
showApiErrorNotification(error);
|
|
@@ -4483,4 +4645,4 @@ function useCreateNote() {
|
|
|
4483
4645
|
});
|
|
4484
4646
|
}
|
|
4485
4647
|
|
|
4486
|
-
export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, isSessionCapable, milestoneKeys, noteKeys, operationsKeys, projectKeys, scheduleKeys, sessionsKeys, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, sortData, taskKeys, transformMembershipToTableRow, useActivateDeployment, useActivities, 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, useCreateMilestone, useCreateNote, useCreateProject, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteProject, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteTask2, useDeleteWebhookEndpoint, useDeploymentDocs, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync,
|
|
4648
|
+
export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, isSessionCapable, milestoneKeys, noteKeys, operationsKeys, projectActivityKeys, projectKeys, scheduleKeys, sessionsKeys, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, sortData, taskKeys, 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, useCreateMilestone, useCreateNote, useCreateProject, useCreateSchedule, useCreateSession, useCreateTask, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteMilestone, useDeleteProject, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteTask2, useDeleteWebhookEndpoint, useDeploymentDocs, 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, useMilestones, useNotificationCount, useNotifications, useOrganizationMembers, usePaginationState, usePatchTask, usePauseSchedule, useProject, useProjectActivities, useProjectMilestones, useProjectNotes, useProjectRealtime, useProjectTasks, useProjects, useReactivateMembership, useRecentExecutionsByResource, 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, useTasks, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateMilestone, useUpdateProject, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
|