@elevasis/ui 2.82.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.
Files changed (98) hide show
  1. package/dist/api/index.d.ts +2 -2
  2. package/dist/api/index.js +3 -3
  3. package/dist/app/index.d.ts +38 -3710
  4. package/dist/app/index.js +10 -10
  5. package/dist/auth/index.d.ts +2 -3
  6. package/dist/auth/index.js +4 -4
  7. package/dist/charts/index.d.ts +10 -10
  8. package/dist/charts/index.js +4 -4
  9. package/dist/{chunk-ZG3DARVR.js → chunk-2WXFPHBV.js} +1 -1
  10. package/dist/{chunk-I2JOA54D.js → chunk-34YVWPW6.js} +1 -1
  11. package/dist/{chunk-5WNRTDEZ.js → chunk-4ILZBLQY.js} +1 -1
  12. package/dist/{chunk-PTB575MP.js → chunk-6DWWZXLS.js} +5 -5
  13. package/dist/{chunk-LTRJZOHA.js → chunk-7D6ZLLOZ.js} +1 -1
  14. package/dist/chunk-BIKD5UUM.js +386 -0
  15. package/dist/{chunk-HOX4CMYY.js → chunk-CEP5A55J.js} +1 -1
  16. package/dist/{chunk-4TEVJRKQ.js → chunk-CUJBF3X6.js} +1 -1
  17. package/dist/{chunk-PNCJJE4Z.js → chunk-DRTC7LRG.js} +1 -1
  18. package/dist/{chunk-ROC2TFPS.js → chunk-EEONAV4R.js} +2 -2
  19. package/dist/{chunk-HDITVHZT.js → chunk-EHWHG6PW.js} +2 -2
  20. package/dist/{chunk-7RS2NUC6.js → chunk-IR7HVER2.js} +1 -1
  21. package/dist/{chunk-ELQLU323.js → chunk-IYY27OLF.js} +5 -5
  22. package/dist/{chunk-PV64XFZY.js → chunk-JCETE623.js} +1 -1
  23. package/dist/{chunk-TCVMLAMC.js → chunk-JJCY23X3.js} +2 -2
  24. package/dist/{chunk-6NIGO2LD.js → chunk-JPQNXH4X.js} +3 -3
  25. package/dist/{chunk-3OQVXI4C.js → chunk-JXS2LDGN.js} +2 -2
  26. package/dist/{chunk-G6VHIXWD.js → chunk-KQ2YSAXL.js} +1 -1
  27. package/dist/{chunk-XHJBDW2S.js → chunk-LACAXGZK.js} +1 -1
  28. package/dist/{chunk-ZYIGD2QY.js → chunk-LKM32PP6.js} +3 -3
  29. package/dist/{chunk-PJN6CMWZ.js → chunk-LKZV5TDL.js} +1 -1
  30. package/dist/{chunk-TAGPVICO.js → chunk-MZXUISBI.js} +11 -12
  31. package/dist/{chunk-KQTI4RZN.js → chunk-N5O5OYLB.js} +8 -8
  32. package/dist/{chunk-VTUVB3J3.js → chunk-OC7TYJ75.js} +1 -1
  33. package/dist/{chunk-AA257QZO.js → chunk-PQEGQ63N.js} +8 -9
  34. package/dist/{chunk-ER2HBKS7.js → chunk-QQ3JCEN2.js} +5 -5
  35. package/dist/{chunk-3PQMF4RP.js → chunk-U727JFPK.js} +3 -3
  36. package/dist/{chunk-DEZW7QDI.js → chunk-VFWOUD3M.js} +31 -2
  37. package/dist/{chunk-M5CRPFJA.js → chunk-VGHYGEPR.js} +62 -4
  38. package/dist/{chunk-GH3UY2FM.js → chunk-WYFNXCDJ.js} +4 -4
  39. package/dist/{chunk-RKTFFLVV.js → chunk-XYRMUHWN.js} +1 -1
  40. package/dist/{chunk-OWAEBFWH.js → chunk-YZ47UWV5.js} +1 -1
  41. package/dist/{chunk-4C4IFMRP.js → chunk-YZ5Q34MK.js} +11 -6
  42. package/dist/{chunk-2S5477QR.js → chunk-ZS3BJLOJ.js} +9 -9
  43. package/dist/components/chat/index.d.ts +4 -5
  44. package/dist/components/index.d.ts +210 -198
  45. package/dist/components/index.js +38 -39
  46. package/dist/components/navigation/index.js +5 -5
  47. package/dist/execution/index.d.ts +2 -2
  48. package/dist/features/auth/index.d.ts +6 -6
  49. package/dist/features/auth/index.js +6 -6
  50. package/dist/features/clients/index.d.ts +11 -11
  51. package/dist/features/clients/index.js +7 -7
  52. package/dist/features/content/index.d.ts +36 -24
  53. package/dist/features/content/index.js +7 -7
  54. package/dist/features/crm/index.d.ts +29 -17
  55. package/dist/features/crm/index.js +9 -10
  56. package/dist/features/dashboard/index.d.ts +12 -6
  57. package/dist/features/dashboard/index.js +6 -6
  58. package/dist/features/delivery/index.d.ts +13 -13
  59. package/dist/features/delivery/index.js +17 -17
  60. package/dist/features/knowledge/index.js +4 -4
  61. package/dist/features/lead-gen/index.d.ts +40 -26
  62. package/dist/features/lead-gen/index.js +10 -11
  63. package/dist/features/monitoring/index.d.ts +8 -8
  64. package/dist/features/monitoring/index.js +8 -8
  65. package/dist/features/monitoring/requests/index.d.ts +10 -10
  66. package/dist/features/monitoring/requests/index.js +6 -6
  67. package/dist/features/notes/index.d.ts +7 -7
  68. package/dist/features/operations/index.d.ts +42 -30
  69. package/dist/features/operations/index.js +11 -11
  70. package/dist/features/public-agent-chat/index.d.ts +3 -3
  71. package/dist/features/right-panel-host/index.d.ts +3 -3
  72. package/dist/features/seo/index.d.ts +7 -7
  73. package/dist/features/seo/index.js +7 -7
  74. package/dist/features/settings/index.d.ts +13 -13
  75. package/dist/features/settings/index.js +7 -7
  76. package/dist/hooks/access/index.js +4 -4
  77. package/dist/hooks/delivery/index.js +3 -3
  78. package/dist/hooks/published.d.ts +19 -5
  79. package/dist/hooks/published.js +15 -15
  80. package/dist/knowledge/index.d.ts +34 -22
  81. package/dist/knowledge/index.js +9 -9
  82. package/dist/layout/index.d.ts +48 -48
  83. package/dist/layout/index.js +8 -8
  84. package/dist/organization/index.d.ts +2 -3
  85. package/dist/provider/ElevasisServiceContext.d.ts +1 -2
  86. package/dist/provider/index.d.ts +65 -3735
  87. package/dist/provider/index.js +4 -4
  88. package/dist/provider/published.d.ts +50 -3721
  89. package/dist/provider/published.js +4 -4
  90. package/dist/router/index.d.ts +2 -3
  91. package/dist/test-utils/index.d.ts +4 -4
  92. package/dist/test-utils/index.js +3 -3
  93. package/dist/types/index.d.ts +6 -0
  94. package/dist/utils/index.d.ts +6 -0
  95. package/dist/utils/index.js +1 -1
  96. package/package.json +5 -5
  97. package/dist/chunk-3RYXJS2F.js +0 -231
  98. package/dist/chunk-NQSZ4UGG.js +0 -200
@@ -1,9 +1,9 @@
1
- export { AppearanceProvider, ElevasisCoreProvider, ElevasisSystemsProvider, NotificationProvider, SystemShell, selectDeclaredSystems, useAppearance, useElevasisSystems, useNotificationAdapter, useOptionalElevasisSystems, useResolvedOrganizationModel } from '../chunk-M5CRPFJA.js';
1
+ export { AppearanceProvider, ElevasisCoreProvider, ElevasisSystemsProvider, NotificationProvider, SystemShell, selectDeclaredSystems, useAppearance, useElevasisSystems, useNotificationAdapter, useOptionalElevasisSystems, useResolvedOrganizationModel } from '../chunk-VGHYGEPR.js';
2
2
  import '../chunk-4WLAVUPS.js';
3
3
  import '../chunk-RXZ3XDBM.js';
4
- import '../chunk-7RS2NUC6.js';
4
+ import '../chunk-IR7HVER2.js';
5
5
  import '../chunk-L7BZZ4SI.js';
6
- import '../chunk-PNCJJE4Z.js';
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-DEZW7QDI.js';
17
+ import '../chunk-VFWOUD3M.js';
18
18
  import '../chunk-6XBZPKMI.js';
19
19
  import '../chunk-7ZUXA2NW.js';
20
20
  export { ElevasisServiceProvider, useElevasisServices } from '../chunk-BI5VDO2K.js';
@@ -1,6 +1,5 @@
1
1
  import * as react from 'react';
2
2
  import { AnchorHTMLAttributes, ElementType, ReactNode } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
 
5
4
  interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
6
5
  to: string;
@@ -26,7 +25,7 @@ declare function RouterProvider({ value, children }: {
26
25
  */
27
26
  declare function TanStackRouterBridge({ children }: {
28
27
  children: ReactNode;
29
- }): react_jsx_runtime.JSX.Element;
28
+ }): react.JSX.Element;
30
29
 
31
30
  /**
32
31
  * Resets scroll position to the top of the nearest scrollable ancestor on every
@@ -37,7 +36,7 @@ declare function TanStackRouterBridge({ children }: {
37
36
  * Place this component directly inside the app shell's content area, above
38
37
  * `<Outlet />`.
39
38
  */
40
- declare function ScrollToTop(): react_jsx_runtime.JSX.Element;
39
+ declare function ScrollToTop(): react.JSX.Element;
41
40
 
42
41
  export { RouterProvider, ScrollToTop, TanStackRouterBridge, useRouterContext };
43
42
  export type { LinkProps, RouterAdapter };
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react$1 from 'react';
2
+ import { ReactNode, ReactElement } from 'react';
2
3
  import { QueryClient } from '@tanstack/react-query';
3
4
  import { RenderHookOptions, RenderOptions, render, renderHook } from '@testing-library/react';
4
5
  export * from '@testing-library/react';
5
- import { ReactNode, ReactElement } from 'react';
6
6
  import * as vitest from 'vitest';
7
7
  import * as msw_node from 'msw/node';
8
8
  import * as msw from 'msw';
@@ -49,7 +49,7 @@ interface TestProvidersProps {
49
49
  apiRequest?: ApiRequest;
50
50
  isServiceReady?: boolean;
51
51
  }
52
- declare function TestProviders({ children, queryClient, getAccessToken, organizationId, isOrganizationReady, apiRequest, isServiceReady }: TestProvidersProps): react_jsx_runtime.JSX.Element;
52
+ declare function TestProviders({ children, queryClient, getAccessToken, organizationId, isOrganizationReady, apiRequest, isServiceReady }: TestProvidersProps): react$1.JSX.Element;
53
53
  interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {
54
54
  queryClient?: QueryClient;
55
55
  getAccessToken?: () => Promise<string | undefined>;
@@ -70,7 +70,7 @@ interface CustomRenderHookOptions<TProps> extends Omit<RenderHookOptions<TProps>
70
70
  declare function renderHookWithProviders<TResult, TProps>(hook: (props: TProps) => TResult, options?: CustomRenderHookOptions<TProps>): ReturnType<typeof renderHook<TResult, TProps>>;
71
71
  declare function createTestWrapper(options?: Omit<TestProvidersProps, 'children'>): ({ children }: {
72
72
  children: ReactNode;
73
- }) => react_jsx_runtime.JSX.Element;
73
+ }) => react$1.JSX.Element;
74
74
 
75
75
  declare const mockWorkOSUser: {
76
76
  id: string;
@@ -2,10 +2,10 @@ import { server, handlers } from '../chunk-7XKCG5CT.js';
2
2
  export { handlers, server } from '../chunk-7XKCG5CT.js';
3
3
  import { mockWorkOSUser, mockUseAuth, mockUnauthenticatedUser, mockAuthenticatedUser, mockAuthLoading, createMockUseAuth } from '../chunk-N7U24M2J.js';
4
4
  export { createMockUseAuth, mockAuthLoading, mockAuthenticatedUser, mockUnauthenticatedUser, mockUseAuth, mockWorkOSUser } from '../chunk-N7U24M2J.js';
5
- import '../chunk-G6VHIXWD.js';
6
- import { ApiClientProvider } from '../chunk-7RS2NUC6.js';
5
+ import '../chunk-KQ2YSAXL.js';
6
+ import { ApiClientProvider } from '../chunk-IR7HVER2.js';
7
7
  import '../chunk-DD3CCMCZ.js';
8
- import '../chunk-DEZW7QDI.js';
8
+ import '../chunk-VFWOUD3M.js';
9
9
  import '../chunk-6XBZPKMI.js';
10
10
  import '../chunk-7ZUXA2NW.js';
11
11
  import { ElevasisServiceProvider } from '../chunk-BI5VDO2K.js';
@@ -4862,12 +4862,18 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
4862
4862
  ownerSystemId: z.ZodOptional<z.ZodString>;
4863
4863
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
4864
4864
  actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
4865
+ order: z.ZodOptional<z.ZodNumber>;
4865
4866
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4866
4867
  effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4867
4868
  resourceId: z.ZodOptional<z.ZodString>;
4868
4869
  invocations: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
4869
4870
  lifecycle: z.ZodOptional<z.ZodString>;
4870
4871
  legacyActionId: z.ZodOptional<z.ZodString>;
4872
+ availableFrom: z.ZodOptional<z.ZodObject<{
4873
+ stageKeys: z.ZodArray<z.ZodString>;
4874
+ stateKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
4875
+ nextActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
4876
+ }, z.core.$strict>>;
4871
4877
  }, z.core.$strict>>>>;
4872
4878
  catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
4873
4879
  id: z.ZodString;
@@ -116,12 +116,18 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
116
116
  ownerSystemId: z.ZodOptional<z.ZodString>;
117
117
  aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
118
  actsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
119
+ order: z.ZodOptional<z.ZodNumber>;
119
120
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
120
121
  effects: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
121
122
  resourceId: z.ZodOptional<z.ZodString>;
122
123
  invocations: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
123
124
  lifecycle: z.ZodOptional<z.ZodString>;
124
125
  legacyActionId: z.ZodOptional<z.ZodString>;
126
+ availableFrom: z.ZodOptional<z.ZodObject<{
127
+ stageKeys: z.ZodArray<z.ZodString>;
128
+ stateKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
+ nextActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
130
+ }, z.core.$strict>>;
125
131
  }, z.core.$strict>>>>;
126
132
  catalogTypes: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
127
133
  id: z.ZodString;
@@ -1,4 +1,4 @@
1
- export { APIClientError, API_URL, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, LIMIT_ACTIVITY_FEED, OAUTH_FLOW_TIMEOUT, PAGE_SIZE_DEFAULT, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, buildQueryString, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getSystemReadinessServerErrorDetails, isAPIClientError, restoreConsole, setupBrowserMocks, suppressKnownWarnings, validateEmail } from '../chunk-DEZW7QDI.js';
1
+ export { APIClientError, API_URL, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, LIMIT_ACTIVITY_FEED, OAUTH_FLOW_TIMEOUT, PAGE_SIZE_DEFAULT, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, buildQueryString, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getSystemReadinessServerErrorDetails, isAPIClientError, restoreConsole, setupBrowserMocks, suppressKnownWarnings, validateEmail } from '../chunk-VFWOUD3M.js';
2
2
  export { REFETCH_INTERVAL_DASHBOARD, REFETCH_INTERVAL_REALTIME, REFETCH_INTERVAL_RUNNING, REFETCH_INTERVAL_RUNNING_FAST, SSE_CLOSE_GRACE_PERIOD, SSE_TOKEN_REFRESH_DELAY, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, debounce, getTimeRangeDates, getTimeRangeLabel } from '../chunk-6XBZPKMI.js';
3
3
  export { ResourceStatusColors } from '../chunk-7ZUXA2NW.js';
4
4
  import '../chunk-34B3ACOZ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/ui",
3
- "version": "2.82.0",
3
+ "version": "2.83.0",
4
4
  "description": "UI components and platform-aware hooks for building custom frontends on the Elevasis platform",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -280,11 +280,11 @@
280
280
  "typescript": "5.9.2",
281
281
  "vite": "^7.0.0",
282
282
  "vitest": "^3.2.4",
283
- "@elevasis/sdk": "1.55.0",
284
- "@repo/core": "0.72.0",
285
- "@repo/eslint-config": "0.0.0",
283
+ "@elevasis/sdk": "1.56.0",
284
+ "@repo/core": "0.73.0",
286
285
  "@repo/elevasis-core": "1.0.0",
287
- "@repo/typescript-config": "0.0.0"
286
+ "@repo/typescript-config": "0.0.0",
287
+ "@repo/eslint-config": "0.0.0"
288
288
  },
289
289
  "dependencies": {
290
290
  "@dagrejs/dagre": "^1.1.4",
@@ -1,231 +0,0 @@
1
- import { acquisitionListKeys } from './chunk-M5CRPFJA.js';
2
- import { showApiErrorNotification, showSuccessNotification } from './chunk-PNCJJE4Z.js';
3
- import { APIClientError, buildQueryString } from './chunk-DEZW7QDI.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 deriveActions(deal, actions = []) {
24
- return actions.filter((a) => a.isAvailableFor(deal)).map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }));
25
- }
26
- function useContacts(filters = {}) {
27
- const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
28
- return useQuery({
29
- queryKey: contactKeys.list(workOSOrganizationId, filters),
30
- queryFn: async () => {
31
- const queryString = buildQueryString({
32
- listId: filters.listId,
33
- search: filters.search,
34
- openingLineIsNull: filters.openingLineIsNull,
35
- batchId: filters.batchId,
36
- contactStatus: filters.contactStatus,
37
- limit: filters.limit,
38
- offset: filters.offset
39
- });
40
- return apiRequest(`/acquisition/contacts${queryString}`);
41
- },
42
- enabled: isReady && !!workOSOrganizationId,
43
- retry: (_failureCount, error) => !(error instanceof APIClientError && error.statusCode === 401)
44
- });
45
- }
46
- function useContact(contactId) {
47
- const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
48
- return useQuery({
49
- queryKey: contactKeys.detail(workOSOrganizationId, contactId),
50
- queryFn: async () => {
51
- if (!contactId) return null;
52
- return apiRequest(`/acquisition/contacts/${contactId}`);
53
- },
54
- enabled: isReady && !!workOSOrganizationId && !!contactId
55
- });
56
- }
57
- function useCreateContact() {
58
- const { apiRequest } = useElevasisServices();
59
- const queryClient = useQueryClient();
60
- return useMutation({
61
- mutationFn: (body) => apiRequest("/acquisition/contacts", {
62
- method: "POST",
63
- body: JSON.stringify(body)
64
- }),
65
- onSuccess: () => {
66
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
67
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
68
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
69
- showSuccessNotification("Contact created");
70
- },
71
- onError: (error) => {
72
- showApiErrorNotification(error);
73
- }
74
- });
75
- }
76
- function useUpdateContact(contactId) {
77
- const { apiRequest } = useElevasisServices();
78
- const queryClient = useQueryClient();
79
- return useMutation({
80
- mutationFn: (body) => apiRequest(`/acquisition/contacts/${contactId}`, {
81
- method: "PATCH",
82
- body: JSON.stringify(body)
83
- }),
84
- onSuccess: () => {
85
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
86
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
87
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
88
- showSuccessNotification("Contact updated");
89
- },
90
- onError: (error) => {
91
- showApiErrorNotification(error);
92
- }
93
- });
94
- }
95
- function useDeleteContacts() {
96
- const { apiRequest } = useElevasisServices();
97
- const queryClient = useQueryClient();
98
- return useMutation({
99
- mutationFn: async (contactIds) => {
100
- const uniqueIds = [...new Set(contactIds)].filter(Boolean);
101
- if (uniqueIds.length === 0) return;
102
- await Promise.all(
103
- uniqueIds.map(
104
- (contactId) => apiRequest(`/acquisition/contacts/${contactId}`, {
105
- method: "DELETE"
106
- })
107
- )
108
- );
109
- },
110
- onSuccess: () => {
111
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
112
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
113
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
114
- showSuccessNotification("Contacts deleted");
115
- },
116
- onError: (error) => {
117
- showApiErrorNotification(error);
118
- }
119
- });
120
- }
121
-
122
- // src/hooks/acquisition/useCompanies.ts
123
- function useCompanies(filters = {}) {
124
- const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
125
- return useQuery({
126
- queryKey: companyKeys.list(workOSOrganizationId, filters),
127
- queryFn: async () => {
128
- const queryString = buildQueryString({
129
- listId: filters.listId,
130
- search: filters.search,
131
- domain: filters.domain,
132
- website: filters.website,
133
- segment: filters.segment,
134
- category: filters.category,
135
- batchId: filters.batchId,
136
- status: filters.status,
137
- includeAll: filters.includeAll,
138
- limit: filters.limit,
139
- offset: filters.offset
140
- });
141
- return apiRequest(`/acquisition/companies${queryString}`);
142
- },
143
- enabled: isReady && !!workOSOrganizationId,
144
- retry: (_failureCount, error) => !(error instanceof APIClientError && error.statusCode === 401)
145
- });
146
- }
147
- function useCompanyFacets() {
148
- const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
149
- return useQuery({
150
- queryKey: companyKeys.facets(workOSOrganizationId),
151
- queryFn: () => apiRequest("/acquisition/companies/facets"),
152
- enabled: isReady && !!workOSOrganizationId
153
- });
154
- }
155
- function useCompany(companyId) {
156
- const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
157
- return useQuery({
158
- queryKey: companyKeys.detail(workOSOrganizationId, companyId),
159
- queryFn: async () => {
160
- if (!companyId) return null;
161
- return apiRequest(`/acquisition/companies/${companyId}`);
162
- },
163
- enabled: isReady && !!workOSOrganizationId && !!companyId
164
- });
165
- }
166
- function useCreateCompany() {
167
- const { apiRequest } = useElevasisServices();
168
- const queryClient = useQueryClient();
169
- return useMutation({
170
- mutationFn: (body) => apiRequest("/acquisition/companies", {
171
- method: "POST",
172
- body: JSON.stringify(body)
173
- }),
174
- onSuccess: () => {
175
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
176
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
177
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
178
- showSuccessNotification("Company created");
179
- },
180
- onError: (error) => {
181
- showApiErrorNotification(error);
182
- }
183
- });
184
- }
185
- function useUpdateCompany(companyId) {
186
- const { apiRequest } = useElevasisServices();
187
- const queryClient = useQueryClient();
188
- return useMutation({
189
- mutationFn: (body) => apiRequest(`/acquisition/companies/${companyId}`, {
190
- method: "PATCH",
191
- body: JSON.stringify(body)
192
- }),
193
- onSuccess: () => {
194
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
195
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
196
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
197
- showSuccessNotification("Company updated");
198
- },
199
- onError: (error) => {
200
- showApiErrorNotification(error);
201
- }
202
- });
203
- }
204
- function useDeleteCompanies() {
205
- const { apiRequest } = useElevasisServices();
206
- const queryClient = useQueryClient();
207
- return useMutation({
208
- mutationFn: async (companyIds) => {
209
- const uniqueIds = [...new Set(companyIds)].filter(Boolean);
210
- if (uniqueIds.length === 0) return;
211
- await Promise.all(
212
- uniqueIds.map(
213
- (companyId) => apiRequest(`/acquisition/companies/${companyId}`, {
214
- method: "DELETE"
215
- })
216
- )
217
- );
218
- },
219
- onSuccess: () => {
220
- queryClient.invalidateQueries({ queryKey: companyKeys.all });
221
- queryClient.invalidateQueries({ queryKey: contactKeys.all });
222
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
223
- showSuccessNotification("Companies deleted");
224
- },
225
- onError: (error) => {
226
- showApiErrorNotification(error);
227
- }
228
- });
229
- }
230
-
231
- export { companyKeys, contactKeys, deriveActions, useCompanies, useCompany, useCompanyFacets, useContact, useContacts, useCreateCompany, useCreateContact, useDeleteCompanies, useDeleteContacts, useUpdateCompany, useUpdateContact };
@@ -1,200 +0,0 @@
1
- import { getLeadGenStageCatalog } from './chunk-M5CRPFJA.js';
2
- import { SYSTEM_INTERFACE_PROFILES, formatOntologyId, registerBuiltInReadinessProfile, registerReadinessInterfaceMarker, requireContractReadiness, computeInterfaceReadiness, addReadinessIssue, formatInterfaceIdentity, getSystem, resourceBindingIds, requireCatalogReadiness, requireScopedBinding } from './chunk-DEZW7QDI.js';
3
-
4
- // ../core/src/business/acquisition/ontology-validation.ts
5
- var LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
6
- var CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
7
- var LEAD_GEN_CRM_HANDOFF_INTERFACE = SYSTEM_INTERFACE_PROFILES[2];
8
- LEAD_GEN_API_INTERFACE.readinessProfile;
9
- CRM_API_INTERFACE.readinessProfile;
10
- LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
11
- var LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID = formatOntologyId({
12
- scope: "sales.lead-gen",
13
- kind: "object",
14
- localId: "list"
15
- });
16
- var LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID = formatOntologyId({
17
- scope: "sales.lead-gen",
18
- kind: "object",
19
- localId: "company"
20
- });
21
- var LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID = formatOntologyId({
22
- scope: "sales.lead-gen",
23
- kind: "object",
24
- localId: "contact"
25
- });
26
- var LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID = formatOntologyId({
27
- scope: "sales.lead-gen",
28
- kind: "catalog",
29
- localId: "build-template"
30
- });
31
- var LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
32
- scope: "sales.lead-gen",
33
- kind: "catalog",
34
- localId: "company-stage"
35
- });
36
- var LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
37
- scope: "sales.lead-gen",
38
- kind: "catalog",
39
- localId: "contact-stage"
40
- });
41
- var CRM_PIPELINE_CATALOG_ONTOLOGY_ID = formatOntologyId({
42
- scope: "sales.crm",
43
- kind: "catalog",
44
- localId: "crm.pipeline"
45
- });
46
- var LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID = formatOntologyId({
47
- scope: "sales.lead-gen",
48
- kind: "catalog",
49
- localId: "lead-gen.stage-catalog"
50
- });
51
- var LEAD_GEN_API_READINESS_CONTRACT = {
52
- requiredObjects: [
53
- LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID,
54
- LEAD_GEN_COMPANY_OBJECT_ONTOLOGY_ID,
55
- LEAD_GEN_CONTACT_OBJECT_ONTOLOGY_ID
56
- ],
57
- requiredCatalogs: [
58
- LEAD_GEN_BUILD_TEMPLATE_CATALOG_ONTOLOGY_ID,
59
- LEAD_GEN_COMPANY_STAGE_CATALOG_ONTOLOGY_ID,
60
- LEAD_GEN_CONTACT_STAGE_CATALOG_ONTOLOGY_ID
61
- ]
62
- };
63
- var CRM_API_READINESS_CONTRACT = {
64
- requiredObjects: [],
65
- requiredCatalogs: [CRM_PIPELINE_CATALOG_ONTOLOGY_ID]
66
- };
67
- function isPlainRecord(value) {
68
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
69
- }
70
- function createLeadGenStageCatalog(model) {
71
- return {
72
- id: LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID,
73
- label: "Lead Gen Processing Stages",
74
- ownerSystemId: "sales.lead-gen",
75
- kind: "processing-stage-catalog",
76
- entries: Object.fromEntries(
77
- Object.entries(getLeadGenStageCatalog(model)).map(([key, entry]) => [
78
- key,
79
- {
80
- ...entry
81
- }
82
- ])
83
- ),
84
- legacyCatalogKey: "LEAD_GEN_STAGE_CATALOG"
85
- };
86
- }
87
- function requireLeadGenSupplementalReadiness(issues, index, resources, context) {
88
- const catalogs = resourceBindingIds(resources, "usesCatalogs");
89
- const templateStepCatalog = findLeadGenTemplateStepCatalog(index);
90
- if (templateStepCatalog === void 0) {
91
- addReadinessIssue(
92
- issues,
93
- "SYSTEM_INTERFACE_NOT_READY",
94
- "missing-template-step-catalog",
95
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" is missing a lead-gen template-step catalog.`
96
- );
97
- } else {
98
- requireCatalogReadiness(issues, index, templateStepCatalog.id, context);
99
- requireScopedBinding(issues, catalogs, "usesCatalogs", templateStepCatalog.id, context);
100
- }
101
- requireCatalogReadiness(issues, index, LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID, context);
102
- }
103
- function requireLeadGenInterfaceReadiness(issues, index, resources, context) {
104
- requireContractReadiness(issues, index, resources, LEAD_GEN_API_READINESS_CONTRACT, context);
105
- requireLeadGenSupplementalReadiness(issues, index, resources, context);
106
- }
107
- function requireCrmInterfaceReadiness(issues, index, resources, context) {
108
- requireContractReadiness(issues, index, resources, CRM_API_READINESS_CONTRACT, context);
109
- }
110
- function findSystemInterfaceGrant(model, consumer, provider) {
111
- return Object.values(model.topology?.relationships ?? {}).find((relationship) => {
112
- const grant = relationship.metadata?.["systemInterfaceGrant"];
113
- if (!isPlainRecord(grant) || !isPlainRecord(grant.consumer) || !isPlainRecord(grant.provider)) return false;
114
- return grant.consumer.systemPath === consumer.systemPath && grant.consumer.interfaceKey === consumer.interfaceKey && grant.provider.systemPath === provider.systemPath && grant.provider.interfaceKey === provider.interfaceKey;
115
- });
116
- }
117
- function requireHandoffBridgeReadiness(issues, model, context) {
118
- const crmResult = computeInterfaceReadiness(model, CRM_API_INTERFACE);
119
- if (!crmResult.ready) {
120
- for (const issue of crmResult.issues) {
121
- addReadinessIssue(
122
- issues,
123
- "SYSTEM_BRIDGE_NOT_READY",
124
- issue.code,
125
- `Provider interface ${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)} is not ready: ${issue.message}`,
126
- { path: issue.path, ref: issue.ref }
127
- );
128
- }
129
- }
130
- const bridgeGrant = findSystemInterfaceGrant(model, context, CRM_API_INTERFACE);
131
- if (bridgeGrant === void 0) {
132
- addReadinessIssue(
133
- issues,
134
- "SYSTEM_BRIDGE_NOT_READY",
135
- "missing-topology-grant",
136
- `System Interface "${formatInterfaceIdentity(context.systemPath, context.interfaceKey)}" requires a scoped topology grant to "${formatInterfaceIdentity(CRM_API_INTERFACE.systemPath, CRM_API_INTERFACE.interfaceKey)}".`
137
- );
138
- }
139
- return bridgeGrant;
140
- }
141
- function getLeadGenCrmHandoffResourceIds(model) {
142
- return Object.values(model.resources ?? {}).filter(
143
- (resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
144
- ).map((resource) => resource.id);
145
- }
146
- function isLeadGenCrmHandoffAdopted(model) {
147
- return getSystem(model, LEAD_GEN_API_INTERFACE.systemPath)?.apiInterface !== void 0 && getSystem(model, CRM_API_INTERFACE.systemPath)?.apiInterface !== void 0;
148
- }
149
- function mergeLeadGenDerivedCatalogs(model) {
150
- const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
151
- const derivedCatalogTypes = {};
152
- if (baseCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] === void 0) {
153
- derivedCatalogTypes[LEAD_GEN_STAGE_CATALOG_ONTOLOGY_ID] = createLeadGenStageCatalog(model);
154
- }
155
- if (Object.keys(derivedCatalogTypes).length === 0) return model;
156
- return {
157
- ...model,
158
- ontology: {
159
- ...model.ontology ?? {},
160
- catalogTypes: {
161
- ...baseCatalogTypes,
162
- ...derivedCatalogTypes
163
- }
164
- }
165
- };
166
- }
167
- registerBuiltInReadinessProfile(LEAD_GEN_API_INTERFACE.readinessProfile, {
168
- validate: (issues, index, resources, _model, context) => requireLeadGenInterfaceReadiness(issues, index, resources, context),
169
- prepareModel: mergeLeadGenDerivedCatalogs
170
- });
171
- registerBuiltInReadinessProfile(CRM_API_INTERFACE.readinessProfile, {
172
- validate: (issues, index, resources, _model, context) => requireCrmInterfaceReadiness(issues, index, resources, context)
173
- });
174
- registerBuiltInReadinessProfile(LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile, {
175
- validate: (issues, index, resources, model, context) => {
176
- requireLeadGenInterfaceReadiness(issues, index, resources, context);
177
- requireCrmInterfaceReadiness(issues, index, resources, { ...context, allowForeignOwner: true });
178
- requireHandoffBridgeReadiness(issues, model, context);
179
- },
180
- prepareModel: mergeLeadGenDerivedCatalogs
181
- });
182
- registerReadinessInterfaceMarker(
183
- LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath,
184
- LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey,
185
- (model) => {
186
- if (!isLeadGenCrmHandoffAdopted(model)) return void 0;
187
- return {
188
- lifecycle: "active",
189
- readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
190
- resourceIds: getLeadGenCrmHandoffResourceIds(model)
191
- };
192
- }
193
- );
194
- function findLeadGenTemplateStepCatalog(index) {
195
- return Object.values(index.ontology.catalogTypes).find(
196
- (catalog) => catalog.ownerSystemId === "sales.lead-gen" && catalog.kind === "template-step" && catalog.appliesTo === LEAD_GEN_LIST_OBJECT_ONTOLOGY_ID
197
- );
198
- }
199
-
200
- export { CRM_API_INTERFACE, LEAD_GEN_API_INTERFACE };