@elevasis/ui 2.24.0 → 2.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/app/index.css +11 -0
- package/dist/app/index.d.ts +457 -357
- package/dist/app/index.js +8 -7
- package/dist/auth/index.js +4 -4
- package/dist/charts/index.js +7 -7
- package/dist/{chunk-DDZOHLHB.js → chunk-26HQMR7S.js} +1 -1
- package/dist/{chunk-4NWNS7TX.js → chunk-3AHEHVJ6.js} +3 -3
- package/dist/{chunk-LJWV4TWV.js → chunk-4ZFBVND2.js} +2 -2
- package/dist/{chunk-FUEXGRFR.js → chunk-7LJUTTXU.js} +5 -5
- package/dist/{chunk-KCJ6VATY.js → chunk-AZQY7AJR.js} +13 -24
- package/dist/{chunk-BIWHHWCJ.js → chunk-DWK2QIAK.js} +2 -1
- package/dist/{chunk-ZDKQNQ4X.js → chunk-GESXCQWY.js} +1 -1
- package/dist/{chunk-Z6FAH4XV.js → chunk-HKBEURCV.js} +1 -1
- package/dist/{chunk-HC2KV6BU.js → chunk-HOIT677G.js} +1 -1
- package/dist/chunk-IS53MXE4.js +230 -0
- package/dist/{chunk-MTR6AN2C.js → chunk-IX7LWINC.js} +6 -5
- package/dist/{chunk-AXXTN44Z.js → chunk-IYIZYMIE.js} +2 -2
- package/dist/{chunk-VGNAV3TH.js → chunk-JDQSCEEF.js} +1237 -642
- package/dist/chunk-JMI7L7Y7.js +524 -0
- package/dist/{chunk-TSSKOQBX.js → chunk-KMAXFJPH.js} +2 -2
- package/dist/{chunk-HQ7M6PBW.js → chunk-KU7ZDWQ7.js} +1 -1
- package/dist/{chunk-YBZT7MJR.js → chunk-L4RT57WU.js} +7 -7
- package/dist/{chunk-2WZ635SS.js → chunk-MU4VPAMR.js} +2 -2
- package/dist/{chunk-3JCMO7SD.js → chunk-N55DVMAG.js} +1 -1
- package/dist/{chunk-EIOJNUPL.js → chunk-PNLJIPV5.js} +1 -1
- package/dist/{chunk-6Z3G4U2R.js → chunk-Q5BEODAT.js} +3 -2
- package/dist/{chunk-M2HWJY6O.js → chunk-QB2CC4VH.js} +2045 -243
- package/dist/{chunk-QULLZ5PE.js → chunk-RSG2O3HF.js} +893 -642
- package/dist/{chunk-M25JL54Z.js → chunk-RYTEQBAO.js} +1 -1
- package/dist/{chunk-XUYBOO32.js → chunk-U36X6NZM.js} +15 -7
- package/dist/{chunk-QSTH6T77.js → chunk-VKMNWHTL.js} +1 -1
- package/dist/{chunk-KLFIJDTD.js → chunk-VOVZLL23.js} +4 -4
- package/dist/{chunk-SLH2QLKV.js → chunk-WFTNY755.js} +1 -1
- package/dist/{chunk-DK2HVHCY.js → chunk-WKJ47GIW.js} +1 -1
- package/dist/chunk-X4WBGKJQ.js +138 -0
- package/dist/{chunk-QHSW4WHM.js → chunk-XTVZFT7U.js} +1 -1
- package/dist/components/index.css +11 -0
- package/dist/components/index.d.ts +478 -386
- package/dist/components/index.js +138 -267
- package/dist/components/navigation/index.css +11 -0
- package/dist/components/navigation/index.js +8 -8
- package/dist/features/auth/index.css +11 -0
- package/dist/features/auth/index.d.ts +369 -363
- package/dist/features/auth/index.js +7 -7
- package/dist/features/crm/index.css +11 -0
- package/dist/features/crm/index.d.ts +551 -360
- package/dist/features/crm/index.js +19 -19
- package/dist/features/dashboard/index.css +11 -0
- package/dist/features/dashboard/index.js +20 -20
- package/dist/features/delivery/index.css +11 -0
- package/dist/features/delivery/index.d.ts +363 -357
- package/dist/features/delivery/index.js +19 -19
- package/dist/features/lead-gen/index.css +11 -0
- package/dist/features/lead-gen/index.d.ts +174 -4
- package/dist/features/lead-gen/index.js +20 -20
- package/dist/features/monitoring/index.css +11 -0
- package/dist/features/monitoring/index.js +21 -21
- package/dist/features/monitoring/requests/index.css +11 -0
- package/dist/features/monitoring/requests/index.js +17 -17
- package/dist/features/operations/index.css +11 -0
- package/dist/features/operations/index.js +24 -24
- package/dist/features/seo/index.js +2 -2
- package/dist/features/settings/index.css +11 -0
- package/dist/features/settings/index.d.ts +369 -363
- package/dist/features/settings/index.js +19 -19
- package/dist/hooks/delivery/index.css +11 -0
- package/dist/hooks/delivery/index.d.ts +363 -357
- package/dist/hooks/delivery/index.js +2 -2
- package/dist/hooks/index.css +11 -0
- package/dist/hooks/index.d.ts +769 -401
- package/dist/hooks/index.js +17 -17
- package/dist/hooks/published.css +11 -0
- package/dist/hooks/published.d.ts +769 -401
- package/dist/hooks/published.js +17 -17
- package/dist/index.css +11 -0
- package/dist/index.d.ts +885 -383
- package/dist/index.js +17 -17
- package/dist/initialization/index.d.ts +369 -363
- package/dist/initialization/index.js +4 -4
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.js +5 -5
- package/dist/organization/index.css +11 -0
- package/dist/organization/index.js +4 -4
- package/dist/profile/index.d.ts +369 -363
- package/dist/profile/index.js +2 -2
- package/dist/provider/ElevasisServiceContext.d.ts +1 -0
- package/dist/provider/ElevasisServiceContext.js +1 -1
- package/dist/provider/index.css +11 -0
- package/dist/provider/index.d.ts +503 -362
- package/dist/provider/index.js +14 -14
- package/dist/provider/published.css +11 -0
- package/dist/provider/published.d.ts +494 -359
- package/dist/provider/published.js +12 -12
- package/dist/supabase/index.d.ts +369 -357
- package/dist/test-utils/index.js +1 -1
- package/dist/typeform/index.js +49 -20
- package/dist/types/index.d.ts +382 -363
- package/package.json +2 -2
- package/dist/chunk-CEWTOKE7.js +0 -109
- package/dist/chunk-OWHQ65EQ.js +0 -211
- package/dist/chunk-UDJE54WN.js +0 -209
- /package/dist/{chunk-IRW7JMQ4.js → chunk-5WWZXCS5.js} +0 -0
- /package/dist/{chunk-QJ2KCHKX.js → chunk-E565XMTQ.js} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useSupabase } from './chunk-BRXELOHC.js';
|
|
2
|
-
import { observabilityKeys } from './chunk-
|
|
3
|
-
import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-
|
|
2
|
+
import { observabilityKeys } from './chunk-VKMNWHTL.js';
|
|
3
|
+
import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-HKBEURCV.js';
|
|
4
4
|
import { GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
|
|
5
|
-
import { useNotificationAdapter, deriveActions } from './chunk-
|
|
6
|
-
import { useOptionalElevasisFeatures } from './chunk-
|
|
5
|
+
import { useNotificationAdapter, deriveActions } from './chunk-JMI7L7Y7.js';
|
|
6
|
+
import { useOptionalElevasisFeatures } from './chunk-4ZFBVND2.js';
|
|
7
7
|
import { HTTP_HEADERS } from './chunk-T6INEVX6.js';
|
|
8
8
|
import { ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, UuidSchema, CredentialNameSchema, STALE_TIME_DEFAULT, REFETCH_INTERVAL_DASHBOARD, STALE_TIME_MONITORING, STALE_TIME_ADMIN, getTimeRangeDates, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, APIClientError, GC_TIME_MEDIUM, GC_TIME_SHORT } from './chunk-SGXXJE52.js';
|
|
9
|
-
import { useStableAccessToken } from './chunk-
|
|
10
|
-
import { useInitialization } from './chunk-
|
|
9
|
+
import { useStableAccessToken } from './chunk-WFTNY755.js';
|
|
10
|
+
import { useInitialization } from './chunk-WKJ47GIW.js';
|
|
11
11
|
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
12
|
-
import { useElevasisServices } from './chunk-
|
|
12
|
+
import { useElevasisServices } from './chunk-5WWZXCS5.js';
|
|
13
13
|
import { useAuthContext } from './chunk-BRJ3QZ4E.js';
|
|
14
|
-
import { useMemo, useCallback, useState, useEffect,
|
|
14
|
+
import { useMemo, useCallback, useState, useEffect, useId, useRef } from 'react';
|
|
15
15
|
import { useQuery, useQueryClient, useMutation, useQueries } from '@tanstack/react-query';
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
import { notifications } from '@mantine/notifications';
|
|
@@ -547,291 +547,6 @@ function useExecuteAsync() {
|
|
|
547
547
|
}
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
|
-
function useRetryExecution() {
|
|
551
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
552
|
-
const queryClient = useQueryClient();
|
|
553
|
-
return useMutation({
|
|
554
|
-
mutationFn: async ({ resourceId, resourceType, input }) => {
|
|
555
|
-
const response = await apiRequest("/execution-engine/execute-async", {
|
|
556
|
-
method: "POST",
|
|
557
|
-
body: JSON.stringify({ resourceType, resourceId, input })
|
|
558
|
-
});
|
|
559
|
-
return { ...response, resourceId };
|
|
560
|
-
},
|
|
561
|
-
onSuccess: (data) => {
|
|
562
|
-
queryClient.invalidateQueries({
|
|
563
|
-
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
function useCancelExecution() {
|
|
569
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
570
|
-
const queryClient = useQueryClient();
|
|
571
|
-
return useMutation({
|
|
572
|
-
mutationFn: async ({ resourceId, executionId }) => {
|
|
573
|
-
const response = await apiRequest(
|
|
574
|
-
`/execution-engine/executions/${resourceId}/${executionId}/cancel`,
|
|
575
|
-
{ method: "POST" }
|
|
576
|
-
);
|
|
577
|
-
return { ...response, resourceId, executionId };
|
|
578
|
-
},
|
|
579
|
-
onSuccess: (data) => {
|
|
580
|
-
queryClient.invalidateQueries({
|
|
581
|
-
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
582
|
-
});
|
|
583
|
-
queryClient.invalidateQueries({
|
|
584
|
-
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
function useDeleteExecution() {
|
|
590
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
591
|
-
const queryClient = useQueryClient();
|
|
592
|
-
return useMutation({
|
|
593
|
-
mutationFn: async ({ resourceId, executionId }) => {
|
|
594
|
-
await apiRequest(`/execution-engine/executions/${resourceId}/${executionId}`, {
|
|
595
|
-
method: "DELETE"
|
|
596
|
-
});
|
|
597
|
-
return { resourceId, executionId };
|
|
598
|
-
},
|
|
599
|
-
onSuccess: (data) => {
|
|
600
|
-
queryClient.removeQueries({
|
|
601
|
-
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
602
|
-
});
|
|
603
|
-
queryClient.invalidateQueries({
|
|
604
|
-
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
function useBulkDeleteExecutions() {
|
|
610
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
611
|
-
const queryClient = useQueryClient();
|
|
612
|
-
return useMutation({
|
|
613
|
-
mutationFn: async ({
|
|
614
|
-
resourceId,
|
|
615
|
-
resourceStatus
|
|
616
|
-
}) => {
|
|
617
|
-
const params = new URLSearchParams();
|
|
618
|
-
if (resourceStatus && resourceStatus !== "all") {
|
|
619
|
-
params.set("resourceStatus", resourceStatus);
|
|
620
|
-
}
|
|
621
|
-
const queryString = params.toString();
|
|
622
|
-
const endpoint = `/execution-engine/executions/${resourceId}${queryString ? `?${queryString}` : ""}`;
|
|
623
|
-
const response = await apiRequest(
|
|
624
|
-
endpoint,
|
|
625
|
-
{ method: "DELETE" }
|
|
626
|
-
);
|
|
627
|
-
return { resourceId, deletedCount: response.deletedCount, resourceStatus };
|
|
628
|
-
},
|
|
629
|
-
onSuccess: (data) => {
|
|
630
|
-
queryClient.invalidateQueries({
|
|
631
|
-
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// src/hooks/services/OperationsService.ts
|
|
638
|
-
var OperationsService = class {
|
|
639
|
-
constructor(apiRequest) {
|
|
640
|
-
this.apiRequest = apiRequest;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Fetch all available Execution Engine resources
|
|
644
|
-
* Uses the unified /list-resources endpoint
|
|
645
|
-
*/
|
|
646
|
-
async getResources() {
|
|
647
|
-
return this.apiRequest("/execution-engine/resources");
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Get detailed workflow information
|
|
651
|
-
* Optional: For future detailed views
|
|
652
|
-
*/
|
|
653
|
-
async getWorkflowDetails() {
|
|
654
|
-
return this.apiRequest("/execution-engine/workflows/details");
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Get detailed agent information
|
|
658
|
-
* Optional: For future detailed views
|
|
659
|
-
*/
|
|
660
|
-
async getAgentDetails() {
|
|
661
|
-
return this.apiRequest("/execution-engine/agents/details");
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Get detailed pipeline information
|
|
665
|
-
* Optional: For future detailed views
|
|
666
|
-
*/
|
|
667
|
-
async getPipelineDetails() {
|
|
668
|
-
return this.apiRequest("/execution-engine/pipelines/details");
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Get resource definition (workflow steps, agent actions, pipeline stages, etc.)
|
|
672
|
-
*/
|
|
673
|
-
async getResourceDefinition(resourceId) {
|
|
674
|
-
return this.apiRequest(`/execution-engine/resources/${resourceId}/definition`);
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* List sessions with optional filtering
|
|
678
|
-
*/
|
|
679
|
-
async listSessions(params) {
|
|
680
|
-
const queryParams = new URLSearchParams();
|
|
681
|
-
if (params?.resourceId) queryParams.append("resourceId", params.resourceId);
|
|
682
|
-
const endpoint = queryParams.toString() ? `/sessions?${queryParams.toString()}` : "/sessions";
|
|
683
|
-
const response = await this.apiRequest(endpoint);
|
|
684
|
-
return response.sessions.map((session) => ({
|
|
685
|
-
sessionId: session.sessionId,
|
|
686
|
-
resourceId: session.resourceId,
|
|
687
|
-
turnCount: session.turnCount,
|
|
688
|
-
isEnded: session.isEnded,
|
|
689
|
-
createdAt: new Date(session.createdAt),
|
|
690
|
-
updatedAt: new Date(session.updatedAt)
|
|
691
|
-
}));
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Get session details by ID
|
|
695
|
-
*/
|
|
696
|
-
async getSession(sessionId) {
|
|
697
|
-
SessionIdParamSchema.parse({ sessionId });
|
|
698
|
-
const response = await this.apiRequest(`/sessions/${sessionId}`);
|
|
699
|
-
return {
|
|
700
|
-
sessionId: response.sessionId,
|
|
701
|
-
resourceId: response.resourceId,
|
|
702
|
-
organizationId: response.organizationId,
|
|
703
|
-
userId: response.userId || void 0,
|
|
704
|
-
turnCount: response.turnCount,
|
|
705
|
-
isEnded: response.isEnded,
|
|
706
|
-
metadata: response.metadata || void 0,
|
|
707
|
-
memorySnapshot: response.memorySnapshot || void 0,
|
|
708
|
-
createdAt: new Date(response.createdAt),
|
|
709
|
-
updatedAt: new Date(response.updatedAt),
|
|
710
|
-
endedAt: response.endedAt ? new Date(response.endedAt) : void 0
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Create a new session for an agent
|
|
715
|
-
*/
|
|
716
|
-
async createSession(resourceId) {
|
|
717
|
-
const validated = CreateSessionSchema.parse({
|
|
718
|
-
resourceId
|
|
719
|
-
});
|
|
720
|
-
const result = await this.apiRequest("/sessions", {
|
|
721
|
-
method: "POST",
|
|
722
|
-
body: JSON.stringify(validated)
|
|
723
|
-
});
|
|
724
|
-
return result;
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Archive a session
|
|
728
|
-
*/
|
|
729
|
-
async archiveSession(sessionId) {
|
|
730
|
-
SessionIdParamSchema.parse({ sessionId });
|
|
731
|
-
return this.apiRequest(`/sessions/${sessionId}/archive`, {
|
|
732
|
-
method: "POST"
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
// src/hooks/executions/useResources.ts
|
|
738
|
-
function useResources() {
|
|
739
|
-
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
740
|
-
return useQuery({
|
|
741
|
-
queryKey: executionsKeys.resources(organizationId),
|
|
742
|
-
queryFn: async () => {
|
|
743
|
-
const service = new OperationsService(apiRequest);
|
|
744
|
-
const result = await service.getResources();
|
|
745
|
-
return {
|
|
746
|
-
workflows: result.workflows ?? [],
|
|
747
|
-
agents: result.agents ?? [],
|
|
748
|
-
pipelines: result.pipelines ?? [],
|
|
749
|
-
total: (result.workflows?.length ?? 0) + (result.agents?.length ?? 0) + (result.pipelines?.length ?? 0)
|
|
750
|
-
};
|
|
751
|
-
},
|
|
752
|
-
enabled: isReady
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
function useResourceDefinition(resourceId, enabled = true) {
|
|
756
|
-
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
757
|
-
return useQuery({
|
|
758
|
-
queryKey: executionsKeys.resourceDefinition(organizationId, resourceId),
|
|
759
|
-
queryFn: () => {
|
|
760
|
-
const service = new OperationsService(apiRequest);
|
|
761
|
-
return service.getResourceDefinition(resourceId);
|
|
762
|
-
},
|
|
763
|
-
enabled: enabled && isReady && !!resourceId,
|
|
764
|
-
retry: 2,
|
|
765
|
-
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4)
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
function useArchivedLogs(executionId) {
|
|
769
|
-
const { apiRequest } = useElevasisServices();
|
|
770
|
-
const [logs, setLogs] = useState(null);
|
|
771
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
772
|
-
const [error, setError] = useState(null);
|
|
773
|
-
const fetch = useCallback(async () => {
|
|
774
|
-
if (!executionId || isLoading) return;
|
|
775
|
-
setIsLoading(true);
|
|
776
|
-
setError(null);
|
|
777
|
-
try {
|
|
778
|
-
const response = await apiRequest(
|
|
779
|
-
`/observability/executions/${executionId}/archived-logs`
|
|
780
|
-
);
|
|
781
|
-
setLogs(response.logs);
|
|
782
|
-
} catch (err) {
|
|
783
|
-
setError(err instanceof Error ? err.message : "Failed to load archived logs");
|
|
784
|
-
} finally {
|
|
785
|
-
setIsLoading(false);
|
|
786
|
-
}
|
|
787
|
-
}, [executionId, apiRequest, isLoading]);
|
|
788
|
-
return { logs, isLoading, error, fetch };
|
|
789
|
-
}
|
|
790
|
-
function useExecuteResource(options) {
|
|
791
|
-
const mutation = useExecuteAsync();
|
|
792
|
-
const execute = useCallback(
|
|
793
|
-
async (input) => {
|
|
794
|
-
let validatedInput = input;
|
|
795
|
-
if (options.schema) {
|
|
796
|
-
const parsed = options.schema.safeParse(input);
|
|
797
|
-
if (!parsed.success) {
|
|
798
|
-
throw new Error(`Invalid input for resource "${options.resourceId}": ${parsed.error.message}`);
|
|
799
|
-
}
|
|
800
|
-
validatedInput = parsed.data;
|
|
801
|
-
}
|
|
802
|
-
return mutation.mutateAsync({
|
|
803
|
-
resourceId: options.resourceId,
|
|
804
|
-
resourceType: options.resourceType,
|
|
805
|
-
input: validatedInput
|
|
806
|
-
});
|
|
807
|
-
},
|
|
808
|
-
[mutation, options.resourceId, options.resourceType, options.schema]
|
|
809
|
-
);
|
|
810
|
-
return {
|
|
811
|
-
execute,
|
|
812
|
-
mutation,
|
|
813
|
-
isPending: mutation.isPending,
|
|
814
|
-
isSuccess: mutation.isSuccess,
|
|
815
|
-
isError: mutation.isError,
|
|
816
|
-
error: mutation.error,
|
|
817
|
-
data: mutation.data,
|
|
818
|
-
reset: mutation.reset
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// src/hooks/operations/shared/queryKeys.ts
|
|
823
|
-
var operationsKeys = {
|
|
824
|
-
all: ["operations"],
|
|
825
|
-
// Individual resource types (kept for CC-specific features)
|
|
826
|
-
workflows: (org) => [...operationsKeys.all, "workflows", org],
|
|
827
|
-
workflowDetails: (org) => [...operationsKeys.workflows(org), "details"],
|
|
828
|
-
workflow: (id, org) => [...operationsKeys.workflows(org), id],
|
|
829
|
-
agents: (org) => [...operationsKeys.all, "agents", org],
|
|
830
|
-
agentDetails: (org) => [...operationsKeys.agents(org), "details"],
|
|
831
|
-
agent: (id, org) => [...operationsKeys.agents(org), id],
|
|
832
|
-
sessions: (org, params) => [...operationsKeys.all, "sessions", org, params],
|
|
833
|
-
session: (org, sessionId) => [...operationsKeys.all, "session", org, sessionId]
|
|
834
|
-
};
|
|
835
550
|
function useCreateOrgRole() {
|
|
836
551
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
837
552
|
const queryClient = useQueryClient();
|
|
@@ -990,6 +705,37 @@ function usePaginationState(pageSize, resetDeps, total) {
|
|
|
990
705
|
[page, pageSize]
|
|
991
706
|
);
|
|
992
707
|
}
|
|
708
|
+
function useExecuteResource(options) {
|
|
709
|
+
const mutation = useExecuteAsync();
|
|
710
|
+
const execute = useCallback(
|
|
711
|
+
async (input) => {
|
|
712
|
+
let validatedInput = input;
|
|
713
|
+
if (options.schema) {
|
|
714
|
+
const parsed = options.schema.safeParse(input);
|
|
715
|
+
if (!parsed.success) {
|
|
716
|
+
throw new Error(`Invalid input for resource "${options.resourceId}": ${parsed.error.message}`);
|
|
717
|
+
}
|
|
718
|
+
validatedInput = parsed.data;
|
|
719
|
+
}
|
|
720
|
+
return mutation.mutateAsync({
|
|
721
|
+
resourceId: options.resourceId,
|
|
722
|
+
resourceType: options.resourceType,
|
|
723
|
+
input: validatedInput
|
|
724
|
+
});
|
|
725
|
+
},
|
|
726
|
+
[mutation, options.resourceId, options.resourceType, options.schema]
|
|
727
|
+
);
|
|
728
|
+
return {
|
|
729
|
+
execute,
|
|
730
|
+
mutation,
|
|
731
|
+
isPending: mutation.isPending,
|
|
732
|
+
isSuccess: mutation.isSuccess,
|
|
733
|
+
isError: mutation.isError,
|
|
734
|
+
error: mutation.error,
|
|
735
|
+
data: mutation.data,
|
|
736
|
+
reset: mutation.reset
|
|
737
|
+
};
|
|
738
|
+
}
|
|
993
739
|
|
|
994
740
|
// src/hooks/settings/api-keys/apiKeyService.ts
|
|
995
741
|
var ApiKeyService = class {
|
|
@@ -1534,10 +1280,129 @@ function useDeleteSchedule() {
|
|
|
1534
1280
|
GetScheduleParamsSchema.parse({ id });
|
|
1535
1281
|
await apiRequest(`/task-scheduler/schedules/${id}`, { method: "DELETE" });
|
|
1536
1282
|
},
|
|
1537
|
-
onSuccess: (_, id) => {
|
|
1538
|
-
queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
|
|
1539
|
-
queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
|
|
1540
|
-
}
|
|
1283
|
+
onSuccess: (_, id) => {
|
|
1284
|
+
queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
|
|
1285
|
+
queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
// src/hooks/services/OperationsService.ts
|
|
1291
|
+
var OperationsService = class {
|
|
1292
|
+
constructor(apiRequest) {
|
|
1293
|
+
this.apiRequest = apiRequest;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Fetch all available Execution Engine resources
|
|
1297
|
+
* Uses the unified /list-resources endpoint
|
|
1298
|
+
*/
|
|
1299
|
+
async getResources() {
|
|
1300
|
+
return this.apiRequest("/execution-engine/resources");
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Get detailed workflow information
|
|
1304
|
+
* Optional: For future detailed views
|
|
1305
|
+
*/
|
|
1306
|
+
async getWorkflowDetails() {
|
|
1307
|
+
return this.apiRequest("/execution-engine/workflows/details");
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Get detailed agent information
|
|
1311
|
+
* Optional: For future detailed views
|
|
1312
|
+
*/
|
|
1313
|
+
async getAgentDetails() {
|
|
1314
|
+
return this.apiRequest("/execution-engine/agents/details");
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Get detailed pipeline information
|
|
1318
|
+
* Optional: For future detailed views
|
|
1319
|
+
*/
|
|
1320
|
+
async getPipelineDetails() {
|
|
1321
|
+
return this.apiRequest("/execution-engine/pipelines/details");
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Get resource definition (workflow steps, agent actions, pipeline stages, etc.)
|
|
1325
|
+
*/
|
|
1326
|
+
async getResourceDefinition(resourceId) {
|
|
1327
|
+
return this.apiRequest(`/execution-engine/resources/${resourceId}/definition`);
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* List sessions with optional filtering
|
|
1331
|
+
*/
|
|
1332
|
+
async listSessions(params) {
|
|
1333
|
+
const queryParams = new URLSearchParams();
|
|
1334
|
+
if (params?.resourceId) queryParams.append("resourceId", params.resourceId);
|
|
1335
|
+
const endpoint = queryParams.toString() ? `/sessions?${queryParams.toString()}` : "/sessions";
|
|
1336
|
+
const response = await this.apiRequest(endpoint);
|
|
1337
|
+
return response.sessions.map((session) => ({
|
|
1338
|
+
sessionId: session.sessionId,
|
|
1339
|
+
resourceId: session.resourceId,
|
|
1340
|
+
turnCount: session.turnCount,
|
|
1341
|
+
isEnded: session.isEnded,
|
|
1342
|
+
createdAt: new Date(session.createdAt),
|
|
1343
|
+
updatedAt: new Date(session.updatedAt)
|
|
1344
|
+
}));
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Get session details by ID
|
|
1348
|
+
*/
|
|
1349
|
+
async getSession(sessionId) {
|
|
1350
|
+
SessionIdParamSchema.parse({ sessionId });
|
|
1351
|
+
const response = await this.apiRequest(`/sessions/${sessionId}`);
|
|
1352
|
+
return {
|
|
1353
|
+
sessionId: response.sessionId,
|
|
1354
|
+
resourceId: response.resourceId,
|
|
1355
|
+
organizationId: response.organizationId,
|
|
1356
|
+
userId: response.userId || void 0,
|
|
1357
|
+
turnCount: response.turnCount,
|
|
1358
|
+
isEnded: response.isEnded,
|
|
1359
|
+
metadata: response.metadata || void 0,
|
|
1360
|
+
memorySnapshot: response.memorySnapshot || void 0,
|
|
1361
|
+
createdAt: new Date(response.createdAt),
|
|
1362
|
+
updatedAt: new Date(response.updatedAt),
|
|
1363
|
+
endedAt: response.endedAt ? new Date(response.endedAt) : void 0
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Create a new session for an agent
|
|
1368
|
+
*/
|
|
1369
|
+
async createSession(resourceId) {
|
|
1370
|
+
const validated = CreateSessionSchema.parse({
|
|
1371
|
+
resourceId
|
|
1372
|
+
});
|
|
1373
|
+
const result = await this.apiRequest("/sessions", {
|
|
1374
|
+
method: "POST",
|
|
1375
|
+
body: JSON.stringify(validated)
|
|
1376
|
+
});
|
|
1377
|
+
return result;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Archive a session
|
|
1381
|
+
*/
|
|
1382
|
+
async archiveSession(sessionId) {
|
|
1383
|
+
SessionIdParamSchema.parse({ sessionId });
|
|
1384
|
+
return this.apiRequest(`/sessions/${sessionId}/archive`, {
|
|
1385
|
+
method: "POST"
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
// src/hooks/executions/useResources.ts
|
|
1391
|
+
function useResources() {
|
|
1392
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
1393
|
+
return useQuery({
|
|
1394
|
+
queryKey: executionsKeys.resources(organizationId),
|
|
1395
|
+
queryFn: async () => {
|
|
1396
|
+
const service = new OperationsService(apiRequest);
|
|
1397
|
+
const result = await service.getResources();
|
|
1398
|
+
return {
|
|
1399
|
+
workflows: result.workflows ?? [],
|
|
1400
|
+
agents: result.agents ?? [],
|
|
1401
|
+
pipelines: result.pipelines ?? [],
|
|
1402
|
+
total: (result.workflows?.length ?? 0) + (result.agents?.length ?? 0) + (result.pipelines?.length ?? 0)
|
|
1403
|
+
};
|
|
1404
|
+
},
|
|
1405
|
+
enabled: isReady
|
|
1541
1406
|
});
|
|
1542
1407
|
}
|
|
1543
1408
|
function useCommandQueue({
|
|
@@ -2396,252 +2261,96 @@ function useTransitionItem() {
|
|
|
2396
2261
|
stageKey,
|
|
2397
2262
|
...stateKey !== void 0 ? { stateKey } : {},
|
|
2398
2263
|
...reason !== void 0 ? { reason } : {},
|
|
2399
|
-
...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
|
|
2400
|
-
})
|
|
2401
|
-
});
|
|
2402
|
-
},
|
|
2403
|
-
onSuccess: (_, variables) => {
|
|
2404
|
-
queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
|
|
2405
|
-
queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
|
|
2406
|
-
queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
|
|
2407
|
-
},
|
|
2408
|
-
onError: (error) => {
|
|
2409
|
-
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
2410
|
-
showApiErrorNotification(error);
|
|
2411
|
-
}
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
var dealNoteKeys = {
|
|
2415
|
-
all: ["deal-notes"],
|
|
2416
|
-
list: (organizationId, dealId) => ["deal-notes", organizationId, dealId]
|
|
2417
|
-
};
|
|
2418
|
-
function useDealNotes(dealId) {
|
|
2419
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2420
|
-
return useQuery({
|
|
2421
|
-
queryKey: dealNoteKeys.list(organizationId, dealId),
|
|
2422
|
-
queryFn: async () => {
|
|
2423
|
-
return apiRequest(`/deals/${dealId}/notes`);
|
|
2424
|
-
},
|
|
2425
|
-
enabled: isReady && !!dealId
|
|
2426
|
-
});
|
|
2427
|
-
}
|
|
2428
|
-
function useCreateDealNote() {
|
|
2429
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
2430
|
-
const queryClient = useQueryClient();
|
|
2431
|
-
return useMutation({
|
|
2432
|
-
mutationFn: async ({ dealId, body }) => {
|
|
2433
|
-
return apiRequest(`/deals/${dealId}/notes`, {
|
|
2434
|
-
method: "POST",
|
|
2435
|
-
body: JSON.stringify({ body })
|
|
2436
|
-
});
|
|
2437
|
-
},
|
|
2438
|
-
onSuccess: (_, variables) => {
|
|
2439
|
-
queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
|
|
2440
|
-
queryClient.invalidateQueries({ queryKey: ["recent-crm-activity", organizationId] });
|
|
2441
|
-
showSuccessNotification("Note added");
|
|
2442
|
-
},
|
|
2443
|
-
onError: (error) => {
|
|
2444
|
-
showApiErrorNotification(error);
|
|
2445
|
-
}
|
|
2446
|
-
});
|
|
2447
|
-
}
|
|
2448
|
-
var dealTaskKeys = {
|
|
2449
|
-
all: ["deal-tasks"],
|
|
2450
|
-
list: (orgId, dealId) => ["deal-tasks", orgId, dealId],
|
|
2451
|
-
due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
|
|
2452
|
-
};
|
|
2453
|
-
function useDealTasks(dealId) {
|
|
2454
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2455
|
-
return useQuery({
|
|
2456
|
-
queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
|
|
2457
|
-
queryFn: async () => {
|
|
2458
|
-
return apiRequest(`/deals/${dealId}/tasks`);
|
|
2459
|
-
},
|
|
2460
|
-
enabled: isReady && !!dealId
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
function useDealTasksDue(opts) {
|
|
2464
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2465
|
-
const window = opts?.window ?? "today_and_overdue";
|
|
2466
|
-
const assigneeUserId = opts?.assigneeUserId ?? null;
|
|
2467
|
-
return useQuery({
|
|
2468
|
-
queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
|
|
2469
|
-
queryFn: async () => {
|
|
2470
|
-
const params = new URLSearchParams({ window });
|
|
2471
|
-
if (assigneeUserId) params.set("assigneeUserId", assigneeUserId);
|
|
2472
|
-
return apiRequest(`/deals/tasks/due?${params.toString()}`);
|
|
2473
|
-
},
|
|
2474
|
-
enabled: isReady
|
|
2475
|
-
});
|
|
2476
|
-
}
|
|
2477
|
-
function useCreateDealTask() {
|
|
2478
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
2479
|
-
const queryClient = useQueryClient();
|
|
2480
|
-
return useMutation({
|
|
2481
|
-
mutationFn: async (params) => {
|
|
2482
|
-
const { dealId, ...body } = params;
|
|
2483
|
-
return apiRequest(`/deals/${dealId}/tasks`, {
|
|
2484
|
-
method: "POST",
|
|
2485
|
-
body: JSON.stringify({
|
|
2486
|
-
title: body.title,
|
|
2487
|
-
description: body.description ?? null,
|
|
2488
|
-
kind: body.kind ?? "other",
|
|
2489
|
-
dueAt: body.dueAt ?? null,
|
|
2490
|
-
assigneeUserId: body.assigneeUserId ?? null
|
|
2491
|
-
})
|
|
2492
|
-
});
|
|
2493
|
-
},
|
|
2494
|
-
onSuccess: (_, variables) => {
|
|
2495
|
-
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2496
|
-
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
2497
|
-
showSuccessNotification("Task created");
|
|
2498
|
-
},
|
|
2499
|
-
onError: (error) => {
|
|
2500
|
-
showApiErrorNotification(error);
|
|
2501
|
-
}
|
|
2502
|
-
});
|
|
2503
|
-
}
|
|
2504
|
-
function useCompleteDealTask() {
|
|
2505
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
2506
|
-
const queryClient = useQueryClient();
|
|
2507
|
-
return useMutation({
|
|
2508
|
-
mutationFn: async ({ taskId, dealId }) => {
|
|
2509
|
-
return apiRequest(`/deals/${dealId}/tasks/${taskId}/complete`, {
|
|
2510
|
-
method: "PATCH"
|
|
2511
|
-
});
|
|
2512
|
-
},
|
|
2513
|
-
onSuccess: (_, variables) => {
|
|
2514
|
-
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2515
|
-
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
2516
|
-
showSuccessNotification("Task completed");
|
|
2517
|
-
},
|
|
2518
|
-
onError: (error) => {
|
|
2519
|
-
showApiErrorNotification(error);
|
|
2520
|
-
}
|
|
2521
|
-
});
|
|
2522
|
-
}
|
|
2523
|
-
var acquisitionListKeys = {
|
|
2524
|
-
all: ["acquisition-lists"],
|
|
2525
|
-
list: (organizationId) => [...acquisitionListKeys.all, organizationId],
|
|
2526
|
-
detail: (organizationId, listId) => [...acquisitionListKeys.all, organizationId, listId],
|
|
2527
|
-
telemetry: (organizationId) => [...acquisitionListKeys.all, "telemetry", organizationId],
|
|
2528
|
-
progress: (organizationId, listId) => [...acquisitionListKeys.all, "progress", organizationId, listId],
|
|
2529
|
-
executions: (organizationId, listId) => [...acquisitionListKeys.all, "executions", organizationId, listId]
|
|
2530
|
-
};
|
|
2531
|
-
function useLists() {
|
|
2532
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2533
|
-
return useQuery({
|
|
2534
|
-
queryKey: acquisitionListKeys.list(organizationId),
|
|
2535
|
-
queryFn: () => apiRequest("/acquisition/lists"),
|
|
2536
|
-
enabled: isReady
|
|
2537
|
-
});
|
|
2538
|
-
}
|
|
2539
|
-
function useList(listId) {
|
|
2540
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2541
|
-
return useQuery({
|
|
2542
|
-
queryKey: acquisitionListKeys.detail(organizationId, listId),
|
|
2543
|
-
queryFn: () => apiRequest(`/acquisition/lists/${listId}`),
|
|
2544
|
-
enabled: isReady && !!listId
|
|
2545
|
-
});
|
|
2546
|
-
}
|
|
2547
|
-
function useListsTelemetry() {
|
|
2548
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2549
|
-
return useQuery({
|
|
2550
|
-
queryKey: acquisitionListKeys.telemetry(organizationId),
|
|
2551
|
-
queryFn: () => apiRequest("/acquisition/lists/telemetry"),
|
|
2552
|
-
enabled: isReady
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
function useListProgress(listId) {
|
|
2556
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2557
|
-
return useQuery({
|
|
2558
|
-
queryKey: acquisitionListKeys.progress(organizationId, listId),
|
|
2559
|
-
queryFn: () => apiRequest(`/acquisition/lists/${listId}/progress`),
|
|
2560
|
-
enabled: isReady && !!listId
|
|
2561
|
-
});
|
|
2562
|
-
}
|
|
2563
|
-
function useListExecutions(listId) {
|
|
2564
|
-
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2565
|
-
return useQuery({
|
|
2566
|
-
queryKey: acquisitionListKeys.executions(organizationId, listId),
|
|
2567
|
-
queryFn: () => apiRequest(`/acquisition/lists/${listId}/executions`),
|
|
2568
|
-
enabled: isReady && !!listId
|
|
2569
|
-
});
|
|
2570
|
-
}
|
|
2571
|
-
function useCreateList() {
|
|
2572
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
2573
|
-
const queryClient = useQueryClient();
|
|
2574
|
-
return useMutation({
|
|
2575
|
-
mutationFn: (body) => apiRequest("/acquisition/lists", {
|
|
2576
|
-
method: "POST",
|
|
2577
|
-
body: JSON.stringify(body)
|
|
2578
|
-
}),
|
|
2579
|
-
onSuccess: () => {
|
|
2580
|
-
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
2581
|
-
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
|
|
2582
|
-
showSuccessNotification("List created");
|
|
2583
|
-
},
|
|
2584
|
-
onError: (error) => {
|
|
2585
|
-
showApiErrorNotification(error);
|
|
2586
|
-
}
|
|
2587
|
-
});
|
|
2588
|
-
}
|
|
2589
|
-
function useUpdateList(listId) {
|
|
2590
|
-
const { apiRequest, organizationId } = useElevasisServices();
|
|
2591
|
-
const queryClient = useQueryClient();
|
|
2592
|
-
return useMutation({
|
|
2593
|
-
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}`, {
|
|
2594
|
-
method: "PATCH",
|
|
2595
|
-
body: JSON.stringify(body)
|
|
2596
|
-
}),
|
|
2597
|
-
onSuccess: () => {
|
|
2598
|
-
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
2599
|
-
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
2600
|
-
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
|
|
2601
|
-
showSuccessNotification("List updated");
|
|
2264
|
+
...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
|
|
2265
|
+
})
|
|
2266
|
+
});
|
|
2267
|
+
},
|
|
2268
|
+
onSuccess: (_, variables) => {
|
|
2269
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
|
|
2270
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
|
|
2271
|
+
queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
|
|
2602
2272
|
},
|
|
2603
2273
|
onError: (error) => {
|
|
2274
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
2604
2275
|
showApiErrorNotification(error);
|
|
2605
2276
|
}
|
|
2606
2277
|
});
|
|
2607
2278
|
}
|
|
2608
|
-
|
|
2279
|
+
var dealTaskKeys = {
|
|
2280
|
+
all: ["deal-tasks"],
|
|
2281
|
+
list: (orgId, dealId) => ["deal-tasks", orgId, dealId],
|
|
2282
|
+
due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
|
|
2283
|
+
};
|
|
2284
|
+
function useDealTasks(dealId) {
|
|
2285
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2286
|
+
return useQuery({
|
|
2287
|
+
queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
|
|
2288
|
+
queryFn: async () => {
|
|
2289
|
+
return apiRequest(`/deals/${dealId}/tasks`);
|
|
2290
|
+
},
|
|
2291
|
+
enabled: isReady && !!dealId
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
function useDealTasksDue(opts) {
|
|
2295
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
2296
|
+
const window = opts?.window ?? "today_and_overdue";
|
|
2297
|
+
const assigneeUserId = opts?.assigneeUserId ?? null;
|
|
2298
|
+
return useQuery({
|
|
2299
|
+
queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
|
|
2300
|
+
queryFn: async () => {
|
|
2301
|
+
const params = new URLSearchParams({ window });
|
|
2302
|
+
if (assigneeUserId) params.set("assigneeUserId", assigneeUserId);
|
|
2303
|
+
return apiRequest(`/deals/tasks/due?${params.toString()}`);
|
|
2304
|
+
},
|
|
2305
|
+
enabled: isReady
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function useCreateDealTask() {
|
|
2609
2309
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
2610
2310
|
const queryClient = useQueryClient();
|
|
2611
2311
|
return useMutation({
|
|
2612
|
-
mutationFn: (
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2312
|
+
mutationFn: async (params) => {
|
|
2313
|
+
const { dealId, ...body } = params;
|
|
2314
|
+
return apiRequest(`/deals/${dealId}/tasks`, {
|
|
2315
|
+
method: "POST",
|
|
2316
|
+
body: JSON.stringify({
|
|
2317
|
+
title: body.title,
|
|
2318
|
+
description: body.description ?? null,
|
|
2319
|
+
kind: body.kind ?? "other",
|
|
2320
|
+
dueAt: body.dueAt ?? null,
|
|
2321
|
+
assigneeUserId: body.assigneeUserId ?? null
|
|
2322
|
+
})
|
|
2323
|
+
});
|
|
2324
|
+
},
|
|
2325
|
+
onSuccess: (_, variables) => {
|
|
2326
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2327
|
+
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
2328
|
+
showSuccessNotification("Task created");
|
|
2620
2329
|
},
|
|
2621
2330
|
onError: (error) => {
|
|
2622
2331
|
showApiErrorNotification(error);
|
|
2623
2332
|
}
|
|
2624
2333
|
});
|
|
2625
2334
|
}
|
|
2626
|
-
function
|
|
2335
|
+
function useCompleteDealTask() {
|
|
2627
2336
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
2628
2337
|
const queryClient = useQueryClient();
|
|
2629
2338
|
return useMutation({
|
|
2630
|
-
mutationFn: (
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2339
|
+
mutationFn: async ({ taskId, dealId }) => {
|
|
2340
|
+
return apiRequest(`/deals/${dealId}/tasks/${taskId}/complete`, {
|
|
2341
|
+
method: "PATCH"
|
|
2342
|
+
});
|
|
2343
|
+
},
|
|
2344
|
+
onSuccess: (_, variables) => {
|
|
2345
|
+
queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
|
|
2346
|
+
queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
|
|
2347
|
+
showSuccessNotification("Task completed");
|
|
2637
2348
|
},
|
|
2638
2349
|
onError: (error) => {
|
|
2639
2350
|
showApiErrorNotification(error);
|
|
2640
2351
|
}
|
|
2641
2352
|
});
|
|
2642
2353
|
}
|
|
2643
|
-
|
|
2644
|
-
// src/hooks/acquisition/useCompanies.ts
|
|
2645
2354
|
var companyKeys = {
|
|
2646
2355
|
all: ["acquisition-companies"],
|
|
2647
2356
|
list: (organizationId, filters) => [...companyKeys.all, "list", organizationId, filters],
|
|
@@ -3043,6 +2752,181 @@ function useProjectActivities(projectId, enabled = true) {
|
|
|
3043
2752
|
enabled: isReady && !!projectId && enabled
|
|
3044
2753
|
});
|
|
3045
2754
|
}
|
|
2755
|
+
|
|
2756
|
+
// src/hooks/operations/shared/queryKeys.ts
|
|
2757
|
+
var operationsKeys = {
|
|
2758
|
+
all: ["operations"],
|
|
2759
|
+
// Individual resource types (kept for CC-specific features)
|
|
2760
|
+
workflows: (org) => [...operationsKeys.all, "workflows", org],
|
|
2761
|
+
workflowDetails: (org) => [...operationsKeys.workflows(org), "details"],
|
|
2762
|
+
workflow: (id, org) => [...operationsKeys.workflows(org), id],
|
|
2763
|
+
agents: (org) => [...operationsKeys.all, "agents", org],
|
|
2764
|
+
agentDetails: (org) => [...operationsKeys.agents(org), "details"],
|
|
2765
|
+
agent: (id, org) => [...operationsKeys.agents(org), id],
|
|
2766
|
+
sessions: (org, params) => [...operationsKeys.all, "sessions", org, params],
|
|
2767
|
+
session: (org, sessionId) => [...operationsKeys.all, "session", org, sessionId]
|
|
2768
|
+
};
|
|
2769
|
+
function useSSEConnection({
|
|
2770
|
+
manager,
|
|
2771
|
+
connectionKey,
|
|
2772
|
+
url,
|
|
2773
|
+
enabled = true,
|
|
2774
|
+
headers,
|
|
2775
|
+
onmessage,
|
|
2776
|
+
onopen,
|
|
2777
|
+
onerror,
|
|
2778
|
+
onclose
|
|
2779
|
+
}) {
|
|
2780
|
+
const [connected, setConnected] = useState(false);
|
|
2781
|
+
const [error, setError] = useState(null);
|
|
2782
|
+
const getAccessToken = useStableAccessToken();
|
|
2783
|
+
const subscriberId = useId();
|
|
2784
|
+
const onmessageRef = useRef(onmessage);
|
|
2785
|
+
const onopenRef = useRef(onopen);
|
|
2786
|
+
const onerrorRef = useRef(onerror);
|
|
2787
|
+
const oncloseRef = useRef(onclose);
|
|
2788
|
+
const headersRef = useRef(headers);
|
|
2789
|
+
onmessageRef.current = onmessage;
|
|
2790
|
+
onopenRef.current = onopen;
|
|
2791
|
+
onerrorRef.current = onerror;
|
|
2792
|
+
oncloseRef.current = onclose;
|
|
2793
|
+
headersRef.current = headers;
|
|
2794
|
+
useEffect(() => {
|
|
2795
|
+
if (!enabled) return;
|
|
2796
|
+
const unsubscribe = manager.subscribe(connectionKey, subscriberId, {
|
|
2797
|
+
url,
|
|
2798
|
+
getToken: getAccessToken,
|
|
2799
|
+
headers: headersRef.current ?? {},
|
|
2800
|
+
onopen(response) {
|
|
2801
|
+
if (response.ok) {
|
|
2802
|
+
setConnected(true);
|
|
2803
|
+
setError(null);
|
|
2804
|
+
}
|
|
2805
|
+
const customError = onopenRef.current?.(response);
|
|
2806
|
+
if (customError) setError(customError);
|
|
2807
|
+
},
|
|
2808
|
+
onmessage(event) {
|
|
2809
|
+
if (!event.data || event.data.trim() === "") return;
|
|
2810
|
+
onmessageRef.current(event.data);
|
|
2811
|
+
},
|
|
2812
|
+
onerror(err) {
|
|
2813
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
2814
|
+
setConnected(false);
|
|
2815
|
+
setError(msg);
|
|
2816
|
+
onerrorRef.current?.(err instanceof Error ? err : new Error(msg));
|
|
2817
|
+
},
|
|
2818
|
+
onclose() {
|
|
2819
|
+
setConnected(false);
|
|
2820
|
+
oncloseRef.current?.();
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
return () => {
|
|
2824
|
+
unsubscribe();
|
|
2825
|
+
setConnected(false);
|
|
2826
|
+
setError(null);
|
|
2827
|
+
};
|
|
2828
|
+
}, [enabled, connectionKey, url, subscriberId, getAccessToken, manager]);
|
|
2829
|
+
return { connected, error };
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// src/hooks/operations/shared/useExecutionLogSSE.ts
|
|
2833
|
+
function useExecutionLogSSE(resourceId, manager, apiUrl) {
|
|
2834
|
+
const queryClient = useQueryClient();
|
|
2835
|
+
const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
|
|
2836
|
+
const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
|
|
2837
|
+
const { isReady: isOrganizationReady, organizationId } = useElevasisServices();
|
|
2838
|
+
const { currentMembership } = useOrganization();
|
|
2839
|
+
const currentWorkOSOrganizationId = currentMembership?.organization?.workos_org_id;
|
|
2840
|
+
const sseUrl = `${apiUrl}/api/execution-engine/sse/${resourceId}`;
|
|
2841
|
+
const headers = useMemo(() => {
|
|
2842
|
+
const h = {};
|
|
2843
|
+
if (currentWorkOSOrganizationId) h[HTTP_HEADERS.WORKOS_ORGANIZATION_ID] = currentWorkOSOrganizationId;
|
|
2844
|
+
return h;
|
|
2845
|
+
}, [currentWorkOSOrganizationId]);
|
|
2846
|
+
const handleMessage = useCallback(
|
|
2847
|
+
(data) => {
|
|
2848
|
+
try {
|
|
2849
|
+
const event = JSON.parse(data);
|
|
2850
|
+
switch (event.type) {
|
|
2851
|
+
case "connected":
|
|
2852
|
+
break;
|
|
2853
|
+
case "new-execution":
|
|
2854
|
+
if (event.executionId) {
|
|
2855
|
+
setLiveExecutions((prev) => {
|
|
2856
|
+
const updated = new Set(prev);
|
|
2857
|
+
updated.add(event.executionId);
|
|
2858
|
+
return updated;
|
|
2859
|
+
});
|
|
2860
|
+
queryClient.invalidateQueries({
|
|
2861
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
break;
|
|
2865
|
+
case "execution-complete":
|
|
2866
|
+
if (event.executionId) {
|
|
2867
|
+
setLiveExecutions((prev) => {
|
|
2868
|
+
const updated = new Set(prev);
|
|
2869
|
+
updated.delete(event.executionId);
|
|
2870
|
+
return updated;
|
|
2871
|
+
});
|
|
2872
|
+
setStreamingLogs((prev) => {
|
|
2873
|
+
const updated = new Map(prev);
|
|
2874
|
+
updated.delete(event.executionId);
|
|
2875
|
+
return updated;
|
|
2876
|
+
});
|
|
2877
|
+
queryClient.invalidateQueries({
|
|
2878
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
2879
|
+
});
|
|
2880
|
+
queryClient.invalidateQueries({
|
|
2881
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
2882
|
+
});
|
|
2883
|
+
}
|
|
2884
|
+
break;
|
|
2885
|
+
case "log":
|
|
2886
|
+
if (event.executionId) {
|
|
2887
|
+
if (event.data?.log) {
|
|
2888
|
+
setStreamingLogs((prev) => {
|
|
2889
|
+
const updated = new Map(prev);
|
|
2890
|
+
const existing = updated.get(event.executionId) || [];
|
|
2891
|
+
updated.set(event.executionId, [...existing, event.data.log]);
|
|
2892
|
+
return updated;
|
|
2893
|
+
});
|
|
2894
|
+
}
|
|
2895
|
+
queryClient.invalidateQueries({
|
|
2896
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2901
|
+
} catch {
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
[organizationId, resourceId, queryClient]
|
|
2905
|
+
);
|
|
2906
|
+
const { connected, error } = useSSEConnection({
|
|
2907
|
+
manager,
|
|
2908
|
+
connectionKey: `resource-${resourceId}`,
|
|
2909
|
+
url: sseUrl,
|
|
2910
|
+
enabled: !!resourceId && !!organizationId && isOrganizationReady,
|
|
2911
|
+
headers,
|
|
2912
|
+
onmessage: handleMessage,
|
|
2913
|
+
onopen: (response) => response.status === 403 ? "Organization access denied" : void 0
|
|
2914
|
+
});
|
|
2915
|
+
useEffect(() => {
|
|
2916
|
+
return () => {
|
|
2917
|
+
setLiveExecutions(/* @__PURE__ */ new Set());
|
|
2918
|
+
setStreamingLogs(/* @__PURE__ */ new Map());
|
|
2919
|
+
};
|
|
2920
|
+
}, [resourceId, organizationId, isOrganizationReady]);
|
|
2921
|
+
return {
|
|
2922
|
+
liveExecutions,
|
|
2923
|
+
connected,
|
|
2924
|
+
error,
|
|
2925
|
+
runningCount: liveExecutions.size,
|
|
2926
|
+
isLive: (executionId) => liveExecutions.has(executionId),
|
|
2927
|
+
streamingLogs
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
3046
2930
|
function useExecutionPanelState({
|
|
3047
2931
|
resourceId,
|
|
3048
2932
|
manager,
|
|
@@ -3660,167 +3544,414 @@ function useEffectivePermissions(membershipId) {
|
|
|
3660
3544
|
staleTime: STALE_TIME_DEFAULT
|
|
3661
3545
|
});
|
|
3662
3546
|
}
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3547
|
+
|
|
3548
|
+
// src/hooks/acquisition/useLists.ts
|
|
3549
|
+
var acquisitionListKeys = {
|
|
3550
|
+
all: ["acquisition-lists"],
|
|
3551
|
+
list: (organizationId) => [...acquisitionListKeys.all, organizationId],
|
|
3552
|
+
detail: (organizationId, listId) => [...acquisitionListKeys.all, organizationId, listId],
|
|
3553
|
+
telemetry: (organizationId) => [...acquisitionListKeys.all, "telemetry", organizationId],
|
|
3554
|
+
progress: (organizationId, listId) => [...acquisitionListKeys.all, "progress", organizationId, listId],
|
|
3555
|
+
executions: (organizationId, listId) => [...acquisitionListKeys.all, "executions", organizationId, listId]
|
|
3556
|
+
};
|
|
3557
|
+
function useLists() {
|
|
3558
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3559
|
+
return useQuery({
|
|
3560
|
+
queryKey: acquisitionListKeys.list(organizationId),
|
|
3561
|
+
queryFn: () => apiRequest("/acquisition/lists"),
|
|
3562
|
+
enabled: isReady
|
|
3563
|
+
});
|
|
3564
|
+
}
|
|
3565
|
+
function useList(listId) {
|
|
3566
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3567
|
+
return useQuery({
|
|
3568
|
+
queryKey: acquisitionListKeys.detail(organizationId, listId),
|
|
3569
|
+
queryFn: () => apiRequest(`/acquisition/lists/${listId}`),
|
|
3570
|
+
enabled: isReady && !!listId
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3573
|
+
function useListsTelemetry() {
|
|
3574
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3575
|
+
return useQuery({
|
|
3576
|
+
queryKey: acquisitionListKeys.telemetry(organizationId),
|
|
3577
|
+
queryFn: () => apiRequest("/acquisition/lists/telemetry"),
|
|
3578
|
+
enabled: isReady
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
function useListProgress(listId) {
|
|
3582
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3583
|
+
return useQuery({
|
|
3584
|
+
queryKey: acquisitionListKeys.progress(organizationId, listId),
|
|
3585
|
+
queryFn: () => apiRequest(`/acquisition/lists/${listId}/progress`),
|
|
3586
|
+
enabled: isReady && !!listId
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
function useListExecutions(listId) {
|
|
3590
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
3591
|
+
return useQuery({
|
|
3592
|
+
queryKey: acquisitionListKeys.executions(organizationId, listId),
|
|
3593
|
+
queryFn: () => apiRequest(`/acquisition/lists/${listId}/executions`),
|
|
3594
|
+
enabled: isReady && !!listId
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
function useCreateList() {
|
|
3598
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3599
|
+
const queryClient = useQueryClient();
|
|
3600
|
+
return useMutation({
|
|
3601
|
+
mutationFn: (body) => apiRequest("/acquisition/lists", {
|
|
3602
|
+
method: "POST",
|
|
3603
|
+
body: JSON.stringify(body)
|
|
3604
|
+
}),
|
|
3605
|
+
onSuccess: () => {
|
|
3606
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
3607
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
|
|
3608
|
+
showSuccessNotification("List created");
|
|
3609
|
+
},
|
|
3610
|
+
onError: (error) => {
|
|
3611
|
+
showApiErrorNotification(error);
|
|
3612
|
+
}
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
function useUpdateList(listId) {
|
|
3616
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3617
|
+
const queryClient = useQueryClient();
|
|
3618
|
+
return useMutation({
|
|
3619
|
+
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}`, {
|
|
3620
|
+
method: "PATCH",
|
|
3621
|
+
body: JSON.stringify(body)
|
|
3622
|
+
}),
|
|
3623
|
+
onSuccess: () => {
|
|
3624
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
3625
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
3626
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
|
|
3627
|
+
showSuccessNotification("List updated");
|
|
3628
|
+
},
|
|
3629
|
+
onError: (error) => {
|
|
3630
|
+
showApiErrorNotification(error);
|
|
3631
|
+
}
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3634
|
+
function useUpdateListConfig(listId) {
|
|
3635
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3636
|
+
const queryClient = useQueryClient();
|
|
3637
|
+
return useMutation({
|
|
3638
|
+
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/config`, {
|
|
3639
|
+
method: "PATCH",
|
|
3640
|
+
body: JSON.stringify(body)
|
|
3641
|
+
}),
|
|
3642
|
+
onSuccess: () => {
|
|
3643
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
3644
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
3645
|
+
showSuccessNotification("List configuration saved");
|
|
3646
|
+
},
|
|
3647
|
+
onError: (error) => {
|
|
3648
|
+
showApiErrorNotification(error);
|
|
3649
|
+
}
|
|
3650
|
+
});
|
|
3651
|
+
}
|
|
3652
|
+
function useDeleteList() {
|
|
3653
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3654
|
+
const queryClient = useQueryClient();
|
|
3655
|
+
return useMutation({
|
|
3656
|
+
mutationFn: (listId) => apiRequest(`/acquisition/lists/${listId}`, {
|
|
3657
|
+
method: "DELETE"
|
|
3658
|
+
}),
|
|
3659
|
+
onSuccess: () => {
|
|
3660
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
|
|
3661
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
|
|
3662
|
+
showSuccessNotification("List deleted");
|
|
3663
|
+
},
|
|
3664
|
+
onError: (error) => {
|
|
3665
|
+
showApiErrorNotification(error);
|
|
3666
|
+
}
|
|
3667
|
+
});
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
// src/hooks/executions/useWorkflowExecution.ts
|
|
3671
|
+
function useWorkflowExecution({
|
|
3672
|
+
workflowId,
|
|
3673
|
+
listId
|
|
3673
3674
|
}) {
|
|
3674
|
-
const
|
|
3675
|
-
const
|
|
3676
|
-
const
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
url,
|
|
3692
|
-
getToken: getAccessToken,
|
|
3693
|
-
headers: headersRef.current ?? {},
|
|
3694
|
-
onopen(response) {
|
|
3695
|
-
if (response.ok) {
|
|
3696
|
-
setConnected(true);
|
|
3697
|
-
setError(null);
|
|
3698
|
-
}
|
|
3699
|
-
const customError = onopenRef.current?.(response);
|
|
3700
|
-
if (customError) setError(customError);
|
|
3701
|
-
},
|
|
3702
|
-
onmessage(event) {
|
|
3703
|
-
if (!event.data || event.data.trim() === "") return;
|
|
3704
|
-
onmessageRef.current(event.data);
|
|
3705
|
-
},
|
|
3706
|
-
onerror(err) {
|
|
3707
|
-
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3708
|
-
setConnected(false);
|
|
3709
|
-
setError(msg);
|
|
3710
|
-
onerrorRef.current?.(err instanceof Error ? err : new Error(msg));
|
|
3711
|
-
},
|
|
3712
|
-
onclose() {
|
|
3713
|
-
setConnected(false);
|
|
3714
|
-
oncloseRef.current?.();
|
|
3675
|
+
const mutation = useExecuteAsync();
|
|
3676
|
+
const queryClient = useQueryClient();
|
|
3677
|
+
const { organizationId } = useElevasisServices();
|
|
3678
|
+
const execute = useCallback(
|
|
3679
|
+
async ({ input }) => {
|
|
3680
|
+
const result = await mutation.mutateAsync({
|
|
3681
|
+
resourceId: workflowId,
|
|
3682
|
+
resourceType: "workflow",
|
|
3683
|
+
input
|
|
3684
|
+
});
|
|
3685
|
+
queryClient.invalidateQueries({
|
|
3686
|
+
queryKey: executionsKeys.executionsListBase(organizationId, workflowId)
|
|
3687
|
+
});
|
|
3688
|
+
if (listId) {
|
|
3689
|
+
queryClient.invalidateQueries({
|
|
3690
|
+
queryKey: acquisitionListKeys.executions(organizationId, listId)
|
|
3691
|
+
});
|
|
3715
3692
|
}
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3693
|
+
return result;
|
|
3694
|
+
},
|
|
3695
|
+
[listId, mutation, organizationId, queryClient, workflowId]
|
|
3696
|
+
);
|
|
3697
|
+
return {
|
|
3698
|
+
execute,
|
|
3699
|
+
executionId: mutation.data?.executionId ?? null,
|
|
3700
|
+
status: mutation.data?.status ?? null,
|
|
3701
|
+
isIdle: mutation.isIdle,
|
|
3702
|
+
isPending: mutation.isPending,
|
|
3703
|
+
isSuccess: mutation.isSuccess,
|
|
3704
|
+
isError: mutation.isError,
|
|
3705
|
+
error: mutation.error,
|
|
3706
|
+
data: mutation.data,
|
|
3707
|
+
reset: mutation.reset
|
|
3708
|
+
};
|
|
3724
3709
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3710
|
+
function createDisabledManager() {
|
|
3711
|
+
return {
|
|
3712
|
+
subscribe: () => () => {
|
|
3713
|
+
},
|
|
3714
|
+
closeConnection: () => {
|
|
3715
|
+
},
|
|
3716
|
+
getConnectionInfo: () => /* @__PURE__ */ new Map()
|
|
3717
|
+
};
|
|
3718
|
+
}
|
|
3719
|
+
function useExecutionSSE(resourceId, options = {}) {
|
|
3728
3720
|
const queryClient = useQueryClient();
|
|
3721
|
+
const features = useOptionalElevasisFeatures();
|
|
3722
|
+
const { currentMembership } = useOrganization();
|
|
3723
|
+
const { isReady, organizationId } = useElevasisServices();
|
|
3724
|
+
const {
|
|
3725
|
+
enabled = true,
|
|
3726
|
+
apiUrl: apiUrlOverride,
|
|
3727
|
+
manager: managerOverride,
|
|
3728
|
+
listId,
|
|
3729
|
+
onEvent
|
|
3730
|
+
} = options;
|
|
3731
|
+
const [events, setEvents] = useState([]);
|
|
3729
3732
|
const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
|
|
3730
3733
|
const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
|
|
3731
|
-
const
|
|
3732
|
-
const
|
|
3733
|
-
const
|
|
3734
|
-
const
|
|
3734
|
+
const disabledManager = useMemo(() => createDisabledManager(), []);
|
|
3735
|
+
const apiUrl = apiUrlOverride ?? features?.operationsApiUrl;
|
|
3736
|
+
const manager = managerOverride ?? features?.operationsSSEManager ?? disabledManager;
|
|
3737
|
+
const workOSOrganizationId = currentMembership?.organization?.workos_org_id ?? organizationId;
|
|
3738
|
+
const connectionKey = `execution-sse-${workOSOrganizationId ?? "unknown"}-${resourceId}`;
|
|
3735
3739
|
const headers = useMemo(() => {
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
+
if (!workOSOrganizationId) return {};
|
|
3741
|
+
const nextHeaders = {};
|
|
3742
|
+
nextHeaders[HTTP_HEADERS.WORKOS_ORGANIZATION_ID] = workOSOrganizationId;
|
|
3743
|
+
return nextHeaders;
|
|
3744
|
+
}, [workOSOrganizationId]);
|
|
3745
|
+
const clear = useCallback(() => {
|
|
3746
|
+
setEvents([]);
|
|
3747
|
+
setLiveExecutions(/* @__PURE__ */ new Set());
|
|
3748
|
+
setStreamingLogs(/* @__PURE__ */ new Map());
|
|
3749
|
+
}, []);
|
|
3740
3750
|
const handleMessage = useCallback(
|
|
3741
|
-
(
|
|
3751
|
+
(rawData) => {
|
|
3742
3752
|
try {
|
|
3743
|
-
const event = JSON.parse(
|
|
3753
|
+
const event = JSON.parse(rawData);
|
|
3754
|
+
setEvents((current) => [...current, event]);
|
|
3755
|
+
onEvent?.(event);
|
|
3744
3756
|
switch (event.type) {
|
|
3745
|
-
case "connected":
|
|
3746
|
-
break;
|
|
3747
3757
|
case "new-execution":
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
});
|
|
3757
|
-
}
|
|
3758
|
+
setLiveExecutions((current) => {
|
|
3759
|
+
const next = new Set(current);
|
|
3760
|
+
next.add(event.executionId);
|
|
3761
|
+
return next;
|
|
3762
|
+
});
|
|
3763
|
+
queryClient.invalidateQueries({
|
|
3764
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
3765
|
+
});
|
|
3758
3766
|
break;
|
|
3759
3767
|
case "execution-complete":
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3768
|
+
setLiveExecutions((current) => {
|
|
3769
|
+
const next = new Set(current);
|
|
3770
|
+
next.delete(event.executionId);
|
|
3771
|
+
return next;
|
|
3772
|
+
});
|
|
3773
|
+
setStreamingLogs((current) => {
|
|
3774
|
+
const next = new Map(current);
|
|
3775
|
+
next.delete(event.executionId);
|
|
3776
|
+
return next;
|
|
3777
|
+
});
|
|
3778
|
+
queryClient.invalidateQueries({
|
|
3779
|
+
queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
|
|
3780
|
+
});
|
|
3781
|
+
queryClient.invalidateQueries({
|
|
3782
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
3783
|
+
});
|
|
3784
|
+
if (listId) {
|
|
3771
3785
|
queryClient.invalidateQueries({
|
|
3772
|
-
queryKey:
|
|
3786
|
+
queryKey: acquisitionListKeys.executions(organizationId, listId)
|
|
3773
3787
|
});
|
|
3774
3788
|
queryClient.invalidateQueries({
|
|
3775
|
-
queryKey:
|
|
3789
|
+
queryKey: acquisitionListKeys.progress(organizationId, listId)
|
|
3776
3790
|
});
|
|
3777
3791
|
}
|
|
3778
3792
|
break;
|
|
3779
3793
|
case "log":
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
});
|
|
3792
|
-
}
|
|
3794
|
+
setStreamingLogs((current) => {
|
|
3795
|
+
const next = new Map(current);
|
|
3796
|
+
const existing = next.get(event.executionId) ?? [];
|
|
3797
|
+
next.set(event.executionId, [...existing, event.data.log]);
|
|
3798
|
+
return next;
|
|
3799
|
+
});
|
|
3800
|
+
queryClient.invalidateQueries({
|
|
3801
|
+
queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
|
|
3802
|
+
});
|
|
3803
|
+
break;
|
|
3804
|
+
case "connected":
|
|
3793
3805
|
break;
|
|
3794
3806
|
}
|
|
3795
3807
|
} catch {
|
|
3796
3808
|
}
|
|
3797
3809
|
},
|
|
3798
|
-
[organizationId,
|
|
3810
|
+
[listId, onEvent, organizationId, queryClient, resourceId]
|
|
3799
3811
|
);
|
|
3800
3812
|
const { connected, error } = useSSEConnection({
|
|
3801
3813
|
manager,
|
|
3802
|
-
connectionKey
|
|
3803
|
-
url:
|
|
3804
|
-
enabled:
|
|
3814
|
+
connectionKey,
|
|
3815
|
+
url: apiUrl ? `${apiUrl}/api/execution-engine/sse/${resourceId}` : "",
|
|
3816
|
+
enabled: enabled && Boolean(apiUrl && resourceId && workOSOrganizationId && isReady),
|
|
3805
3817
|
headers,
|
|
3806
3818
|
onmessage: handleMessage,
|
|
3807
3819
|
onopen: (response) => response.status === 403 ? "Organization access denied" : void 0
|
|
3808
3820
|
});
|
|
3809
|
-
useEffect(() =>
|
|
3810
|
-
return () => {
|
|
3811
|
-
setLiveExecutions(/* @__PURE__ */ new Set());
|
|
3812
|
-
setStreamingLogs(/* @__PURE__ */ new Map());
|
|
3813
|
-
};
|
|
3814
|
-
}, [resourceId, organizationId, isOrganizationReady]);
|
|
3821
|
+
useEffect(() => () => clear(), [clear, connectionKey]);
|
|
3815
3822
|
return {
|
|
3816
|
-
liveExecutions,
|
|
3817
3823
|
connected,
|
|
3818
3824
|
error,
|
|
3825
|
+
events,
|
|
3826
|
+
latestEvent: events.length > 0 ? events[events.length - 1] : null,
|
|
3827
|
+
liveExecutions,
|
|
3828
|
+
streamingLogs,
|
|
3819
3829
|
runningCount: liveExecutions.size,
|
|
3820
3830
|
isLive: (executionId) => liveExecutions.has(executionId),
|
|
3821
|
-
|
|
3831
|
+
clear
|
|
3822
3832
|
};
|
|
3823
3833
|
}
|
|
3834
|
+
function useRetryExecution() {
|
|
3835
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3836
|
+
const queryClient = useQueryClient();
|
|
3837
|
+
return useMutation({
|
|
3838
|
+
mutationFn: async ({ resourceId, resourceType, input }) => {
|
|
3839
|
+
const response = await apiRequest("/execution-engine/execute-async", {
|
|
3840
|
+
method: "POST",
|
|
3841
|
+
body: JSON.stringify({ resourceType, resourceId, input })
|
|
3842
|
+
});
|
|
3843
|
+
return { ...response, resourceId };
|
|
3844
|
+
},
|
|
3845
|
+
onSuccess: (data) => {
|
|
3846
|
+
queryClient.invalidateQueries({
|
|
3847
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
3848
|
+
});
|
|
3849
|
+
}
|
|
3850
|
+
});
|
|
3851
|
+
}
|
|
3852
|
+
function useCancelExecution() {
|
|
3853
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3854
|
+
const queryClient = useQueryClient();
|
|
3855
|
+
return useMutation({
|
|
3856
|
+
mutationFn: async ({ resourceId, executionId }) => {
|
|
3857
|
+
const response = await apiRequest(
|
|
3858
|
+
`/execution-engine/executions/${resourceId}/${executionId}/cancel`,
|
|
3859
|
+
{ method: "POST" }
|
|
3860
|
+
);
|
|
3861
|
+
return { ...response, resourceId, executionId };
|
|
3862
|
+
},
|
|
3863
|
+
onSuccess: (data) => {
|
|
3864
|
+
queryClient.invalidateQueries({
|
|
3865
|
+
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
3866
|
+
});
|
|
3867
|
+
queryClient.invalidateQueries({
|
|
3868
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3873
|
+
function useDeleteExecution() {
|
|
3874
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3875
|
+
const queryClient = useQueryClient();
|
|
3876
|
+
return useMutation({
|
|
3877
|
+
mutationFn: async ({ resourceId, executionId }) => {
|
|
3878
|
+
await apiRequest(`/execution-engine/executions/${resourceId}/${executionId}`, {
|
|
3879
|
+
method: "DELETE"
|
|
3880
|
+
});
|
|
3881
|
+
return { resourceId, executionId };
|
|
3882
|
+
},
|
|
3883
|
+
onSuccess: (data) => {
|
|
3884
|
+
queryClient.removeQueries({
|
|
3885
|
+
queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
|
|
3886
|
+
});
|
|
3887
|
+
queryClient.invalidateQueries({
|
|
3888
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
});
|
|
3892
|
+
}
|
|
3893
|
+
function useBulkDeleteExecutions() {
|
|
3894
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
3895
|
+
const queryClient = useQueryClient();
|
|
3896
|
+
return useMutation({
|
|
3897
|
+
mutationFn: async ({
|
|
3898
|
+
resourceId,
|
|
3899
|
+
resourceStatus
|
|
3900
|
+
}) => {
|
|
3901
|
+
const params = new URLSearchParams();
|
|
3902
|
+
if (resourceStatus && resourceStatus !== "all") {
|
|
3903
|
+
params.set("resourceStatus", resourceStatus);
|
|
3904
|
+
}
|
|
3905
|
+
const queryString = params.toString();
|
|
3906
|
+
const endpoint = `/execution-engine/executions/${resourceId}${queryString ? `?${queryString}` : ""}`;
|
|
3907
|
+
const response = await apiRequest(
|
|
3908
|
+
endpoint,
|
|
3909
|
+
{ method: "DELETE" }
|
|
3910
|
+
);
|
|
3911
|
+
return { resourceId, deletedCount: response.deletedCount, resourceStatus };
|
|
3912
|
+
},
|
|
3913
|
+
onSuccess: (data) => {
|
|
3914
|
+
queryClient.invalidateQueries({
|
|
3915
|
+
queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3920
|
+
function useResourceDefinition(resourceId, enabled = true) {
|
|
3921
|
+
const { apiRequest, organizationId, isReady } = useElevasisServices();
|
|
3922
|
+
return useQuery({
|
|
3923
|
+
queryKey: executionsKeys.resourceDefinition(organizationId, resourceId),
|
|
3924
|
+
queryFn: () => {
|
|
3925
|
+
const service = new OperationsService(apiRequest);
|
|
3926
|
+
return service.getResourceDefinition(resourceId);
|
|
3927
|
+
},
|
|
3928
|
+
enabled: enabled && isReady && !!resourceId,
|
|
3929
|
+
retry: 2,
|
|
3930
|
+
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4)
|
|
3931
|
+
});
|
|
3932
|
+
}
|
|
3933
|
+
function useArchivedLogs(executionId) {
|
|
3934
|
+
const { apiRequest } = useElevasisServices();
|
|
3935
|
+
const [logs, setLogs] = useState(null);
|
|
3936
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
3937
|
+
const [error, setError] = useState(null);
|
|
3938
|
+
const fetch = useCallback(async () => {
|
|
3939
|
+
if (!executionId || isLoading) return;
|
|
3940
|
+
setIsLoading(true);
|
|
3941
|
+
setError(null);
|
|
3942
|
+
try {
|
|
3943
|
+
const response = await apiRequest(
|
|
3944
|
+
`/observability/executions/${executionId}/archived-logs`
|
|
3945
|
+
);
|
|
3946
|
+
setLogs(response.logs);
|
|
3947
|
+
} catch (err) {
|
|
3948
|
+
setError(err instanceof Error ? err.message : "Failed to load archived logs");
|
|
3949
|
+
} finally {
|
|
3950
|
+
setIsLoading(false);
|
|
3951
|
+
}
|
|
3952
|
+
}, [executionId, apiRequest, isLoading]);
|
|
3953
|
+
return { logs, isLoading, error, fetch };
|
|
3954
|
+
}
|
|
3824
3955
|
function useActivitiesRealtime(organizationId, enabled) {
|
|
3825
3956
|
const queryClient = useQueryClient();
|
|
3826
3957
|
const supabase = useSupabase();
|
|
@@ -4477,6 +4608,32 @@ function useDealDetail(acqDealId) {
|
|
|
4477
4608
|
enabled: isReady && !!acqDealId
|
|
4478
4609
|
});
|
|
4479
4610
|
}
|
|
4611
|
+
function useTransitionState() {
|
|
4612
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
4613
|
+
const queryClient = useQueryClient();
|
|
4614
|
+
return useMutation({
|
|
4615
|
+
mutationFn: async (input) => {
|
|
4616
|
+
const { dealId, stateKey, reason, expectedUpdatedAt } = input;
|
|
4617
|
+
await apiRequest(`/deals/${dealId}/state`, {
|
|
4618
|
+
method: "PATCH",
|
|
4619
|
+
body: JSON.stringify({
|
|
4620
|
+
stateKey,
|
|
4621
|
+
...reason !== void 0 ? { reason } : {},
|
|
4622
|
+
...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
|
|
4623
|
+
})
|
|
4624
|
+
});
|
|
4625
|
+
},
|
|
4626
|
+
onSuccess: (_, variables) => {
|
|
4627
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
|
|
4628
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
|
|
4629
|
+
queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
|
|
4630
|
+
},
|
|
4631
|
+
onError: (error) => {
|
|
4632
|
+
queryClient.invalidateQueries({ queryKey: dealKeys.all });
|
|
4633
|
+
showApiErrorNotification(error);
|
|
4634
|
+
}
|
|
4635
|
+
});
|
|
4636
|
+
}
|
|
4480
4637
|
function useExecuteAction({ dealId }) {
|
|
4481
4638
|
const { apiRequest, organizationId } = useElevasisServices();
|
|
4482
4639
|
const queryClient = useQueryClient();
|
|
@@ -4498,6 +4655,100 @@ function useExecuteAction({ dealId }) {
|
|
|
4498
4655
|
}
|
|
4499
4656
|
});
|
|
4500
4657
|
}
|
|
4658
|
+
var dealNoteKeys = {
|
|
4659
|
+
all: ["deal-notes"],
|
|
4660
|
+
list: (organizationId, dealId) => ["deal-notes", organizationId, dealId]
|
|
4661
|
+
};
|
|
4662
|
+
function useDealNotes(dealId) {
|
|
4663
|
+
const { apiRequest, isReady, organizationId } = useElevasisServices();
|
|
4664
|
+
return useQuery({
|
|
4665
|
+
queryKey: dealNoteKeys.list(organizationId, dealId),
|
|
4666
|
+
queryFn: async () => {
|
|
4667
|
+
return apiRequest(`/deals/${dealId}/notes`);
|
|
4668
|
+
},
|
|
4669
|
+
enabled: isReady && !!dealId
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
function useCreateDealNote() {
|
|
4673
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
4674
|
+
const queryClient = useQueryClient();
|
|
4675
|
+
return useMutation({
|
|
4676
|
+
mutationFn: async ({ dealId, body }) => {
|
|
4677
|
+
return apiRequest(`/deals/${dealId}/notes`, {
|
|
4678
|
+
method: "POST",
|
|
4679
|
+
body: JSON.stringify({ body })
|
|
4680
|
+
});
|
|
4681
|
+
},
|
|
4682
|
+
onSuccess: (_, variables) => {
|
|
4683
|
+
queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
|
|
4684
|
+
queryClient.invalidateQueries({ queryKey: ["recent-crm-activity", organizationId] });
|
|
4685
|
+
showSuccessNotification("Note added");
|
|
4686
|
+
},
|
|
4687
|
+
onError: (error) => {
|
|
4688
|
+
showApiErrorNotification(error);
|
|
4689
|
+
}
|
|
4690
|
+
});
|
|
4691
|
+
}
|
|
4692
|
+
function useAddCompaniesToList(listId) {
|
|
4693
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
4694
|
+
const queryClient = useQueryClient();
|
|
4695
|
+
return useMutation({
|
|
4696
|
+
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/companies`, {
|
|
4697
|
+
method: "POST",
|
|
4698
|
+
body: JSON.stringify(body)
|
|
4699
|
+
}),
|
|
4700
|
+
onSuccess: () => {
|
|
4701
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
4702
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
4703
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
|
|
4704
|
+
queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
|
|
4705
|
+
showSuccessNotification("Companies added to list");
|
|
4706
|
+
},
|
|
4707
|
+
onError: (error) => {
|
|
4708
|
+
showApiErrorNotification(error);
|
|
4709
|
+
}
|
|
4710
|
+
});
|
|
4711
|
+
}
|
|
4712
|
+
function useRemoveCompaniesFromList(listId) {
|
|
4713
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
4714
|
+
const queryClient = useQueryClient();
|
|
4715
|
+
return useMutation({
|
|
4716
|
+
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/companies`, {
|
|
4717
|
+
method: "DELETE",
|
|
4718
|
+
body: JSON.stringify(body)
|
|
4719
|
+
}),
|
|
4720
|
+
onSuccess: () => {
|
|
4721
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
4722
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
4723
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
|
|
4724
|
+
queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
|
|
4725
|
+
showSuccessNotification("Companies removed from list");
|
|
4726
|
+
},
|
|
4727
|
+
onError: (error) => {
|
|
4728
|
+
showApiErrorNotification(error);
|
|
4729
|
+
}
|
|
4730
|
+
});
|
|
4731
|
+
}
|
|
4732
|
+
function useAddContactsToList(listId) {
|
|
4733
|
+
const { apiRequest, organizationId } = useElevasisServices();
|
|
4734
|
+
const queryClient = useQueryClient();
|
|
4735
|
+
return useMutation({
|
|
4736
|
+
mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/contacts`, {
|
|
4737
|
+
method: "POST",
|
|
4738
|
+
body: JSON.stringify(body)
|
|
4739
|
+
}),
|
|
4740
|
+
onSuccess: () => {
|
|
4741
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
4742
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
|
|
4743
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
|
|
4744
|
+
queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
|
|
4745
|
+
showSuccessNotification("Contacts added to list");
|
|
4746
|
+
},
|
|
4747
|
+
onError: (error) => {
|
|
4748
|
+
showApiErrorNotification(error);
|
|
4749
|
+
}
|
|
4750
|
+
});
|
|
4751
|
+
}
|
|
4501
4752
|
|
|
4502
4753
|
// src/hooks/acquisition/useBatchTelemetry.ts
|
|
4503
4754
|
function useBatchTelemetry() {
|
|
@@ -5054,4 +5305,4 @@ function useProjectRealtime(projectId) {
|
|
|
5054
5305
|
});
|
|
5055
5306
|
}
|
|
5056
5307
|
|
|
5057
|
-
export { ApiKeyService, COMMAND_VIEW_VISUALIZATION_MODES, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getCommandViewGraphPositions, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useDeriveActions, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAction, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useHasPermission, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useTransitionListCompany, useTransitionListMember, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
|
|
5308
|
+
export { ApiKeyService, COMMAND_VIEW_VISUALIZATION_MODES, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getCommandViewGraphPositions, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useAddCompaniesToList, useAddContactsToList, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useDeriveActions, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAction, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutionSSE, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useHasPermission, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRemoveCompaniesFromList, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useTransitionListCompany, useTransitionListMember, useTransitionState, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification, useWorkflowExecution };
|