@elevasis/ui 2.81.0 → 2.83.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/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +3 -3
- package/dist/app/index.d.ts +68 -3710
- package/dist/app/index.js +12 -10
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.js +4 -4
- package/dist/charts/index.d.ts +10 -10
- package/dist/charts/index.js +4 -4
- package/dist/{chunk-AI5OYVLR.js → chunk-2WXFPHBV.js} +1 -1
- package/dist/{chunk-7D4FKBB4.js → chunk-34YVWPW6.js} +1 -1
- package/dist/{chunk-BLYK6I4D.js → chunk-4ILZBLQY.js} +1 -1
- package/dist/{chunk-TLMNBOAG.js → chunk-6DWWZXLS.js} +5 -5
- package/dist/{chunk-LTRJZOHA.js → chunk-7D6ZLLOZ.js} +1 -1
- package/dist/chunk-BIKD5UUM.js +386 -0
- package/dist/{chunk-HDLYC63N.js → chunk-CEP5A55J.js} +1 -1
- package/dist/{chunk-JLKZUO2I.js → chunk-CUJBF3X6.js} +1 -1
- package/dist/{chunk-PNCJJE4Z.js → chunk-DRTC7LRG.js} +1 -1
- package/dist/{chunk-ROC2TFPS.js → chunk-EEONAV4R.js} +2 -2
- package/dist/{chunk-HDITVHZT.js → chunk-EHWHG6PW.js} +2 -2
- package/dist/{chunk-AKANHRQ5.js → chunk-GKTQEVSO.js} +3 -4
- package/dist/{chunk-7RS2NUC6.js → chunk-IR7HVER2.js} +1 -1
- package/dist/{chunk-3ZADOARU.js → chunk-IYY27OLF.js} +5 -5
- package/dist/{chunk-LGJASP5H.js → chunk-JCETE623.js} +1 -1
- package/dist/{chunk-42C2WVYU.js → chunk-JJCY23X3.js} +2 -2
- package/dist/{chunk-XUL4UBYJ.js → chunk-JPQNXH4X.js} +3 -3
- package/dist/{chunk-SWC54W3A.js → chunk-JXS2LDGN.js} +2 -2
- package/dist/{chunk-G6VHIXWD.js → chunk-KQ2YSAXL.js} +1 -1
- package/dist/{chunk-SOBKRB4N.js → chunk-LACAXGZK.js} +1 -1
- package/dist/{chunk-QFKOHZM3.js → chunk-LKM32PP6.js} +3 -3
- package/dist/{chunk-PJN6CMWZ.js → chunk-LKZV5TDL.js} +1 -1
- package/dist/{chunk-ILOKKA6L.js → chunk-MZXUISBI.js} +11 -12
- package/dist/{chunk-K635QVGI.js → chunk-N5O5OYLB.js} +8 -8
- package/dist/{chunk-FPRDEKFY.js → chunk-OC7TYJ75.js} +1 -1
- package/dist/{chunk-6YWBMLEM.js → chunk-PQEGQ63N.js} +8 -9
- package/dist/{chunk-52AZTFUR.js → chunk-QQ3JCEN2.js} +5 -5
- package/dist/{chunk-SHJYK2X4.js → chunk-U727JFPK.js} +3 -3
- package/dist/{chunk-DEZW7QDI.js → chunk-VFWOUD3M.js} +31 -2
- package/dist/{chunk-PSGSFPWA.js → chunk-VGHYGEPR.js} +98 -30
- package/dist/{chunk-LTKBVL7D.js → chunk-WYFNXCDJ.js} +4 -4
- package/dist/{chunk-KU7KN5VN.js → chunk-XYRMUHWN.js} +1 -1
- package/dist/{chunk-O4XUKLRY.js → chunk-YZ47UWV5.js} +1 -1
- package/dist/{chunk-5GYJ3IDO.js → chunk-YZ5Q34MK.js} +11 -6
- package/dist/{chunk-QEQXPWOK.js → chunk-ZS3BJLOJ.js} +9 -9
- package/dist/components/chat/index.d.ts +4 -5
- package/dist/components/index.d.ts +210 -198
- package/dist/components/index.js +38 -39
- package/dist/components/navigation/index.js +5 -5
- package/dist/execution/index.d.ts +2 -2
- package/dist/features/auth/index.d.ts +6 -6
- package/dist/features/auth/index.js +6 -6
- package/dist/features/clients/index.d.ts +11 -11
- package/dist/features/clients/index.js +7 -7
- package/dist/features/content/index.d.ts +36 -24
- package/dist/features/content/index.js +7 -7
- package/dist/features/crm/index.d.ts +29 -17
- package/dist/features/crm/index.js +9 -10
- package/dist/features/dashboard/index.d.ts +12 -6
- package/dist/features/dashboard/index.js +6 -6
- package/dist/features/delivery/index.d.ts +13 -13
- package/dist/features/delivery/index.js +17 -17
- package/dist/features/knowledge/index.js +4 -4
- package/dist/features/lead-gen/index.d.ts +40 -26
- package/dist/features/lead-gen/index.js +10 -11
- package/dist/features/monitoring/index.d.ts +8 -8
- package/dist/features/monitoring/index.js +8 -8
- package/dist/features/monitoring/requests/index.d.ts +10 -10
- package/dist/features/monitoring/requests/index.js +6 -6
- package/dist/features/notes/index.d.ts +7 -7
- package/dist/features/operations/index.d.ts +42 -30
- package/dist/features/operations/index.js +11 -11
- package/dist/features/public-agent-chat/index.d.ts +3 -3
- package/dist/features/right-panel-host/index.d.ts +3 -3
- package/dist/features/seo/index.d.ts +7 -7
- package/dist/features/seo/index.js +7 -7
- package/dist/features/settings/index.d.ts +13 -13
- package/dist/features/settings/index.js +7 -7
- package/dist/hooks/access/index.js +4 -4
- package/dist/hooks/delivery/index.js +3 -3
- package/dist/hooks/published.d.ts +21 -7
- package/dist/hooks/published.js +15 -15
- package/dist/knowledge/index.d.ts +65 -37
- package/dist/knowledge/index.js +20 -7185
- package/dist/layout/index.d.ts +48 -48
- package/dist/layout/index.js +8 -8
- package/dist/organization/index.d.ts +2 -3
- package/dist/provider/ElevasisServiceContext.d.ts +1 -2
- package/dist/provider/index.d.ts +103 -3736
- package/dist/provider/index.js +4 -4
- package/dist/provider/published.d.ts +80 -3721
- package/dist/provider/published.js +4 -4
- package/dist/router/index.d.ts +2 -3
- package/dist/test-utils/index.d.ts +4 -4
- package/dist/test-utils/index.js +3 -3
- package/dist/types/index.d.ts +6 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +1 -1
- package/dist/vite/index.js +2 -2
- package/dist/vite-plugin-knowledge/index.js +1 -1
- package/package.json +5 -5
- package/src/knowledge/README.md +32 -32
- package/dist/chunk-6J3SCCZ2.js +0 -200
- package/dist/chunk-75OLN23F.js +0 -231
- package/dist/knowledge-search-index-UPKXCXQP.js +0 -1539
package/dist/app/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { AppErrorBoundary } from '../chunk-
|
|
2
|
-
import { SidebarProvider, AppShellContainer, Sidebar, AppShellRightSideContainer, AppShellRightSideOuterContainer } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
1
|
+
import { AppErrorBoundary } from '../chunk-CEP5A55J.js';
|
|
2
|
+
import { SidebarProvider, AppShellContainer, Sidebar, AppShellRightSideContainer, AppShellRightSideOuterContainer } from '../chunk-XYRMUHWN.js';
|
|
3
|
+
import '../chunk-CUJBF3X6.js';
|
|
4
|
+
import '../chunk-JCETE623.js';
|
|
5
|
+
import '../chunk-OC7TYJ75.js';
|
|
6
|
+
import '../chunk-LACAXGZK.js';
|
|
7
7
|
import '../chunk-BZZCNLT6.js';
|
|
8
|
-
import { useSessionCheck, ElevasisSystemsProvider, useElevasisSystems, SystemShell, ElevasisUIProvider } from '../chunk-
|
|
8
|
+
import { useSessionCheck, ElevasisSystemsProvider, useElevasisSystems, SystemShell, ElevasisUIProvider } from '../chunk-VGHYGEPR.js';
|
|
9
9
|
import '../chunk-4WLAVUPS.js';
|
|
10
10
|
import '../chunk-RXZ3XDBM.js';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-IR7HVER2.js';
|
|
12
12
|
import '../chunk-L7BZZ4SI.js';
|
|
13
|
-
import '../chunk-
|
|
13
|
+
import '../chunk-DRTC7LRG.js';
|
|
14
14
|
import '../chunk-62GVNH5U.js';
|
|
15
15
|
import { useInitialization } from '../chunk-P45GQ3ZW.js';
|
|
16
16
|
import '../chunk-IIMC4TRH.js';
|
|
@@ -21,7 +21,7 @@ import '../chunk-YJ437RDY.js';
|
|
|
21
21
|
import '../chunk-DD3CCMCZ.js';
|
|
22
22
|
import '../chunk-RNP5R5I3.js';
|
|
23
23
|
import '../chunk-RT4KRGZT.js';
|
|
24
|
-
import '../chunk-
|
|
24
|
+
import '../chunk-VFWOUD3M.js';
|
|
25
25
|
import '../chunk-6XBZPKMI.js';
|
|
26
26
|
import '../chunk-7ZUXA2NW.js';
|
|
27
27
|
import '../chunk-BI5VDO2K.js';
|
|
@@ -126,6 +126,7 @@ function renderTopbar(topbar, context) {
|
|
|
126
126
|
function ElevasisAuthenticatedShell({
|
|
127
127
|
systems,
|
|
128
128
|
organizationModel,
|
|
129
|
+
knowledgeBodies,
|
|
129
130
|
logos,
|
|
130
131
|
topbar,
|
|
131
132
|
children,
|
|
@@ -164,6 +165,7 @@ function ElevasisAuthenticatedShell({
|
|
|
164
165
|
{
|
|
165
166
|
systems,
|
|
166
167
|
organizationModel,
|
|
168
|
+
knowledgeBodies,
|
|
167
169
|
timeRange,
|
|
168
170
|
operationsApiUrl,
|
|
169
171
|
operationsSSEManager,
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
5
|
/** A WorkOS organization id (`org_...`) -- the auth identity for API/SSE/query keys. */
|
|
@@ -242,7 +241,7 @@ interface ProtectedRouteProps {
|
|
|
242
241
|
* <WelcomePage />
|
|
243
242
|
* </ProtectedRoute>
|
|
244
243
|
*/
|
|
245
|
-
declare function ProtectedRoute({ children, redirectTo, fallback, errorFallback, waitForOrganization }: ProtectedRouteProps):
|
|
244
|
+
declare function ProtectedRoute({ children, redirectTo, fallback, errorFallback, waitForOrganization }: ProtectedRouteProps): react.JSX.Element | null;
|
|
246
245
|
|
|
247
246
|
interface UseAccessResult extends AccessAnswer {
|
|
248
247
|
isReady: boolean;
|
|
@@ -260,7 +259,7 @@ interface AccessGuardProps {
|
|
|
260
259
|
/**
|
|
261
260
|
* Unified route/UI guard for the shared Access Model.
|
|
262
261
|
*/
|
|
263
|
-
declare function AccessGuard({ accessKey, children, fallback, loadingFallback, redirectTo }: AccessGuardProps):
|
|
262
|
+
declare function AccessGuard({ accessKey, children, fallback, loadingFallback, redirectTo }: AccessGuardProps): react.JSX.Element;
|
|
264
263
|
|
|
265
264
|
export { AccessGuard, AccessKeys, AuthProvider, ProtectedRoute, useAuthContext, useSessionCheck as useRefocusSessionCheck, useSessionCheck, useStableAccessToken };
|
|
266
265
|
export type { AccessGuardProps, AccessKeyInput, AuthContextValue, ProtectedRouteProps };
|
package/dist/auth/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { AccessGuard, AccessKeys, ProtectedRoute, useSessionCheck as useRefocusSessionCheck, useSessionCheck, useStableAccessToken } from '../chunk-
|
|
1
|
+
export { AccessGuard, AccessKeys, ProtectedRoute, useSessionCheck as useRefocusSessionCheck, useSessionCheck, useStableAccessToken } from '../chunk-VGHYGEPR.js';
|
|
2
2
|
import '../chunk-4WLAVUPS.js';
|
|
3
3
|
import '../chunk-RXZ3XDBM.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-IR7HVER2.js';
|
|
5
5
|
import '../chunk-L7BZZ4SI.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-DRTC7LRG.js';
|
|
7
7
|
import '../chunk-62GVNH5U.js';
|
|
8
8
|
import '../chunk-P45GQ3ZW.js';
|
|
9
9
|
import '../chunk-IIMC4TRH.js';
|
|
@@ -14,7 +14,7 @@ import '../chunk-YJ437RDY.js';
|
|
|
14
14
|
import '../chunk-DD3CCMCZ.js';
|
|
15
15
|
import '../chunk-RNP5R5I3.js';
|
|
16
16
|
import '../chunk-RT4KRGZT.js';
|
|
17
|
-
import '../chunk-
|
|
17
|
+
import '../chunk-VFWOUD3M.js';
|
|
18
18
|
import '../chunk-6XBZPKMI.js';
|
|
19
19
|
import '../chunk-7ZUXA2NW.js';
|
|
20
20
|
import '../chunk-BI5VDO2K.js';
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -22,7 +22,7 @@ interface ChartFrameProps {
|
|
|
22
22
|
debounceMs?: number;
|
|
23
23
|
children: ReactNode;
|
|
24
24
|
}
|
|
25
|
-
declare function ChartFrame({ h, debounceMs, children }: ChartFrameProps):
|
|
25
|
+
declare function ChartFrame({ h, debounceMs, children }: ChartFrameProps): react.JSX.Element;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* CyberAreaChart — Reusable area chart with cyber/high-tech aesthetic.
|
|
@@ -82,8 +82,8 @@ interface CyberAreaChartProps {
|
|
|
82
82
|
declare function CyberLegendItem({ color, label }: {
|
|
83
83
|
color: string;
|
|
84
84
|
label: string;
|
|
85
|
-
}):
|
|
86
|
-
declare function CyberAreaChart({ data, series, xDataKey, height, yAxisLabel, yDomain, yTickFormatter, showGrid, showZeroBaseline, baselineColor, lineOnly, margin, xTickFormatter, tooltipFormatter }: CyberAreaChartProps):
|
|
85
|
+
}): react.JSX.Element;
|
|
86
|
+
declare function CyberAreaChart({ data, series, xDataKey, height, yAxisLabel, yDomain, yTickFormatter, showGrid, showZeroBaseline, baselineColor, lineOnly, margin, xTickFormatter, tooltipFormatter }: CyberAreaChartProps): react.JSX.Element;
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Cyber chart theme — color palette and shared config for light/dark modes.
|
|
@@ -157,8 +157,8 @@ declare function CyberDonutTooltip({ active, payload, colors }: {
|
|
|
157
157
|
};
|
|
158
158
|
}>;
|
|
159
159
|
colors: CyberColors;
|
|
160
|
-
}):
|
|
161
|
-
declare function CyberDonut({ title, segments, centerValue, centerLabel, centerValueColor, glowId, colors, size, innerRadius, outerRadius, isLoading, showLegend }: CyberDonutProps):
|
|
160
|
+
}): react.JSX.Element | null;
|
|
161
|
+
declare function CyberDonut({ title, segments, centerValue, centerLabel, centerValueColor, glowId, colors, size, innerRadius, outerRadius, isLoading, showLegend }: CyberDonutProps): react.JSX.Element;
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Time range selector for dashboard metrics
|
|
@@ -295,7 +295,7 @@ interface ActivityTrendChartProps {
|
|
|
295
295
|
isLoading: boolean;
|
|
296
296
|
timeRange?: TimeRange;
|
|
297
297
|
}
|
|
298
|
-
declare function ActivityTrendChart({ timestamps, total, isLoading, timeRange: timeRangeProp }: ActivityTrendChartProps):
|
|
298
|
+
declare function ActivityTrendChart({ timestamps, total, isLoading, timeRange: timeRangeProp }: ActivityTrendChartProps): react.JSX.Element;
|
|
299
299
|
|
|
300
300
|
interface CostTrendChartProps {
|
|
301
301
|
data?: CostTrendsResponse;
|
|
@@ -303,7 +303,7 @@ interface CostTrendChartProps {
|
|
|
303
303
|
isLoading: boolean;
|
|
304
304
|
error?: Error | null;
|
|
305
305
|
}
|
|
306
|
-
declare function CostTrendChart({ data, summaryData, isLoading, error }: CostTrendChartProps):
|
|
306
|
+
declare function CostTrendChart({ data, summaryData, isLoading, error }: CostTrendChartProps): react.JSX.Element;
|
|
307
307
|
|
|
308
308
|
interface HeroStatsRowProps {
|
|
309
309
|
resourcesData?: {
|
|
@@ -317,7 +317,7 @@ interface HeroStatsRowProps {
|
|
|
317
317
|
unresolvedErrorCount: number | null;
|
|
318
318
|
errorsLoading: boolean;
|
|
319
319
|
}
|
|
320
|
-
declare function HeroStatsRow({ resourcesData, resourcesLoading, dashboardData, dashboardLoading, unresolvedErrorCount, errorsLoading }: HeroStatsRowProps):
|
|
320
|
+
declare function HeroStatsRow({ resourcesData, resourcesLoading, dashboardData, dashboardLoading, unresolvedErrorCount, errorsLoading }: HeroStatsRowProps): react.JSX.Element;
|
|
321
321
|
|
|
322
322
|
interface CombinedTrendChartProps {
|
|
323
323
|
healthData?: ExecutionHealthMetrics;
|
|
@@ -329,7 +329,7 @@ interface CombinedTrendChartProps {
|
|
|
329
329
|
navigationAction?: ReactNode;
|
|
330
330
|
compact?: boolean;
|
|
331
331
|
}
|
|
332
|
-
declare function CombinedTrendChart({ healthData, errorData: _errorData, isLoading, error, timeRange: timeRangeProp, navigationAction, compact }: CombinedTrendChartProps):
|
|
332
|
+
declare function CombinedTrendChart({ healthData, errorData: _errorData, isLoading, error, timeRange: timeRangeProp, navigationAction, compact }: CombinedTrendChartProps): react.JSX.Element;
|
|
333
333
|
|
|
334
334
|
export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors };
|
|
335
335
|
export type { ActivityTrendChartProps, ChartFrameProps, CombinedTrendChartProps, CostTrendChartProps, CyberAreaChartProps, CyberColors, CyberDonutProps, CyberDonutSegment, CyberSeries, HeroStatsRowProps };
|
package/dist/charts/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors } from '../chunk-
|
|
1
|
+
export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors } from '../chunk-VGHYGEPR.js';
|
|
2
2
|
import '../chunk-4WLAVUPS.js';
|
|
3
3
|
import '../chunk-RXZ3XDBM.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-IR7HVER2.js';
|
|
5
5
|
import '../chunk-L7BZZ4SI.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-DRTC7LRG.js';
|
|
7
7
|
import '../chunk-62GVNH5U.js';
|
|
8
8
|
import '../chunk-P45GQ3ZW.js';
|
|
9
9
|
import '../chunk-IIMC4TRH.js';
|
|
@@ -14,7 +14,7 @@ import '../chunk-YJ437RDY.js';
|
|
|
14
14
|
import '../chunk-DD3CCMCZ.js';
|
|
15
15
|
import '../chunk-RNP5R5I3.js';
|
|
16
16
|
import '../chunk-RT4KRGZT.js';
|
|
17
|
-
import '../chunk-
|
|
17
|
+
import '../chunk-VFWOUD3M.js';
|
|
18
18
|
import '../chunk-6XBZPKMI.js';
|
|
19
19
|
import '../chunk-7ZUXA2NW.js';
|
|
20
20
|
import '../chunk-BI5VDO2K.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSupabase } from './chunk-MKH2KOAO.js';
|
|
2
|
-
import { useNotificationAdapter } from './chunk-
|
|
2
|
+
import { useNotificationAdapter } from './chunk-VGHYGEPR.js';
|
|
3
3
|
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
// ../core/src/supabase/helpers.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetNotificationsQuerySchema, MarkAsReadParamsSchema } from './chunk-GY7FXTC4.js';
|
|
2
|
-
import { useNotificationAdapter } from './chunk-
|
|
2
|
+
import { useNotificationAdapter } from './chunk-VGHYGEPR.js';
|
|
3
3
|
import { getTimeRangeDates } from './chunk-6XBZPKMI.js';
|
|
4
4
|
import { useElevasisServices } from './chunk-BI5VDO2K.js';
|
|
5
5
|
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useResolvedTimeRange, useCyberColors, useResourcesHealth, EmptyState, CyberLegendItem, CyberAreaChart } from './chunk-
|
|
1
|
+
import { useResolvedTimeRange, useCyberColors, useResourcesHealth, EmptyState, CyberLegendItem, CyberAreaChart } from './chunk-VGHYGEPR.js';
|
|
2
2
|
import { CardHeader } from './chunk-62GVNH5U.js';
|
|
3
3
|
import { getTimeRangeDates, formatBucketTime } from './chunk-6XBZPKMI.js';
|
|
4
4
|
import { Paper, Center, Loader, Group } from '@mantine/core';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { eqOrgId, sanitizePostgrestValue, useBatchDeleteRows } from './chunk-
|
|
1
|
+
import { eqOrgId, sanitizePostgrestValue, useBatchDeleteRows } from './chunk-2WXFPHBV.js';
|
|
2
2
|
import { useSupabase } from './chunk-MKH2KOAO.js';
|
|
3
3
|
import { useTableSort, sortData } from './chunk-2Y6AKWGU.js';
|
|
4
4
|
import { useTableSelection } from './chunk-WDBNW44Z.js';
|
|
5
|
-
import { SubshellPageLayout } from './chunk-
|
|
5
|
+
import { SubshellPageLayout } from './chunk-LACAXGZK.js';
|
|
6
6
|
import { TableSelectionToolbar, SortableHeader } from './chunk-TUMSNGTX.js';
|
|
7
7
|
import { FilterBar } from './chunk-PDHTXPSF.js';
|
|
8
|
-
import { usePaginationState, PageTitleCaption, StatCard, EmptyState, CustomModal, SubshellContentContainer } from './chunk-
|
|
9
|
-
import { showApiErrorNotification } from './chunk-
|
|
8
|
+
import { usePaginationState, PageTitleCaption, StatCard, EmptyState, CustomModal, SubshellContentContainer } from './chunk-VGHYGEPR.js';
|
|
9
|
+
import { showApiErrorNotification } from './chunk-DRTC7LRG.js';
|
|
10
10
|
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
11
|
-
import { PAGE_SIZE_DEFAULT } from './chunk-
|
|
11
|
+
import { PAGE_SIZE_DEFAULT } from './chunk-VFWOUD3M.js';
|
|
12
12
|
import { Stack, SimpleGrid, Paper, Select, TextInput, Group, Button, Center, Loader, Table, Checkbox, Text, Badge, Pagination, Title, Anchor, Card, Divider } from '@mantine/core';
|
|
13
13
|
import { IconFileText, IconCircleCheck, IconPencil, IconAlertTriangle, IconEye, IconClick, IconTarget, IconBrain, IconSearch, IconFilterOff, IconExternalLink, IconArrowLeft, IconPercentage, IconChartLine, IconForms } from '@tabler/icons-react';
|
|
14
14
|
import { useState, useMemo } from 'react';
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, LEAD_GEN_API_READINESS_CONTRACT, CRM_API_READINESS_CONTRACT, CRM_PIPELINE_CATALOG_ONTOLOGY_ID, getLeadGenStageCatalog, LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID, acquisitionListKeys } from './chunk-VGHYGEPR.js';
|
|
2
|
+
import { showApiErrorNotification, showSuccessNotification } from './chunk-DRTC7LRG.js';
|
|
3
|
+
import { requireSystemInterfaceProfile, registerBuiltInReadinessProfile, registerReadinessInterfaceMarker, requireContractReadiness, computeInterfaceReadiness, addReadinessIssue, formatInterfaceIdentity, getSystem, resourceBindingIds, requireCatalogReadiness, requireScopedBinding, APIClientError, buildQueryString } from './chunk-VFWOUD3M.js';
|
|
4
|
+
import { useElevasisServices } from './chunk-BI5VDO2K.js';
|
|
5
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
// src/hooks/acquisition/queryKeys.ts
|
|
9
|
+
var companyKeys = {
|
|
10
|
+
all: ["acquisition-companies"],
|
|
11
|
+
list: (organizationId, filters) => [...companyKeys.all, "list", organizationId, filters],
|
|
12
|
+
facets: (organizationId) => [...companyKeys.all, "facets", organizationId],
|
|
13
|
+
detail: (organizationId, companyId) => [...companyKeys.all, "detail", organizationId, companyId]
|
|
14
|
+
};
|
|
15
|
+
var contactKeys = {
|
|
16
|
+
all: ["acquisition-contacts"],
|
|
17
|
+
list: (organizationId, filters) => [...contactKeys.all, "list", organizationId, filters],
|
|
18
|
+
detail: (organizationId, contactId) => [...contactKeys.all, "detail", organizationId, contactId]
|
|
19
|
+
};
|
|
20
|
+
z.object({
|
|
21
|
+
replyBody: z.string().trim().min(1).max(1e4)
|
|
22
|
+
}).strict();
|
|
23
|
+
function getDealNextActionKey(deal) {
|
|
24
|
+
return "nextAction" in deal && typeof deal.nextAction === "string" ? deal.nextAction : null;
|
|
25
|
+
}
|
|
26
|
+
function isCompiledCrmActionAvailable(deal, action) {
|
|
27
|
+
const { stageKeys, stateKeys, nextActionKeys } = action.availableFrom;
|
|
28
|
+
if (deal.stage_key === null || !stageKeys.includes(deal.stage_key)) return false;
|
|
29
|
+
if (stateKeys !== void 0 && (deal.state_key === null || !stateKeys.includes(deal.state_key))) return false;
|
|
30
|
+
if (nextActionKeys !== void 0) {
|
|
31
|
+
const nextAction = getDealNextActionKey(deal);
|
|
32
|
+
if (nextAction === null || !nextActionKeys.includes(nextAction)) return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ../core/src/business/acquisition/ontology-validation.ts
|
|
38
|
+
var LEAD_GEN_API_INTERFACE = requireSystemInterfaceProfile("sales.lead-gen.api");
|
|
39
|
+
var CRM_API_INTERFACE = requireSystemInterfaceProfile("sales.crm.api");
|
|
40
|
+
var LEAD_GEN_CRM_HANDOFF_INTERFACE = requireSystemInterfaceProfile("sales.lead-gen.crm-handoff");
|
|
41
|
+
LEAD_GEN_API_INTERFACE.readinessProfile;
|
|
42
|
+
CRM_API_INTERFACE.readinessProfile;
|
|
43
|
+
LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
|
|
44
|
+
function isPlainRecord(value) {
|
|
45
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
function createLeadGenStageCatalog(model) {
|
|
48
|
+
return {
|
|
49
|
+
id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
|
|
50
|
+
label: "Lead Gen Processing Stages",
|
|
51
|
+
ownerSystemId: "sales.lead-gen",
|
|
52
|
+
kind: "processing-stage-catalog",
|
|
53
|
+
entries: Object.fromEntries(
|
|
54
|
+
Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
|
|
55
|
+
key,
|
|
56
|
+
{
|
|
57
|
+
...entry
|
|
58
|
+
}
|
|
59
|
+
])
|
|
60
|
+
),
|
|
61
|
+
legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function requireLeadGenSupplementalReadiness(issues, index, resources, context) {
|
|
65
|
+
const catalogs = resourceBindingIds(resources, "usesCatalogs");
|
|
66
|
+
const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
|
|
67
|
+
if (templateStepCatalog === void 0) {
|
|
68
|
+
addReadinessIssue(
|
|
69
|
+
issues,
|
|
70
|
+
"SYSTEM_INTERFACE_NOT_READY",
|
|
71
|
+
"missing-template-step-catalog",
|
|
72
|
+
`System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing a lead-gen template-step catalog.`
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
75
|
+
requireCatalogReadiness(issues, index, templateStepCatalog.id, context);
|
|
76
|
+
requireScopedBinding(issues, catalogs, "usesCatalogs", templateStepCatalog.id, context);
|
|
77
|
+
}
|
|
78
|
+
requireCatalogReadiness(issues, index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, context);
|
|
79
|
+
}
|
|
80
|
+
function requireLeadGenInterfaceReadiness(issues, index, resources, context) {
|
|
81
|
+
requireContractReadiness(issues, index, resources, LEAD_GEN_API_READINESS_CONTRACT, context);
|
|
82
|
+
requireLeadGenSupplementalReadiness(issues, index, resources, context);
|
|
83
|
+
}
|
|
84
|
+
function requireCrmInterfaceReadiness(issues, index, resources, context) {
|
|
85
|
+
requireContractReadiness(issues, index, resources, CRM_API_READINESS_CONTRACT, context);
|
|
86
|
+
}
|
|
87
|
+
function findSystemInterfaceGrant(model, consumer, provider) {
|
|
88
|
+
return Object.values(model.topology?.relationships ?? {}).find((relationship) => {
|
|
89
|
+
const grant = relationship.metadata?.["systemInterfaceGrant"];
|
|
90
|
+
if (!isPlainRecord(grant) || !isPlainRecord(grant.consumer) || !isPlainRecord(grant.provider)) return false;
|
|
91
|
+
return grant.consumer.systemPath === consumer.systemPath && grant.consumer.interfaceKey === consumer.interfaceKey && grant.provider.systemPath === provider.systemPath && grant.provider.interfaceKey === provider.interfaceKey;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function requireHandoffBridgeReadiness(issues, model, context) {
|
|
95
|
+
const crmResult = computeInterfaceReadiness(model, CRM_API_INTERFACE);
|
|
96
|
+
if (!crmResult.ready) {
|
|
97
|
+
for (const issue of crmResult.issues) {
|
|
98
|
+
addReadinessIssue(
|
|
99
|
+
issues,
|
|
100
|
+
"SYSTEM_BRIDGE_NOT_READY",
|
|
101
|
+
issue.code,
|
|
102
|
+
`Provider interface ${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)} is not ready: ${issue.message}`,
|
|
103
|
+
{ path: issue.path, ref: issue.ref }
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const bridgeGrant = findSystemInterfaceGrant(model, context, CRM_API_INTERFACE);
|
|
108
|
+
if (bridgeGrant === void 0) {
|
|
109
|
+
addReadinessIssue(
|
|
110
|
+
issues,
|
|
111
|
+
"SYSTEM_BRIDGE_NOT_READY",
|
|
112
|
+
"missing-topology-grant",
|
|
113
|
+
`System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires a scoped topology grant to "${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)}".`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return bridgeGrant;
|
|
117
|
+
}
|
|
118
|
+
function getLeadGenCrmHandoffResourceIds(model) {
|
|
119
|
+
return Object.values(model.resources ?? {}).filter(
|
|
120
|
+
(resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
|
|
121
|
+
).map((resource) => resource.id);
|
|
122
|
+
}
|
|
123
|
+
function isLeadGenCrmHandoffAdopted(model) {
|
|
124
|
+
return getSystem(model, LEAD_GEN_API_INTERFACE.systemPath)?.apiInterface !== void 0 && getSystem(model, CRM_API_INTERFACE.systemPath)?.apiInterface !== void 0;
|
|
125
|
+
}
|
|
126
|
+
function mergeLeadGenDerivedCatalogs(model) {
|
|
127
|
+
const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
|
|
128
|
+
const derivedCatalogTypes = {};
|
|
129
|
+
if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
|
|
130
|
+
derivedCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
|
|
131
|
+
}
|
|
132
|
+
if (Object.keys(derivedCatalogTypes).length === 0) return model;
|
|
133
|
+
return {
|
|
134
|
+
...model,
|
|
135
|
+
ontology: {
|
|
136
|
+
...model.ontology ?? {},
|
|
137
|
+
catalogTypes: {
|
|
138
|
+
...baseCatalogTypes,
|
|
139
|
+
...derivedCatalogTypes
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
registerBuiltInReadinessProfile(LEAD_GEN_API_INTERFACE.readinessProfile, {
|
|
145
|
+
validate: (issues, index, resources, _model, context) => requireLeadGenInterfaceReadiness(issues, index, resources, context),
|
|
146
|
+
prepareModel: mergeLeadGenDerivedCatalogs
|
|
147
|
+
});
|
|
148
|
+
registerBuiltInReadinessProfile(CRM_API_INTERFACE.readinessProfile, {
|
|
149
|
+
validate: (issues, index, resources, _model, context) => requireCrmInterfaceReadiness(issues, index, resources, context)
|
|
150
|
+
});
|
|
151
|
+
registerBuiltInReadinessProfile(LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile, {
|
|
152
|
+
validate: (issues, index, resources, model, context) => {
|
|
153
|
+
requireLeadGenInterfaceReadiness(issues, index, resources, context);
|
|
154
|
+
requireCrmInterfaceReadiness(issues, index, resources, { ...context, allowForeignOwner: true });
|
|
155
|
+
requireHandoffBridgeReadiness(issues, model, context);
|
|
156
|
+
},
|
|
157
|
+
prepareModel: mergeLeadGenDerivedCatalogs
|
|
158
|
+
});
|
|
159
|
+
registerReadinessInterfaceMarker(
|
|
160
|
+
LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath,
|
|
161
|
+
LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey,
|
|
162
|
+
(model) => {
|
|
163
|
+
if (!isLeadGenCrmHandoffAdopted(model)) return void 0;
|
|
164
|
+
return {
|
|
165
|
+
lifecycle: "active",
|
|
166
|
+
readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
|
|
167
|
+
resourceIds: getLeadGenCrmHandoffResourceIds(model)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
function findLeadGenTemplateStepCatalog(index) {
|
|
172
|
+
return Object.values(index.ontology.catalogTypes).find(
|
|
173
|
+
(catalog) => catalog.ownerSystemId === "sales.lead-gen" && catalog.kind === "template-step" && catalog.appliesTo === LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ../core/src/business/acquisition/compile-action-catalog.ts
|
|
178
|
+
function deriveCompiledCrmActions(deal, catalog) {
|
|
179
|
+
return catalog.filter((action) => isCompiledCrmActionAvailable(deal, action));
|
|
180
|
+
}
|
|
181
|
+
function useContacts(filters = {}) {
|
|
182
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
183
|
+
return useQuery({
|
|
184
|
+
queryKey: contactKeys.list(workOSOrganizationId, filters),
|
|
185
|
+
queryFn: async () => {
|
|
186
|
+
const queryString = buildQueryString({
|
|
187
|
+
listId: filters.listId,
|
|
188
|
+
search: filters.search,
|
|
189
|
+
openingLineIsNull: filters.openingLineIsNull,
|
|
190
|
+
batchId: filters.batchId,
|
|
191
|
+
contactStatus: filters.contactStatus,
|
|
192
|
+
limit: filters.limit,
|
|
193
|
+
offset: filters.offset
|
|
194
|
+
});
|
|
195
|
+
return apiRequest(`/acquisition/contacts${queryString}`);
|
|
196
|
+
},
|
|
197
|
+
enabled: isReady && !!workOSOrganizationId,
|
|
198
|
+
retry: (_failureCount, error) => !(error instanceof APIClientError && error.statusCode === 401)
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function useContact(contactId) {
|
|
202
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
203
|
+
return useQuery({
|
|
204
|
+
queryKey: contactKeys.detail(workOSOrganizationId, contactId),
|
|
205
|
+
queryFn: async () => {
|
|
206
|
+
if (!contactId) return null;
|
|
207
|
+
return apiRequest(`/acquisition/contacts/${contactId}`);
|
|
208
|
+
},
|
|
209
|
+
enabled: isReady && !!workOSOrganizationId && !!contactId
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function useCreateContact() {
|
|
213
|
+
const { apiRequest } = useElevasisServices();
|
|
214
|
+
const queryClient = useQueryClient();
|
|
215
|
+
return useMutation({
|
|
216
|
+
mutationFn: (body) => apiRequest("/acquisition/contacts", {
|
|
217
|
+
method: "POST",
|
|
218
|
+
body: JSON.stringify(body)
|
|
219
|
+
}),
|
|
220
|
+
onSuccess: () => {
|
|
221
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
222
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
223
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
224
|
+
showSuccessNotification("Contact created");
|
|
225
|
+
},
|
|
226
|
+
onError: (error) => {
|
|
227
|
+
showApiErrorNotification(error);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function useUpdateContact(contactId) {
|
|
232
|
+
const { apiRequest } = useElevasisServices();
|
|
233
|
+
const queryClient = useQueryClient();
|
|
234
|
+
return useMutation({
|
|
235
|
+
mutationFn: (body) => apiRequest(`/acquisition/contacts/${contactId}`, {
|
|
236
|
+
method: "PATCH",
|
|
237
|
+
body: JSON.stringify(body)
|
|
238
|
+
}),
|
|
239
|
+
onSuccess: () => {
|
|
240
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
241
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
242
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
243
|
+
showSuccessNotification("Contact updated");
|
|
244
|
+
},
|
|
245
|
+
onError: (error) => {
|
|
246
|
+
showApiErrorNotification(error);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function useDeleteContacts() {
|
|
251
|
+
const { apiRequest } = useElevasisServices();
|
|
252
|
+
const queryClient = useQueryClient();
|
|
253
|
+
return useMutation({
|
|
254
|
+
mutationFn: async (contactIds) => {
|
|
255
|
+
const uniqueIds = [...new Set(contactIds)].filter(Boolean);
|
|
256
|
+
if (uniqueIds.length === 0) return;
|
|
257
|
+
await Promise.all(
|
|
258
|
+
uniqueIds.map(
|
|
259
|
+
(contactId) => apiRequest(`/acquisition/contacts/${contactId}`, {
|
|
260
|
+
method: "DELETE"
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
onSuccess: () => {
|
|
266
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
267
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
268
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
269
|
+
showSuccessNotification("Contacts deleted");
|
|
270
|
+
},
|
|
271
|
+
onError: (error) => {
|
|
272
|
+
showApiErrorNotification(error);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// src/hooks/acquisition/useCompanies.ts
|
|
278
|
+
function useCompanies(filters = {}) {
|
|
279
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
280
|
+
return useQuery({
|
|
281
|
+
queryKey: companyKeys.list(workOSOrganizationId, filters),
|
|
282
|
+
queryFn: async () => {
|
|
283
|
+
const queryString = buildQueryString({
|
|
284
|
+
listId: filters.listId,
|
|
285
|
+
search: filters.search,
|
|
286
|
+
domain: filters.domain,
|
|
287
|
+
website: filters.website,
|
|
288
|
+
segment: filters.segment,
|
|
289
|
+
category: filters.category,
|
|
290
|
+
batchId: filters.batchId,
|
|
291
|
+
status: filters.status,
|
|
292
|
+
includeAll: filters.includeAll,
|
|
293
|
+
limit: filters.limit,
|
|
294
|
+
offset: filters.offset
|
|
295
|
+
});
|
|
296
|
+
return apiRequest(`/acquisition/companies${queryString}`);
|
|
297
|
+
},
|
|
298
|
+
enabled: isReady && !!workOSOrganizationId,
|
|
299
|
+
retry: (_failureCount, error) => !(error instanceof APIClientError && error.statusCode === 401)
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function useCompanyFacets() {
|
|
303
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
304
|
+
return useQuery({
|
|
305
|
+
queryKey: companyKeys.facets(workOSOrganizationId),
|
|
306
|
+
queryFn: () => apiRequest("/acquisition/companies/facets"),
|
|
307
|
+
enabled: isReady && !!workOSOrganizationId
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function useCompany(companyId) {
|
|
311
|
+
const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
|
|
312
|
+
return useQuery({
|
|
313
|
+
queryKey: companyKeys.detail(workOSOrganizationId, companyId),
|
|
314
|
+
queryFn: async () => {
|
|
315
|
+
if (!companyId) return null;
|
|
316
|
+
return apiRequest(`/acquisition/companies/${companyId}`);
|
|
317
|
+
},
|
|
318
|
+
enabled: isReady && !!workOSOrganizationId && !!companyId
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function useCreateCompany() {
|
|
322
|
+
const { apiRequest } = useElevasisServices();
|
|
323
|
+
const queryClient = useQueryClient();
|
|
324
|
+
return useMutation({
|
|
325
|
+
mutationFn: (body) => apiRequest("/acquisition/companies", {
|
|
326
|
+
method: "POST",
|
|
327
|
+
body: JSON.stringify(body)
|
|
328
|
+
}),
|
|
329
|
+
onSuccess: () => {
|
|
330
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
331
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
332
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
333
|
+
showSuccessNotification("Company created");
|
|
334
|
+
},
|
|
335
|
+
onError: (error) => {
|
|
336
|
+
showApiErrorNotification(error);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function useUpdateCompany(companyId) {
|
|
341
|
+
const { apiRequest } = useElevasisServices();
|
|
342
|
+
const queryClient = useQueryClient();
|
|
343
|
+
return useMutation({
|
|
344
|
+
mutationFn: (body) => apiRequest(`/acquisition/companies/${companyId}`, {
|
|
345
|
+
method: "PATCH",
|
|
346
|
+
body: JSON.stringify(body)
|
|
347
|
+
}),
|
|
348
|
+
onSuccess: () => {
|
|
349
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
350
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
351
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
352
|
+
showSuccessNotification("Company updated");
|
|
353
|
+
},
|
|
354
|
+
onError: (error) => {
|
|
355
|
+
showApiErrorNotification(error);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function useDeleteCompanies() {
|
|
360
|
+
const { apiRequest } = useElevasisServices();
|
|
361
|
+
const queryClient = useQueryClient();
|
|
362
|
+
return useMutation({
|
|
363
|
+
mutationFn: async (companyIds) => {
|
|
364
|
+
const uniqueIds = [...new Set(companyIds)].filter(Boolean);
|
|
365
|
+
if (uniqueIds.length === 0) return;
|
|
366
|
+
await Promise.all(
|
|
367
|
+
uniqueIds.map(
|
|
368
|
+
(companyId) => apiRequest(`/acquisition/companies/${companyId}`, {
|
|
369
|
+
method: "DELETE"
|
|
370
|
+
})
|
|
371
|
+
)
|
|
372
|
+
);
|
|
373
|
+
},
|
|
374
|
+
onSuccess: () => {
|
|
375
|
+
queryClient.invalidateQueries({ queryKey: companyKeys.all });
|
|
376
|
+
queryClient.invalidateQueries({ queryKey: contactKeys.all });
|
|
377
|
+
queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
|
|
378
|
+
showSuccessNotification("Companies deleted");
|
|
379
|
+
},
|
|
380
|
+
onError: (error) => {
|
|
381
|
+
showApiErrorNotification(error);
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export { CRM_API_INTERFACE, LEAD_GEN_API_INTERFACE, companyKeys, contactKeys, deriveCompiledCrmActions, useCompanies, useCompany, useCompanyFacets, useContact, useContacts, useCreateCompany, useCreateContact, useDeleteCompanies, useDeleteContacts, useUpdateCompany, useUpdateContact };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-
|
|
1
|
+
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-VFWOUD3M.js';
|
|
2
2
|
import { notifications } from '@mantine/notifications';
|
|
3
3
|
|
|
4
4
|
var showInfoNotification = (message) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { showApiErrorNotification } from './chunk-
|
|
2
|
-
import { buildQueryString } from './chunk-
|
|
1
|
+
import { showApiErrorNotification } from './chunk-DRTC7LRG.js';
|
|
2
|
+
import { buildQueryString } from './chunk-VFWOUD3M.js';
|
|
3
3
|
import { useElevasisServices } from './chunk-BI5VDO2K.js';
|
|
4
4
|
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
5
5
|
|